13Level 4
On/off temperature control of an oven
A temperature transmitter gives an analog signal. The program scales it to degrees Celsius and switches the heater on and off with a ±5 °C hysteresis around 180 °C.
Open in the simulator
The simulator is designed for computers (screens 1024 px or wider).
Virtual plant
Temperature: 20 °C
Shown at rest. In the simulator the plant moves according to your program's outputs.
Inputs and outputs
| Address | Name | Description |
|---|---|---|
| I0.0 | ON | Oven switch |
| IW0 | TEMP_TRANSMITTER | Transmitter analog input: 0–27648 = 0–300 °C (plant) |
| MD0 | TEMPERATURE | Temperature in °C (REAL) |
| Q0.0 | HEATER | Heater contactor |
Program
Ladder diagram (LD)
Rung 1 — Scales the transmitter: 0–27648 → 0–300 °C.
Rung 2 — Below 175 °C: heater on.
Rung 3 — Above 185 °C or with the oven off: heater off.
Function block diagram (FBD)
Network 1 — Scales the transmitter: 0–27648 → 0–300 °C.
Network 2 — Below 175 °C: heater on.
Network 3 — Above 185 °C or with the oven off: heater off.
Structured text (ST)
(* On/off temperature control of an oven — converted from Ladder *)
(* Rung 1: Scales the transmitter: 0–27648 → 0–300 °C. *)
TEMPERATURE := (TO_REAL(TEMP_TRANSMITTER) - TO_REAL(0)) * (TO_REAL(300) - TO_REAL(0)) / (TO_REAL(27648) - TO_REAL(0)) + TO_REAL(0);
(* Rung 2: Below 175 °C: heater on. *)
IF ON AND TEMPERATURE < 175.0 THEN HEATER := TRUE; END_IF;
(* Rung 3: Above 185 °C or with the oven off: heater off. *)
IF TEMPERATURE > 185.0 OR NOT ON THEN HEATER := FALSE; END_IF;Instruction list (IL)
(* On/off temperature control of an oven — converted from Ladder *)
(* Rung 1: Scales the transmitter: 0–27648 → 0–300 °C. *)
LD TEMP_TRANSMITTER
TO_REAL
SUB( 0
TO_REAL
)
MUL( 300
TO_REAL
SUB( 0
TO_REAL
)
)
DIV( 27648
TO_REAL
SUB( 0
TO_REAL
)
)
ADD( 0
TO_REAL
)
ST TEMPERATURE
(* Rung 2: Below 175 °C: heater on. *)
LD ON
AND( TEMPERATURE
LT 175.0
)
S HEATER
(* Rung 3: Above 185 °C or with the oven off: heater off. *)
LD TEMPERATURE
GT 185.0
ORN ON
R HEATER
Step by step
- 1Press ▶ Run (F5) and turn on ON. Rung 1: SCALE converts the transmitter number (0 to 27648) into degrees (0 to 300 °C).
- 2Rung 2: if the temperature drops below 175 °C, the heater turns on (Set). Rung 3: above 185 °C, or when the oven is switched off, it turns off (Reset).
- 3Watch the temperature go up and down between the two marks: that band is the hysteresis. Without it, the heater would switch many times per second near the setpoint, wearing out the contactor.
- 4In the plant, open the oven door: losses increase and the heater stays on longer.