I have calculated the transfer function of my system to apply a PID to it. With MATLAB and the PID Tuner tool I got the Kp
, Ki
and Kd
parameters of my PID controller. For example in my case they are 0.175, 371.22 and 0 respectively.
Now, I need to use this values in my DSP but the PID algorithm uses the Q15 fractional format for everything. I know how I should scale the input and output values of my PID:
If the max input value is
x
, divide it byx
if it goes from-x
tox
, or do(x/2)-1
if it goes from0
tox
and then convert to Q15 fractionalFor the output value just scale it to your needs
But how do I convert my PID parameters Kp
, Ki
and Kd
to Q15 correctly? If I apply some factor to them like I do for the input and output values I'm actually changing the loop response so how is this done? I think this should be a fairly common thing to do when designing digital PIDs.