PID Clamping circuit - Problem with Fixed-Point Data Type
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi everybody,
I use the PID-Controller Block in Simulink in combination with hardware running on fixed-point datatypes. (btw.: I am using MATLAB/SIMULINK 2011b)
In my first layout, I had a Saturation-block after the PID to ensure that the output stays between -23 and 57 and it worked pretty good on the hardware (by the way: I defined every Data-Type in the PID as fixdt(1,32,16) in my first layout).
Now, to prevent Integration windup by the PID, I deleted the saturation after the PID, defined the upper and lower saturation limits inside the PID itself and activated the Anti-windup method "back-calculation" with the back-calculation coefficient Kb=1. This setup didn't work as it was supposed to on my hardware (the PID gave wrong or to low outputs according to the input controller deviation).
So i tried the "clamping" Anti-windup method of the PID block (again, all internal Data-Types: fixdt(1,32,16)) and here i got the next problem, when I tried to simulate the setup:
Data type mismatch. Output port 1 of 'onboard_matlab/Onboard_Matlab_Controller/Flight Control System/PID Controller/Clamping circuit/preSat' is a signal of data type 'sfix32_En16'. However, it is driving a signal of data type 'int32'.
Data type mismatch. Input port 1 of 'onboard_matlab/Onboard_Matlab_Controller/Flight Control System/PID Controller/Clamping circuit/SignPreSat' expects a signal of data type 'int32'. However, it is driven by a signal of data type 'sfix32_En16'.
It seems to me, that the PID block can't handle the fixed-point data types in the "clamping circuit" of the anti-windup part of the controller. Am I wrong with this thought? Is there some kind of workaround?
I appreciate every hint and help very much. -tom
0 Commenti
Risposta accettata
Ryan G
il 30 Nov 2012
This is an issue that was resolved in R2012b by adding some data type converts in the clamping circuit. You can see how the clamping circuit works by looking under the mask of the PID control block.
I'm not sure there is an easy fix if you require fixed point. However, you could look at the structure and design your datatypes such that the input to the clamping block is not fixed point. If you are on software maintenance you can upgrade to R2012b.
The final way you could do this is by reconstructing the PID manually and adding in the datatype converts yourself. However, this would not allow you to use any of the features of the PID block (such as easily manipulating the structure or tuning).
0 Commenti
Più risposte (0)
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!