Let us study how to create a Function Block (FC) for a Valve Control Logic in PLC. This article focuses on Siemens function block programming for the control valve with example.
There are two valve functions in this application. Valve opening and closing can be controlled by giving OPEN and CLOSE commands. So Consider two outputs for valve open command and valve close command.
When we need to write a logic for many valves in a plant then we use the FC blocks. So here we will write the logic for the valve by using the FC block.
For example, we have one valve to control it manually from PLC. So we need two buttons in the graphics for controlling the valve position, i.e. for valve opening and valve closing.
An operator will press the valve open button for the valve opening position. Similarly, the operator press the valve close button for the valve closing position.
Valve has the two proximity switches installed on it to know the valve position. So, two feedback signals will be generated for the open position and also for the close position. So PLC will receive these feedback signals and display the valve status on the graphics.
In this example, we will take FC block and write the logic for the valve. Declare all temporary variables in the table.
After configuration of FC, take OB 1 and call FC in OB 1. You Call this FC block many times in the logic. Use the FC block for each time when you want to implement the control logic for the valves.
For example, we will consider one valve control logic.
List of Inputs:-
- I0.0:- valve Open
- I0.1:- Valve close
List of Outputs:-
- Q0.0:- Valve ON
- Q0.1:- Valve Open Command
- Q0.2:- Valve Close Command
Create a Function (FC) in Siemens PLC
OB1:- Organization block for valve control logic. FC 1 is called in OB 1. As shown in the below figure we can drag FC 1 in OB 1 for valve control logic.
We have called FC 1 only for one valve in the OB1. Generally, FC can be called multiple times. If there are more valves in the application, FC 1 can be called for another valve also, no need to write logic every time.
For FC, no need to create separate DB like FB configuration. Here when we press the valve open (I0.0), the valve (Q0.0) will be ON and if the valve close (I0.1) is pressed, the valve will be closed.
FC 1:- In Simatic manager, we can configure FC or another block by clicking on insert new object.
Add Function in the program as shown in the below figure.
After FC configuration, declare all temporary variables in the table as shown in the below figure.
In this network, we have taken a temporary variable for valve ON/OFF. By pressing the valve open, valve can be opened and by pressing the close button, valve can be closed.
If the valve (Q0.0) is ON, Valve open command (Q0.1) should be ON.
If the valve (Q0.0) is ON, valve close command (Q0.2) should be ON.
As per the above explanation, you can write the logic for other valves also. Call FC in OB 1 for the second valve and configure the inputs and outputs.
Note:- This is the simple example for the FC block used for valve application in PLC, we can use this concept in other examples also.