Introduction to the course

Variables

Operators

Program flow control instructions

Project: Pump station project

Project description05:47
Pump Station Project Structure01:55
Function Block: Water Generator01:41
Function Block: Pump Operation10:10
Main program07:29
Visualization pattern03:48
Visualization project03:15
Alarm programming05:31
Pump Station Homework Assignment01:39

Project: Lights control for Smart Home

Bonus module

Function Block: Pump Control

// variables
VAR_INPUT
xEnable:BOOL; // decommissioning of control block
rCurrentLevel:REAL; // current liquid level in the tank
rActivationLevel_1:REAL:=2; // activation level for pump1
rDeactivationLevel_1:REAL:=1; // deactivation level for pump1
rActivationLevel_2:REAL:=4; // activation level for pump2
rDeactivationLevel_2:REAL:=3; // deactivation level for pump2
rActivationLevel_3:REAL:=5; // activation level for pump3
rDeactivationLevel_3:REAL:=4; // deactivation level for pump3
END_VAR
VAR_OUTPUT
xPumpStart_1:BOOL; // activate pump no.1
xPumpStart_2:BOOL; // activate pump no.2
xPumpStart_3:BOOL; // activate pump no.3
END_VAR
VAR
rLevelMeters:REAL; // Liquid level in meters
END_VAR

 

// code

// Converting water level to meters
rLevelMeters := rCurrentLevel / 100;
 
IF xEnable THEN
// Filling conditions in automatic mode
IF rLevelMeters >= rActivationLevel_1 THEN
xPumpStart_1 := TRUE;
ELSIF rLevelMeters < rDeactivationLevel_1 THEN
xPumpStart_1 := FALSE;
END_IF
 
IF rLevelMeters >= rActivationLevel_2 THEN
xPumpStart_2 := TRUE; 
ELSIF rLevelMeters < rActivationLevel_2THEN
xPumpStart_2 := FALSE;
END_IF;
 
IF rLevelMeters >= rActivationLevel_3 THEN
xPumpStart_3 := TRUE; 
ELSIF rLevelMeters < rDeactivationLevel_3 THEN
xPumpStart_3 :=FALSE; 
END_IF;
ELSE
xPumpStart_1 := FALSE;
xPumpStart_2 := FALSE;
xPumpStart_3 := FALSE;
 
END_IF
COD-ST-EN-BASIC FB Pump Control Done.zip
Size: 378.01 KB
COD-ST-EN-BASIC FB Pump Control Template.zip
Size: 330.58 KB
Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
Click outside to hide the comparison bar
Compare