Sunteți pe pagina 1din 71

Tutorial

Unity Pro & Modicon M340


Developing your first project with Unity Pro

Schneider Electric

Your first Unity Pro project


Programming in LD Programming in ST On-line modification To find out more

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

Your first Unity Pro project


Programming in LD Programming in ST On-line modification To find out more

Starting from an application specification of requirements, we are going to show you the project development principles using Unity Pro

The tutorial is divided into four parts:

1. Programming in LD (Ladder Diagram language): this part


presents the method to be used to create a project, the programming procedures in LD, as well as project debugging.

2. Programming in ST (Structured Text language): this part


presents the programming and debugging procedures in ST, as well as how to use the operator screens to view and control the process.

3. On-line modification: presents the procedures required for the


on-line modification of the program.

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

Your first Unity Pro project Methodological approach


Programming in LD Programming in ST On-line modification To find out more

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 chosen application breaks down into three functions:

The Conveyor function which is used to control the conveyor belt.

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

Your first Unity Pro project Introduction to Unity Pro


Programming in LD Programming in ST On-line modification To find out more

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

Creation of animation tables for the application's variables

Programs structuration and creation

Creation of the application's graphic operator screens

Information window Status line

Schneider Electric

Programming the conveyor in LD language Expression of requirements for the conveyor


Expression of requirements Analysis Project creation Data declaration Programming in LD Code generation Debugging Customization

The installation includes a conveyor belt and a control panel

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

Your first Unity Pro project Development methodology


Expression of requirements Analysis Project creation Data declaration Programming in LD Code generation Debugging Customization

The development chronology that we propose is as follows:

Taking charge of the application Expression of requirements Analysis Running Unity Pro

Project development Project creation Data declaration

Project debugging Transfer of the project to the simulator Transfer to Run Dynamic visualization of the program and setting of the variables

Program creation

Analysis of the program and code generation

Schneider Electric

Programming the conveyor in LD language Analysis of the expression of requirements


Expression of requirements Analysis Project creation Data declaration Programming in LD Code generation Debugging Customization

This phase consists of determining the conveyor belt's command logic

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

Programming the conveyor in LD language Project creation (1/3)


Expression of requirements Analysis Project creation Data declaration Programming in LD Code generation Debugging Customization

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.

The project structure is created.

Select the PLC: BMX P34 2030 and validate by clicking OK. The browser then presents an application structure.
Schneider Electric 9

Programming the conveyor in LD language Project creation (2/3)


Expression of requirements Analysis Project creation Data declaration Programming in LD Code generation Debugging Customization

Naming and saving the project:

Machine

Save the project using the File/Save menu (*.STU file).

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

Programming the conveyor in LD language Project creation (3/3)


Expression of requirements Analysis Project creation Data declaration Programming in LD Code generation Debugging Customization

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

Meaning of the commands available during the demonstration

Read Pause Rewind

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 .

Now, it's your turn


Run the Unity Pro software and carry out the project creation operations.

Schneider Electric

11

Programming the conveyor in LD language Data declaration (1/2)


Expression of requirements Analysis Project creation Data declaration Programming in LD Code generation Debugging Customization

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

Programming the conveyor in LD language Data declaration (2/2)


Expression of requirements Analysis Project creation Data declaration Programming in LD Code generation Debugging Customization

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.

Declare all the following variables

Remark: the other items of data will be declared gradually as you create the LD program

Schneider Electric

13

Programming the conveyor in LD language Creating the conveyor section (1/3)


Expression of requirements Analysis Project creation Data declaration Programming in LD Code generation Debugging Customization

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.

Right-click on Section and select the New section menu.

Type in the Name of the section and select LD language then click on OK to validate.

Schneider Electric

14

Programming the conveyor in LD language Creating the conveyor section (2/3)


Expression of requirements Analysis Project creation Data declaration Programming in LD Code generation Debugging Customization

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

Place the object on the desired cell.

5
Select the object on the list by doubleclicking (Inside structure box not checked)

Double click on to show the list of variables already declared

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

Programming the conveyor in LD language Creating the conveyor section (3/3)


Expression of requirements Analysis Project creation Data declaration Programming in LD Code generation Debugging Customization

Creating the network of contacts with declaration of the variables gradually as you progress

Click to enter the object

Enter the object name and click on OK to validate Select the type of object and validate.

Select the type of object and position it.

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).

Run the program on the simulator


You can run the project on : - the PLC, in which case you must define the configuration. - a PLC simulator, in which case it is not necessary to define the configuration.

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

Run project analysis.

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.

Display the project's analysis result.

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.

Select the Build / Rebuild All Project menu.

Display of all the warnings or errors that have been found

Remark: the warnings are due to the fact that the CANopen bus has not been configured

Schneider Electric

19

Programming the conveyor in LD language Debugging the project (1/7)


Expression of requirements Analysis Project creation Data declaration Programming in LD Code generation Debugging Customization

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.

The simulator starts to run

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

Programming the conveyor in LD language Debugging the project (2/7)


Expression of requirements Analysis Project creation Data declaration Programming in LD Code generation Debugging Customization

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

Programming the conveyor in LD language Debugging the project (3/7)


Expression of requirements Analysis Project creation Data declaration Programming in LD Code generation Debugging Customization

Once the connection has been made, the project has been transferred on the simulator.

Select the PLC / Run menu.

4
Click on OK to switch the PLC to RUN mode.

The bar indicates that the PLC is in RUN mode.

Schneider Electric

22

Programming the conveyor in LD language Debugging the project (4/7)


Expression of requirements Analysis Project creation Data declaration Programming in LD Code generation Debugging Customization

We will now be able to view the program in dynamic mode and modify the variables values to simulate conveyor operation.

Double-click on the Conveyor section

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

Programming the conveyor in LD language Debugging the project (5/7)


Expression of requirements Analysis Project creation Data declaration Programming in LD Code generation Debugging Customization

Modifying variables on the Ladder Diagram viewing screen.

Select the RUN variable.

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

Programming the conveyor in LD language Debugging the project (6/7)


Expression of requirements Analysis Project creation Data declaration Programming in LD Code generation Debugging Customization

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).

Right-click then select the Initialize Animation Table menu.

The animation table appears with the selected variables.

Schneider Electric

25

Programming the conveyor in LD language Debugging the project (7/7)


Expression of requirements Analysis Project creation Data declaration Programming in LD Code generation Debugging Customization

Modifying the variables from the animation table.

1
Select the Modification button. Select the STOP variable. Click on the set to 1 icon.

The STOP variable is at 1 and the motor stops.

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.

Use the mockup buttons to understand the expression of requirements

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

The development chronology that we are proposing is as follows:

Taking charge of the application

Project development Data declaration

operator screens

Expression of requirements
Analysis

Creation of the section in ST language Debugging

Control by means of an operator screen

Schneider Electric

28

Programming the palletizer in ST language Analysis of the requirements


Expression of requirements Analysis Data declaration Programming in ST Debugging Operator screens Customization

Program structure and visualization of the process in Unity Pro with an operator screen.

Structure of the Palletization section


If the conveyor is running, the boxes are placed on the conveyor. The boxes are counted. When there are 10 boxes, the pallet is full and the blocker is activated. When requested by the operator, the pallet is removed so that a new one can be processed. The section will be programmed in Structured Text (ST) language. An operator screen is used to command process and view its status.

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

Programming the palletizer in ST language Data declaration


Expression of requirements Analysis Data declaration Programming in ST Debugging Operator screens Customization

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

Programming the palletizer in ST language Creating the palletizer section (1/4)


Expression of requirements Analysis Data declaration Programming in ST Debugging Operator screens Customization

Creating the palletizer section in structured text (ST) language .

2 1

Right-click on Section and select the New Section menu.

Key in the Section name (Palletizer) and select the ST language to be used. Click on OK to validate.

Schneider Electric

31

Programming the palletizer in ST language Creating the palletizer section (2/4)


Expression of requirements Analysis Data declaration Programming in ST Debugging Operator screens Customization

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.

Remark: the variables can also be keyed in directly.

Schneider Electric

32

Programming the palletizer in ST language Creating the palletizer section (3/4)


Expression of requirements Analysis Data declaration Programming in ST Debugging Operator screens Customization

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

Fill in the template

1
Click on the place where you want to insert the control structure
IF THEN

ELSIF
ELSE END_IF;

THEN

Help

Schneider Electric

33

Programming the palletizer in ST language Creating the palletizer section (4/4)


Expression of requirements Analysis Data declaration Programming in ST Debugging Operator screens Customization

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

Programming the palletizer in ST language Debugging the palletizer section (1/2)


Expression of requirements Analysis Data declaration Programming in ST Debugging Operator screens Customization

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

Programming the palletizer in ST language Debugging the palletizer section (2/2)


Expression of requirements Analysis Data declaration Programming in ST Debugging Operator screens Customization

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

Programming the palletizer in ST language Operators screens (1/4)


Expression of requirements Analysis Data declaration Programming in ST Debugging Operator screens Customization

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.

Key in the name of the screen and click OK to validate.

2
Select the New screen menu in the Operator screens browser.

Schneider Electric

37

Programming the palletizer in ST language Operators screens (2/4)


Expression of requirements Analysis Data declaration Programming in ST Debugging Operator screens Customization

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

Align with the top

2 4 3

Draw the object using the mouse. Double click to access the object's properties.

Enter 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

Programming the palletizer in ST language Operators screens (3/4)


Expression of requirements Analysis Data declaration Programming in ST Debugging Operator screens Customization

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

Operator screen libraries

Moteur

4 2
Double click on the type of object to be inserted

Access the screen concerned, paste the object.

Schneider Electric

39

Programming the palletizer in ST language Operators screens (4/4)


Expression of requirements Analysis Data declaration Programming in ST Debugging Operator screens Customization

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.

Animation : int NUMBER Animation bit = 1 Blocker

Animation bit = 1 PALET_FULL

Animation bit = 1 OPTICAL_SENSOR

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

Animation bit = 1 URGENCY

Animation bit = 1 RUNNING

Animation bit = 0 RUNNING

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

Control RUN Control URGENCY Control STOP

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.

Use the mockup buttons to understand the expression of requirements

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

The development chronology that we propose is as follows:

On-line modification of the project

Using a real PLC


Configuration of the PLC's inputs/outputs

Expression of requirements On-line modification of the LD program Debugging

Data assignment to the input/output channels

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

The following modifications should be made on line:

Modification to be made to the program's structure:


1.Creation of the new command for controlling the end of the conveyor: insertion of RUN1 and STOP1 contacts 2. Insertion of the conveyor's stop timeout in the absence of a box for 10 seconds 1
The new input variables Name RUN1 STOP1 No_Box_Input Type EBOOL EBOOL BOOL Comment Start conveyor 1 Stop conveyor1 Simulate absence of boxes Comment End of 10s timeout

The new output variables Name Motor_Timer Type EBOOL

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

Displaying the "conveyor" section in dynamic viewing

The conveyor section is displayed in dynamic mode.

2 1

Double-click on the Conveyor section

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.

The coils have been moved.

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

Inserting additional contacts with declaration of the variables as you progress.

2 1
Enter the object name and the type of object then validate.

Insert the contact and double-click to enter the object name.

Complete the diagram with the RUN1 and STOP1 contacts

Remark: The procedures are identical to those performed in phase 1

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

Selecting a timer for monitoring the arrival of boxes.

2
Right-click then select the FFB Input Assistant. menu

Click on the button to access the DFB library

Select and expand the Global Libraries <Libset>

Select and expand the Base Lib family

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

Select the Timers & Counters family

6
5
Select the TON timer

Enter the name of the instance: Stop_motor.

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

Extending the application in connected mode Debugging


Expression of requirements On-line modification Debugging Configuration I/O data declaration Customization

Verifying execution of the TON timer

Select the No_Box_Input variable.

Right-click and select the Modify value menu

2
Set No_Box_Input to 1, the time delay elapses and the motor stops after 10 s.

Schneider Electric

51

Using the Modicon M340 PLC Configuring the PLC


Expression of requirements On-line modification Debugging Configuration I/O data declaration Customization

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.

The module has been configured.

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

Using the Modicon M340 PLC Inputs/Outputs data declaration (1/2)


Expression of requirements On-line modification Debugging Configuration I/O data declaration Customization

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.

Name RUN RUN1 STOP STOP1 URGENCY New_Palett

Type EBOOL EBOOL EBOOL EBOOL EBOOL EBOOL

Comment Start conveyor Start conveyor 1 Stop conveyor Stop conveyor Emergency stop New pallet

Address %I0.1.0 %I0.1.1 %I0.1.2 %I0.1.3 %I0.1.4 %I0.1.5

Name MOTOR RUNNING Palett_Full Blocker

Type EBOOL EBOOL EBOOL EBOOL

Comment Conveyor motor command Motor On-Off indicator light Pallet full Box blocker

Address %Q0.1.16 %Q0.1.17 %Q0.1.18 %Q0.1.19

Remarks Perform the same operation for all the input/output variables: Addressing: I (input), Q (output). rack.slot.channel.

Schneider Electric

53

Using the Modicon M340 PLC Inputs/Outputs data declaration (2/2)


Expression of requirements On-line modification Debugging Configuration I/O data declaration Customization

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.

Save the project. End of phase 3: On-line modification

Schneider Electric

54

To find out more Integration in an automation architecture


Programming in LD Programming in ST On-line modification To find out more

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

Display of the PLC data on a Magelis XBT GT operator terminal

Schneider Electric

55

To find out more Controlling an ATV 31 with a Modicon M340 (1/6)


Programming in LD Programming in ST On-line modification To find out more

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

To find out more Controlling an ATV 31 with a Modicon M340 (2/6)


Programming in LD Programming in ST On-line modification To find out more

Declaring the ATV device on the CANopen bus with the part number

Click to access Canopen Bus configuration.

Right click and select the New device menu.

Select the device.and define the Canopen address

Schneider Electric

57

To find out more Controlling an ATV 31 with a Modicon M340 (3/6)


Programming in LD Programming in ST On-line modification To find out more

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

To find out more Controlling an ATV 31 with a Modicon M340 (4/6)


Programming in LD Programming in ST On-line modification To find out more

If necessary modify the exchange profile: add or delete data exchanged

Possibility of adding variables by drag and drop (High speed example ) Transmitted variables predefined by the profile

Received variables predefined by the profile

Schneider Electric

59

To find out more Controlling an ATV 31 with a Modicon M340 (5/6)


Programming in LD Programming in ST On-line modification To find out more

Pre-symbolize the variables. To do this, access to I/O objects tab of speed drive reference.

Key in a prefix for the name of the set of variables.


e.g. MOTOR_ATV

then click on Create


MOTOR_ATV

3
Open the data editor, and visualize the IODDT of Motor-ATV types. All the variables are symbolized.

Select the channel (%CH)

4
Click on Update grid

Schneider Electric

60

To find out more Controlling an ATV 31 with a Modicon M340 (6/6)


Programming in LD Programming in ST On-line modification To find out more

Use the variables exchanged in the PLC application example: modification of a speed setting on command

1
Create the corresponding contact network

Double click to access Operate block input.

Click to access the list of variables.

Select the Variable.


COMMAND

4 5

Key in the Operate block

Schneider Electric

61

To find out more Displaying data on the XBT terminal (1/6)


Programming in LD Programming in ST On-line modification To find out more

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

To find out more Displaying data on the XBT terminal (2/6)


Programming in LD Programming in ST On-line modification To find out more

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

Access the variable editor

1 3

Assign an address to the variables which will be used in Vijeo Designer

In order to take into account the modification, carry out a build by means of the Build Changes menu and then Save the project

Remark: It is possible to sort the variables by means of a customization of the columns

Schneider Electric

63

To find out more Displaying data on the XBT terminal (3/6)


Programming in LD Programming in ST On-line modification To find out more

Create the project in Vijeo Designer

Select the File/New project menu and name it CONVEYOR

Name the terminal Select the type and the model for example 7.5 inches

1 2

Schneider Electric

64

To find out more Displaying data on the XBT terminal (4/6)


Programming in LD Programming in ST On-line modification To find out more

Define the PLC/Terminal connection. Use the Modicon M340 PLC's USB port: Modbus TCP/IP

2 1

Select the New driver menu by rightclicking

Select the driver

Configure the device: address of the unit and IEC syntax

Schneider Electric

65

To find out more Displaying data on the XBT terminal (5/6)


Programming in LD Programming in ST On-line modification To find out more

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

To find out more Displaying data on the XBT terminal (6/6)


Programming in LD Programming in ST On-line modification To find out more

Use the variables on the dialog screen: display absence of boxes and box counter on the operator terminal

Access to the panel1

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 find out more Writing the inputs


Programming in LD Programming in ST On-line modification To find out more

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

Your first Unity Pro project Customizing Unity Pro (1/3)


Programming in LD Programming in ST On-line modification To find out more

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 )

Options for using the Unity Pro workstation

Project settings are embedded in the project

Schneider Electric

69

Your first Unity Pro project Customizing Unity Pro (2/3)


Programming in LD Programming in ST On-line modification To find out more

Unity Pro allows you to define various workstation options. Here are some examples.

Automatic incrementation of projet versions. Modification of the various directories.

Library settings for the predefined function blocks

Automatic assignment of a variable to any graphic object Ladder editor parameter setting

Programming mode: The PC is connected, by default, in programming mode.

Monitoring mode: The PC is connected in monitoring mode (reading of variables only).

Schneider Electric

70

Your first Unity Pro project Customizing Unity Pro (3/3)


Programming in LD Programming in ST On-line modification To find out more

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

Coils right-justified (General tab)

When this box is checked, the coils are automatically placed on the right-hand supply bar.

Upload information (General tab)

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.

Link animation (General tab)

This allows you to include, or not, the information that ensures link animation in contact language in the generated code.

Schneider Electric

71

S-ar putea să vă placă și