This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

understand the values lab6c washing machine

Other Parts Discussed in Thread: MOTORWARE

I arrived at the lab 06c
but I do not understand how to change the values of the function
STVELPLAN_addCfgState
STVELPLAN_addCfgTran
where can I find a full explanation what it means _IQ (0.1)


how do I know how many rounds will make my engine

what does it mean
_IQ (0.25 *ST_SPEED_PU_PER_KRPM _)

if I put in 1000 will make 1000 rpm


What does that mean IQ before these values?

// Establish the Velocity, Acceleration, and Jerk Maximums
velMax = STVELMOVE_getVelocityMaximum(stObj->velMoveHandle);
accMax = STVELMOVE_getAccelerationMaximum(stObj->velMoveHandle);
jrkMax = STVELMOVE_getJerkMaximum(stObj->velMoveHandle);

// Configure SpinTAC Velocity Plan: Sample Time, VelMax, AccMax, DecMax, JrkMax, LoopENB
STVELPLAN_setCfg(stObj->velPlanHandle, _IQ(ST_SAMPLE_TIME), velMax, accMax, jrkMax, false);
// Configure halt state: VelEnd, AccMax, JrkMax, Timer
STVELPLAN_setCfgHaltState(stObj->velPlanHandle, 0, accMax, jrkMax, 1000L);

//Example: STVELPLAN_addCfgState(handle, VelSetpoint[pups], StateTimer[ticks]);
STVELPLAN_addCfgState(stObj->velPlanHandle, 0, 200L); // StateIdx0: Idle
STVELPLAN_addCfgState(stObj->velPlanHandle, 0, 200L); // StateIdx1: Fill
STVELPLAN_addCfgState(stObj->velPlanHandle, _IQ(0.25 * ST_SPEED_PU_PER_KRPM), 200L); // StateIdx2: AgiCW
STVELPLAN_addCfgState(stObj->velPlanHandle, _IQ(-0.25 * ST_SPEED_PU_PER_KRPM), 200L); // StateIdx3: AgiCCW
STVELPLAN_addCfgState(stObj->velPlanHandle, 0, 200L); // StateIdx4: Drain
STVELPLAN_addCfgState(stObj->velPlanHandle, _IQ(2 * ST_SPEED_PU_PER_KRPM), 2000L); // StateIdx5: Dry

//Example: STVELPLAN_addCfgVar(handle, VarType, InitialValue);
STVELPLAN_addCfgVar(stObj->velPlanHandle, ST_VAR_IN, 0); // VarIdx0: FillSensor {0: not filled; 1: filled}
STVELPLAN_addCfgVar(stObj->velPlanHandle, ST_VAR_IN, 0); // VarIdx1: DrainSensor {0: not drained; 1: drained}
STVELPLAN_addCfgVar(stObj->velPlanHandle, ST_VAR_INOUT, 0); // VarIdx2: CycleCounter
STVELPLAN_addCfgVar(stObj->velPlanHandle, ST_VAR_OUT, 0); // VarIdx3: FillValve {0: valve closed; 1: valve open}
STVELPLAN_addCfgVar(stObj->velPlanHandle, ST_VAR_OUT, 0); // VarIdx4: DrainValve {0: valve closed; 1: valve open}

//Example: STVELPLAN_addCfgCond(handle, VarIdx, Comparison, Value1, Value2)
STVELPLAN_addCfgCond(stObj->velPlanHandle, WASHER_FillSensor, ST_COMP_EQ, 1, 0); // CondIdx0: WaterFull Water is filled
STVELPLAN_addCfgCond(stObj->velPlanHandle, WASHER_CycleCounter, ST_COMP_GT, 0, 0); // CondIdx1: AgiNotDone SgitCycleCounter is greater than 0 (not done)
STVELPLAN_addCfgCond(stObj->velPlanHandle, WASHER_CycleCounter, ST_COMP_ELW, 0, 0); // CondIdx2: AgiDone SgitCycleCounter is equal or less than 0 (done)
STVELPLAN_addCfgCond(stObj->velPlanHandle, WASHER_DrainSensor, ST_COMP_EQ, 1, 0); // CondIdx3: WaterEmpty Water is drained
// Note: Set Value2 to 0 if Comparison is for only one value.

//Example: STVELPLAN_addCfgTran(handle, FromState, ToState, CondOption, CondIdx1, CondiIdx2, AccLim[pups2], JrkLim[pups3]);
STVELPLAN_addCfgTran(stObj->velPlanHandle, WASHER_IDLE, WASHER_FILL, ST_COND_NC, 0, 0, _IQ(0.1), _IQ20(1)); // From IdleState to FillState
STVELPLAN_addCfgTran(stObj->velPlanHandle, WASHER_FILL, WASHER_AGI_CCW, ST_COND_FC, WASHER_WaterFull, 0, _IQ(0.1), _IQ20(1)); // From FillState to AgiState1
STVELPLAN_addCfgTran(stObj->velPlanHandle, WASHER_AGI_CCW, WASHER_AGI_CW, ST_COND_NC, 0, 0, _IQ(1), _IQ20(1)); // From AgiState1 to AgiState2
STVELPLAN_addCfgTran(stObj->velPlanHandle, WASHER_AGI_CW, WASHER_AGI_CCW, ST_COND_FC, WASHER_AgiNotDone, 0, _IQ(1), _IQ20(1)); // From AgiState2 to AgiState1
STVELPLAN_addCfgTran(stObj->velPlanHandle, WASHER_AGI_CW, WASHER_DRAIN, ST_COND_FC, WASHER_AgiDone, 0, _IQ(0.1), _IQ20(1)); // From AgiState2 to DrainState
STVELPLAN_addCfgTran(stObj->velPlanHandle, WASHER_DRAIN, WASHER_DRY, ST_COND_FC, WASHER_WaterEmpty, 0, _IQ(0.2), _IQ20(1)); // From DrainState to DryState
STVELPLAN_addCfgTran(stObj->velPlanHandle, WASHER_DRY, WASHER_IDLE, ST_COND_NC, 0, 0, _IQ(0.1), _IQ20(1)); // From DryState to IdleState
// Note: set CondIdx1 to 0 if CondOption is ST_COND_NC; set CondIdx2 to 0 if CondOption is ST_COND_NC or ST_COND_FC

//Example: STVELPLAN_addCfgAct(handle, StateIdx, CondOption, CondIdx1, CondIdx2, VarIdx, Operation, Value, ActionTriger);
STVELPLAN_addCfgAct(stObj->velPlanHandle, WASHER_IDLE, ST_COND_NC, 0, 0, WASHER_CycleCounter, ST_ACT_EQ, 20, ST_ACT_EXIT); // In IdleState, preset AgiCycleCounter counter to 20
STVELPLAN_addCfgAct(stObj->velPlanHandle, WASHER_AGI_CCW, ST_COND_NC, 0, 0, WASHER_CycleCounter, ST_ACT_ADD, -1, ST_ACT_ENTR); // Decrease AgiCycleCounter by 1 everytime enters AgiState1
STVELPLAN_addCfgAct(stObj->velPlanHandle, WASHER_FILL, ST_COND_NC, 0, 0, WASHER_FillValve, ST_ACT_EQ, 1, ST_ACT_ENTR); // In FillState, set VarIdx3 to 1 to open FillValve
STVELPLAN_addCfgAct(stObj->velPlanHandle, WASHER_FILL, ST_COND_NC, 0, 0, WASHER_FillValve, ST_ACT_EQ, 0, ST_ACT_EXIT); // In FillState, set VarIdx3 to 0 to close FillValve when FillSensor = 1
STVELPLAN_addCfgAct(stObj->velPlanHandle, WASHER_DRAIN, ST_COND_NC, 0, 0, WASHER_DrainValve, ST_ACT_EQ, 1, ST_ACT_ENTR); // In DrainState, set VarIdx4 to 1 to open DrainValve
STVELPLAN_addCfgAct(stObj->velPlanHandle, WASHER_DRAIN, ST_COND_NC, 0, 0, WASHER_DrainValve, ST_ACT_EQ, 0, ST_ACT_EXIT); // In DrainState, set VarIdx4 to 0 to close DrainValve when DrainSensor = 1

  • Hello,
    Did you read instaspin labs documentation that can be found in \motorware\motorware_1_01_00_13\docs\labs ?


    It is mentioned:


    STVELPLAN_addCfgState(Velocity Plan Handle, Speed Setpoint [pu/s], Time in State [ISR ticks])
    This function adds a state into the motion sequence. It is configured by setting the speed that you want
    the motor to run during this state and with the minimum time it should remain in this state.


    STVELPLAN_addCfgTran(Velocity Plan Handle, From State, To State, Condition Option, Condition Index
    1, Condition Index 2, Acceleration Limit [pu/s^2], Jerk Limit [pu/s^3])
    This function establishes the transitions between two states. The From State and To State values
    describe which states this transition is valid for. The condition option specifies if a condition needs to be
    evaluated prior to the transition. The condition index 1 & 2 specify which conditions should be evaluated.
    If no conditions or one condition needs to be evaluated, set the not used values to 0. Acceleration limit
    sets the acceleration to use to transition between the From State speed and the To State speed. This
    value cannot exceed the acceleration max that is configured for the motion sequence. The jerk limit sets
    the jerk to be used in the speed transition. This value should not exceed the jerk max that is configured
    for the motion sequence.


    Best regards,
    Maria
  • Andrea,

    andrea canestrari said:
    where can I find a full explanation what it means _IQ (0.1)

    _IQ() is a macro that will convert a floating point number int a fixed point Q24 notation.  If you find the definition of _IQ(0.1) it will resolve to (int32_t)(0.1 * 16777216.0).

    andrea canestrari said:
    what does it mean
    _IQ (0.25 *ST_SPEED_PU_PER_KRPM _)

    This is the goal speed for the state in the state machine.  It is setting the goal speed to 0.25 krpm.  It is using a predefined symbol ST_SPEED_PU_PER_KRPM to convert from user units for speed into the scaled units of speed used by the rest of the control system.  So if you wanted to make your motor spin at 0.3 krpm, you should change that speed setting to _IQ (0.3 *ST_SPEED_PU_PER_KRPM _).

    Hope this helps!

  • andrea canestrari said:

    What does that mean IQ before these values?

    If you are asking about IQ values definition, please refer to this thread

    Best regards,

    Maria

  • thank you all for your contribution now is much clearer this parameter iq, then

    if I did not specify the number after IQ as _IQ (0.1) then I selected the default Q24 is correct?

    in the following expression
    STVELPLAN_addCfgState (stObj-> velPlanHandle, _IQ (0:25 ST_SPEED_PU_PER_KRPM *), 200L)

    200L corresponds to the actual values for example are 200ms? what is the relationship with values in real terms?

    the same question for the terms in the following expression
    STVELPLAN_addCfgTran (stObj-> velPlanHandle, WASHER_DRAIN, WASHER_DRY, ST_COND_FC, WASHER_WaterEmpty, 0, _IQ (0.2), _IQ20 (1));

    _IQ (0.2) (I always have the range of values of Q24?)
    then in real terms how much current corresponds to the value that I put to the current limit in acceleration?
    I have to follow this conversion reported here

    http://processors.wiki.ti.com/index.php/TMS320C2000_Motor_Control_Primer#PU_System_Model_and_Base_Values


    Ipu = I / Ibase? but what is the basis

    thanks to all

  • Andrea,

    The 200L refers to 200 isr ticks as the minimum time in that state.  In this specific case it would be 200ms unless you have changed the speed loop update rate.

    The acceleration rate is in scaled speed, not scaled current.  The speed scale is based on the USER_IQ_FULL_SCALE_FREQ_Hz.  1.0 in this value represents (USER_IQ_FULL_SCALE_FREQ_Hz * 60) / (USER_MOTOR_NUM_POLE_PAIRS * 1000) in krpm.