Other Parts Discussed in Thread: MOTORWARE
Hi All,
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.
Other Parts Discussed in Thread: MOTORWARE
Hi All,
can you attach your user.h file please
I still don't understand what you mean by contacts. If you need it to make more revs in a time frame increase the allowed acceleration and jerk.
You are right. Indeed more contacts mean more revolutions in a time frame. On velocity, acceleration and jerk, I saw some definitions in 'spintac_pos_move.h', such as:
_iq24 VelLim; //!< Velocity Limit { unit: [pu/s], value range: (0.0, 1.0] )
_iq18 AccLim; //!< Acceleration Limit { unit: [pu/s^2], value range: [0.001, 120.0] }
_iq18 DecLim; //!< Deceleration Limit { unit: [pu/s^2], value range: [0.001, 120.0] }
_iq18 JrkLim; //!< Jerk Limit { unit: [pu/s^3], value range: [0.0005, 2000.0] }
ST_SPEED_PU_PER_KRPM = (1/30)
I want to know if that values I assigned can exceed value range above limit in spintac?
Winston,
The limits you quoted are the pu mathematical limits of the SpinTAC module. They cannot be exceeded.
For acceleration, that translates to (for your settings) 3600krpm/s [ (500 {USER_IQ_FULL_SCALE_FREQ_Hz} * 60 {Hz to RPM Scale}) / 1 {USER_MOTOR_NUM_POLE_PAIRS} * 120 {SpinTAC AccMax} ] which is enormous.
I would echo Chris' suggestions. Numerically work out what Velocity, Acceleration/Deceleration will meet your application requirements. You can change the curve type from ST-Curve to Trapezodial in order to ignore the Jerk term. This will simplify the calculations.
Winston,
Did you modify the code so that it will translate your IQ18 SI Acceleration and Deceleration values into the appropriate IQ24 PU Acceleration and Deceleration to provide to the SpinTAC block?
Adam,
In ST_runPosMove() function,
void ST_runPosMove(ST_Handle handle)
{
ST_Obj *stObj = (ST_Obj *)handle;
// Run SpinTAC Position Profile Generator
// If we are not running a profile, and command indicates we should has been modified
if((STPOSMOVE_getStatus(stObj->posMoveHandle) == ST_MOVE_IDLE) && (gMotorVars.RunPositionProfile == true))
{
// Get the configuration for SpinTAC Position Move
STPOSMOVE_setCurveType(stObj->posMoveHandle, gMotorVars.SpinTAC.PosMoveCurveType);
STPOSMOVE_setPositionStep_mrev(stObj->posMoveHandle, gMotorVars.PosStepInt_MRev, gMotorVars.PosStepFrac_MRev);
STPOSMOVE_setVelocityLimit(stObj->posMoveHandle, _IQmpy(gMotorVars.MaxVel_krpm, _IQ(ST_SPEED_PU_PER_KRPM)));
STPOSMOVE_setAccelerationLimit(stObj->posMoveHandle, _IQ18mpy(gMotorVars.MaxAccel_krpmps, _IQ18(ST_SPEED_PU_PER_KRPM)));
STPOSMOVE_setDecelerationLimit(stObj->posMoveHandle, _IQ18mpy(gMotorVars.MaxDecel_krpmps, _IQ18(ST_SPEED_PU_PER_KRPM)));
STPOSMOVE_setJerkLimit(stObj->posMoveHandle, _IQ18mpy(gMotorVars.MaxJrk_krpmps2, _IQ18(ST_SPEED_PU_PER_KRPM)));
// Enable the SpinTAC Position Profile Generator
STPOSMOVE_setEnable(stObj->posMoveHandle, true);
if(gMotorVars.PosStepInt_MRev > 0) Flag_End_Upward = true;
if(gMotorVars.PosStepInt_MRev < 0) Flag_End_Downward = true;
// clear the position step command
gMotorVars.PosStepInt_MRev = 0;
gMotorVars.PosStepFrac_MRev = 0;
gMotorVars.RunPositionProfile = false;
}
STPOSMOVE_run(stObj->posMoveHandle);
}
Winston,
That is the issue. You are passing an IQ18 value into SpinTAC. This needs to be an IQ24 value. Try the following code.
STPOSMOVE_setAccelerationLimit(stObj->posMoveHandle, _IQ24mpyIQX(gMotorVars.MaxAccel_krpmps, 18, _IQ18(ST_SPEED_PU_PER_KRPM), 18)); STPOSMOVE_setDecelerationLimit(stObj->posMoveHandle, _IQ24mpyIQX(gMotorVars.MaxDecel_krpmps, 18, _IQ18(ST_SPEED_PU_PER_KRPM), 18)); STPOSMOVE_setJerkLimit(stObj->posMoveHandle, _IQ20mpyIQX(gMotorVars.MaxJrk_krpmps2, 18, _IQ18(ST_SPEED_PU_PER_KRPM), 18));
The SpinTAC interface expect all inputs to be a particular Q-ness. So instead of providing IQ24(120) like you expected, you were really providing IQ24(1.875) since IQ18(120) == IQ24(1.875).
Hi Adam,
According to the code you provided, I modified my software and everything was correct. Thanks a lot.
Right now I set parameters of motor motion as:
gMotorVars.MaxVel_krpm = _IQ(6.33345);
gMotorVars.MaxAccel_krpmps = _IQ20(690.844);
gMotorVars.MaxDecel_krpmps = _IQ20(690.844);
PosMoveCurveType = ST_MOVE_CUR_TRAP;
The motor rotates same revolutions in forward and reverse directions. When the revolution = 1 or 2, all things are right. But while the revolution is more than 3, the motion of motor is unstable. I want to know the reason to generate this. Is the torque not enough?
Winston,
It is possible. You can try increased the USER_MOTOR_MAX_CURRENT_A in order to allow your motor to command more torque.
Adam,
There was no improvement after I increased USER_MOTOR_MAX_CURRENT until the value of 3 times. What are other reasons that can result in unstable motion?
Winston,
Try lowering the maximum velocity, you might be exceeding the maximum possible speed of the motor.
Depending on your motor, you may need to rescale the phase current sense resistors so that you can maximize the performance of the FOC.
You can also try increasing the stiffness of the current controller. There should be some posts/blogs that talk about tuning the current controller.
Adam,
I tested my motor system according to your advise. When I changed these parameters the motor run still unstably. But I found that when some parameters were fixed let the motor start running, stop, reset, and restart, stop, reset,.....repeat these procedures. In a loop of these repeats the motor will work very well, that means work state of the motor is related to the moment of the motor starting. So how to adjust parameters make them synchronized at every starting.
Winston,
I'm not quite sure what you are saying here. Can you provide some additional clarification?
Adam,
Presently I set parameters of motor motion as:
gMotorVars.MaxVel_krpm = _IQ(6.33345);
gMotorVars.MaxAccel_krpmps = _IQ20(390.844);
gMotorVars.MaxDecel_krpmps = _IQ20(390.844);
PosMoveCurveType = ST_MOVE_CUR_TRAP;
The motor rotates 4 revolutions in forward and reverse directions. And then I start running program, observing state of motion, stopping and resetting program, repeat this procedure many times. In occasional one of these procedures, the motor will work very well as setting parameters. But in the majority of cases, the state of motor motion is unstable, speed and number of revolution of motor motion are all different every time. So I think this is not a torque issue, but a synchronization problem. How do I resolve it?
Winston,
In the InstaSPIN-MOTION labs the motor and encoder are synchronized when the resistance is recalibrated prior to each start. Have you disabled this functionality?
You may need to increase the amount of alignment current in order to guarantee this alignment occurs. In order to do that you should modify the USER_MOTOR_RES_EST_CURRENT_A in the user.h file.
Adam,
I can't find out reasons on the motor synchronization issue. So I did labs again from beginning of Instaspin. I have a question to ask you. SpinTAC.PosCtlBw_radps is defined as _iq20, can I modify it as _iq18.
Winston,
winston wu said:SpinTAC.PosCtlBw_radps is defined as _iq20, can I modify it as _iq18.
The q-ness of variable within SpinTAC cannot be modified since the library was compiled with the assumed q-ness.
Adam,
Based on lab13b of MotorWare, I finished the motor control. But I had a new problem.
Presently parameters of motor motion was set as:
gMotorVars.MaxVel_krpm = _IQ(6.33345);
gMotorVars.MaxAccel_krpmps = _IQ20(690.844);
gMotorVars.MaxDecel_krpmps = _IQ20(690.844);
PosMoveCurveType = ST_MOVE_CUR_TRAP;
The motor rotates 6 revolutions in forward and then reverse directions continuously. When I define 'ST_POS_ERROR_MAXIMUM_MREV (1.0)', the motor works well. However when I define 'ST_POS_ERROR_MAXIMUM_MREV (0.5)', there will be 'gMotorVars.SpinTAC.PosCtlErrorID = 2002'. I tried to adjust parameter gMotorVars.SpinTAC.PosCtlBw_radps, there is no improvement. In my project I hope getting position accuracy less than 50 counts at above parameters of motor motion. If can I obtain that result by MotorWare?
winston wu said:In my project I hope getting position accuracy less than 50 counts at above parameters of motor motion. If can I obtain that result by MotorWare?
Are you positive that the combination of your motor, inertia, and inverter can reach your goal acceleration?
My suspicion is that your motor is lagging behind the reference and is unable to actually track your command signal. This is difficult to look at without logging the position error in realtime during a movement.
So if that is the case, than your position controller will be commanding maximum current and adjusting the bandwidth will do nothing. Only thing you can really do here is increase the maximum current so that your motor can accelerate faster.
So I don't think this is a limitation of Motorware but a limitation of the maximum current applied to the motor.