PID Controller Thermal simulation - Page 1
Forum section: electronics / projects

author: hamdi.tn
author_rank: Frequent Contributor
timestamp: January 06, 2015, 10:05:54 am
content: Hi everyoneSo am working on a project of water heating system for sanitary and house heating, it involve a stepper motor to control hot water flow speed and a pomp to control water flow speed through heating element. both controlled with a PID loop . several sensor are used to measure all temperature in the system and flow speed.The hardware is done, i have the board and i almost finished the software too and everything work like it should ( i only tested the board and not the whole system) . but i can't verify ( theoretically ) how my loop will behave... am far from being an expert in system involving thermal physics. I tried to do some approximate simulation with MATLAB that i interfaced with my board through serial port. but am not confidante about how accurate or near to reality my simulation is.The client's engineer is an electronic developer too and working in this field for so many years and he's almost certain that i can't simulate that. Am not convinced and almost sure that it can be done, knowing the right tool and the know how.Am sure some Design expert here have done something similar to this, house heating system exist for a long time and if anyone designed such system your advice and tips are welcome

author: IanB
author_rank: Super Contributor
timestamp: January 06, 2015, 12:15:57 pm
content: Yes this is very possible, but it's not a simple undertaking. What you have to do is draw out a schematic diagram of your hot water circulation system and then construct models of each element in that system (pumps, valves, heaters, tanks, pipes, sensors, and so on). When you have all of your device models you can connect them up into a system model and then interface that system model with your control system to have a model of the complete system. MATLAB can be used for this and often is (MATLAB is the Swiss Army Knife of engineering).Rather than interface your system model to the board through the serial port you could also include a model of your control system in MATLAB and test the whole system virtually. If you did this you would be able to test the controller tuning parameters but you would not of course be able to test the actual hardware implementation. If you do want to test the actual control hardware you would have to make your simulation run in real time so that it provides the right speed of response to the control inputs.In short, yes it can be done and it is something chemical engineers and control engineers do frequently to test the designs of their systems. There are even tools similar to Spice for modeling such physical systems (OpenModelica for example). But if you have not done such system modeling before it won't be easy. It is relatively simple to construct a model. It is much harder to validate the model and to trust that it correctly represents the system being modelled.

author: dannyf
author_rank: Super Contributor
timestamp: January 06, 2015, 12:23:16 pm
content: It depends on how your loop is set-up.A single parameter PID loop can be fairly effectively simulated in any programming language. A multi-parameter one can be also done, with some help, in a language like C.The key is to understand the behavior of the underlying system you are trying to simulate. A heater + a thermal mass can be simulated easily:Code:T[t+1]=alpha * (Ctrl - beta * T) * delta T.Where Ctrl is your control variable.It becomes (marginally) more complex if multiple heaters are involved. Even harder still if multiple temperature measurements are involved.I have found Proteus to be quite good at this sort of things, particularly with the code on the mcus supported.

author: hamdi.tn
author_rank: Frequent Contributor
timestamp: January 06, 2015, 06:02:40 pm
content: Thanks for your replyQuote from: IanB on January 06, 2015, 12:15:57 pmdid that and the model respond the same way as the real hardware, but as you said it's the thermal model i did is one i don't trust. The control algorithm is ok for nowQuote from: IanB on January 06, 2015, 12:15:57 pmThat's exactly what i need to achieveQuote from: IanB on January 06, 2015, 12:15:57 pmthanksi will check openModelica and i already contacted a " specialist " let's say , a fluid and thermal system engineering professor , he may help me modelling the system , i rarely get a useful answer out of an academic professor but i hope he will help.Quote from: dannyf on January 06, 2015, 12:23:16 pm3 heat circuit with 2 temperature sensor and a flowmeter in each one , the system should be simulated 2 circuit by 2 circuit , the first pair is a plate heat exchanger , the second is like a mixer with a pump , a PID for each pair to control heating energy being used. and an open loop control for pump speed too.How hard it is nowbut this is the whole system as i said it can be divided to two separate part.