2013-03-07 02:53 PM
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. voidfile:///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_tfile:///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 understandingfile:///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 infile:///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? Thanks2013-03-08 12:07 AM
I believe you can answer this questions yourself, checking the actual implementation.
Both thearm_pid_instance
struct definition and thearm_pid_q15
implementation can be found atarm_math.h
in the DSP_Libs.