Professional Documents
Culture Documents
Schneider Electric
The purpose of this tutorial is to show you how easy it is to use Unity Pro by means of a practical application controlled by the Modicon M340 programmable logic controller (PLC).
The chosen application is a conveyor belt that transports boxes to place them in batches of 10 on a pallet.
Schneider Electric
Goals
Starting from an application specification of requirements, we are going to show you the project development principles using Unity Pro
4. To find out more: this last part of the tutorial shows how easy it
is to integrate Modicon M340 PLC, programmed with Unity Pro, in an automation architecture: controlling an ATV31 variable speed drive, operator dialog with a Magelis XBT GT terminal.
The project will be debugged on the PLC simulator and then configured to run on the real PLC. Recorded demonstrations of the operating modes will also be proposed.
Schneider Electric
The installation we want to control is a conveyor belt that is used to transport boxes which are placed in batches of 10 on a pallet and then dispatched. An expression of requirements will be proposed for each function, as well as a development methodology.
The Palletizer function which is used to count the boxes and process a new pallet.
The Management function which makes it possible to stop the conveyor belt after a certain lapse of time, if there are no boxes left on the conveyor.
Schneider Electric
Unity Pro allows you to program the following PLCs: Modicon M340, Premium, Atrium, Quantum . The Project Browser visualizes the organization of the project and gives the access to the editors. The windows are repositionable on the screen and can be posted according to several modes (full page, reduced, floating)
Definition of the hardware configuration Menu bars Tool bar Editing window Logical axes configuration Logical Networks configuration Data declaration
Schneider Electric
The input requirements: A RUN input to start the conveyor A STOP input to stop the conveyor An URGENCY emergency shutdown input
The output requirements: A MOTOR command output A RUNNING indicator light output
Remark: In this first phase we are going to define the input/output information required, without assigning the real inputs/outputs for the moment; with the project being tested on the Unity Pro simulator. The inputs/outputs will be assigned in phase 3
Use the mock-up buttons to understand the expression of requirements
Schneider Electric
Taking charge of the application Expression of requirements Analysis Running Unity Pro
Project debugging Transfer of the project to the simulator Transfer to Run Dynamic visualization of the program and setting of the variables
Program creation
Schneider Electric
Conveyor Command
Program structure: The conveyor starts up when the user presses the RUN button, provided there is no emergency stop. The conveyor stops when the user presses the STOP button or when there is an emergency stop. The program will be developed in Ladder Diagram language (LD). RUN MOTOR URGENCY STOP MOTOR
RUNNING
Schneider Electric
Using the Unity Pro software we are now going to: Create a new project called "Machine" Define the PLC's family and reference
Select the File/New menu.
Select the PLC: BMX P34 2030 and validate by clicking OK. The browser then presents an application structure.
Schneider Electric 9
Machine
Right click on Station and select the Properties menu, so you can give the name and type in the comments for the project.
Projet_Machine
Schneider Electric
10
Demonstrations of the various procedures are proposed in this tutorial. Run the demonstrations, then carry out the procedure presented with Unity Pro yourself.
Demonstration
Click on the icon shown opposite to run the demonstration on application creation
END will be displayed at the end of the demonstration, and the film winds back to the beginning. Click on the Pause button if you want to freeze on the last image. Close the demonstration before passing in the following page .
Schneider Electric
11
The data can be declared: - either using the data editor, - or gradually, as you key in the program.
We are going to declare the input data for the Conveyor program in the data editor. The output data will be declared gradually as you create the program.
Inputs Name RUN STOP URGENCY Type EBOOL EBOOL EBOOL Comment Start conveyor Stop conveyor Emergency stop
Outputs Name MOTOR RUNNING Type EBOOL EBOOL Comment Conveyor Motor command Motor Run/Stop indicator light
Remark: we will type-define the I/O variables in EBOOL so that we can then associate them with the PLC's module channels.
Schneider Electric
12
On the Unity Pro workshop, you can use variables simply by declaring the name and type but without having to declare the address: these variables are non-localized, it is the system that assigns these addresses internally.
Double click on Elementary variables to access the data editor.
2
Indicate : the variable's name the type of variable : EBOOL the comment relative to the variable.
Remark: the other items of data will be declared gradually as you create the LD program
Schneider Electric
13
A Unity Pro project may be comprised of several tasks (master task created by default and which represents the main task, event-related tasks, etc.). The tasks are made up of sections and subroutines. The order of the sections determines the program polling order.
Type in the Name of the section and select LD language then click on OK to validate.
Schneider Electric
14
Building the network of contacts using the variables that have already been declared
1
Select the type of object. Click to enter the contact
3 2
5
Select the object on the list by doubleclicking (Inside structure box not checked)
Remark: the data input screen is divided up into cells receiving the various objects. You can display the object's meaning by hovering over it with the mouse.
Schneider Electric
15
Creating the network of contacts with declaration of the variables gradually as you progress
Enter the object name and click on OK to validate Select the type of object and validate.
4
Remark: the type of object proposed is always coherent with the selected object.
Schneider Electric
16
Programming the conveyor in LD language Analysis and first build of the project (1/3)
Expression of requirements Analysis Project creation Data declaration Programming in LD Code generation Debugging Customization
Once you have finished keying in your program, we are going to Analyze the project (report the errors and warnings in the project) and then Rebuild All the project (essential the first time).
When generating code, Unity Pro takes into account whether the target is the PLC or a simulator.
Remark The PLC simulator allows you to simulate a project in its entirety with all the associated user tasks. However, the dynamics of the simulator's execution behavior cannot be compared with that of a real PLC.
Schneider Electric
17
Programming the conveyor in LD language Analysis and first build of the project (2/3)
Expression of requirements Analysis Project creation Data declaration Programming in LD Code generation Debugging Customization
Project analysis. Reporting of the errors and warnings with navigation towards the cause of origin
A warning indicates an element that might raise a problem, but which does not prevent transfer to the simulator or PLC. An error prevents any transfer
3
Double-click on the element displayed in blue or in red, Unity Pro automatically positions itself on the element in question.
Schneider Electric
18
Programming the conveyor in LD language Analysis and first build of the project (3/3)
Expression of requirements Analysis Project creation Data declaration Programming in LD Code generation Debugging Customization
The first build requires a complete rebuilding of the project. Subsequently, you only have to rebuild the changes.
1
2
Select the program's execution target on the PLC / Simulation Mode menu.
Remark: the warnings are due to the fact that the CANopen bus has not been configured
Schneider Electric
19
Once the analysis is correct, we are going to debug the application using the PLC simulator by connecting up to it.
Select the PLC / Connect menu. The bar at the bottom displays the simulator's status.
3 ?
The bar indicates that the project opened in Unity Pro and the one in the simulator are not the same. Remark: The ? On the task bar indicates that the simulator has been run without any valid project.
Schneider Electric
20
Once the connection has been made and we can transfer the project to the simulator, we can run the project.
Click on Transfer.
2
Select the PLC / Transfer Project to PLC menu.
3
The bar indicates that the programs are identical but the PLC is on STOP.
Schneider Electric
21
Once the connection has been made, the project has been transferred on the simulator.
4
Click on OK to switch the PLC to RUN mode.
Schneider Electric
22
We will now be able to view the program in dynamic mode and modify the variables values to simulate conveyor operation.
The Conveyor section appears in dynamic mode. The on-state contacts are displayed in reverse video (on blue background). Or in green color if link animation is selected during project settings
Schneider Electric
23
Right-click then select the Modify value menu and set the value to 1.
4 3
Set the RUN command to 0 (by repeating steps 1 and 2) The motor has started and the running indicator light is on.
Schneider Electric
24
Initializing an animation table to view the status of the conveyor section's variables.
1
Select box 2. Select box 3 by multiple selection (Shift).
Schneider Electric
25
1
Select the Modification button. Select the STOP variable. Click on the set to 1 icon.
3
Save the project. End of phase 1: Programming in LD
Schneider Electric
26
Programming the palletizer in ST language Expression of requirements for the palletizer (1/2)
Expression of requirements Analysis Data declaration Programming in ST Debugging Operator screens Customization
We are now going to make an extension to the project by adding the palletizer to the previous installation. The conveyor brings the boxes which are then stacked 10 by 10 on a pallet
The input requirements: One input for the optical sensor used to count the boxes (Optical_sensor). One New_palett input to remove the pallet, reset the counter (Number) to 0 and call up a new pallet.
The output requirements One output for the Palett_full indicator light One Blocker output to control the blocker that stops the boxes from arriving.
Schneider Electric
27
Programming the palletizer in ST language Expression of requirements for the palletizer (2/2)
Expression of requirements Analysis Data declaration Programming in ST Debugging Operator screens Customization
operator screens
Expression of requirements
Analysis
Schneider Electric
28
Program structure and visualization of the process in Unity Pro with an operator screen.
10
operator screen
Remark: In order to simulate the supply of boxes, every second for example, we will use the %S6 system bit
Schneider Electric
29
We are now going to add new variables to the existing list of variables. Disconnect the simulator (select the PLC/disconnect menu or the disconnection icon) to return to local mode.
Double-click on Elementary Variables to access the data editor.
The screen appears with the variables that have already been declared.
1
Symbolize all of the following data items (no spaces).
Help
Schneider Electric
30
2 1
Key in the Section name (Palletizer) and select the ST language to be used. Click on OK to validate.
Schneider Electric
31
Creating the program in Structured Text: simulation logic for the optical sensor using the variables that have already been declared
1 2 3
Key in the comment between (* and *) Right-click to call up the Data selection tool. Click on to display the list of variables already declared.
5
The variable has been entered. Double-click on the OPTICAL_SENSOR variable.
Schneider Electric
32
Key in the complete program shown below. The number of boxes is checked by means of the "If then else" control structure A template is proposed.
2
Click on the icon associated with IF An input template is displayed
1
Click on the place where you want to insert the control structure
IF THEN
ELSIF
ELSE END_IF;
THEN
Help
Schneider Electric
33
Analyzing, generating and transferring the project to the simulator for debugging.
2 1
Select the Build changes menu to check the modifications and build the code. In case of default make the corrections before doing a partial build of the code.
Switch to Connection mode and Transfer the project to the simulator in the same way as in phase 1. Switch to RUN mode
Remark: the Build Changes / Rebuild All Project command starts with the analysis, if this has not been done beforehand.
Schneider Electric
34
Colors are used to display the status of the variables in dynamic viewing. The inspection windows make it possible to complete the view in the editor.
Color of the variables according to their status: Boolean type: Green if the variable is TRUE, Red if the variable is FALSE Yellow background for the other types.
Number 6
The inspection windows allow you to view the status of the variables. To do this put the cursor on the variable then select the New inspect. The inspection windows remain on display even if you scroll.
If you want to view the value of a numerical variable in a tooltip you just have to point at the variable with the mouse.
Schneider Electric
35
Initializing an animation table to view the status of the variables in the Palletizer section. Modification of the variable to check the operation of the machine.
1
Select the program for the Palletizer section. Ctrl+A to select all the program
Right-click and select Initialize Animation Table menu or Initialize New Animation table menu .
Schneider Electric
36
Unity Pro proposes operator screens that are designed to facilitate operation of an automated process. These screens can be built in local or connected mode. We are going to create a screen associated with the machine in connected mode.
2
Select the New screen menu in the Operator screens browser.
Schneider Electric
37
Creating the content of the Conveyor screen. The input screen proposes a set of graphic objects with which animation variables can be associated. The input principle is as follows:
1
Select the Object type.
Rectangle
Command button
2 4 3
Draw the object using the mouse. Double click to access the object's properties.
Drawing tab: Modification of the object's color, line, pattern Animation type tab: Choice of the type of animation and display condition Animation tab: Choice of animation variable and display condition
Schneider Electric
38
Creating the content of the Conveyor screen: objects taken from the library. Unity proposes a library of predefined objects: actuators, displays, PLCs, machines. The input principle is as follows:
Select the Tools / Operator screen libraries menu. Select the object to be inserted and copy it using the contextsensitive menu (rightclick)
1
Tools
Moteur
4 2
Double click on the type of object to be inserted
Schneider Electric
39
Your now going to create the content of the conveyor screen, the texts in yellow indicate the variables to be associated with the objects (by the animation tab or the control tab for the object properties.
To enable write variables and perform the commands when the screen is displayed: press the F7 key or click on the corresponding icon
Control NEW_PALETT
Remark: the command buttons are active after pressing the F7 key, and you can carry out process control
Save the project. End of phase 2: Programming in ST
Schneider Electric
40
Extending the application in connected mode Expression of requirements for phase 3 (1/2)
Expression of requirements On-line modification Debugging Configuration I/O data declaration Customization
Extending the machine's functions by modifying the project on line. Our conveyor application stops if there are no boxes present for 10 seconds. There is a conveyor control command installed at the other end of the conveyor.
The input requirements: The conveyor can be stopped or started from the other end of the conveyor belt (RUN1 and STOP1 inputs) A No_box_Input input makes it possible to simulate the absence of boxes at the conveyor input.
The internal variable requirements: In order to save power, the addition of a timer device will stop the motor automatically when there are no boxes for more than 10 seconds. The end of timeout variable (Motor_Timer) will stop the motor. The (Timer) variable contains the timeout's current time.
Schneider Electric
41
Extending the application in connected mode Expression of requirements for phase 3 (2/2)
Expression of requirements On-line modification Debugging Configuration I/O data declaration Customization
Schneider Electric
42
Extending the application in connected mode On-line modification of the Conveyor section
Expression of requirements On-line modification Debugging Configuration I/O data declaration Customization
Schneider Electric
43
Extending the application in connected mode On-line modification of the Conveyor section
Expression of requirements On-line modification Debugging Configuration I/O data declaration Customization
2 1
The on-state contacts are displayed in reverse video (on blue background) or in green color.
Schneider Electric
44
Extending the application in connected mode On-line modification of the Conveyor section
Expression of requirements On-line modification Debugging Configuration I/O data declaration Customization
Inserting the RUN1 and STOP1 contacts: It will be necessary to move coils in order to insert a contact in the network.
1
Confirm the modification by clicking on Yes.
Select the 2 coils and the vertical bar with Shift/Right-click. Hold down the Right-click and move the selection.
Schneider Electric
45
Extending the application in connected mode On-line modification of the Conveyor section
Expression of r equirements On-line modification Debugging Configuration I/O data declaration Customization
2 1
Enter the object name and the type of object then validate.
Schneider Electric
46
Extending the application in connected mode On-line modification of the Conveyor section
Expression of requirements On-line modification Debugging Configuration I/O data declaration Customization
Taking the modifications into account: analysis of the modifications and partial building of the code
2
Select the Build changes menu to check that there are no errors in the project, and perform partial rebuilding of the code.
Remarks: Debugging is carried out in the same way as when making the conveyor section, via an animation table.
The modified project becomes active in the PLC (the modification was made with the PLC in RUN mode).
Schneider Electric
47
Extending the application in connected mode On-line modification of the Conveyor section
Expression of requirements On-line modification Debugging Configuration I/O data declaration Customization
2
Right-click then select the FFB Input Assistant. menu
Remark: the Application folder contains the function blocks already used in the project
Schneider Electric
48
Extending the application in connected mode On-line modification of the Conveyor section
Expression of requirements On-line modification Debugging Configuration I/O data declaration Customization
Adding the stop conveyor timeout, filling out the TON function block using the function input assistant
6
5
Select the TON timer
7
Use the Entry field to enter the name of the variables: IN : No_Box_Input
PT : T#10s Q : motor_timer ET : timer Select OK to validate
9 8
Confirm the modification by clicking on Yes.
Schneider Electric
49
Extending the application in connected mode On-line modification of the Conveyor section
Expression of requirements On-line modification Debugging Configuration I/O data declaration Customization
Inserting the function block and filling out by creating new variables as you progress. Inserting the end of timer information in the logic of the motor command. Taking into account the modifications: analysis of the modifications and partial rebuild of the code.
3
Position the cursor at the required place on the screen then click. Move the coils and add the contact Motor-timer
Reminder of the project's list of variables
Create the variables in the data editor. To do this right click on the variable name and select create variable menu
Remark 1 : After having made the modifications, select the Analyze menu to check that there are no errors in the project, and do a partial rebuild of the code. Remark 2 : You must modify the first line of the Palletizer section written in ST language
Schneider Electric
50
2
Set No_Box_Input to 1, the time delay elapses and the motor stops after 10 s.
Schneider Electric
51
Using the real PLC: creation of the physical configuration. We are going to work with a real PLC: disconnect the simulator (select the local icon of the toolbox) to return to local mode.
1
Double-click on slot 1 which is going to receive the inputs/outputs module.
Double-click on PLC bus to access the hardware configuration. The rack is displayed and we are going to configure it.
3 4
Select the 8 inputs/ 8 outputs module DDM16022 in the discrete references and click on OK to validate, the module is inserted in the rack.
Schneider Electric
52
Once the PLC's configuration has been defined, we are going to declare the addresses of the Inputs and Outputs.
1
Double-click on Elementary variables to access the data editor.
Select the BLOCKER variable
3
Assign an address to the variable.
Comment Start conveyor Start conveyor 1 Stop conveyor Stop conveyor Emergency stop New pallet
Comment Conveyor motor command Motor On-Off indicator light Pallet full Box blocker
Remarks Perform the same operation for all the input/output variables: Addressing: I (input), Q (output). rack.slot.channel.
Schneider Electric
53
If you to have a Modicon M340 PLC, you can now test your program. Analyse the modifications and generate the code as in the preceding phases, then transfer the application in the PLC and finally go to RUN mode.
Connect Unity Pro to the PLC and select the download icon then click on Transfer.
Select the program's execution target on the PLC / Standard Mode menu
Note You can go to simulation mode after having configured a real PLC (proceed as in phase 1: To program in LD.
Schneider Electric
54
Unity Pro allows you very simply to configure automation architectures including a Modicon M340 PLC, a variable speed drive and an XBT GT operator terminal
USB link
Controlling an ATV31 variable speed drive on a CANopen bus by a Modicon M340 PLC
Master CANopen
Slave
Schneider Electric
55
In our installation, an ATV31 speed drive is used to control the motor. Communication between the PLC and the ATV is ensured via the CANopen bus
Implementation principle
Declare the equipment on the CANopen bus in Unity Pro. Select the equipment ATV31 Slave Choose the data exchange profile between the Modicon M340 PLC and the ATV31 If necessary, modify the exchange profile (addition or deletion of data exchanged) Pre-symbolize the variables Use the data from the speed drive in the PLC application
Master
CANopen
Schneider Electric
56
Declaring the ATV device on the CANopen bus with the part number
Schneider Electric
57
Each profile contains the list of preset variables exchanged between the PLC and the speed drive.
1 2
Select PDO tab to display the tables send and receive between the PLC and the speed drive
3
Double click to access device configuration. Select the Standard profile for example then validate.
Schneider Electric
58
Possibility of adding variables by drag and drop (High speed example ) Transmitted variables predefined by the profile
Schneider Electric
59
Pre-symbolize the variables. To do this, access to I/O objects tab of speed drive reference.
3
Open the data editor, and visualize the IODDT of Motor-ATV types. All the variables are symbolized.
4
Click on Update grid
Schneider Electric
60
Use the variables exchanged in the PLC application example: modification of a speed setting on command
1
Create the corresponding contact network
4 5
Schneider Electric
61
The data defined in Unity Pro can be reused in Vijeo Designer without having to key them in again.
Implementation principle
You can locate the variables to be displayed on the terminal on addresses (in Unity Pro) but its not mandatory. Validate and save the modifications
Create the project in Vijeo Designer USB link Define the terminal/PLC connection Create the links with the Unity Pro application and select the variables Use the variables on the dialog screen
Schneider Electric
62
You can locate the variables to be displayed on the terminal on addresses (in Unity Pro) but this operation is not mandatory. Validate and save the modifications
1 3
In order to take into account the modification, carry out a build by means of the Build Changes menu and then Save the project
Schneider Electric
63
Name the terminal Select the type and the model for example 7.5 inches
1 2
Schneider Electric
64
Define the PLC/Terminal connection. Use the Modicon M340 PLC's USB port: Modbus TCP/IP
2 1
Schneider Electric
65
Create the links with the Unity Pro application and select the variables: the Vijeo Designer application is associated with the PLC application
1 3 2
Select the Link variables menu by right clicking Select the Unity Pro application (STU file) Select the variables to be added
Schneider Electric
66
Use the variables on the dialog screen: display absence of boxes and box counter on the operator terminal
1 2
Draw the objects using the icons
3 4
Assign a variable to each object by selecting it on the list Rebuild the whole project and transfer it to the terminal
Schneider Electric
67
To modify the inputs when you have assigned addresses, you have to be connected to a simulator or to create new section with a function block that is enabled to write the inputs.
Create these new variables. L stands for Local Modify in the operator screen the variables by their local variables.
3 1
4
Run the project.
2
Create this new FBD section
Schneider Electric
68
Unity allows you to define different working options: - options relative to the utilization of Unity Pro (Tools/Options menu ) - options relative to the project (Tools/Project settings menu )
Schneider Electric
69
Unity Pro allows you to define various workstation options. Here are some examples.
Automatic assignment of a variable to any graphic object Ladder editor parameter setting
Schneider Electric
70
Unity allows you to define various options that will be embedded in the project. They thus preserved on any Unity Pro workstation. Here are three examples
When this box is checked, the coils are automatically placed on the right-hand supply bar.
The upload information consists of the code, variable symbols, comments and animation tables, etc. They are saved when you record the project and they may or may not be included with the PLC memory. This information makes it possible to work with a workstation that does not contain the project.
This allows you to include, or not, the information that ensures link animation in contact language in the generated code.
Schneider Electric
71