AnsweredAssumed Answered

URGENT HELP IN UNDERSTANDING CMSIS PID IMPLEMENTATION

Question asked by slimsly on Mar 7, 2013
Latest reply on Mar 8, 2013 by fm
Hello,

I will like to implement PID in CMSIS but the documentation lack clear instructions and examples.Can someone be kind enough to explain the below function and answer the few questions.
 
void arm_pid_init_q15 (arm_pid_instance_q15 *S, int32_t resetStateFlag)
__STATIC_INLINE q15_t arm_pid_q15 (arm_pid_instance_q15 *S, q15_t in)
Algorithm:
   
   
    y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] 
    A0 = Kp + Ki + Kd 
    A1 = (-Kp ) - (2 * Kd ) 
    A2 = Kd  
   
From my understanding arm_pid_instance_q15 *S holds A0,A1, & A2 in consecutive memory location, My question are
1] Where is the state variable (x[n], x[n-1] & x[n-2]) and previous output y[n-1] store in arm_pid_instance_q15 *S?.
2] How do I pass the Process error to the PID?
3] Do CMSIS PID take care of Integral windup?  if not How do I take care of it?
4] is q15_t in that hold process error variable?

Thanks

Outcomes