I have a designed a PID controller in simulink with the plant model and everything works fine. I have converted z domain to difference equation and fused the program in microcontroller and things do not work identical. I have a compared with the commercial PID with identical settings, but my custom controller behaves abnormally. The difficulty is that I am unable to explore the model that is inside a microcontroller. Any ideas how to do so?
Since in theory the PID control is composed of sum of independent parts (P + I + D), you could inject a step waveform in the input, and check output, by enabling one control parcel at a time, doing the same in the simulation environment, and this way you would be able to identify precisely which of these controllers is the most discrepant of the model.