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.

LAUNCHXL-F280049C: Speed Measurement Range

Part Number: LAUNCHXL-F280049C

What parameter sets the range for measured speed in the software?

I'm using code build from this version, $TI Release: MotorControl SDK v3.00.01.00, but I believe the variables i'm referencing here are the same for later versions of the code.

Example: If I set the parameter, USER_MOTOR_FREQ_MAX_HZ, to 100Hz which corresponds to a rotational speed of 1500rpm, what is the measurement range for the speed? I can see where USER_MOTOR_FREQ_MAX_HZ sets the maximum absolute speed command in the code and I can observe that if I command a speed higher than this setting, it will not exceed this value. But, if I have some overshoot on my speed step response the controller needs to be able to resolve speeds higher than the command and in the expression list when viewing motorVars.speed_krpm I can see that it goes higher than the commanded speed during overshoot from a transient. Is there another variable in the code that is used to set the measurement range or is it just a predefined factor above the USER_MOTOR_FREQ_MAX_HZ setting?

  • You should set the maximum frequency value (USER_MOTOR_FREQ_MAX_HZ) according to the specification of the motor. The maximum speed  will be equal to USER_MOTOR_FREQ_MAX_HZ * 60 /Pole Pairs accordingly.

    There is no measurement/running frequency/speed from control side, but the maximum motor frequency must be far lower than the PWM or controller frequency. 

  • Are you saying the max allowable commanded speed set by USER_MOTOR_FREQ_MAX_HZ also sets the max measureable speed for the control loops?

    I need to make sure I'm using this parameter properly and I want to know how to  scale the DAC output for motorVars.speed_krpm. How can I scale the DAC output in volts to obtain speed in krpm if I don't know the max measureable speed (ie 3.3V out on the DAC = ??? krpm if I set the USER_MOTOR_FREQ_MAX_Hz to 100Hz)? 

    And if I have a desired application speed range of +/- 1500rpm for a 4 pole motor do I set USER_MOTOR_FREQ_MAX_HZ to 100Hz? Or should I pick something 1.2-1.3x higher (120Hz - 130Hz) to allow some margin as is suggested in the user guide for parameter USER_IQ_FULL_SCALE_FREQ_Hz (this parameter does not appear in any version of TI code I have seen)

  • I need to make sure I'm using this parameter properly and I want to know how to  scale the DAC output for motorVars.speed_krpm. How can I scale the DAC output in volts to obtain speed in krpm if I don't know the max measureable speed (ie 3.3V out on the DAC = ??? krpm if I set the USER_MOTOR_FREQ_MAX_Hz to 100Hz)? 

    What do you mean "how to  scale the DAC output for motorVars.speed_krpm"? As mentioned above, you should set a right USER_MOTOR_FREQ_MAX_HZ  according to your motor. The target speed for the motor you set should be lower than USER_MOTOR_FREQ_MAX_HZ. So the maximum output of DAC will be scaled to USER_MOTOR_FREQ_MAX_HZ.

    USER_IQ_FULL_SCALE_FREQ_Hz

    Yes, the definition is not necessary for the floating-point based InstaSPIN-FOC, it's only for _IQ format.

  • You've answered part of my question by saying the maximum output of the DAC will be scaled to USER_MOTOR_FREQ_MAX_Hz. But this means I will be unable to observe any overshoot in the speed response because that overshoot will be higher than the maximum allowable voltage on the DAC if I command a step change to the max speed. Does that mean I'm setting this value incorrectly?

    I am currently using the parameter, USER_MOTOR_FREQ_MAX_Hz, to control the maximum allowed speed command to the motor. An example would be helpful because this parameter is not defined in the user guide but it shows up in the code. When you say this shout be set based on my motor, are you referring to a certain datasheet parameter?

  • You can set a higher USER_MOTOR_FREQ_MAX_Hz than the maximum target speed you want. Or you may use a higher scaling value for DAC like 2*USER_MOTOR_FREQ_MAX_Hz.

  • That explains the DAC portion, but according to the InstaSPIN Projects and Labs User’s Guide, the variable USER_MOTOR_FREQ_MAX_Hz is used in the gain equations on p. 76 and p. 77.

    USER_MOTOR_FREQ_MAX_Hz shows up in the code but is not described in the InstaSPIN User Guide, SPRUHJ1H. Instead there is a parameter with a similar name, USER_IQ_MOTOR_FREQ_MAX_Hz that is not present in the code. On p. 205 of SPRUHJ1H it suggests USER_IQ_MOTOR_FREQ_MAX_Hz should be set larger than the maximum speed expected for the motor. Then on p. 223 it says adding 20-30% headroom is recommended for this parameter. 

    I know these aren't the same two parameters, but this is why I’m asking about how the control loops measure the speed when it’s above USER_MOTOR_FREQ_MAX_Hz.

    Do I need to set USER_MOTOR_FREQ_MAX_Hz 20-30% above my desired operating speed. And if I change this value will it change the calculated gains in the control loops. And does this parameter affect anything else?

  • Yes, at least 20-30% of the maximum target speed and higher than the maximum speed of the motor.

  • There is still something that doesn't make sense. USER_MOTOR_FREQ_MAX_Hz goes into these four functions in the example lab code.

    TRAJ_setMinValue(trajHandle_spd, -USER_MOTOR_FREQ_MAX_HZ);
    TRAJ_setMaxValue(trajHandle_spd, USER_MOTOR_FREQ_MAX_HZ);

    float32_t speed_min_Hz = -USER_MOTOR_FREQ_MAX_HZ;
    float32_t speed_max_Hz = USER_MOTOR_FREQ_MAX_HZ;

    For our application, the max speed for the application and the motor max speed are essentially the same thing. We do expect to have some overshoot when performing a step change to max speed but not much, less than 5% is expected. 

    I would like to use USER_MOTOR_FREQ_MAX_HZ to limit the speed command and at the same time allow for a certain amount of overshoot in the control loops. I believe this is what the user guide is suggesting by recommending the 20-30% margin. The problem is, there is only one parameter that seems to simultaneously affect the speed command limit and the 'measured' limit for the control loops.

    For example, if I want to limit the commanded speed to +/-200 Hz and the motor speed could overshoot to +/-210Hz worst case during acceleration to a max commanded speed of 200Hz. How should I set the parameters above to limit the commanded speed to +/-200Hz and at the same time allow for a 5% max overshoot?

    If I set USER_MOTOR_FREQ_MAX_HZ to 20-30% higher than 200Hz as you suggested, this will not limit the speed command to 200Hz.

    If I set USER_MOTOR_FREQ_MAX_HZ to 200Hz, this will limit the speed but I have not allowed for any overshoot as you suggested. 

  • Since you are using the floating-point device, you can set the USER_MOTOR_FREQ_MAX_Hz to the limitation target value of your motor. And just set the scaling value of the DAC to a greater value than USER_MOTOR_FREQ_MAX_Hz like 2*USER_MOTOR_FREQ_MAX_Hz.

    At least 20-30% of the maximum target speed is necessary for fixed-point device with _IQ format, that is not must have for he floating-point device.

  • Thanks, we did a test in the lab to confirm that the USER_MOTOR_FREQ_MAX_Hz did not affect the measured speed by using a second motor/drive that was shaft coupled to the motor and TI INSTASPIN drive. We put the TI drive in torque mode with a set current of 0. We then used the other motor to back drive it to a speed that was 2X greater than our setting for USER_MOTOR_FREQ_MAX_Hz. The speed in the TI debugger tracked the commanded speed from other drive/motor. These results align with your last post and confirm that the 20-30% is not relevant for this parameter on this processor. As for the DAC, that's just a scaler value so we should set that to the max expected speed for the system.