Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
19
Добавлен:
11.10.2020
Размер:
3.39 Mб
Скачать

Programming Example 59

Visualizing a Traffic Signal Unit

element and dragging this with a constantly depressed mouse key to the input/output of the desired element.

Your program should finally look like the example shown here.

x PLC_PRG, Declaration and presentation with the continuous function chart editor

3.1.17TRAFFICSIGNAL simulation

Now test your program. For this you must compile it ('Project' 'Rebuild all') login ('Online' 'Login' and then load it 'Online' 'Download'). If you now select 'Online' 'Run', the chronological order of the individual steps of your main program can be followed. The window of the POU PLC_PRG has now changed to the monitor window. Click twice on the plus sign in the declaration editor, the variable display drops down, and you can see the values of the individual variables.

3.2 Visualizing a Traffic Signal Unit

With the visualization of WAGO-I/O-PRO 32 you can quickly and easily bring project variables to life. We will now plot two traffic signals and an ONSwitch for our traffic light unit which will illustrate the switching process.

3.2.1 Creating a new visualization

In order to create a visualization you must first select the range of Visualization in the Object Organizer. First click on the lower edge of the

window on the left side with the POU on the register card with this symbol

WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32

60 Programming Example

Visualizing a Traffic Signal Unit

and the name Visualization. If you now choose the command 'Project' 'Object Add', then a dialog box opens.

Enter here any name. When you confirm the dialog with OK, then a window opens in which you can set up your new visualization.

3.2.2 Insert element in Visualization

For our TRAFFICSIGNAL visualization you should proceed as follows:

Give the command 'Insert' 'Ellipse' and try to draw a medium sized circle ( 2cm). For this click in the editor field and draw with pressed left mouse button the circle in its length.

Now doubleclick the circle. The dialog box for editing visualization elements opens

Choose the category Variables and enter in the field Change color the variable name .L1_red or choose this variable using the input assistance (button <F2>). This addresses the variable RED of the function block instance TRAFFICSIGNAL1 of the POU PLC_PRG.

x Visualization Dialog Box Variables

Then choose the category Color and click on the button Inside in the area Color. Choose as neutral a color as possible, such as black.

Now click on the button within in the area Alarm color and choose the red which comes closest to that of a red light.

x Visualization Configuration Dialog Box (Color category)

WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32

Programming Example 61

Visualizing a Traffic Signal Unit

The resulting circle will normally be black, and when the variable RED from TRAFFICSIGNAL1 is TRUE, then its color will change to red. We have therefore created the first light of the first TRAFFICSIGNAL!

3.2.3 The other traffic lights

Now enter the commands 'Edit' 'Copy' (<Ctrl>+<C>) and then twice 'Edit' 'Paste' (<Ctrl>+<V>). That gives you two more circles of the exact same size lying on top of the first one. You can move the circles by clicking on the circle and dragging it with pressed left mouse button. The desired position should, in our case, be in a vertical row in the left half of the editor window. Doubleclick on one of the other two circles in order to open the configuration dialog box again. Enter in the field Change Color of the corresponding circle the following variables:

for the middle circle:

L1_yellow

for the lowest circle:

L1-green

Now choose for the circles in the category Color and in the area Alarm color the corresponding color (yellow or green).

3.2.4 The TRAFFICSIGNAL case

Now enter the command 'Insert' 'Rectangle', and insert in the same way as the circle a rectangle which encloses the three circles. Once again choose as neutral a color as possible for the rectangle and give the command 'Extras' 'Send to back' so that the circles are visible again.

If simulation mode1is not yet turned on, you can activate it with the command 'Online' 'Simulation'.

If you now start the simulation with the commands 'Online' 'Login' and 'Online' 'Run', then you can observe the color change of the first traffic signal.

WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32

62 Programming Example

Visualizing a Traffic Signal Unit

3.2.5 The second traffic signal

The simplest way to create the second traffic signal is to copy all of the elements of the first traffic signal. For this you select all elements of the first traffic signal and copy them (as before with the lights of the first traffic signal) with the commands 'Edit' 'Copy' and 'Edit' 'Paste'. You then only have to change the text "TRAFFICSIGNAL1" in the respective dialog boxes into "TRAFFICSIGNAL2", and the visualization of the second traffic signal is completed.

3.2.6 The ON switch

Insert a rectangle and award it, as described above, a colour for a traffic light of your choice and enter .ON at Variables for the Change color. Enter "ON" in the input field for Content in the category Text.

x Dialog to configure the visualization elements (Category Text)

In order to set the variable ON to TRUE with a mouse click on the switch, the variable .ON must be entered into the category Variables. Also select the Option Variable keying and enter the variable .ON at this point. Variable keying means that when a mouse click is made on the visualization element the variable .ON is set to the value TRUE but is reset to the value FALSE when the mousekey is released again (we have created hereby a simple switchon device for our traffic lights program).

x Dialog to configure the visualization elements (Category Input)

WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32