cancel
Showing results for 
Search instead for 
Did you mean: 

URGENT HELP IN UNDERSTANDING CMSIS PID IMPLEMENTATION

bluewaters213
Associate III
Posted on March 07, 2013 at 23:53

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 

file:///D:/ARM%20EBOOKS_DATASHEET/CMSIS/CMSIS/Documentation/DSP/html/group___p_i_d.html#ga2cb1e3d3ebb167348fdabec74653d5c3

(

file:///D:/ARM%20EBOOKS_DATASHEET/CMSIS/CMSIS/Documentation/DSP/html/structarm__pid__instance__q15.html

*S, int32_t resetStateFlag)

__STATIC_INLINE q15_t 

file:///D:/ARM%20EBOOKS_DATASHEET/CMSIS/CMSIS/Documentation/DSP/html/group___p_i_d.html#gac82bd6ccb2b4395ead06ddefe481a244

(

file:///D:/ARM%20EBOOKS_DATASHEET/CMSIS/CMSIS/Documentation/DSP/html/structarm__pid__instance__q15.html

*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

file:///D:/ARM%20EBOOKS_DATASHEET/CMSIS/CMSIS/Documentation/DSP/html/structarm__pid__instance__q15.html

*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

file:///D:/ARM%20EBOOKS_DATASHEET/CMSIS/CMSIS/Documentation/DSP/html/structarm__pid__instance__q15.html

file:///D:/ARM%20EBOOKS_DATASHEET/CMSIS/CMSIS/Documentation/DSP/html/structarm__pid__instance__q15.html

*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
1 REPLY 1
frankmeyer9
Associate II
Posted on March 08, 2013 at 09:07

I believe you can answer this questions yourself, checking the actual implementation.

Both the

arm_pid_instance

struct definition and the

arm_pid_q15

implementation can be found at

arm_math.h

in the DSP_Libs.