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.

MOTORWARE: MOTORWARE questions

Part Number: MOTORWARE
Other Parts Discussed in Thread: TMS320F28069, , C2000WARE, CONTROLSUITE

Hello,

We use the TMS320F28069 processor with Instaspin for an inverter application. I am looking into a little bit into the code trying to understand some parts of it to rewrite it and add some functionality for our application and I have some questions about it:

1. CTRL_setup: As far as I understand all this function does is runs the trajectories, is this correct? If so, which trajectories? I believe it is speed, Id, maybe speed_max?

I added to this function another trajectory for the Iq so that the torque would be ramped up instead of stepped-up:

" // Iq trajectory handle
_iq intValue_Iq = TRAJ_getIntValue(obj->trajHandle_Iq);
_iq targetValue_Iq = TRAJ_getTargetValue(obj->trajHandle_Iq);
_iq maxDelta_Iq = TRAJ_getMaxDelta(obj->trajHandle_Iq);

_iq error_Iq = targetValue_Iq - intValue_Iq;

// clip and update the value
intValue_Iq += _IQsat(error_Iq,maxDelta_Iq,-maxDelta_Iq);

// store the value
TRAJ_setIntValue(obj->trajHandle_Iq,intValue_Iq);
CTRL_setIq_ref_pu(handle, intValue_Iq); "

would it be possible to just re-use that code for the other trajectories instead of using CTRL_runTraj? I believe that function is part of the Instaspin ROM library and thus I have no access to it.

2. What is the spdmax trajectory? Is this a trajectory for the maximum speed that the speed controller can output? Is this not the same as changing the maxValue of the speed trajectory? Why do you need another trajectory?

3. What is gMxCurrentSlope? In my code now it is:


"if(EST_isMotorIdentified(obj->estHandle))
{

stuff;

EST_setMaxCurrentSlope_pu(obj->estHandle,gMaxCurrentSlope);

stuff;

}
else
{
gMaxCurrentSlope = EST_getMaxCurrentSlope_pu(obj->estHandle);
} "

Is this only used during identification? if so, what identification? The only identification that I need to use in my application is the offsets calibration and the Rs recalibration. 

4. Is it possible to know what parameters are necessary for the estimator to run? The only place where I have found anything to do with the setup of the estimator is in CTRL_setparam:

"CTRL_setEstParams(obj->estHandle,pUserParams); "

 I am assuming the estimator takes all of the parameters it needs from pUserParams? I was planning on modifying this structure to maybe add/remove some stuff. Is this possible without breaking the estimator?

5. I would like to add another interrupt to deal with CAN communications. Would this somehow interfere with the main ISR? Is there any example for this?

6. The structure gMotorVars is defined as volatile. Is this necessary? Can be changed?

Thanks in advance!

Javier

  • 1. The CTR_setup run the trajectories for Id, speed, and speedMax. And you can use the functions in traj.c and traj.h, but you can't CTRL_runTraj since it is blocked in ROM.
    2. It's for the limitation of the output of speed PI controller, that limit the maximum torque current.
    3. It's for the ramp rate of the Id trajectory.
    4. All parameters, you can't change the structure, even the order of its object variables, the same required for CTRL object.
    5. No example code in motorWare, you might refer to the eCAN example code in controlSUITE or C2000Ware.
    6. You'd better keep this.

    Btw, you might refer to lab11a if you want to have more flexibility to modify the instaSPIN example project.
  • 1. Would it be a problem if I use the trajectories from traj.c instead of CTRL_runTraj?

    2. Could you expand a little bit more on this? I still can't understand why it is necessary. If you limit the max and min output of the speed trajectory that should limit the maximum speed allowed. And since the CTRL_runTraj is the one that runs the speedmax trajectory, I can't see the code to see where the target value for both the speed and the speedmax trajectories is set.

    3. Does the estimator need this value to estimate the angle/speed? or it is just for identification?

    6. Why is this?

    I've had a look to lab11a and it doesn't use the speedmax trajectory.

  • 1. Would it be a problem if I use the trajectories from traj.c instead of CTRL_runTraj?

    2. Could you expand a little bit more on this? I still can't understand why it is necessary. If you limit the max and min output of the speed trajectory that should limit the maximum speed allowed. And since the CTRL_runTraj is the one that runs the speedmax trajectory, I can't see the code to see where the target value for both the speed and the speedmax trajectories is set.

    3. Does the estimator need this value to estimate the angle/speed? or it is just for identification?

    6. Why is this?

    I've had a look to lab11a and it doesn't use the speedmax trajectory.
  • 1. No since you defined a new trajectory object, not used the handle in CTRL_runTraj(), just called the same function.
    2. As the limitation or ramp-up control for torque current from the speed PI regulator, it is just working when the maximum current is changed, and the output will be set to the maximum and minimum output of speed PI controller. You might find the code in CTRL_runOnLine_User() in ctrl.h. It's not must have for the running process, so it's not used in lab11a.
    3. No need, just used for motor identification to limit the current ramp-up rate to avoid overcurrent.
    6. "volatile" tells the compiler not to optimize anything that has to do with the volatile variable, it tells the compiler that the value of the variable may change at any time that could be changed by ISR or background loop.
  • Just one last question regarding 3. Is it used during all of the identification process? Because the only part of the identification process that we make use of is the Rs estimation, if it is not used there or it can work with the default values then I would rather remove it to simplify the code and make it more readable.

  • It will be used for Rs estimation, but not only for Rs estimation. The variable and its value will be used in some FAST functions in ROM code. I don't think you need to change or replace it, just follow the example code.