The sample program makes use of information that you have already read in part 1 of the manual about controlling an industrial blending process.
Task
Two ingredients (ingredient A and ingredient B) are mixed together in a mixing tank by an agitator. The finished product is drained from the tank through a drain valve. The following figure shows a diagram of the sampling process.
Describing the Parts of a Process
Part 1 of the manual included a description of how you divide up the sampling process into functional areas and individual tasks. The individual areas are described below.
The area for ingredients A and B:
• The pipes for each of the ingredients are equipped with an inlet and a feed valve and feed pump.
• The inlet pipes also have flow sensors.
• Turning on the feed pumps must be interlocked when the tank level sensor indicates that the tank is full.
• The activation of the feed pumps must be interlocked when the drain valve is open.
• The inlet and feed valves must be opened at the earliest 1 second after starting the feed pump.
• The valves must be closed immediately after the feed pumps stop (signal from the flow sensor) to prevent ingredients leaking from the pump.
• The activation of the feed pumps is combined with a time monitoring function, in other words, within 7 seconds after the pumps start, the flow sensor must report a flow.
• The feed pumps must be turned off as quickly as possible if the flow sensor no longer signals a flow while the feed pumps are running.
• The number of times that the feed pumps are started must be counted (maintenance interval).
Mixing tank area:
• The activation of the agitator motor must be interlocked when the tank level sensor indicates "level below minimum" or the drain valve is open.
• The agitator motor sends a response signal after reaching the rated speed. If this signal is not received within 10 seconds after the motor is activated, the motor must be turned off.
• The number of times that the agitator motor starts must be counted (maintenance interval).
• Three sensors must be installed in the mixing tank:
Tank full: a normally closed contact. When the maximum tank level is reached, the contact is opened.
The level in a tank above minimum: a normally open contact. If the minimum level is reached, the contact is closed.
Tank not empty: a normally open contact. If the tank is not empty, the contact is closed.
Drain area:
• Drainage of the tank is controlled by a solenoid valve.
• The solenoid valve is controlled by the operator but must be closed again at the latest when the "tank empty" signal is generated.
• Opening the drain valve is interlocked when
the agitator motor is running
the tank is empty
Operator Station
To allow an operator to start, stop, and monitor the process, an operator station is also required. The operator station is equipped with the following:
• Switches for controlling the most important stages of the process. Using the "reset maintenance display" switch, you can turn off the maintenance display lamps for the motors due for maintenance and reset the corresponding counters for the maintenance interval to 0.
• Display lamps to indicate the status of the process.
• The emergency stop switch.
Creating a Configuration Diagram
After you have documented the design requirements, you must then decide on the type of control equipment required for the project.
By deciding which modules you want to use, you also specify the structure of the programmable controller. Create a configuration diagram specifying the following aspects:
• Type of CPU
• Number and type of I/O modules
• Configuration of the physical inputs and outputs
The following figure illustrates an example of an S7 configuration for the industrial blending process.
Describing the Individual Functional Areas
As you describe each area and task within your process, you define not only the operation of each area, but also the various elements that control the area. These include:
• Electrical, mechanical, and logical inputs and outputs for each task
• Interlocks and dependencies between the individual tasks
The sample industrial blending process uses pumps, motors, and valves. These must be described precisely to identify the operating characteristics and type of interlocks required during operation. The following tables provide examples of the description of the equipment used in an industrial blending process. When you have completed description, you could also use it to order the required equipment.
Ingredients A/B: Feed Pump Motors
The feed pump motors convey ingredients A and B to the mixing tank.
• Flow rate: 400 l (100 gallons) per minute
• Rating: 100 kW (134 hp) at 1200 rpm
The pumps are controlled (start/stop) from an operator station located near the mixing tank. The number of starts is counted for maintenance purposes. Both the counters and the display can be reset with one button.
The following conditions must be satisfied for the pumps to operate:
• The mixing tank is not full.
• The drain valve of the mixing tank is closed.
• The emergency off is not activated.
The pumps are switched off if the following condition is satisfied:
• The flow sensor signals no flow 7 seconds after the pump motor is started.
• The flow sensor signals that the flow has ceased.
Ingredients A/B: Inlet and Feed Valves
The inlet and feed valves for ingredients A and B allow or prevent the flow of the ingredients into the mixing tank. The valves have a solenoid with a spring return.
• When the solenoid is activated, the valve is opened.
• When the solenoid is deactivated, the valve is closed.
The inlet and feed valves are controlled by the user program. For the valves to be activated, the following condition must be satisfied:
• The feed pump motor has been running for at least 1 second.
The pumps are switched off if the following condition is satisfied:
• The flow sensor signals no flow.
Agitator Motor
The agitator motor mixes ingredient A with ingredient B in the mixing tank.
• Rating: 100 kW (134 hp) at 1200 rpm
The agitator motor is controlled (start/stop) from an operator station located near the mixing tank. The number of starts is counted for maintenance purposes. Both the counters and the display can be reset with one button. The following conditions must be satisfied for the pumps to operate:
• The tank level sensor is not signaling "Tank below the minimum."
• The drain valve of the mixing tank is closed.
• The emergency off is not activated.
The pumps are switched off if the following condition is satisfied:
• The tachometer does not indicate that the rated speed has been reached within 10 seconds of starting the motor.
Drain Valve
The drain valve allows the mixture to drain (using gravity feed) to the next stage in the process. The valve has a solenoid with a spring return.
• If the solenoid is activated, the outlet valve is opened.
• If the solenoid is deactivated, the outlet valve is closed.
The outlet valve is controlled (open/close) from an operator station. The drain valve can be opened under the following conditions:
• The agitator motor is off.
• The tank level sensor is not signaling "Tank empty."
• The emergency off is not activated.
The pumps are switched off if the following condition is satisfied:
• The tank level sensor is indicating "Tank empty."
Switches for Tank Level Measurement
The switches in the mixing tank indicate the level in the tank and are used to interlock the feed pumps and the agitator motor.
Listing Inputs, Outputs, and In/Outs
After writing a physical description of each device to be controlled, draw diagrams of the inputs and outputs for each device or task area.
These diagrams correspond to the logic blocks to be programmed.
Describing the Required Operator Displays and Controls
Every process requires an operator interface that allows human intervention in the process. Part of the design specification includes the design of the operator console.
Defining an Operator Console
In the industrial blending process described in our example, each device can be started or stopped by a pushbutton located on the operator console. This operator console includes indicators to show the status of the operation (see figure below).
The console also includes display lamps for the devices that require maintenance after a certain number of starts and the emergency off switch with which the process can be stopped immediately. The console also has a reset button for the maintenance display of the three motors. Using this, you can turn off the maintenance display lamps for the motors due for maintenance and reset the corresponding counters to 0.
Establishing the Safety Requirements
Decide which additional elements are needed to ensure the safety of the process - based on legal requirements and corporate health and safety policy. In your description, you should also include any influences that the safety elements have in your process areas.
Defining Safety Requirements
Find out which devices require hardwired circuits to meet safety requirements. By definition, these safety circuits operate independently of the programmable controller (although the safety circuit generally provides an I/O interface to allow coordination with the user program). Normally, you configure a matrix to connect every actuator with its own emergency off range. This matrix is the basis for the circuit diagrams of the safety circuits.
To design safety mechanisms, proceed as follows:
• Determine the logical and mechanical/electrical interlocks between the individual automation tasks.
• Design circuits to allow the devices belonging to the process to be operated manually in an emergency.
• Establish any further safety requirements for safe operation of the process.
Creating a Safety Circuit
The sample industrial blending process uses the following logic for its safety circuit:
• One emergency off switch shuts down the following devices independent of the programmable controller (PLC):
Feed pump for ingredient A
Feed pump for ingredient B
Agitator motor
Valves
• The emergency off switch is located at the operator station.
• An input to the controller indicates the state of the emergency off switch.
Dividing the Process into Tasks and Areas
An automation process consists of a number of individual tasks. By identifying groups of related tasks within a process and then breaking these groups down into smaller tasks, even the most complex process can be defined.
The following example of an industrial blending process can be used to illustrate how to organize a process into functional areas and individual tasks:
Determining the Areas of a Process
After defining the process to be controlled, divide the project into related groups or areas:
As each group is divided into smaller tasks, the tasks required for controlling that part of the process become less complicated.
In our example of an industrial blending process you can identify four distinct areas (see table below). In this example, the area for ingredient A contains the same equipment as the area for ingredient B.
Creating OB1
OB1 decides the structure of the sample program. OB1 also contains the parameters that are transferred to the various functions, for example:
• The STL networks for the feed pumps and the agitator motor supply the FB for the motor with the input parameters for starting ("Start"), stopping ("Stop"), for the response ("Response"), and for resetting the maintenance display ("Reset_Maint"). The FB for the motor is processed in every cycle of the PLC.
• If the FB for the motor is processed, the inputs Timer_No and Response_Time inform the function of the timer being used and which time must be measured.
• The FC for the valves and the FB for the motors are processed in every program cycle of the programmable controller because they are called in OB1.
The program uses the FB for the motor with different instance DBs to handle the tasks for controlling the feed pumps and the agitator motor.
Declaring Variables for OB1
The variable declaration table for OB1 is shown below. The first 20 bytes contain the start information of OB1 and must not be modified.
Creating the Program for OB1
In STEP 7, every block that is called by a different block must be created before the block containing its call. In the sample program, you must, therefore, create both the FB for the motor and the FC for the valves before the program in OB1.
The blocks FB1 and FC1 are called more than once in OB1; FB1 is called with different instance DBs:
The code section of OB1 appears as shown below in the STL programming language:
Network 1 Interlocks for feed pump A
A "EMER_STOP_off"
A "Tank_below_max"
AN "Drain"
= #Enable_Motor
Network 2 Calling FB Motor for ingredient A
A "Feed_pump_A_start"
A #Enable_Motor
= #Start_Fulfilled
A(
O "Feed_pump_A_stop"
ON #Enable_Motor
)
= #Stop_Fulfilled
CALL "Motor_block", "DB_feed_pump_A"
Start :=#Start_Fulfilled
Stop :=#Stop_Fulfilled
Response :="Flow_A"
Reset_Maint :="Reset_maint"
Timer_No :=T12
Reponse_Time:=S5T#7S
Fault :="Feed_pump_A_fault"
Start_Dsp :="Feed_pump_A_on"
Stop_Dsp :="Feed_pump_A_off"
Maint :="Feed_pump_A_maint"
Motor :="Feed_pump_A"
Network 3 Delaying the valve enable ingredient A
A "Feed_pump_A"
L S5T#1S
SD T 13
AN "Feed_pump_A"
R T 13
A T 13
= #Enable_Valve
Network 4 Inlet valve control for ingredient A
AN "Flow_A"
AN "Feed_pump_A"
= #Close_Valve_Fulfilled
CALL "Valve_block"
Open :=#Enable_Valve
Close :=#Close_Valve_Fulfilled
Dsp_Open :=#Inlet_Valve_A_Open
Dsp_Closed:=#Inlet_Valve_A_Closed
Valve :="Inlet_Valve_A"
Network 5 Feed valve control for ingredient A
AN "Flow_A"
AN "Feed_pump_A"
= #Close_Valve_Fulfilled
CALL "Valve_block"
Open :=#Enable_Valve
Close :=#Close_Valve_Fulfilled
Dsp_Open :=#Feed_Valve_A_Open
Dsp_Closed:=#Feed_Valve_A_Closed
Valve :="Feed_Valve_A"
Network 6 Interlocks for feed pump B
A "EMER_STOP_off"
A "Tank_below_max"
AN "Drain"
= "Enable_Motor
Network 7 Calling FB Motor for ingredient B
A "Feed_pump_B_start"
A #Enable_Motor
= #Start_Fulfilled
A(
O "Feed_pump_B_stop"
ON #Enable_Motor
)
= #Stop_Fulfilled
CALL "Motor_block", "DB_feed_pump_B"
Start :=#Start_Fulfilled
Stop :=#Stop_Fulfilled
Response :="Flow_B"
Reset_Maint :="Reset_maint"
Timer_No :=T14
Reponse_Time:=S5T#7S
Fault :="Feed_pump_B_fault"
Start_Dsp :="Feed_pump_B_on"
Stop_Dsp :="Feed_pump_B_off"
Maint :="Feed_pump_B_maint"
Motor :="Feed_pump_B"
Network 8 Delaying the valve enable ingredient B
A "Feed_pump_B"
L S5T#1S
SD T 15
AN "Feed_pump_B"
R T 15
A T 15
= #Enable_Valve
Network 9 Inlet valve control for ingredient B
AN "Flow_B"
AN "Feed_pump_B"
= #Close_Valve_Fulfilled
CALL "Valve_block"
Open :=#Enable_Valve
Close :=#Close_Valve_Fulfilled
Dsp_Open :=#Inlet_Valve_B_Open
Dsp_Closed:=#Inlet_Valve_B_Closed
Valve :="Inlet_Valve_B"
Network 10 Feed valve control for ingredient B
AN "Flow_B"
AN "Feed_pump_B"
= #Close_Valve_Fulfilled
CALL "Valve_block"
Open :=#Enable_Valve
Close :=#Close_Valve_Fulfilled
Dsp_Open :=#Feed_Valve_B_Open
Dsp_Closed:=#Feed_Valve_B_Closed
Valve :="Feed_Valve_B"
Network 11 Interlocks for agitator
A "EMER_STOP_off"
A "Tank_above_min"
AN "Drain"
= #Enable_Motor
Network 12 Calling FB Motor for agitator
A "Agitator_start"
A #Enable_Motor
= #Start_Fulfilled
A(
O "Agitator_stop"
ON #Enable_Motor
)
= #Stop_Fulfilled
CALL "Motor_block", "DB_Agitator"
Start :=#Start_Fulfilled
Stop :=#Stop_Fulfilled
Response :="Agitator_running"
Reset_Maint :="Reset_maint"
Timer_No :=T16
Reponse_Time:=S5T#10S
Fault :="Agitator_fault"
Start_Dsp :="Agitator_on"
Stop_Dsp :="Agitator_off"
Maint :="Agitator_maint"
Motor :="Agitator"
Network 13 Interlocks for drain valve
A "EMER_STOP_off"
A "Tank_not_empty"
AN "Agitator"
= "Enable_Valve
Network 14 Drain valve control
A "Drain_open"
A #Enable_Valve
= #Open_Drain
A(
O "Drain_closed"
ON #Enable_Valve
)
= #Close_Drain
CALL "Valve_block"
Open :=#Open_Drain
Close :=#Close_Drain
Dsp_Open :="Drain_open_disp"
Dsp_Closed :="Drain_closed_disp"
Valve :="Drain"
Network 15 Tank level display
AN "Tank_below_max"
= "Tank_max_disp"
AN "Tank_above_min"
= "Tank_min_disp"
AN "Tank_not_empty"
= "Tank_empty_disp"
Creating the FB for the Motor
What is Required of the FB?
The FB for the motor contains the following logical functions:
• There is a start and a stop input.
• A series of interlocks allow the operation of the devices (pumps and agitator motor). The status of the interlocks is saved in the temporary local data (L stack) of OB1 ("Motor_enable," "Valve_enable") and is logically combined with the start and stop inputs when the FB for the motor is processed.
• Feedback from the devices must appear within a certain time. Otherwise, it is assumed that an error or fault has occurred. The function then stops the motor.
• The point in time and the duration of the response or error/fault cycle must be specified.
• If the start button is pressed and the motor enabled, the device switches itself on and runs until the stop button is pressed.
• When the device is switched on, a timer starts to run. If the response signal from the device is not received before the timer has expired, the device stops.
Specifying the Inputs and Outputs
The following figure shows the inputs and outputs of the general FB for the motor.
Defining the Parameters for the FB
If you use a multiple instances FB for the motor (for controlling both pumps and the motor) you must define general parameter names for the inputs and outputs.
The FB for the motor in the sampling process requires the following:
• It must have signals from the operator station to stop and start the motor and pumps.
• It requires a response signal from the motor and pumps to indicate that the motor is running.
• It must calculate the time between sending the signal to activate the motor and receiving the response signal. If no response signal is received in this time, the motor must be switched off.
• It must turn the lamps on the operator station on and off.
• It supplies a signal to activate the motor.
These requirements can be specified as inputs and outputs to the FB. The following table shows the parameters of the FB for the motor in our sample process.
Declaring the Variables of the FB for the Motor
You must declare the input, output, and in/out parameters of the FB for the motor.
With FBs, the input, output, in/out, and static variables are saved in the instance DB specified in the call statement. The temporary variables are stored in the L stack.
Programming the FB for the Motor
In STEP 7, every block that is called by a different block must be created before the block containing its call. In the sample program, you must, therefore, create the FB for the motor before OB1.
The code section of FB1 appears as follows in the STL programming language:
Network 1 Start/stop and latching
A(
O #Start
O #Motor
)
AN #Stop
= #Motor
Network 2 Startup monitoring
A #Motor
L #Response_Time
SD #Timer_No
AN #Motor
R #Timer_No
L #Timer_No
T #Time_bin
LC #Timer_No
T #Time_BCD
A #Timer_No
AN #Response
S #Fault
R #Motor
Network 3 Start lamp and fault reset
A #Response
= #Start_Dsp
R #Fault
Network 4 Stop lamp
AN #Response
= #Stop_Dsp
Network 5 Counting the starts
A #Motor
FP #Start_Edge
JCN lab1
L #Starts
+ 1
T #Starts
lab1: NOP 0
Network 6 Maintenance lamp
L #Starts
L 50
>=I
= #Maint
Network 7 Reset counter for number of starts
A #Reset_Maint
A #Maint
JCN END
L 0
T #Starts
END: NOP 0
Creating the Instance Data Blocks
Create three data blocks and open them one after another. In the "New Data Block" dialog box select the option "Data block referencing a function block." In the "Reference" list box select "FB1." The data blocks are then specified as instance data blocks with a fixed assignment to FB1.
Creating the FC for the Valves
What is Required of the FC?
The function of the inlet and feed valves and for the drain valve contains the following logical functions:
There is an input for opening and an input for closing the valves.
Interlocks allow the valves to be opened. The state of the interlocks is saved in the temporary local data (L stack) of OB1 ("Valve_enable") and is logically combined with the inputs for opening and closing when the FC for the valves is processed.
The following table shows the parameters that must be transferred to the FC.
Specifying the Inputs and Outputs
The following figure shows the inputs and outputs of the general FC for the valves. The devices that call the FB for the motor transfer input parameters. The FC for the valves returns output parameters.
Declaring the Variables of the FC for the Valves
Just as with the FB for the motor, you must also declare the input, output, and in/out parameters for the FC for the valves (see following variable declaration table).
With FCs, the temporary variables are saved in the L stack. The input, output, and in/out variables are saved as pointers to the logic block that called the FC. Additional memory space in the L stack (after the temporary variables) is used for these variables.
Programming the FC for the Valves
The FC1 function for the valves must be created before OB1 since the called blocks must be created before the calling blocks.
The code section of FC1 appears as shown below in the STL programming language:
Network 1 Open/close and latching
A(
O #Open
O #Valve
)
AN #Close
= #Valve
Network 2 Display "valve open"
A #Valve
= #Dsp_Open
Network 3 Display "valve closed"
AN #Valve
= #Dsp_Closed
@leslierevalves what you are writing is a little bit technical for people to understand, am suggestion adding some video so as to make your audience have a brief knowledge of what you are saying.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
thanks for the advice sir .. it'll be easier to understand if anyone has the software for this .. Just so hard to find the availability.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit