Example of controlling room temperature - STEP 7

Creating FBD programs

ft:publication_title
Creating FBD programs
Product
STEP 7
Version
V20
Publication date
11/2024
Language
en-US
Example of controlling room temperature

Controlling room temperature

In a cold room, the temperature must be maintained below zero degrees Celsius. A sensor is used to check for any temperature fluctuations. If the temperature rises above zero degrees Celsius, the cooling system switches on for a preset time. The "Cooling system on" lamp is lit during this time.

The cooling system and the lamp are turned off if one of the following conditions is met:

  • The sensor reports a temperature fall below zero degrees Celsius.

  • The preset cooling time has elapsed.

  • The "Stop" pushbutton is pressed.

If the preset cooling time has expired and the temperature in the cold room is still too high, the cooling system can be restarted with the "RESET" pushbutton.

Implementation

The following table shows the definition of the tags used:

Name

Declaration

Data type

Comment

Sensor

Input

BOOL

Temperature sensor signal

RESET

Input

BOOL

Restart

STOP

Input

BOOL

The cooling system is switched off.

MaxCoolTime

-

TIME

Preset cooling time

This tag is defined in the "DB_Cool" data block.

CurrCoolTime

-

TIME

Currently elapsed cooling time

This tag is defined in the "DB_Cool" data block.

Cooling system

Output

BOOL

The cooling system is switched on.

Lamp

Output

BOOL

The lamp for the "Cooling system on" message is switched on.

TempVariable

Temp

BOOL

Temporary tag

This tag stores the signal state of the IEC timer TP.

The following network shows the FBD programming for controlling room temperature:

Network 1:

Network 2:

When the temperature in the cold room rises above zero degrees Celsius, the signal state at the "Sensor" operand switches from "0" to "1" (positive signal edge). In the case of a positive signal edge at the IN input of the timer function, the preset cooling time is started and the "TempVariable" receives the signal state "1". The signal state "1" of the "TempVariable" causes the cooling system as well as the display lamp to be turned on in network 2. The "Sensor", "Cooling system" and "Lamp" outputs must be programmed in network 2, because program only one coil can be programmed at the Q output of the timer function.

If the temperature in the cold room falls below zero degrees Celsius, the signal state of the sensor switches back to "0". This switches the cooling system and lamp off.

If the sensor does not signal a temperature drop, the cooling system and lamp are switched off after the preset cooling time has elapsed, at the latest. In this case, the cooling process can be restarted with the "RESET" pushbutton. Pressing and releasing the pushbutton generates a new positive signal edge at the IN input that restarts the cooling system.

The cooling system and the display lamp can be turned off with the "STOP" pushbutton at any time.