Simulation on Simulink/MATLAB - Page 1
Forum section: electronics / projects

author: XaviPacheco
author_rank: Regular Contributor
timestamp: August 09, 2018, 02:06:21 am
content: Hi,The picture below shows a temperature control system that I found on the web. I would like to simulate it by myself. My question is about the first block which receives two constants values (a setpoint, and an initial temperature). I'm trying to identify that block in Simulink. What do you think it could be?

author: rstofer
author_rank: Super Contributor
timestamp: August 10, 2018, 05:33:49 pm
content: Simulink Library Browser->Simulink->Sources->Constant?

author: XaviPacheco
author_rank: Regular Contributor
timestamp: August 10, 2018, 05:38:42 pm
content: Sorry, I meant the second block which receives the two constants as inputs.

author: rstofer
author_rank: Super Contributor
timestamp: August 10, 2018, 05:55:19 pm
content: It looks like a summer (but the sum makes no sense); it may be more complex than that. I really don't know how the initial temperature gets involved with the setpoint. The control loop summer comes after that block so apparently the + input can vary with both initial temperature and setpoint.Unless I knew a great deal more about the importance of the initial temperature on the setpoint, I would drop that block. Once I knew more, I could always add it back in.

author: rstofer
author_rank: Super Contributor
timestamp: August 10, 2018, 06:04:02 pm
content: I guess the initial temperature could be used to create a setpoint much higher than the real setpoint in an attempt to get a maximum error and more output. Essentially it creates a 'gain' on the error.I didn't look at the transfer function (since it is given), does this thing implement a PID control? If so, the P term should account for the high error during warmup.

author: XaviPacheco
author_rank: Regular Contributor
timestamp: August 10, 2018, 06:06:04 pm
content: Yeah, the red block is a PID controller.

author: rstofer
author_rank: Super Contributor
timestamp: August 10, 2018, 06:50:17 pm
content: Suppose you subtracted the initial temperature from the setpoint and multiplied that difference times 5 (just to pick a number) and then added the product to the setpoint temperature. The controller would think that a there was a massive error.As the temperature got closer to the real setpoint, the multiple would diminish and the real setpoint would take over.I imagine it would be possible to include the multiple only if the initial temperature was more than some distance from the setpoint. Maybe use a Function block:https://www.mathworks.com/help/simulink/ug/creating-an-example-model-that-uses-a-matlab-function-block.htmlNow the block can be quite tricky!Later on, the question will be whether the function can be realized in hardware but that's a problem for another day.

author: XaviPacheco
author_rank: Regular Contributor
timestamp: August 10, 2018, 06:57:30 pm
content: Well, it's kind of tricky as you say. I think I'll have to see what happens without that block.

author: rstofer
author_rank: Super Contributor
timestamp: August 10, 2018, 07:37:13 pm
content: It may turn out that the initial warmup time is longer than desired. In the end, I expect the PID control to maintain the temperature. One of the problems, of course, is I term windup. The integral of the error gets quite large because it takes so long to come up to temperature. I haven't looked at the Matlab PID but I have read about some physical controllers that bound the integral term to prevent overshoot.You would expect the D term to come into play as the temperature approaches the setpoint to help prevent overshoot but it turns out that D is often turned way down.It'll be interesting to see what you come up with!

author: larsdenmark
author_rank: Regular Contributor
timestamp: August 11, 2018, 09:02:45 am
content: Quote from: XaviPacheco on August 09, 2018, 02:06:21 amThe plant and controller work in deviation variables (which means that the variable used here have the initial value subtracted). The setpoint is in original units (let's say Celcius) and hence you need to subtract the initial value from the setpoint before sending it to the controller block. Also note that diagram adds the initial value from the output of the plant block in order to get the original units out in the scope block.So the block you are asking about calculates the difference of the two signals.