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.

DRV8312-C2-KIT: Difference between Initialization and Reset

Part Number: DRV8312-C2-KIT
Other Parts Discussed in Thread: INSTASPIN-BLDC, CONTROLSUITE

Hey there,

I have a question about the GUI InstaSPIN-BLDC Project.

The initialization for "w1" of the current controller is done like:

#define PID_DATA_DEFAULTS { \

_IQ(0.0), \

_IQ(0.0), \

_IQ(0.0), \

_IQ(0.0), \

_IQ(0.0), \

_IQ(0.0), \

_IQ(0.0), \

_IQ(1.0) \

}

But while Reset in A1 it is done like:

pid1_idc.data.w1 = 0;

 

It is the same for speed controller.

My question is: Why is there a difference in value (zero<->one)?

 

Thanks in advance,

Sarah

  • You might have a look at the code or the guide of "pid_grando" in controlSUITE as the following folder, resetting the "w1" term to avoid the overshot if there is a wrong feedback value when starting the pid controller. It's only used in the first calculation of the integral term. There is no difference if the reference is close to feedback.

    C:\ti\controlSUITE\libs\app_libs\motor_control\math_blocks\v311\~Docs

  • Hello,

    I am aware of that, but it is the same at the very first time of pid-controller usage after initilization.
    So why is "w1" initialized at 1? Shouldn't it be 0?

    Sarah

    typedef struct { _iq up; // Data: proportional term

    _iq ui; // Data: integral term

    _iq ud; // Data: derivative term

    _iq v1; // Data: pre-saturated controller output

    _iq i1; // Data: integrator storage: ui(k-1)

    _iq d1; // Data: differentiator storage: ud(k-1)

    _iq d2; // Data: differentiator storage: d2(k-1)

    _iq w1; // Data: saturation record: [u(k-1) - v(k-1)]

    } PID_GRANDO_DATA;

     

    PID_GRANDO_CONTROLLER pid1_idc = {PID_TERM_DEFAULTS,PID_PARAM_DEFAULTS,PID_DATA_DEFAULTS};

     

    #define PID_DATA_DEFAULTS { \

    _IQ(0.0), \

    _IQ(0.0), \

    _IQ(0.0), \

    _IQ(0.0), \

    _IQ(0.0), \

    _IQ(0.0), \

    _IQ(0.0), \

    _IQ(1.0) \

    }

     

  • The initialization value will not be used, and will be replaced by the value is set in the control loop. And as replied to you, the initialization "w1" is not critical, just impact the first integral term, its value will be updated in PID_GR_MACRO always.
  • Before first spinning A1 is used to set "w1" to 0 with
    pid1_idc.data.w1 = 0;
  • Right. Some terms include w1 will be reset to zero before startup every time.