1 #ifndef __SPINTAC_VEL_PLAN_H__
2 #define __SPINTAC_VEL_PLAN_H__
51 #define ST_VEL_PLAN_ACT_DWORDS (5)
52 #define ST_VEL_PLAN_COND_DWORDS (3)
54 #define ST_VEL_PLAN_VAR_DWORDS (2)
56 #define ST_VEL_PLAN_TRAN_DWORDS (5)
58 #define ST_VEL_PLAN_STATE_DWORDS (6)
62 #ifndef __ST_PLAN_ENUM__
63 #define __ST_PLAN_ENUM__
132 #endif //__ST_PLAN_ENUM__
134 #ifndef __ST_PLAN_ERROR__
135 #define __ST_PLAN_ERROR__
143 #endif //__ST_PLAN_ERROR__
596 void STVELPLAN_setCfgArray(
ST_VELPLAN_Handle handle, uint32_t *cfgArray,
const size_t numBytes, uint16_t MaxActNum,uint16_t MaxCondNum, uint16_t MaxVarNum, uint16_t MaxTranNum, uint16_t MaxStateNum);
static bool STVELPLAN_getReset(ST_VELPLAN_Handle handle)
Gets the Reset signal (RES) for SpinTAC Velocity Plan.
void STVELPLAN_getCfgVarNum(ST_VELPLAN_Handle handle, uint16_t *VarNum)
Returns the number of configured Variables in SpinTAC Velocity Plan.
ST_PlanCond_e
Enumeration for the Plan Condition options.
uint16_t ERR_idx
Plan component index that caused the error.
ST_PlanComp_e
Enumeration for the Plan Compare options.
void STVELPLAN_getCfgVarCond(ST_VELPLAN_Handle handle, uint16_t CondIdx, uint16_t *VarIdx1, uint16_t *VarIdx2, ST_PlanComp_e *Comp)
Returns a Variable Condition from the SpinTAC Velocity Plan configuration.
Compares, VarIdx >= Value1 OR VarIdx1 >= VarIdx2.
Transition/Action with either condition satisfied.
void STVELPLAN_delCfgVar(ST_VELPLAN_Handle handle, uint16_t VarIdx)
Deletes a Variable from the SpinTAC Velocity Plan configuration.
bool ENB
Enable bit { false: disabled; true: enabled }.
void STVELPLAN_getCfgTran(ST_VELPLAN_Handle handle, uint16_t TranIdx, uint16_t *FromState, uint16_t *ToState, ST_PlanCond_e *AndOr, uint16_t *CondIdx1, uint16_t *CondIdx2, _iq24 *AccLim, _iq20 *JrkLim)
Return a Transition from the SpinTAC Velocity Plan configuration.
void STVELPLAN_setCfgAct(ST_VELPLAN_Handle handle, uint16_t ActIdx, uint16_t State, ST_PlanCond_e AndOr, uint16_t CondIdx1, uint16_t CondIdx2, uint16_t VarIdx, ST_PlanActOptn_e Opt, _iq24 Value, ST_PlanActTrgr_e EnterExit)
Modifies an action in the SpinTAC Velocity Plan configuration.
void STVELPLAN_setCfgVarCond(ST_VELPLAN_Handle handle, uint16_t CondIdx, uint16_t VarIdx1, uint16_t VarIdx2, ST_PlanComp_e Comp)
Modifies a Varaible Condition to the SpinTAC Velocity Plan configuration.
void STVELPLAN_addCfgCond(ST_VELPLAN_Handle handle, uint16_t VarIdx, ST_PlanComp_e Comp, _iq24 Value1, _iq24 Value2)
Adds a Condition to the SpinTAC Velocity Plan configuration.
ST_VELPLAN_Handle STVELPLAN_init(void *pMemory, const size_t numBytes)
Initializes the SpinTAC Velocity Plan component.
void STVELPLAN_getCfgStateNum(ST_VELPLAN_Handle handle, uint16_t *StateNum)
Returns the number of configured States in SpinTAC Velocity Plan.
static ST_PlanFsmState_e STVELPLAN_getFsmState(ST_VELPLAN_Handle handle)
Gets the State Machine State (FsmState) for SpinTAC Velocity Plan.
void STVELPLAN_addCfgState(ST_VELPLAN_Handle handle, _iq24 VelEnd, int32_t Timer_tick)
Adds a State to the SpinTAC Velocity Plan configuration.
ST_PlanVar_e
Enumeration for the Plan variable types.
void STVELPLAN_setCfgTran(ST_VELPLAN_Handle handle, uint16_t TranIdx, uint16_t FromState, uint16_t ToState, ST_PlanCond_e AndOr, uint16_t CondIdx1, uint16_t CondIdx2, _iq24 AccLim, _iq20 JrkLim)
Modifies a Transition in the SpinTAC Velocity Plan configuration.
void STVELPLAN_setCfgVar(ST_VELPLAN_Handle handle, uint16_t VarIdx, ST_PlanVar_e Type, _iq24 Value)
Modifies a variable in the SpinTAC Velocity Plan configuration.
void STVELPLAN_run(ST_VELPLAN_Handle handle)
Runs SpinTAC Velocity Plan calculation.
void STVELPLAN_delCfgState(ST_VELPLAN_Handle handle, uint16_t StateIdx)
Deletes a state from the SpinTAC Velocity Plan configuration.
Compares, Value1 <= VarIdx <= Value2.
ST_PlanStatus_e
Enumeration for the Plan Status States.
wait state, holding the speed reference in idle state
void STVELPLAN_setCfg(ST_VELPLAN_Handle handle, _iq24 T_sec, bool LoopENB)
Configures SpinTAC Velocity Plan.
void STVELPLAN_addCfgVarCond(ST_VELPLAN_Handle handle, uint16_t VarIdx1, uint16_t VarIdx2, ST_PlanComp_e Comp)
Adds a Variable Condition to the SpinTAC Velocity Plan configuration.
Plan is waiting for a transition condition to be true.
static uint16_t STVELPLAN_getCfgError(ST_VELPLAN_Handle handle, uint16_t *ERR_idx, uint16_t *ERR_code)
Gets the Configuration Error for SpinTAC Velocity Plan.
uint16_t CurTran
Current transition of the state machine.
void STVELPLAN_delCfgTran(ST_VELPLAN_Handle handle, uint16_t TranIdx)
Deletes a Transition from the SpinTAC Velocity Plan configuration.
Compares, VarIdx != Value1 OR VarIdx1 != VarIdx2.
ST_PlanStatus_e STATUS
Plan status { ST_PLAN_IDLE, ST_PLAN_INIT, ST_PLAN_BUSY, ST_PLAN_HALT, ST_PLAN_WAIT}.
void STVELPLAN_delCfgAct(ST_VELPLAN_Handle handle, uint16_t ActIdx)
Deletes an action from the SpinTAC Velocity Plan configuration.
Compares, Value1 > VarIdx > Value2.
void STVELPLAN_runTick(ST_VELPLAN_Handle handle)
Updates the SpinTAC Velocity Plan Timer.
void STVELPLAN_getCfgCondNum(ST_VELPLAN_Handle handle, uint16_t *CondNum)
Returns the number of configured Conditions in SpinTAC Velocity Plan.
void STVELPLAN_delCfgCond(ST_VELPLAN_Handle handle, uint16_t CondIdx)
Deletes a Condition from the SpinTAC Velocity Plan configuration.
static _iq24 STVELPLAN_getAccelerationLimit(ST_VELPLAN_Handle handle)
Gets the Acceleration Limit (AccLim) for SpinTAC Velocity Plan.
void STVELPLAN_setCfgHaltState(ST_VELPLAN_Handle handle, _iq24 VelEnd, _iq24 AccLim, _iq20 JrkLim, int32_t Timer_tick)
Configures the SpinTAC Velocity Plan Halt state.
Compares, VarIdx <= Value1 OR VarIdx1 <= VarIdx2.
ST_PlanCond_e
Enumeration for the Plan Condition options.
ST_PlanComp_e
Enumeration for the Plan Compare options.
void STVELPLAN_getCfg(ST_VELPLAN_Handle handle, _iq24 *T_sec, bool *LoopENB)
Gets the SpinTAC Velocity Plan configuration.
Compares, Value1 < VarIdx < Value2.
halt state, return to the speed reference in idle state
void STVELPLAN_reset(ST_VELPLAN_Handle handle)
Resets the Velocity Plan component.
void STVELPLAN_addCfgTran(ST_VELPLAN_Handle handle, uint16_t FromState, uint16_t ToState, ST_PlanCond_e AndOr, uint16_t CondIdx1, uint16_t CondIdx2, _iq24 AccLim, _iq20 JrkLim)
Adds a Transition to the SpinTAC Velocity Plan configuration.
ST_PlanActOptn_e
Enumeration for the Plan Action Options.
Transition/Action with no conditions satisfied.
ST_PlanFsmState_e FsmState
State of the state machine.
uint16_t ERR_code
Function specific condition that caused the error.
Compares, Value1 > VarIdx >= Value2.
void STVELPLAN_setUnitProfDone(ST_VELPLAN_Handle handle, bool ProDON)
Sets a flag in SpinTAC Velocity Plan to indicate if the unit profile is complete. ...
struct _ST_VELPLAN_Handle_ * ST_VELPLAN_Handle
void STVELPLAN_getCfgVar(ST_VELPLAN_Handle handle, uint16_t VarIdx, ST_PlanVar_e *Type, _iq24 *Value)
Returns a variable from the SpinTAC Velocity Plan configuration.
ST_PlanFsmState_e
Enumeration for the Plan FSM states.
void STVELPLAN_addCfgAct(ST_VELPLAN_Handle handle, uint16_t State, ST_PlanCond_e AndOr, uint16_t CondIdx1, uint16_t CondIdx2, uint16_t VarIdx, ST_PlanActOptn_e Opt, _iq24 Value, ST_PlanActTrgr_e EnterExit)
Adds an action to the SpinTAC Velocity Plan configuration.
uint16_t ERR_ID
Error ID { 0: no error; others: see error code }.
void STVELPLAN_getCfgActNum(ST_VELPLAN_Handle handle, uint16_t *ActNum)
Returns the number of configured Actions in SpinTAC Velocity Plan.
Compares, VarIdx == Value1 OR VarIdx1 == VarIdx2.
void STVELPLAN_getCfgCond(ST_VELPLAN_Handle handle, uint16_t CondIdx, uint16_t *VarIdx, ST_PlanComp_e *Comp, _iq24 *Value1, _iq24 *Value2)
Returns a Condition from the SpinTAC Velocity Plan configuration.
Transition/Action with both conditions satisfied.
static void STVELPLAN_setEnable(ST_VELPLAN_Handle handle, bool enb)
Sets the Enable signal (ENB) for SpinTAC Velocity Plan.
Compares, Value1 >= VarIdx >= Value2.
ST_PlanActTrgr_e
Enumeration for the Plan Action trigger point types.
Action will be considered when exiting the state.
Compares, VarIdx < Value1 OR VarIdx1 < VarIdx2.
static uint16_t STVELPLAN_getCurrentState(ST_VELPLAN_Handle handle)
Gets the Current State (CurState) for SpinTAC Velocity Plan.
ST_PlanError_t CfgError
Error decoding structure.
void STVELPLAN_setVar(ST_VELPLAN_Handle handle, uint16_t VarIdx, _iq24 Value)
Sets the value of a SpinTAC Velocity Plan variable.
ST_PlanVar_e
Enumeration for the Plan variable types.
Compares, Value1 < VarIdx <= Value2.
Public interface, object, and function definitions related to the SpinTAC Version object...
_iq24 AccLim
Acceleration limit { unit: [pu/s^2], value range: [0.001, 120.0] }.
Compares, Value1 >= VarIdx > Value2.
int32_t Timer_tick
State Timer { unit: [tick] }.
ST_PlanStatus_e
Enumeration for the Plan Status States.
_iq24 VelEnd
Velocity setpoint { unit: [pu/s], value range: [-1.0, 1.0] }.
Defines the ST_VelPlan_t data.
Action will be considered when entering the state.
void STVELPLAN_addCfgVar(ST_VELPLAN_Handle handle, ST_PlanVar_e Type, _iq24 Value)
Adds a variable to the SpinTAC Velocity Plan configuration.
_iq20 JrkLim
Jerk Limit { unit: [pu/s^3], value range: [0.0005, 2000.0] }.
Action will set the variable equal to a value.
void STVELPLAN_setCfgArray(ST_VELPLAN_Handle handle, uint32_t *cfgArray, const size_t numBytes, uint16_t MaxActNum, uint16_t MaxCondNum, uint16_t MaxVarNum, uint16_t MaxTranNum, uint16_t MaxStateNum)
Prepares SpinTAC Velocity Plan configuration array.
ST_PlanActTrgr_e
Enumeration for the Plan Action trigger point types.
Action will add a value to the variable.
void STVELPLAN_getCfgTranNum(ST_VELPLAN_Handle handle, uint16_t *TranNum)
Returns the number of configured Transitions in SpinTAC Velocity Plan.
static bool STVELPLAN_getEnable(ST_VELPLAN_Handle handle)
Gets the Enable signal (ENB) for SpinTAC Velocity Plan.
init state, initialize internal states
Plan is in transition with a motion profile.
Compares, VarIdx > Value1 OR VarIdx1 > VarIdx2.
Transition/Action with first condition satisfied.
ST_PlanActOptn_e
Enumeration for the Plan Action Options.
void STVELPLAN_setCfgCond(ST_VELPLAN_Handle handle, uint16_t CondIdx, uint16_t VarIdx, ST_PlanComp_e Comp, _iq24 Value1, _iq24 Value2)
Modifies a Condition in the SpinTAC Velocity Plan configuration.
static uint16_t STVELPLAN_getErrorID(ST_VELPLAN_Handle handle)
Gets the Error ID for SpinTAC Velocity Plan.
static void STVELPLAN_setReset(ST_VELPLAN_Handle handle, bool res)
Sets the Reset signal (RES) for SpinTAC Velocity Plan.
void STVELPLAN_getCfgHaltState(ST_VELPLAN_Handle handle, _iq24 *VelEnd, _iq24 *AccLim, _iq20 *JrkLim, int32_t *Timer_tick)
Gets the SpinTAC Velocity Plan Halt state configuration.
static _iq24 STVELPLAN_getVelocitySetpoint(ST_VELPLAN_Handle handle)
Gets the Velocity Setpoint (VelEnd) for SpinTAC Velocity Plan.
bool RES
Reset bit { false: not reset; true: reset }.
ST_PlanFsmState_e
Enumeration for the Plan FSM states.
static _iq20 STVELPLAN_getJerkLimit(ST_VELPLAN_Handle handle)
Gets the Jerk Limit (JrkLim) for SpinTAC Velocity Plan.
void STVELPLAN_getVar(ST_VELPLAN_Handle handle, uint16_t VarIdx, _iq24 *Value)
Gets the value of a SpinTAC Velocity Plan variable.
idle state, holding velocity
Variable type input/output.
void STVELPLAN_setCfgState(ST_VELPLAN_Handle handle, uint16_t StateIdx, _iq24 VelEnd, int32_t Timer_tick)
Modifies a state in the SpinTAC Velocity Plan configuration.
Compares, Value1 <= VarIdx < Value2.
static ST_PlanStatus_e STVELPLAN_getStatus(ST_VELPLAN_Handle handle)
Gets the Status value (STATUS) for SpinTAC Velocity Plan.
static uint16_t STVELPLAN_getCurrentTransition(ST_VELPLAN_Handle handle)
Gets the Current Transition (CurTran) for SpinTAC Velocity Plan.
busy state, running state machine
void STVELPLAN_getCfgState(ST_VELPLAN_Handle handle, uint16_t StateIdx, _iq24 *VelEnd, int32_t *Timer_tick)
Returns a state from the SpinTAC Velocity Plan configuration.
void STVELPLAN_delCfgVarCond(ST_VELPLAN_Handle handle, uint16_t CondIdx)
Deletes a Variable Condition from the SpinTAC Velocity Plan configuration.
static int32_t STVELPLAN_getCurrentTimerValue_tick(ST_VELPLAN_Handle handle)
Gets the Current Time Value (Timer_tick) for SpinTAC Velocity Plan.
void STVELPLAN_getCfgAct(ST_VELPLAN_Handle handle, uint16_t ActIdx, uint16_t *State, ST_PlanCond_e *AndOr, uint16_t *CondIdx1, uint16_t *CondIdx2, uint16_t *VarIdx, ST_PlanActOptn_e *Opt, _iq24 *Value, ST_PlanActTrgr_e *EnterExit)
Returns an action from the SpinTAC Velocity Plan configuration.
uint16_t CurState
Current state of the state machine.
Plan is staying in a state until the timer is up.
Defines the ST_PlanError_t data.