Multiple times of execution of PID controller in a single loop (Simulink)
2 views (last 30 days)
Show older comments
Hi
I have a problem concerning multiple times of execution of a PID controller per loop in a real-time constant temperature control system shown in the Figure. A source meter (Keithley 2400 with GPIB interface) read the real-time resistance of a wire-thermometer (i.e. real-time temperature) and source a current based on difference between the real-time resistance and the temperature setpoint to keep the wire-thermometer at the temperature setpoint.
The problem I have is that the PID controller executes multiple times (6 or 7 times) in a single loop (a loop in simulink) because I found multiple "Current_Ouput" from the plant in a single loop. However, I want the PID controller to execute "one" time per "loop" (one Current_Output per loop).
Please explain why this PID works in this manner and the way I can set 1 execution per loop. Thanks.
Thanks, William
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/156545/image.png)
0 Comments
Answers (2)
Sebastian Castro
on 3 Mar 2016
That PID Controller block is Continuous, so it will execute whenever the model solver decides to take a time step. If you're using a variable-step solver (such as ode45), this is completely expected. A model may take several "minor steps" to try reduce integration errors.
What you can do is change the block to a discrete-time controller so you control how often the block updates.
- Sebastiam
0 Comments
X W
on 24 Jul 2017
Hi William, Would you mind sharing your "Customized GPIB input" block for the Keithley? I assume it is a Simulink Matlab Function block? I am trying to do the same thing, but couldn't get the correct data input with the "To instrument" or "Query" blocks and am going to put the already-written .m file codes into a function to put into Simulink. However, I see the functions supported https://www.mathworks.com/help/simulink/ug/functions-supported-for-code-generation--alphabetical-list.html have neither gpib() nor visa(), and assume I need to look at some "extrinsic" statement to allow full access to MATLAB codes?
Would greatly appreciate if you could share your GPIB read function blocks in Simulink.
Many thanks, X.W.
0 Comments
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!