Schematic Diagram

Functional schematic overview for the PLC
application.
I/O and Internal Tags
|
Area |
Tag |
Type |
Default |
Description |
|
INPUT |
StartPB |
Bool |
|
|
|
INPUT |
StopPB |
Bool |
|
|
|
INPUT |
ResetPB |
Bool |
|
|
|
INPUT |
AutoMode |
Bool |
TRUE |
|
|
INPUT |
EStopOK |
Bool |
|
|
|
INPUT |
Permissive1 |
Bool |
|
|
|
INPUT |
Permissive2 |
Bool |
|
|
|
INPUT |
FeedbackOK |
Bool |
|
|
|
INPUT |
FeedbackDelay |
Time |
T#3s |
|
|
OUTPUT |
RunCommand |
Bool |
|
|
|
OUTPUT |
RunLamp |
Bool |
|
|
|
OUTPUT |
ReadyLamp |
Bool |
|
|
|
OUTPUT |
FaultLamp |
Bool |
|
|
|
OUTPUT |
FaultCode |
Int; |
|
0 none, 1
estop, 2 permissive1, 3 permissive2, 4 feedback |
|
VAR |
StartPB |
Bool |
|
|
|
VAR |
StopPB |
Bool |
|
|
|
VAR |
ResetPB |
Bool |
|
|
|
VAR |
AutoMode |
Bool |
TRUE |
|
|
VAR |
EStopOK |
Bool |
|
|
|
VAR |
Permissive1 |
Bool |
|
|
|
VAR |
Permissive2 |
Bool |
|
|
|
VAR |
FeedbackOK |
Bool |
|
|
|
VAR |
FeedbackDelay |
Time |
T#3s |
|
SCL Program
// Application 112: Greenhouse Vent Fan
// Category: Agriculture
// PLC: Siemens S7-1200
// Language: SCL for TIA Portal
// Note: Training template. Validate all safety and
machine behavior before commissioning.
FUNCTION_BLOCK "FB_112_GreenhouseVentFan"
{ S7_Optimized_Access := 'TRUE' }
VERSION : 1.0
VAR_INPUT
StartPB : Bool;
StopPB : Bool;
ResetPB : Bool;
AutoMode : Bool
:= TRUE;
EStopOK : Bool;
Permissive1 :
Bool;
Permissive2 :
Bool;
FeedbackOK :
Bool;
FeedbackDelay :
Time := T#3s;
END_VAR
VAR_OUTPUT
RunCommand :
Bool;
RunLamp : Bool;
ReadyLamp :
Bool;
FaultLamp :
Bool;
FaultCode :
Int; // 0 none, 1 estop, 2 permissive1, 3 permissive2, 4 feedback
END_VAR
VAR
RunLatch :
Bool;
FeedbackTimer :
TON;
FeedbackFault :
Bool;
END_VAR
BEGIN
IF ResetPB AND
EStopOK AND Permissive1 AND Permissive2 THEN
FeedbackFault := FALSE;
FaultCode
:= 0;
END_IF;
IF NOT EStopOK
THEN
FaultCode
:= 1;
ELSIF NOT
Permissive1 THEN
FaultCode
:= 2;
ELSIF NOT
Permissive2 THEN
FaultCode
:= 3;
ELSIF
FeedbackFault THEN
FaultCode
:= 4;
END_IF;
IF StopPB OR
(FaultCode <> 0) OR NOT AutoMode THEN
RunLatch :=
FALSE;
ELSIF StartPB
AND AutoMode AND EStopOK AND Permissive1 AND Permissive2 AND (FaultCode = 0)
THEN
RunLatch :=
TRUE;
END_IF;
RunCommand :=
RunLatch AND AutoMode AND EStopOK AND Permissive1 AND Permissive2 AND
(FaultCode = 0);
FeedbackTimer(IN := RunCommand AND NOT FeedbackOK, PT := FeedbackDelay);
IF
FeedbackTimer.Q THEN
FeedbackFault := TRUE;
RunLatch :=
FALSE;
FaultCode
:= 4;
END_IF;
RunLamp :=
RunCommand AND FeedbackOK;
ReadyLamp :=
AutoMode AND EStopOK AND Permissive1 AND Permissive2 AND (FaultCode = 0) AND
NOT RunCommand;
FaultLamp :=
FaultCode <> 0;
END_FUNCTION_BLOCK
Commissioning Checklist
·
Map every PLC tag to the correct
physical input, output, HMI tag, or memory address.
·
Compile in TIA Portal and adjust
tag names, timers, and setpoints for the real machine.
·
Test normal sequence, stop, reset,
feedback failure, timeout, and alarm conditions in simulation first.
·
Use certified safety hardware or
fail-safe logic for emergency stops, guards, and hazardous motion.
