update parameter during simulink simulation

조회 수: 5 (최근 30일)
Stefano Di Benedetto
Stefano Di Benedetto 2018년 7월 23일
댓글: Ryan Takatsuka 2018년 7월 25일
I have a PID controller which provide to heat up water in a tank with temperature target set to 35°C. Now, once the target is reached, i want to stop the PID controller working and let drop water temperature till 30°C; only when the temperature is below 30°C i want to use again PID controller to reach water again to its target temperature. To do this i need to determinate with a parameter when the tank is warming up and when it is cooling down; since the calculation based on temperature's derivative is unsteable, i want to use a parameter (A) which is =1 when T>=35°C and it is -1 when T<=30°C and in all the others possible case it is the same value of the last calculate value. How can i do that in Simulink? Thank you :)
  댓글 수: 1
Aquatris
Aquatris 2018년 7월 23일
Did you try Switch blocks? or Matlab Function block where you can type out the thing you want as a script?

댓글을 달려면 로그인하십시오.

채택된 답변

Ryan Takatsuka
Ryan Takatsuka 2018년 7월 23일
If you use external gains for the PID block, you can easily modify them during the simulation. Because you want the PID to switch between active and inactive, I would recommend using a parameter A which switches between 0 and 1 instead of -1 and 1.
This way, you can just multiply the PID gains by parameter A at any time and it will automatically cause the PID gains to drop to 0 when T>35°C.
See the attached images for an example of this.
  댓글 수: 2
Stefano Di Benedetto
Stefano Di Benedetto 2018년 7월 25일
thank u very much, this is a very elegant way to solve this problem. Anyway I had to use data store memory block in order to write and read the parameter A with a lower frequency of the cicle itself.
When I usually use a PID controller is it normal to have a warining in diagnostic viewer about algebraic loop? Could be this a problem for the solver stability?
Thank u very much
Ryan Takatsuka
Ryan Takatsuka 2018년 7월 25일
Algebraic loops shouldn't be caused by a PID block alone, and are most likely due to some variable looping back on itself during the same time step. These can generally be fixed by adding small delays between signals that are causing the warning. For the most part, these will just cause the simulation to run slower.
Here are some references:

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Gain Scheduling에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by