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.

Field Weakening with SpinTac Controller

Other Parts Discussed in Thread: TMS320F28069M, MOTORWARE

Hello,

I'd like to implement field weakening using my TMS320F28069M piccolo motor controller together with my SpinTac controller. I found the example in lab9, but this only shows an example using the FOC controller. Is it possible to implement field weakening with SpinTac, e.g. modify the mainISR function in lab 5f to include a call to FW_run, such as the code section below (assuming that everything is initialized properly).

Also, would this approach work together with sensored commutation from an analog encoder, e.g. lab12b?

Thanks for your support.

Best regards,

Chris

if(FW_getFlag_enableFw(fwHandle) == true)

{
FW_incCounter(fwHandle);

if(FW_getCounter(fwHandle) > FW_getNumIsrTicksPerFwTick(fwHandle))
{
_iq refValue;
_iq fbackValue;
_iq output;

FW_clearCounter(fwHandle);

refValue = gMotorVars.VsRef;

fbackValue = gMotorVars.Vs;

FW_run(fwHandle, refValue, fbackValue, &output);

CTRL_setId_ref_pu(ctrlHandle, output);

gMotorVars.IdRef_A = _IQmpy(CTRL_getId_ref_pu(ctrlHandle), _IQ(USER_IQ_FULL_SCALE_CURRENT_A));
}
}
else
{
CTRL_setId_ref_pu(ctrlHandle, _IQmpy(gMotorVars.IdRef_A, _IQ(1.0/USER_IQ_FULL_SCALE_CURRENT_A)));
}

  • Chris,

    Take a look at lab 10b.  In addition to overmodulation, it includes a field weakening example using SpinTAC.

    I don't see why this wouldn't work with using a sensored commutation approach like in lab 12b.  The field weakening controller is determining the amount of current to put onto the d-axis, which should be independent of sensored or sensorless.

  • Hi Adam,

    I added the section of code for field weakening, and enabled it through the UI, but I don't see any change. What should I expect to see for my Vs, and VsRef values? Should my Vs be increasing greater than 1.0? And should VsRef be changing?

    In the current program, there is oddly no change to VsRef, and I'm not able to locate anywhere in the source code where this value is being set.

    Any suggestions? Do you have any example literature that explains the field weakening method in more detail?

    Thanks again,

    Chris

  • Chris,

    In addition to just the field weakening code did you also copy the code to update the Vs, Iq, and Id values in gMotorVars in the function updateGlobalVariables_motor?  These are very useful values to know when you are working with field weakening.

    I would not expect the VsRef value to change, unless you directly write to it.  This variable is initialized in the main.h file and is not updated after that point.  The Vs value should be the amount of scaled voltage that the current regulators want to put onto the motor phase terminals.  This is passed into the modulator, so the value could be greater than 1.0.  The maximum value is provided in gMotorVars.OverModulation.  This should be able to be dynamically modified.  

    The default value for VsRef is setup in the main.h file with the inititlizer MOTOR_Vars_INIT.  The default value is 0.9 * gMotorVars.OverModulation.

    The field weakening method is a basic integration method.  If the Vs is larger than the VsRef, the field weakening routine will add additional negative d-axis current to IdRef.  If the Vs is smaller than teh VsRef it will use less negative d-axis current.  The rate of integration is controlled by FW_INC_DELTA & FW_DEC_DELTA.  There is also a configurable maximum amount of negative current set by USER_MAX_NEGATIVE_ID_REF_CURRENT_A.

  • Hi Adam,

    Thanks again for the feedback. If I'm understanding correctly, if my VsRef is fixed at ~0.85 and my Vs is 1.0 at full speed, I should see a rising negative IdRef and Id. I'll check this again in the morning.

    My Vs increases until it reaches a plateau at 1.0, should I increase my gMotorVars.OverModulation to enable a higher voltage? I'm not seeing any speed improvement yet from the field weakening.

    Lastly, I see in lab10 that there is code for both the field weakening and SVM over-modulation. I only added the source code for the field weakening. Do they need to be implemented together?

    Best regards,

    Chris

  • Chris,

    Field weakening and overmodulation don't need to be included together.  

    Are you enabling field weakening via the variable gMotorVars.Flag_enableFieldWeakening?

  • Hello Adam,

    Thank you for your support with this issue!

    I am working with Chris as well trying to get the field weakening implemented.

    To answer your previous question, yes we are enabling via the gMotor variable.

    Best,
    Jonathan

  • Jonathan,

    The other thing to watch is the value of Id Reference current.  Is this value getting updated and passed to the FOC when you enable field weakening?

  • Hi Adam,

    I'm seeing a few interesting results when testing field weakening and overmodulation (lab10b). First, when enabling field weakening, I'm seeing IdRef increase to 0.5 * max current (as expected), but the Id current does not track IdRef, not even close. Should there be little to no tracking error between IdRef and Id? With the field weakening enabled, I'm achieving a few 100 rpm faster (perhaps 2-3%), but at the cost of 50% more current from my power supply.

    The biggest improvement came by enabling overmodulation (lab10b) and current reconstruction. By setting current USER_MAX_VS_MAG_PU to 1.33 in the user.h, I can increase the speed perhaps 10-15%, but with much higher current costs (perhaps 50% more current).

    The strangest part, is that by disabling both field weakening and current reconstruction, and increasing USER_MAX_VS_MAG_PU to 1.33 or higher, then I can achieve my best case, speeds 20% greater with perhaps 40% more current.

    What am I missing? I would expect the field weakening to result in much faster performance, perhaps as much as 50% higher speeds with a small current cost. Why would I see much better performance by increasing USER_MAX_VS_MAG_PU without implementing current reconstruction? Is this even a safe approach?

    Thanks again for your feedback.

    Best regards,

    Chris

  • field weakening can't be done with any motor, you need to have a large enough flux that you can actually reduce through the -Id injection...actually, it has more to do with the short circuit current of the motor. With a large short circuit current (flux / 2pi / Ls) field weakening buys you almost nothing in speed (and costs you major power usage).

    so first, see if you have the type of motor for field weakening

     

    second, using over modulation is the most efficient way to get more speed (AND torque) as you are just using the available voltage.  You should see about 25-33% higher speed with 1.33 modulation vs. 1.0

    if you are not the likely culprit is in the current sampling. meaning you probably have a large short circuit current motor with nasty current ripple, and even with the current reconstruction algorithm you are getting some bad current information into the controller.  we have another algorithm for this reconstruction that works even better that we will eventually include in MotorWare, but there are still limitations if you are trying to do this on REALLY low Ls motors using low-side current sensing techniques.

    changing the MAX_VS_MAG or the OverModulation variable without using the current reconstruction should NOT be done. You are not controlling the modulation properly at that point and results can not be trusted.

  • Hi Chris,

    Thanks for the feedback. It makes sense that we're not seeing much benefit from field weakening, because it is a very low inductance motor with high short circuit current. 

    Another phenomenon that we encountered the other day was a performance difference between a RAM and flash build. What differences should I expect to see between the two builds?

    Thanks,

    Chris

  • Chris Lightcap said:

    Another phenomenon that we encountered the other day was a performance difference between a RAM and flash build. What differences should I expect to see between the two builds?

    There are wait states from flash, so it will run effectively slower overall. Typically you try to copy the mainISR into RAM so it runs at the maximum speed. The projects should do this when you change the build configuration to the FLASH build...but if you added a bunch of mainISR code you could have an issue. I'd use the features in proj_lab03 to check the cycle time of the core interrupt.

  • Hello, now I want to use FW and over modulation . Actually, I do not know the current sample in the default modulation(1.0), in my opinion, I know if we want to get the accurate current sampled from the 3-shunt, there would be enough t0(000) for sampling left in every TPWM, how does it be set in default modulation(1.0) . I can not find the set in the lab. When the modulation is over 1, we can use the current reconstruction, and I can understand it. But In default modulation, we do not use the current reconstruction, why?
    In one word, When vs=1 and 30 degrees over A phase, I calculate the T1=T2=Tpwm/2, so T0=0, we can not get the sample current from 3-shunt. How it works in lab?
  • You can change the maximum modulation by using the variable gMotorVars.OverModulation in lab 10b.  

    You do not need current reconstruction when modulation is less than 1 since you have enough time to complete the current sampling.  The only time you need to do reconstruction is when the low side transistor is not on long enough to complete the current sampling.  

  • But when the modulation is 1. When the Vs=1, and the Vs degree is 30 degree more than 100. Then I calculate the T(100)=T(110)=Tpwm/2. So T(000)= Tpwm-T(100)-T(110)=0. So there is no enough time to sample the low side current. isn't it?
  • InstaSPIN doesn't use the standard SVPWM calculation, it uses offset addition based PWM, which has a slightly different meaning for modulation.  

    From proj_lab10b.c:

    //Set the maximum current controller output for the Iq and Id current controllers to enable
    //over-modulation.
    //An input into the SVM above 2/SQRT(3) = 1.1547 is in the over-modulation region.  An input of 1.1547 is where
    //the crest of the sinewave touches the 100% duty cycle.  At an input of 4/3, the SVM generator
    //produces a trapezoidal waveform touching every corner of the hexagon
    CTRL_setMaxVsMag_pu(ctrlHandle,gMotorVars.OverModulation);

  • Ok, thanks a lot. Do you have the Pwm theory? Doc or PDF ?
  • And what is the meaning of this modulation?
  • This is the closest paper I've been able to find quickly:
    www.researchgate.net/.../0deec5177799b44237000000.pdf

    Look at method (c)

    See my previous post for the modulation explanation.

  • Yeah . Thanks so much
  • I am sorry that I can not find your post about modulation, I want to know the differences between modulation in offset pwm and in svpwm. The modulation=1(the value is Udc/sqrt(3)) in svpwm is equal to what modulation or value in offset pwm? Thanks.
  • According to the comments in the lab code about the SVGEN block:

    An input into the SVM above 2/SQRT(3) = 1.1547 is in the over-modulation region. An input of 1.1547 is where the crest of the sinewave touches the 100% duty cycle. At an input of 4/3, the SVM generator produces a trapezoidal waveform touching every corner of the hexagon.