![](../../Images/heater4.png)
![](../../Images/heater5.png)
Heater
Simulator of Heater unit
So this is pretty simple code using really IF and END_IF. Not meant for a PLC controller but it does work as a standalone simulator just to get the logic how a normal heater unit works. Just a quick explanation of the code before I show a short GIF how it works: -The code is simple you have a couple BOOL parts for the buttons as well heater 1, 2 and cooler. So why there is 2 heaters ? well because I made it tha t whatever we are below the minimum tempeture that is 10, to heat up the heater faster. After we are above 10 it will only work with 1 heater. In a real life it be a bit diffrent but we are using this as a small example. We are using here a few variables for the buttons that in real life are a big requrements that we have " oldbtn1 := btn1; oldbtn2 := btn2; ". So what is this ? These ones are normally reqremed if you are doing a setup like lets make an example: " You press a button." Normally you press it and let it go but a machine has a high chance to take in account the miliseconds of that press so to make sure it only takes one signal going form 0 to 1 and not 0 to 1 and then 1 to 0 because it detected a second press of the same button we use this command to make sure we have time to do it.
Example of button and old button signals
Made in paint... I'm an Engineer not an artist... So yeh kind of to imagine it that the old statement woudl be equall to the new one and then the new one when it si 0 it will be equall to the old one ... yeah a bit confusing to explain. :D But now time to show the program in work.
Simulation
The end resoult can be seen in a working order with a few variations depending what we have set it up at that moment with the button on the top right.
- Picture one, the device have just started turning on both heaters.
- the device is set on 12 C as it starts to heat up whatever time it reaches the tempeture it stops.
- As it finally reaches 17 degrees on that setting the heater 2 turns off as the device turns on only heater 1 whatever the tempeture drops below 17 degrees.
- Another picture just showing a bit longer graph on 28 C
- As it climbs on 40 degrees we leave it there.
- Finnaly as it reaches 40 degrees the cooler turns on whatever it is equall or greater just for incase the device not to burn.