lab task 1
DESCRIPTION
ControlTRANSCRIPT
-
Computer Based Automation Systems
Programmable Logic Controller Laboratory
Task 1: Programming
MSc Electrical EngineeringFaculty of EE & IT
Prof. Dr. S. SimonsDipl.-Ing. R. Petit
Page 1 of 17
Computer Based Automation Systems
Programmable Logic
Controller (PLC) Laboratory
Task 1: Programming Task 2: Programming with Blocks Task 3: Control of a beverage vending machine
-
Computer Based Automation Systems
Programmable logic controller Laboratory
Task 1: Programming
MSc Electrical EngineeringFaculty of EE & IT
Prof. Dr. S. SimonsDipl.-Ing. R. Petit
Page 2 of 17
Optional memory card Power supply
Status indicators
Input voltage select switch
Signal modules CPU
Optional battery
On/off switch
Power supply connector
MPI and Profibus connectors
Mode select switch
-
Computer Based Automation Systems
Programmable logic controller Laboratory
Task 1: Programming
MSc Electrical EngineeringFaculty of EE & IT
Prof. Dr. S. SimonsDipl.-Ing. R. Petit
Page 3 of 17
Task 1: Programming
1. Introduction
In the laboratory we work with the PLC SIMATIC S7-300 from the Siemens AG. A common PC is used as the programming unit executing the development system SIMATIC Manager STEP 7 with the included editors. The PC is connected to the PLC by a special V24/TTY-connection. The PLC consists of a central processing unit and five input and output modules. The inputs and outputs of the PLC can be accessed via a connection-panel located directly under the PLC central rack. Figure 1.1 shows the structure of the training system. It consist in the upper part from left to right of a central unit (PLC) S7-315-2 DP, a module with 16 binary inputs (SM321), a module with 16 binary outputs (SM322), two modules with two analog inputs each (SM331) and a module with two analog outputs (SM332). The inputs and outputs are extended to the connection-panel in the lower level of the training system.
On the left side of the connection panel are the power switch and the power supply
connector of the whole system as well as DC voltage outputs. Right of those are the connectors for 16 binary inputs (red female connector), which have
the addresses: Left: I0.0 ... I0.7, Right: I1.0 ... I1.7. Next to the right are the connectors of 16 binary outputs (blue connectors) with the
addresses: Left: Q4.0 ... Q4.7, Right: Q5.0 ... Q5.7. Next are 4 analog inputs labeled E.1 to E.3. The input voltages can be provided by
potentiometer (internal) or via the red connectors (external) depending on the associated switches underneath. The PLC addresses of the analog inputs are
E.0: PIW288, E.1: PIW290, E.2: PIW304, E.3: PIW306
On the control panel to the right are 2 analog outputs labeled A.0 and A.1. The output voltage can be accessed via the blue connectors. The voltage value is additionally shown by the related analog scale. The PLC addresses of the analog outputs are:
A.0: PQW320, A.1: PQW322.
-
Computer Based Automation Systems
Programmable logic controller Laboratory
Task 1: Programming
MSc Electrical EngineeringFaculty of EE & IT
Prof. Dr. S. SimonsDipl.-Ing. R. Petit
Page 4 of 17
Figure 1.1: Laboratory PLC Training System
The program development and user interface software for the automation system is STEP 7 running on the PC. It is started by clicking on the desktop icon SIMATIC Manager.
2. Introduction to SIMATIC Manager
The SIMATIC Manager is the main tool of the Programming Software STEP 7. Programming begins with opening or creating a project and with configuring the hardware of the station thereafter. With the hardware configuration the program gets the necessary information about the PLC system structure. Figure 2.1 shows an already created project with the project name SPS_S7_Ver22". The project consists of several nested container. The containers contain data and programs. The container with the project name contains all other containers starting with the container SIMATIC 300 which is the station name. Figure 2.2 shows the structure of a project.
-
Computer Based Automation Systems
Programmable logic controller Laboratory
Task 1: Programming
MSc Electrical EngineeringFaculty of EE & IT
Prof. Dr. S. SimonsDipl.-Ing. R. Petit
Page 5 of 17
Figure 2.1: Project window in the SIMATIC manager 2.1 Creating a new project
1. Creating a new project: Start the SIMATIC Manager by double clicking on its desktop icon and create a new project with the pull down menu File new. Choose a name for the project.
2. Insert a station: Select the project and insert a station with Insert Station
SIMATIC 300 Station.
3. Configuring a station: Select the container SIMATIC 300(1) in the left part of the window and the SIMATIC Manager displays the Hardware container in the right half of the window. Double-clicking on the Hardware container starts the Hardware Configuration tools, with which you edit the configuration tables. Choose the Rail (Folder Rack-300), the power supply (Folder PS-300), the CPU (the PLC central processing unit; Folder CPU-300) and the required signal modules (Folder SM-300) one after each other from the hardware catalog (Fig. 2.3) and place them on the open table in the appropriate slots by drag and drop. Make sure that the order number of each module you pick given in the hardware catalog corresponds exactly to the order number of the hardware module printed on the front side of the module! Also be sure, that the slot number in the table of the hardware configuration corresponds to the number of the hardware slot labeled on the front side of the module (down left). Slot 3 is reserved for an optional interface module to a further rack. Figure 2.4 shows a special configuration (which is not the configuration of the laboratory system!). The CPU is plugged in slot 2. Store and compile the result of the hardware configuration by selecting Station Save and Compile, then close the hardware configurator and return to the SIMATIC Manager.
-
Computer Based Automation Systems
Programmable logic controller Laboratory
Task 1: Programming
MSc Electrical EngineeringFaculty of EE & IT
Prof. Dr. S. SimonsDipl.-Ing. R. Petit
Page 6 of 17
4. The SIMATIC now creates containers for an S7 Program (Sources and Blocks, see Fig. 2.2). The container Sources contains the sources of SCL and Graph programs. The container Blocks contains the compiled user programs for the PLC including LAD, FBD and STL blocks as well as the compiled blocks of the SCL and Graph sources.
5. Editing user program objects: Select the container Blocks in the container S7
Program. Afterwards you can insert organization blocks OBxx, Functions FCxx, Function Blocks FBxx or Data Blocks DBxx by selecting Insert S7 Block appropriate Block. The empty OB1 is automatically created.
Contains a list of variables which shall be
monitored and controlled Figure 2.2: Object hierarchy in a STEP 7 project
-
Computer Based Automation Systems
Programmable logic controller Laboratory
Task 1: Programming
MSc Electrical EngineeringFaculty of EE & IT
Prof. Dr. S. SimonsDipl.-Ing. R. Petit
Page 7 of 17
Figure 2.3: Hardware Catalog
This example is not the hardware configuration of the training system in the laboratory!
Figure 2.4: Example for a Hardware Configuration
-
Computer Based Automation Systems
Programmable logic controller Laboratory
Task 1: Programming
MSc Electrical EngineeringFaculty of EE & IT
Prof. Dr. S. SimonsDipl.-Ing. R. Petit
2.2 Editing a program
This part shows the development of a simple program in the form of a Statement List (STL) and its realization and testing on the PLC. The program shall realize the logic plan shown in Figure 2.5.
I 0.0
I 0.1
I 0.3 Q 4.0
& > 1
Figure 2.5 Logic plan of the first task
For the realization of this program you have to program the organization block OB1. Open the project container in the SIMATIC manager and select the container Blocks. Open the Organization Block OB1 by double clicking on the icon in the right part of the window. The program can then be edited in the LAD/FBD/STL editor. The finished STL program with one network has the following form:
Choosing View from the menu you can automatically view the program in Ladder diagram (LAD) or Function block diagram (FBD). Save your programmed organization block OB1 (File Save). Having saved it, the OB1 is stored on the PC hard-disk. The finished program shall now be transferred into and tested on the PLC.
Page 8 of 17
-
Computer Based Automation Systems
Programmable logic controller Laboratory
Task 1: Programming
MSc Electrical EngineeringFaculty of EE & IT
Prof. Dr. S. SimonsDipl.-Ing. R. Petit
Page 9 of 17
2.3 Deleting programs on the PLC
Before downloading the newly developed programs into the PLC you should delete all old programs in the PLC. Do this by choosing the item PLC Clear/Reset from the menu. Resetting is only possible in the operation modes STOP or RUN-P of the CPU (Use operation mode switch).
2.4 Transferring (downloading) a program from the programming unit (PC) into the PLC
The program OB1 shall now be transferred (downloaded) into the PLC. Open the OB1 or select it in the project window of the SIMATIC Manager. Choose PLC Download from the menu or click on the Icon Download below the menu bar, see Figure 2.6. After the download the programs can be run (tested) on the PLC.
Choose Download or click on download icon Monitor (on/off)
Figure 2.6: Menu bar of the LAD/SL/FBD-Editor: Downloading and monitoring a user program
2.5 Program Test
To run the downloaded program on the PLC switch the operation mode switch to RUN or RUN-P. You can monitor the behavior of the program running on the PLC with the programming unit (PC). Open the organization block OB1 and click on the icon Monitor (on/off) below the menu bar (Figure 2.6). After that you can see on the PC display the status of inputs, outputs, flags and so on. For a deeper introduction into the STEP 7 program development system read the SIEMENS manual S7gsv54_e.pdf.
-
Computer Based Automation Systems
Programmable logic controller Laboratory
Task 1: Programming
MSc Electrical EngineeringFaculty of EE & IT
Prof. Dr. S. SimonsDipl.-Ing. R. Petit
Page 10 of 17
3. Tasks
Document all your programs in the laboratory report by using the menu item File Print to print out each program. Briefly discuss the results of your tests (include a short test report with test cases and their results).
3.1 An example in Ladder diagram (LAD)
Program the logic function of Fig. 2.5 in a ladder diagram (LAD). Before you start delete the old program in the PLC.
3.2 An example in Function block diagram (FBD)
Program the logic function of Fig. 2.5 in a function block diagram (FBD). Before you start delete the old program in the PLC.
3.3 Cooling fluid pump of a machine tool
The cooling pump of a tooling machine can only be turned on, if the machine (spindle) is rotating. It should always be possible to switch off the coolant system. The following schematic diagram shows the hard wired control circuit. Use symbols .e.g. the contact symbols S11S22, S0, K1 and K2 instead of the absolute addresses I0.0I0.4, Q4.0 and Q4.1. The assignment of the symbols to the absolute addresses is defined in a symbol table. You can open the symbol table in the LAD/STL/FBD-Editor by choosing the menu item Options Symbol Table.
-
Computer Based Automation Systems
Programmable logic controller Laboratory
Task 1: Programming
MSc Electrical EngineeringFaculty of EE & IT
Prof. Dr. S. SimonsDipl.-Ing. R. Petit
Page 11 of 17
M3 ~
M3 ~
L1 L2 L3 N
S0 (I 0.0)
S12 (I 0.2)
S11 (I 0.1)
K1 K2
K1 K2
K1
K1 K2
S22 (I 0.4)
S21 (I 0.3)
Spindle motor
Pump motor
(Q 4.0) (Q 4.1)
Fig. 3.1 Schematic of a coolant control system of a tooling machine
Description Symbol
Button spindle motor on (NO) S11 Button spindle motor off (NC) S12 Button pump motor on (NO) S21 Button pump motor off (NC) S22 Button system stop (NC) S0 Relays K1, K2 Contactor spindle motor K1 Contactor pump motor K2
Table 3.1 Description of the symbols of the coolant control system
-
Computer Based Automation Systems
Programmable logic controller Laboratory
Task 1: Programming
MSc Electrical EngineeringFaculty of EE & IT
Prof. Dr. S. SimonsDipl.-Ing. R. Petit
Page 12 of 17
S12 S21 S22
K1 K2
I 0.0 I 01 I 0.2 I 0.3 I 0.4 I 0.5 I 0.6 I 0.7
Q 4.0 Q 4.1 Q 4.3Q 4.2 Q 4.4 Q 4.5 Q 4.6 Q 4.7
S7-300 +
S11 S0
Fig 3.2 PLC connection diagram for the machine tool control
Be careful with the switches S0, S12 and S22 because those are normally closed connectors (NC).
a.) Design the logic diagram (plan), using RS-flipflops wherever possible. b.) Realize the control function with the PLC S7-300. Develop the control program. After testing, print your program out as a functional block diagram (FBD) program.
-
Computer Based Automation Systems
Programmable logic controller Laboratory
Task 1: Programming
MSc Electrical EngineeringFaculty of EE & IT
Prof. Dr. S. SimonsDipl.-Ing. R. Petit
Page 13 of 17
3.4 Rising edge triggered JK-FF Develop a program for a rising edge triggered JK-flipflop. Use one RS-FF (Fig. 3.3).
&
& > 1
S R
C
J
R
K
(I 0.0)
(I 0.2)
(I 0.1)
(I 0.7)
M 1.5
Q
Q
(Q 4.0)
(Q 4.1)
&
Figure 3.3 Structure of a JK-FF Be careful to realize the right sequence of the instructions. The S- and the R-input of the RS-flipflop must be calculated with the old values of the outputs Q and Not-Q. Use symbols for the inputs, outputs and the flags. Test your program. It should realize the following transition table of a JK-flipflops (Table 3.2).
J K Qn+1
0 0 Qn
0 1 0 1 0 1 1 1
n Table 3.2: Transition table of a JK-FF with R=0. For R=1, the FF has the state Q=0.
-
Computer Based Automation Systems
Programmable logic controller Laboratory
Task 1: Programming
MSc Electrical EngineeringFaculty of EE & IT
Prof. Dr. S. SimonsDipl.-Ing. R. Petit
3.5 Circuit with off-delay
The diagram of the circuit in figure 3.4 includes an off-delay-relay (K2).
L1
N
S 0 (I 0.0)
S 1 (I 0.1)
K 1 K 2
K 1 K 2
L (Q 4.0)
K1
Figure 3.4: Hard wired circuit with off-delay-relay Replace the hard wired realization with a PLC. Develop the PLC-program. Choose an off-delay-time of 5 seconds for the test.
S 0 S 1
L
I 0.0 I 0.1 I 0.2 I 0.3 I 0.4 I 0.5 I 0.6 I 0.7
Q 4.0 Q 4.1 Q 4.3Q 4.2 Q 4.4 Q 4.5 Q 4.6 Q 4.7
S7-300 +
Figure 3.5 PLC connection diagram
Page 14 of 17
-
Computer Based Automation Systems
Programmable logic controller Laboratory
Task 1: Programming
MSc Electrical EngineeringFaculty of EE & IT
Prof. Dr. S. SimonsDipl.-Ing. R. Petit
3.6 Oscillator with adjustable frequency and duty cycle
With the timer operations of the PLC is it possible to realize an oscillator. Write a program for an oscillator with an adjustable frequency and an adjustable duty cycle.
Enable
(I 0.0)
I 0.0
Q 4.0
0
1
0
1
t
t
Q
(Q 4.0) Oscillator
t t v1 v2
Figure 3.6: Block structure and timing diagram of the oscillator
Frequency: f = 1
Duty cycle: =1t
Choose for your test: f = 0.2 Hz and = 0.3.
Page 15 of 17
-
Computer Based Automation Systems
Programmable logic controller Laboratory
Task 1: Programming
MSc Electrical EngineeringFaculty of EE & IT
Prof. Dr. S. SimonsDipl.-Ing. R. Petit
Page 16 of 17
3.7 Oscillator with counter
The oscillator of Figure 3.6 shall be completed with a counter, in a way that it is possible to produce a preselected number of pulses with the oscillator.
Oscillator
Counter
Enable Q
(Q 4.0)
Start (I 0.1)
Number of pulses
References: Siemens AG: Automation & Drives Product Support:
SIMATIC S7 Manuals: http://support.automation.siemens.com Product Support Automation Systems SIMATIC Industrial Automation Systems PLC SIMATIC S7:
S7gsv54_e.pdf S7gsv54_e.pdf S7-300_IHB_Hardware_And_Installation_e.pdf S7-300_IHB_Installation_e.pdf S7-300_RHB ModuleData_e.pdf Opli312cbis314c S7-300 Instruction List_e.pdf AWL_e.pdf FUP_e.pdf KOP_e.pdf SCL_e.pdf Graph7_e.pdf GS_SCL_e.pdf GSGraph_e.pdf SystemProg.pdf
Siemens AG: Siemens Automation Cooperates with Education SCE
Training Material: http://www.automation.siemens.com/fea/html_76/down_module.htm
-
Computer Based Automation Systems
Programmable logic controller Laboratory
Task 1: Programming
MSc Electrical EngineeringFaculty of EE & IT
Prof. Dr. S. SimonsDipl.-Ing. R. Petit
Page 17 of 17
Wellenreuther, G.; Zastrow, D.: Automatisieren mit SPS. Revised edition August 2002,
Vieweg-Verlag, Braunschweig
M. Habermann; T. Wei: STEP7-Crashkurs Extended. 5. Auflage 2006, VDE-Verlag, Berlin
Berger, Hans: Automating with SINEMATIC; 3., revised edition - September 2006 Wiley-VCH, Weinheim / Publicis Corporate Publishing, Erlangen
Berger, Hans: Automating with STEP 7 in LAD and FBD; 3., revised edition- November 2005 Wiley-VCH, Weinheim / Publicis Corporate Publishing, Erlangen
Berger, Hans: Automating with STEP 7 in STL and SCL; 3., revised edition - Februar 2005; Wiley-VCH, Weinheim / Publicis Corporate Publishing, Erlangen