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.

output position controller with the opposite sign

Other Parts Discussed in Thread: MOTORWARE

Hello to all ,

my system


f28069
motorware_1_01_00_15
custom firmware-based on lab 13a


electric motor
PMSM
5 pp
5 KPRM
0.023 Nm / A

pos controller and converter configuration 

inline void ST_setupPosConv(ST_Handle handle) {

// get object from the handle
ST_Obj *obj = (ST_Obj *)handle;

// Initalize SpinTAC Position Convert
STPOSCONV_setSampleTime_sec(obj->posConvHandle, _IQ24(ST_SAMPLE_TIME));
STPOSCONV_setERevMaximums_erev(obj->posConvHandle, _IQ24(ST_EREV_MAXIMUM), 0);
STPOSCONV_setUnitConversion(obj->posConvHandle, USER_IQ_FULL_SCALE_FREQ_Hz, ST_SAMPLE_TIME, USER_MOTOR_NUM_POLE_PAIRS);
STPOSCONV_setMRevMaximum_mrev(obj->posConvHandle, _IQ24(ST_MREV_ROLLOVER));
STPOSCONV_setLowPassFilterTime_tick(obj->posConvHandle, 3);
if(USER_MOTOR_TYPE == MOTOR_Type_Induction) {
// The Slip Compensator is only needed for ACIM
STPOSCONV_setupSlipCompensator(obj->posConvHandle, ST_SAMPLE_TIME, USER_IQ_FULL_SCALE_FREQ_Hz, USER_MOTOR_Rr, USER_MOTOR_Ls_d);
}
STPOSCONV_setEnable(obj->posConvHandle, true);
}

//! \brief Setups SpinTAC Position Control
inline void ST_setupPosCtl(ST_Handle handle) {

// get object from the handle
ST_Obj *obj = (ST_Obj *)handle;
_iq24 maxCurrent_PU = _IQ24(USER_MOTOR_MAX_CURRENT / USER_IQ_FULL_SCALE_CURRENT_A);

// Initalize SpinTAC Position Control
STPOSCTL_setAxis(obj->posCtlHandle, ST_AXIS0);
STPOSCTL_setSampleTime_sec(obj->posCtlHandle, _IQ24(ST_SAMPLE_TIME));
STPOSCTL_setOutputMaximums(obj->posCtlHandle, maxCurrent_PU, -maxCurrent_PU);
STPOSCTL_setVelocityMaximum(obj->posCtlHandle, _IQ24(USER_MOTOR_MAX_SPEED_KRPM * ST_SPEED_PU_PER_KRPM));
STPOSCTL_setPositionRolloverMaximum_mrev(obj->posCtlHandle, _IQ24(ST_MREV_ROLLOVER));
STPOSCTL_setUnitConversion(obj->posCtlHandle, USER_IQ_FULL_SCALE_FREQ_Hz, USER_MOTOR_NUM_POLE_PAIRS);
STPOSCTL_setPositionErrorMaximum_mrev(obj->posCtlHandle, _IQ24(ST_POS_ERROR_MAXIMUM_MREV));
STPOSCTL_setRampDisturbanceFlag(obj->posCtlHandle, false);
STPOSCTL_setFilterEnableFlag(obj->posCtlHandle, true);
STPOSCTL_setInertia(obj->posCtlHandle, _IQ24(ST_SYSTEM_INERTIA_PU));
STPOSCTL_setFriction(obj->posCtlHandle, _IQ24(ST_SYSTEM_FRICTION_PU));
STPOSCTL_setBandwidth_radps(obj->posCtlHandle, _IQ20(USER_SYSTEM_BANDWIDTH));
STPOSCTL_setEnable(obj->posCtlHandle, false);
}

my question is my problem because I can not ask my position control a greater rotation of eight, or rather the difference between demand and feedback so the position error must not exceed 8 would otherwise go towards negative values.

example

request 9

current position 0

error should be 9 but in reality I have -7 and accordingly the request to the current controller is to turn in the opposite direction to -7.

here are two images that explain what happens at the output of the position controller

rotationSetpoint is the set point

rotationFeedback is the current position

requestCurrent_pu is the output of the position controller and consequently the input of the controller foc.

 

  I configure wrong my controller or is a limitation of istaspin.

 

wrong output because is negative instead has to be positive


 

 


 

best regards

  • Andrea,

    Are you giving the position controller a position step or do you have some type of profile generation?

    Have you looked at lab 13b where we add in a position profile generator?
  • hello Adam,

    my profile is one step 0 --->9 turns and then 9 --->0 turns.

    I use only the blocks

    STPOSCTL_run for position control
    STPOSCONV_run for the conversion from the absolute angle sensor.

    the lab 13 uses the MOVE block but in this way I lose the absolute position control that is critical for my project.
    I should be sent whenever the input to the MOVE block the difference between the set point and the current position, but it is a block that I do not need it because my application is not jerk critical, or rather the speed of response should be the highest possible because the destined is for motorsport.

    regards
  • Andrea,

    Are you feeding incremental references into the controller or are you giving it a step from 0 to 9?

    What is the value for ST_POS_ERROR_MAXIMUM_MREV & ST_MREV_ROLLOVER in the spintac_position.h file?
  • Hi

    no is a sigle step, i don't use a ramps or incremental request.


    //! \brief ROTATION UNIT MAXIMUMS
    // **************************************************************************
    //! \brief Defines the maximum and minimum value at which the Mechanical Revolution [MRev] will rollover.
    //! \brief The position signal produced by SpinTAC Position Converter is a sawtooth signal.
    //! \brief All SpinTAC Components need to be aware of the bounds of this signal.
    //! \brief When the position signal reaches the maximum value it will immediatly go to the minimum value.
    //! \brief The minimum value is the negative of the maximum value.
    #define ST_MREV_ROLLOVER (100.0)

    //! \brief Defines the maximum value for an Electrical Revolution [ERev]
    //! \brief The position siganl produced by the ENC module is a sawtooth signal
    //! \brief This signal varies from 0 to the value specified in ST_EREV_MAXIMUM
    #define ST_EREV_MAXIMUM (1.0)

    //! \brief Defines the maximum value of error allowable in SpinTAC Position Control, MRev
    //! \breif This value should be the maximum amount of position error that is allowable in your system.
    //! \breif If the position error exceeds this value, SpinTAC Position Control will hold it's output to 0.
    #define ST_POS_ERROR_MAXIMUM_MREV (50.0)

    regards
  • Andrea,

    When you motor is running can you take a screenshot of all the values in st_obj.pos.ctl.cfg and st_obj.pos.conv.cfg?
  • Hello Adam,

    here is what is required, as you can see

    my request is 10 rev
    feedback (actual pos) 0 rev

    PosErr_mrev, give to me a proper error value 10, but the the result in out of the controller is bad because is negative, because it want to bring the shaft  to -6 rev (because surpassing 8 I restart at -8 and 10-8= 2 rev ramaning )

  • Andrea,

    I'm confused by this statement:

    andrea canestrari said:
    PosErr_mrev, give to me a proper error value 10, but the the result in out of the controller is bad because is negative, because it want to bring the shaft  to -6 rev (because surpassing 8 I restart at -8 and 10-8= 2 rev ramaning )

    Do you rollover the feedback between 8 & -8 when providing it to the controller?  Can you please explain how the position feedback is handled?

  • Andrea,

    I was able setup my simulation similar to how yours is configured.  

    I'm able to see the same thing and the underlying cause is that SpinTAC is not designed for steps that large.  When the controller was converted from floating point to fixed point it wasn't conceived that someone would have a position error that large.  The controller is expecting to be used with a profile generator which reduces large errors.  

    I understand that in your application you want to change to the new position setpoint as quickly as possible.  I think you should consider still using the profile generator in order to make the transition.  If you set the curve type to trapezodial and increase the curve limits to be the maximum you can get to the goal position just as quickly and it will settle on the final value faster.  I've taken screen shots for comparison purposes below.

    Step

    Fastest Possible Ramp

  • Hi Adam,

    will you come to the point of my question, before I explain better, however, it is as he showed you.

    in the following days I will try to activate the MOVE block, and follow your suggestion, if I have problems know who to ask.


    thanks again and greetings