training 1 - a-lab.ee · pdf file2016 plc-1 1 ac500 system the following electronic modules...

30

Upload: duonglien

Post on 17-Mar-2018

231 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

Part I

Training 1

1

Page 2: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control
Page 3: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

2016 PLC-1

1 AC500 System

The following electronic modules are the basic components of the AC500 system:

• CPUs of di�erent performance classes

• Communication Modules for various bus systems, e.g. PROFIBUS R©, CANopen R©, DeviceNetTM,

PROFINET R©, EtherCAT R©

Central expansion: One CPU supports direct connection of up to seven S500 FBP system I/O

devices.

Decentralized expansion: Using the DC505 FBP interface module (for �eldbus systems PROFIBUS R©DP, CANopen R©, DeviceNetTM, Modbus RTU), up to seven S500 FBP system I/O devices can be

connected (with a maximum of four analog modules).

General structure of PLC provided in the Lab

CPU PM573 (512kB, 2 RS-232/485 interfaces - programming, Modbus/CS31 (COM1), 1 x FBP)

with an integrated Ethernet Communication Module (TCP/IP).

The I/O Modules Digital and analog in di�erent versions. Can be simply plugged onto the terminal

units � for local expansion of the CPU (max. 10 modules).

Communication Modules Communication Module for �eldbus systems - PROFIBUS R©DP, DeviceNetTM

and CANopen R©.

K.Vassiljeva 3 ISS0065 Control Instrumentation

Page 4: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

PLC-1 2016

AC500 Control Builder provides the following functionalities:

• Five standardized programming languages: Function Block Diagram (FBD), Instruction List

(IL), Ladder Diagram (LD), Structured Text (ST), Sequential Function Chart (SFC);

• Free graphical function chart (CFC);

• Debugging functions for the program test: Single step, Single cycle, Breakpoint.

IEC 61131-3 commands can be simulated without a PLC being connected, including the relevant

malfunctions. After the program test, the application can be downloaded to the control system.

2 Introduction to the program environment

2.1 Declaration of the Modules

In order to communicate with PLC via COM2 we need to know the number of com port used in

PC. In Device Manager check the Ports (COM & LTP). Find out what port is used for Proli�c

USB-to-Serial.

Start "ABB Control Builder Plus".

Figure 1: Front panel of the CPU

This is an environment to connect ABB controller with CoDeSys Programming System. Then

program starts you will see recent projects. If you want to start your own project - you should choose

the right con�guration of the controller. Choose AC500 PM573-ETH V2.1 or AC500 PM590-ETH

V2.1, see Fig. 1. Choose the name of your project and location where it will be saved 1.

1If you logged in under your name the better location is the folder with your name in the TUT network.

ISS0065 Control Instrumentation 4 K.Vassiljeva

Page 5: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

2016 PLC-1

NB! Code will not be running on PLC until where is no errors noti�cation, see Fig. 1, (4). Problem

solution is described in Sec. 2.4.

To avoid some error messages

Battery Click on CPU_parameters and open the CPU Parameters Con�guration window: Check

battery�value = OFF.

Fault Con�guration Double click on Interfaces → COM2_Online and set Run on Con�g Fault�

value=YES.

DA501

In the Devices Window declare the right I/O module

• Click with right button on IO_Bus(I/O-Bus) and choose Add Devices.

• In the new window in the tree S500-I/O modules choose DA501.

Double click on the DA501 opens the window DA501 Con�guration. Set the next parameters:

• Input 0, channel con�guration�value="0...10/ V"

• Input 1, channel con�guration�value="0...10/ V"

• Input 2, channel con�guration�value="Pt100(2-wire/ −50 . . . + 70/◦C)"

• Output 0, channel con�guration�value="−10 . . . + 10/V "

• Output 1, channel con�guration�value="−10 . . . + 10/V "

On order to use Global Variable Names as names of module physical outputs, mapping is needed.

Open the DA501 I/O Mapping window.

• As �rst digital inputs (%IX0.0�%IX0.7) are connected to the switches S0-S7, create the same

variable.

• Digital inputs %IX1.0�%IX1.7, name variables according to the rules of the company. For

example: m2_DI_8, where "m2" is the module position on the BUS, "DI"�Digital Input and

"8"�position of the input.

• Analog Inputs %IW1�%IW4.

• Analog Outputs %QW0�%QW1.

• Digital Inputs %IX10.0�%IX10.7.

• Digital Outputs %QX6.0�%QX6.7.

K.Vassiljeva 5 ISS0065 Control Instrumentation

Page 6: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

PLC-1 2016

Figure 2: PC COM ports usage

Now you can start program the PLC. In the Devices tree double click on AC500� CoDeSys

programming environment will run.

NB! Every time you need to open previously saved CoDeSys project you must do it through

ABB Control Builder Plus.

2.2 Communication

To download your programs to the controller you need set the connection.

In menu Online→Communication Parameters....

Add new Connection:

• Choose Serial (RS232);

• Name it: ComN_PC, where N is the number of COM port (see Fig. 2);

• Set the right parameters for communication via COM2 (see Fig. 3).

2.3 First Steps

POU (Program Organization Unit). Functions, function blocks, and programs are POUs which can

be supplemented by actions.

Each POU consists of a declaration part and a body. The body is written in one of the IEC

programming languages which include IL, ST, SFC, FBD, LD or CFC. CoDeSys supports all IEC

standard POUs.

ISS0065 Control Instrumentation 6 K.Vassiljeva

Page 7: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

2016 PLC-1

Figure 3: Communication parameters

In this course we are interested get to know Structured Text (ST). The Structured Text consists

of a series of instructions which, as determined in high level languages.

Attention: Do not delete or rename the POU PLC_PRG (assuming you are not using a Task

Con�guration)! PLC_PRG is generally the main program in a single task program.

Monitoring

In Online mode, all displayable variables are read from the controller and displayed in real time. You

will �nd this display in the declarations and program editor; you can also read out current values

of variables in the watch and receipt manager and in a visualization. If variables from instances of

function blocks are to be monitored, the corresponding instance must �rst be opened.

Simulation

During the simulation the created PLC program is not processed in the PLC, but rather in the

calculator on which CoDeSys is running. All online functions are available. That allows you to test

the logical correctness of your program without PLC hardware.

NB! As PLC does not have installed battery all the information downloaded to the controller

will be lost when it is turned o�.

2.4 Project

The following objects are included in a project: POUs, Data types, Visualizations, Resources.

In order check the errors you need to start connection with a PLC.

1. Go to Online menu,

K.Vassiljeva 7 ISS0065 Control Instrumentation

Page 8: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

PLC-1 2016

2. Select Login

3. or push <ALT>+<F8>.

Select the entry PLC-Browser in the Resources tab-control(bottom left corner). The browser

consists of a command entry line and a result/display window. In a selection box the input line

displays a list of all the commands entered since the start of the project (input history) or all

possible commands here (. . .).

Click on three dots (right top corner) and open "Insert standard command". Select

• diagshow all in order to see all error messages;

• diagreset - to delete them from PLC.

The entered command is sent to the controller with <Enter>. If there is no Online connection,

the command is displayed in the result window in the same way as it is sent to the controller,

otherwise the response from the controller is shown there. If a new command is sent to the controller,

the content of the result window is deleted.

NB! Without that steps you cannot run your code on PLC.

3 Binary variables

Value of the binary variable can be presented by: 1/0, ON/OFF, True/False.

Exercise 1 Working with (physical) Global Variables

In order to check what functions, blocks, variables and operations are available, you need to call

Input Assistant. Press F2 button.

In Global Variables

• select any input address (S0-S7);

• select any digital output variable.

your_output := your_input;

Download program to the controller

• in Online menu select Login or <ALT>+<F8>;

• to Start program it should be in running mode: in Online menu select Run or F5.

If Program is not running (you cannot switch on Running mode), please see Section 2.4 and reset

error messages. Check the results using physical inputs of the PLC.

ISS0065 Control Instrumentation 8 K.Vassiljeva

Page 9: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

2016 PLC-1

Exercise 2 Combinatory logic

Realize two logical functions F = A ∨ B&C and W = (A ∨ B)&C there logical operations are

denoted as & -"AND" and ∨ - "OR".

Select any digital inputs (S0-S7) as A, B, C, and observable digital outputs: F, W

Exercise 3 Majority rule

If you would like to comment your previous code, write it in (* commented code *).

Combine circuit of 3 inputs and one output: output is "ON" if at least two inputs are "ON".

Exercise 4 Motor control

START and STOP input signals turn on and o� signals of the motor.

Select the controller inputs and outputs, tag them:

START, STOP and Motor.

Write a program. Run program on PLC.

K.Vassiljeva 9 ISS0065 Control Instrumentation

Page 10: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

PLC-1 2016

ISS0065 Control Instrumentation 10 K.Vassiljeva

Page 11: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

Part II

Training 2

11

Page 12: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control
Page 13: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

2016 PLC-1

4 Timers

Types of the Timers

• TP - Timer is a trigger;

• TON - Timer On Delay;

• TOF - Turn-O� Delay.

All timers have the following parameters:

• IN - input which starts the timer (BOOL type);

• PT(Preset Time) - (TIME type) variable;

• Q - state of the timer (BOOL type);

• ET - countering time (TIME type).

See correct assignment of TIME constants in help �les of CoDeSys.

In order to use timer you need to declare it as one of the types described above.

4.1 TP

TP(IN, PT, Q, ET) is a trigger.

Write in the declaration part of the the POU

VAR

tmrTP1:TP;

END_VAR

In the code part of the programme press F2 and using the Input Assistant �nd your timer in

Local Variables. Select it.

As soon as IN becomes TRUE, the time will begin to be counted in milliseconds in ET until its

value is equal to PT. It will then remain constant.

Q is TRUE as from IN has got TRUE and ET is less than or equal to PT. Otherwise it is

FALSE.

Q returns a signal for the time period given in PT.

First, declare new variables in declaration part

trigUp: BOOL;

tTP_Val: TIME;

In the coding part set the next parameters

K.Vassiljeva 13 ISS0065 Control Instrumentation

Page 14: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

PLC-1 2016

IN

Q

ET

t0 t1

t0

t0

t0+PT

t1

t2 t3

t2+PT

t2

t2

t4

t4

t4

t5

t4+PT

t5

0

1

Figure 4: Graphic Display of the TP Time Sequence

tmrTP1(IN:=your_input, PT:=T#5s, Q=>trigUp, ET=>tTP_Val);

your_output :=trigUP;

Download program to the PLC.

4.2 TON

TON(IN, PT, Q, ET) implements a turn-on delay.

Write in the declaration part of the the POU

VAR

tmrTON1:TON;

END_VAR

IN

Q

ET

t0 t1

t1

t0

t0+PT

t1

t2 t3

t2 t3

t4

t4

t5

t4+PT

t5

0

1

t5

Figure 5: Graphic Display of the TON Time Sequence

As soon as IN becomes TRUE, the time will begin to be counted in milliseconds in ET until its

value is equal to PT. It will then remain constant.

Q is TRUE when IN is TRUE and ET is equal to PT. Otherwise it is FALSE.

ISS0065 Control Instrumentation 14 K.Vassiljeva

Page 15: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

2016 PLC-1

Thus, Q has a rising edge when the time indicated in PT in milliseconds has run out.

4.3 TOF

TOF(IN, PT, Q, ET) implements a turn-o� delay.

VAR

tmrTOF1:TOF;

END_VAR

IN

Q

ET

t0 t1

t0 t1+PT

t1

t2 t3

t2 t3

t4

t4

t5

t5+PT

t5

0

1

t2

Figure 6: Graphic Display of the TOF Time Sequence

As soon as IN becomes FALSE, in ET the time will begin to be counted in milliseconds in ET

until its value is equal to PT. It will then remain constant.

Q is FALSE when IN is FALSE and ET equal PT. Otherwise it is TRUE.

Thus, Q has a falling edge when the time indicated in PT in milliseconds has run out.

Exercise 5 Set time on 7 s. delay

Read the HELP for the Timers. Start timer with a switch input. Use a timer. Add a physical

output, which would indicate the timer output signal (output of the controller).

• Check timer's work switching an input signal and tracking the output of the controller.

• Observe output of the timer and the running time /Monitoring mode/.

• What would happened if input signal is shorter than the Preset Value?

Exercise 6 Set an output signal which starts with an input and remains ON for 4 s.

Choose the input and output signals for program monitoring.

• What would happened if input signal is shorter than the Preset Value?

K.Vassiljeva 15 ISS0065 Control Instrumentation

Page 16: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

PLC-1 2016

tOFF

tOFF

tOFF

T

Input

Timer

Output Out = Inp&Tim

• How to manage a long output signal then input signal is short?

Exercise 7 The output signal starts (ON) 2 s. after the input signal and stops (OFF) 1 s. after

the input is OFF.

tOFF

tOFF

T1 T2

Input

Output

5 Counters

Types of counters:

• CTU;

• CTD;

• CTUD.

5.1 CTU

Function block Incrementer: CV will be raised by 1. (see HELP of CoDeSys). Write in the

declaration part of the the POU

VAR

cCTU1:CTU;

END_VAR

cCTU1(CU:= VarBOOL1, RESET:=VarBOOL2 , PV:= VarINT1);

ISS0065 Control Instrumentation 16 K.Vassiljeva

Page 17: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

2016 PLC-1

5.2 CTD

Function Block Decrementer: CV will be lowered by 1. (see HELP of CoDeSys). Write in the

declaration part of the the POU

VAR

cCTD1:CTD;

END_VAR

cCTD1(CD:= VarBOOL1, LOAD:=VarBOOL2, PV:= VarINT1);

5.3 CTUD

Function Block Incrementer/Decrementer Write in the declaration part of the the POU

VAR

cCTUD1:CTUD;

END_VAR

cCTUD1(CU := VarBOOL1, RESET := VarBOOL3, LOAD:=VarBOOL4, PV:= VarINT1);

Exercise 8 Counting

a) Create a program that counts the pulses from input switch (increments them) and resets the

counter.

Observe counter work using Monitoring Mode.

• What would happened if the accumulated number of pulses is greater than the counter's

preset value?

b) Add to the previous part of the program for the same variable the Decrement possibility. In

that case one input signal increments the value and another - decrements it.

K.Vassiljeva 17 ISS0065 Control Instrumentation

Page 18: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

PLC-1 2016

Exercise 9 Wrapping Machine

PLC

BOX

QP

OUT

product

Figure 7: Wrapping Machine

Pieces product (bottles) come o� the production line, they are countered by the sensor QP (see

Fig. 7).

Then you have 9 pieces of the product the output OUT is launched for the 2 s., which stops the

production line and puts the product into the box.

Simulate a delivery of the product by the signal 1 Hz (use function block BLINK).

The function block BLINK generates a pulsating signal. Write in the declaration part of the

the POU

VAR

bottle: BLINK;

END_VAR

bottle(ENABLE:=_, TIMELOW:=t#1s, TIMEHIGH:=t#1s, OUT=>_ );

Write a program.

Exercise 10 Operations with numeric data

ISS0065 Control Instrumentation 18 K.Vassiljeva

Page 19: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

2016 PLC-1

1. Set a constant value 5 to variable A and 2 to variable B

2. Counter (C) counts the number of impulses from Inp module (%IX._)

3. D = A+C; E = B*D;

Compare E with constant 18. Results of comparison present as binary signal (<,=,>). Add Inputs

that reset C, D and E values.

K.Vassiljeva 19 ISS0065 Control Instrumentation

Page 20: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

PLC-1 2016

ISS0065 Control Instrumentation 20 K.Vassiljeva

Page 21: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

Part III

Training 3

21

Page 22: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control
Page 23: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

2016 PLC-1

6 HMI

A visualization is a graphical representation of the project variables which allows inputs to the PLC

program in online mode via mouse and keypad. The CoDeSys visualization editor, which is part of

the programming system provides graphic elements which can be arranged as desired and can be

connected with project variables.

The visualization which is created in the programming system will in many cases be used as

the only user interface available for controlling and watching the associated PLC program in online

mode. For this purpose it must be possible to give inputs to the program solely by activating

visualization elements.

A visualization created in CoDeSys can later be used in di�erent ways:

• It can be made available on CoDeSys HMI, a special runtime system for operating the visu-

alization in full screen mode on a PLC computer.

• It can be made available as a Web-Visualization, which allows to call and operate it via the

Internet (useful for remote maintenance purposes).

• It can be made available as a Target-Visualization, which can be started directly on the PLC.

When de�ning the name of the visualization object, please regard the following:

1. A visualization named "PLC_VISU" per default automatically will be used as start visualiza-

tion in a Target- or Web-Visualization resp. In CoDeSys HMI, if there not explicitly another

visualization is con�gured for this.

2. A visualization may not get the same name as another object within the project because this

would result in problems when changing between visualizations.

For your �rst visualization select Visualizations tab - Right button click on Visualizations folder

- Add Object. In New Visualization window type "PLC_VISU" (see Fig. 8).

6.1 Visualization Elements

A visualization element is a graphical element, which is used to �ll a visualization object. The

available elements are o�ered in the CoDeSys menu bar. Each element gets a separate con�guration.

Go to the 'Insert' menu item and select freely from the following commands (see Fig. 9): 'Rect-

angle', 'Rounded Rectangle', 'Ellipse', 'Polygon'’ Polyline', 'Curve', 'Pie', 'Bitmap', 'Visualization','Button', 'Table', 'ActiveX-Element', 'Scrollbar', 'Meter', 'Bar Display', 'Histogram', 'Alarm table',

'Trend', 'WMF �le'.

K.Vassiljeva 23 ISS0065 Control Instrumentation

Page 24: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

PLC-1 2016

Figure 8: New Visualization creation

Text

Select 'Rectangle' from the menu and then using arrow set the area where text should be placed.

Double clicking on the object opens the window Regular Element Con�guration (#N). In this

window you can set di�erent parameters of the object.

• In the Text Category type the Application Name: "Bottles packing line". Select suitable font

and its size.

• In Colors Category choose color of the Rectangle and its border.

Final view of the application provided further in Fig. 10.

Buttons

Select 'Button' from the menu then using arrow set the area where button should be placed. Add

2 buttons which STARTs and STOPs the line.

For example for START button set the next parameters:

• Type "START" in the Text Category.

• In Input Category select Tap Variable (see Fig. 11).

ISS0065 Control Instrumentation 24 K.Vassiljeva

Page 25: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

2016 PLC-1

Figure 9: New Visualization creation

Figure 10: Visualization of the Wrapping Machine exercise

• To link main program variable with a button type PLC_PRG.bStart, where PLC_PRG -

name of the program, bStart - name of the declared variable, that starts the line.

Do the same way for the STOP button. Set button color as "Red" in Bitmap Category.

Indicators

Operator must to know if line is working or not. We can provide such information using indicators.

Choose Ellipse as an indicator.

• In Text Category type "Line started".

• To read variable value in Input Category check Toggle Variable and link it with program

variable (for example:PLC_PRG.bLineStarted, where PLC_PRG - name of the program,

bLineStarted - name of the declared variable, that indicates state of the line.)

K.Vassiljeva 25 ISS0065 Control Instrumentation

Page 26: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

PLC-1 2016

Figure 11: Category Input

A better way to draw operator's attention is to change color of the indicator while changing the

state.

• In Colors Category choose Alarm Color as "Green".

• In Variables Category for Change Color as PLC_PRG.bLineStarted.

6.2 Compilation

In your program (PLC_PRG) change the code as you can start the line using one of the buttons

(SWITCH (S0)) or visual button (START).

IF bStart=1 OR S0 THEN

bLineStarted :=1;(*line is started*)

END_IF

IF bStop=1 OR S1 THEN

bLineStarted :=0; (*line is stopped*)

END_IF

Where bStart,bStop,bLineStarted are BOOL type variables.

Download program to the PLC. While running open visualization tab. Check how it works

• Does click on the START button or turn on switch S0 start the line?

• Does indicator change its color while switching the line?

ISS0065 Control Instrumentation 26 K.Vassiljeva

Page 27: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

2016 PLC-1

6.3 Other elements

Provide the following information to the operator:

• Using 'Meter' show how many bottles from 9 possible are in the box.

• Also use text to provide that information numerically (see help: Visualization, Con�gure

Text).

In Variables Category set variable which shows bottle index in the box (for example: PLC_PRG.intCurBottle)

to the Textdisplay.

Motion

Add one more 'Rectangle'. In order to show sent out packed box, the x-axis coordinates should be

changed. In Motions Absolute enter intX_o�set variable. This variable can shift the element in

the X direction, depending on the respective variable value.

NB! Do not forget to calculate new value of the intX_o�set in your program.

IF bPacking THEN

intX_o�set:= x_o�Set + 1;(*new position of the box*)

IF intX_o�set = 250 THEN (*where 250 is the right edge of apps window*)

intX_o�set:= 0; (*initial position of the box if window edge is reached*)

END_IF

ELSE

intX_o�set:= 0; (*initial position of the box if not packing*)

END_IF

Below the box provide information how many boxes have been packed.

Time

Open PLC-Browser window. Type time command. You can see that time variable has been reset.

Set the right time to you PLC.

1. date 2014-mm-dd,

2. time HH:MM:SS.

Now, that information can be provided by your application.

First of all declare the following variables

K.Vassiljeva 27 ISS0065 Control Instrumentation

Page 28: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

PLC-1 2016

• tTnD:SystemTimeDate;

Local system clock Date and Time information can be read.

• GetTime(SystemTime:=tSysTime, TimeDate:=tTnD);,

On the visual part of you application add one more 'Rectangle'.

If you enter "%t", followed by a certain sequence of special placeholders, then this location will

be replaced in Online mode by the system time. The placeholders de�ne the display format, see

the following table. See help �le: Text.

Attention: Do not insert any other characters before %t in the 'Content' �eld.

Examples:

1. %t%a %b %d.%m.%y %H:%M:%S

• → Displays in online mode: Wed Aug 28.08.02 16:32:45

2. Between the placeholders you can insert any text strings:

• %t Today is %A %d of %B%Y

• → Displays in online mode: Today is Monday 28 of September 2015.

In a Text Category set right placeholders in order to provide information

• Day of the week;

• Date;

• Time;

In Variables Category set the next variable PLC_PRG.tTnD for time representation in Textdisplay.

Additional example provided by ABB can be seen: ABB AC500 PLC First Visualization

ISS0065 Control Instrumentation 28 K.Vassiljeva

Page 29: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

2016 PLC-1

7 Appendix

7.1 Wrapping machine visualization-listing

(* Visualization of line turning on and o� *)

IF bStart=1 OR S0 THEN

bLineStarted:=1; (*line is started*)

END_IF

IF bStop=1 OR S1 OR bTrayFull THEN

bLineStarted:=0; (*line is stopped*)

END_IF

(*Line working conditions*)

bLineWorks:=bLineStarted AND NOT bPacking;

(* Simulation of the sensor reaction on bottle *)

bottle(ENABLE:=bLineWorks , TIMELOW:= t#1s , TIMEHIGH:= t#1s); (*bottle: BLINK;*)

(* Physical output *)

IF NOT bBoxFull THEN

DO16:=bottle.OUT;

ELSE

DO16:=0;

END_IF

(* Counting bottles *)

cNumBottles( (*cNumBottles: CTU;*)

CU:=bottle.OUT,

RESET:=bStart OR S0 OR (tmrTP_Packing.ET=tmrTP_Packing.PT) ,

PV:=intMaxBottles,

K.Vassiljeva 29 ISS0065 Control Instrumentation

Page 30: Training 1 - a-lab.ee · PDF file2016 PLC-1 1 AC500 System The following electronic modules are the basic components of the AC500 system: ... Select the entry PLC-Browser in theResourcestab-control

PLC-1 2016

Q=> bBoxFull,

CV=>intCurBottle);

(* Packing bottles *)

tmrTP_Packing(IN:=bBoxFull , PT:= t#3s , Q=>bPacking);

(* Counting boxes *)

cNumBoxes((*cNumBoxes: CTU;*)

CU:=bPacking,

RESET:=bStop OR S1 OR bTrayFull,

PV:=10,

Q=>bTrayFull,

CV=>intCurBox);

(*Box animation*)

IF bPacking THEN

intX_o�Set:=intX_o�Set+1;

IF intX_o�Set=250 THEN

intX_o�Set:=0;

END_IF

ELSE

intX_o�Set:=0;

END_IF

(* To read system time declare the following variables *)

(* tSysTime:SysTime64; tTnD:SystemTimeDate; GetTime:CurTimeEx;*)

GetTime(SystemTime:=tSysTime, TimeDate:=tTnD);

ISS0065 Control Instrumentation 30 K.Vassiljeva