MATLAB Answers

How can i pause an engaged PID controller while i am running a simulation? How can i start and reset a subsystem at a given time?

11 views (last 30 days)
Joachim Janssen
Joachim Janssen on 5 Sep 2013
Commented: Joachim Janssen on 2 Oct 2013
Hi there.
I am currently trying to a model a fluid level closed loop control.
In the real world application the PID controller is forced to stop its interference with the system and stay in tracking mode for 20 seconds when done with its work (control factor equals zero) to prevent excessive movement of the valve of the system.
I got the part of the tracking mode solved by looking into the sldemo_bumpless, but i am currently struggling to get the pause to work correctly.
I hope that someone can push me in the right direction,
best regards, Joachim
Ps: Please excuse my poor english skills, it's been a while ;)
Edit:
The more i look at my problem, the more i think i have the answer, altough i do not know how to get it to work. Since my PID controller can only pause when the difference between the target level and the actual value is smaller then my dead band and i will have to make a subsystem, which is able to give out a value=0 for twenty seconds.
But how can i do this without huge trouble?
Thanks in advance

Answers (2)

ES
ES on 5 Sep 2013
You want to pause the simulation using code?
If yes, you can use
set_param(bdroot,'SimulationCommand','pause')
then you can restart or stpo by passing appropriate commands.
  1 Comment
Joachim Janssen
Joachim Janssen on 6 Sep 2013
Hit there! Thank you fo your answer, but this is not what i intend to do.
I want to stopf the interference of the pid controller with the system, while the simulation is running. The system should stay active. I want to create a subsystem which is able to do that for a given time and condition.
The pid block interference should bei stopped for 20 seconds while the system deviation equals zero.
Regards, joachim

Sign in to comment.


Arkadiy Turevskiy
Arkadiy Turevskiy on 30 Sep 2013
Should be pretty straightforward to do. You basically want the PID controller in one control path and the constant zero in the parallel path. Downstream of them you want the switch that you will program with your logic.
PID Block in Simulink has tracking mode, so you should use that while PID is not active so that there is bumpless transfer.
Take a look at this example to get a better idea how to proceed.
The best tool to implement logic like yours for the switch would probably be Stateflow.
  1 Comment
Joachim Janssen
Joachim Janssen on 2 Oct 2013
Hi, thanks for your answer. I thought that, with the idea from the bumpless demo, this should be childs play. The tracking mode of the Pid Block works great. I am currently struggling to get the timing right. Maybe i should take a deeper look into stateflow. I will buy the toolbox later (thank god for the student licence).
I am not on my matlab machine, i will post my current solution later.
Regards Joachim

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!