0% found this document useful (0 votes)
122 views14 pages

Network Variables

This document provides an overview of network variables in a distributed PLC system: 1) Network variables allow data to be distributed across multiple PLCs (resources) with automatic data transfer, simplifying development of distributed systems. 2) Network variables use a publisher/subscriber model where one PLC publishes a variable and others subscribe to it. Variables are organized into groups associated with tasks and communication drivers. 3) The interface includes worksheets to declare variables and dialogs to configure publisher/subscriber groups, assign variables, and set driver parameters for communication between PLCs.

Uploaded by

Rafael
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
122 views14 pages

Network Variables

This document provides an overview of network variables in a distributed PLC system: 1) Network variables allow data to be distributed across multiple PLCs (resources) with automatic data transfer, simplifying development of distributed systems. 2) Network variables use a publisher/subscriber model where one PLC publishes a variable and others subscribe to it. Variables are organized into groups associated with tasks and communication drivers. 3) The interface includes worksheets to declare variables and dialogs to configure publisher/subscriber groups, assign variables, and set driver parameters for communication between PLCs.

Uploaded by

Rafael
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Network variables

Network variables
General information about network variables...............................................................................1
What is a network variable?.................................................................................................1
The publisher/subscriber data distribution model.................................................................2
Grouping of network variables..............................................................................................2

Network variables interface in your programming system..........................................................3


Overview figure of the network variables interface...............................................................3
Working with network variables..........................................................................................................4

Dialogs and procedures for the network variables system..........................................................6


Selecting a resource in the dialog 'Network_variables_worksheet Properties'....................6
Handling network variables groups in the dialog 'Network Variables Settings for
Resource resource_name'..................................................................................................7
Specifying subscriber and publisher groups in the dialog 'Properties of
Subscriber/Publisher Group group_name'..........................................................................9
Dialog 'Parameter for driver_name in Subscriber Group'...................................................11
Dialog 'Parameter for driver_name in Publisher Group'.....................................................12

i
General information about network variables
Using network variables distributed PLC applications (with several configurations or resources) can
be realized nearly as easy as single PLC systems.

Without network variables developing distributed PLC programs is more extensive because the
data transfer between the resources must be configured manually, maintenance and trouble
shooting in distributed systems are more difficult and each modification in the distribution structure
requires changes in the PLC program.

By using network variables no additional programming efforts for distributed systems are
necessary, the data transfer between the PLCs is organised automatically and the structure of the
distributed system can be ignored when designing the system. Additionally starting, stopping and
patching a program can be done for each single PLC independent of other PLCs in the same
network.

Further general information can be found in the topics

• What is a network variable?

• The publisher/subscriber data distribution model

• Grouping of network variables

What is a network variable?

Network variables are similar to global variables, but their scope is not only the 'Resource' (as for
global variables) but the complete 'Project'. If in a network several different PLC programs (i.e.
projects) are executed on different resources the scope of a network variable can also be
project−embracing.

This means that network variables are distributed over the complete network and therefore
accessible by each configuration and resource (i.e. PLC) inserted in the current project.

The declaration of a network variable is done in the network variables worksheet, which is located
in the subtree 'Physical Hardware'. In the overview figure of the network variables interface the
number (1) is assigned to the network variables worksheet. In this worksheet the network variables
are handled identical as local or global variables worksheets in the corresponding variables grid
worksheets.

A network variable can be written, i.e. published by only one resource of the network. This
resource is the owner of this variable and is designed as publisher. Each PLC which has read
access to this variable is designed as subscriber. Click here for detailed information about the
so−called publisher/subscriber data model.

The following list shows the properties and restrictions concerning the declaration of a network
variable:

• Declaration in the network variables worksheet using the variable declaration keyword
'VAR_GLOBAL'.

1
General information about network variables The publisher/subscriber data distribution model

• Declaration in the local variables worksheet (of the POU where it is used) as
VAR_EXTERNAL. The compiler resolves each external variable to the corresponding
network variable.

• It can be declared as a retentive variable using the keyword 'RETAIN'.

• An initial value can be assigned.

• A network variable must not have a direct location.

• It can not be assigned to a pointer (VAR_IN_OUT).

The publisher/subscriber data distribution model

The network variable system is based on a publish−subscribe data distribution model.

Publish−subscribe communication in a distributed system requires that each device (PLC) knows,
which data it has to publish (i.e. to make available for other PLCs in the network) and which data it
has to subscribe (i.e. can be read by the PLC). Therefore each device needs to know for each
network variable, if it has either to be published or to be subscribed.

Network variables that are only read from the application program are identified as subscriber
variables, variables that are written are identified as publisher variables. Variables that are both,
read and write accessed from an application program (e.g. A:=A+1;) are also treated as publisher
variables.

As already mentioned there should only exist one publisher for a network variable.

Whether a variable should be published or subscribed by an individual PLC is defined in the dialog
'Properties of Subscriber Group group_name' or 'Properties of Publisher Group group_name'.

Grouping of network variables

Network variables are organized by groups of variables. Each PLC can have several groups of
network variables (see dialog 'Network Variables Settings for Resource resource_name'). In the
default case for each PLC one group for the publisher variables and one group for the subscriber
variables exist. It is allowed to relate a network variable to several groups of one PLC. Each group
of network variables is related to a PLC task. Due to the assignment of a group to a task,
task−specific communication between publishers and subscribers is possible. Additionally each
group is assigned to a network variable driver with group specific driver attributes (parameters).

The grouping mechanism allows to define specific attributes for a list of network variables that are
collected into one group. Therefore it is possible to configure the network variable communication
in an individual and flexible manner and to optimize the system in order to meet specific
communication requirements.

2
Network variables interface in your programming
system
This topic describes the structure of the network variables system user interface components. To
see an overview figure showing the used dialogs please click on the corresponding hypertext link.

• The network variables worksheet is located in the subtree 'Physical Hardware'.

• Double clicking on the icon in the subtree calls the network variables worksheet (number
(1) in the overview figure). The variables in this worksheet are handled identical as local or
global variables in the corresponding variables grid worksheets.

• The icon context menu item 'Properties...' in the subtree 'Physical Hardware' calls the
dialog 'Network_variables_worksheet Properties' (number (2) in the overview figure). This
dialog is used to select a resource for which you want to define the network settings, the
subscriber and publisher variables groups and properties.

• Selecting a resource name and clicking on the button 'Settings' in the dialog
'Network_variables_worksheet Properties' calls the dialog 'Network Variables Settings for
Resource resource_name' (number (3) in the overview figure). This dialog is divided into 2
tabs, showing the publisher and subscriber variables groups for the current resource. It is
used to add or select a subscriber or publisher group and to define the properties of the
network variables contained in the selected group.

• Selecting a network variables group on the tab 'Subscriber' or 'Publisher' in the dialog
'Network Variables Settings for Resource resource_name' and then clicking on the button
'Properties' calls the dialog 'Properties of Subscriber/Publisher Group group_name' for the
selected group (number (4) in the overview figure). This dialog is used to assign the
available network variables to the current subscriber/publisher group, to assign the group
to a task running in the current resource and to select the network variables driver, which
is used for the communication between the network resources.

• Clicking on the button 'Parameter...' in the dialog 'Properties of Subscriber/Publisher


Group group_name' calls the dialog 'Parameter for driver_name in Subscriber Group' or
'Parameter for driver_name in Publisher Group' (number (5) in the overview figure). Which
dialog appears depends on the group (publisher or subscriber) selected in the settings
dialog (number (3) in the overview figure).

Overview figure of the network variables interface

The figure shown below illustrates how the network variables system is realized in your
programming system. For detailed information about the different dialogs please click on the
corresponding hypertext link.

3
Network variables interface in your programming system Working with network variables

Working with network variables


The following procedure explains the main steps when working with network variables. Detailed
information are provided in the related dialog descriptions.

• Inserting a network variables worksheet.


If no network variables worksheet exists in the subtree 'Physical Hardware', you have to
create one. Keep in mind, that only one network variables worksheet is allowed.
For creating a network variables worksheet click with the right mouse button on the
subtree icon 'Physical Hardware' to open the context menu. Select the menu item 'Insert >
Network variable worksheet'. The dialog 'Insert' appears. Enter a worksheet name into the
text field and confirm the dialog. The network variables worksheet is inserted below the
node icon into the subtree.
The new worksheet is marked with an asterisk indicating that it was not yet compiled.
Example:

4
Network variables interface in your programming system Working with network variables

• Declaring network variables and using them in code body worksheets.


Network variables can be used in code body worksheets in the same way as resource
global variables. Additionally to the VAR_GLOBAL declaration in the network variables
worksheet they have to be declared using the keyword VAR_EXTERNAL in the local
variables worksheet of the POU in which they are used.

For declaring network variables proceed as for resource global variable. This means that
you can
– either declare network variables while editing the code body (in this case select the
network variables worksheet in the 'Global Scope' tab of the dialog 'Variables Properties')
– or open the network variables worksheet by double clicking on the network variables
icon and insert new variables directly in the grid. The network variables grid provides the
same functionality as the local and global variables worksheet. After declaring a variable
directly in the grid you can insert it into the code body using the variables dialog.
For detailed information please select the topics Declaring variables while editing the
code body and Working with variables grid worksheets in the topic list below.

• Compiling the project.


After declaring the required network variables in the previous step you have to compile the
project using 'Make'.
During compilation of the PLC program the accessed network variables are automatically
related to one of the default groups (AutoPublisher or AutoSubscriber) of the resource in
which they are used. These default groups are automatically created by the system. To
which group a variable is assigned depends on the fact whether the resource writes or
reads this variable.

• Configuring the network variables system.


After compiling the project you can set the properties of the network variables worksheets
and the network variables groups. For that purpose you can use the dialogs for the
network variables system. The dialog descriptions provide the required steps and
information for configuring.

5
Dialogs and procedures for the network variables
system
The following dialogs are used to handle the network variables system.

• Dialog 'Network_variables_worksheet Properties' which is used to select a resource for


declaring the resource settings concerning the network variables handling.

• Dialog 'Network Variables Settings for Resource resource_name' which is used to add,
select and open subscriber and publisher variables groups.

• Dialogs 'Properties of Subscriber Group group_name' and 'Properties of Publisher Group


group_name' which are used
− to assign a group to a task running in the current resource,
− to select a network variables driver for the current group and
− to define network variables which are published/subscribed by the current resource.

• Dialogs 'Parameter for driver_name in Subscriber Group' and 'Parameter for driver_name
in Publisher Group' which are used to define the settings for the network variables driver,
selected for the current group.

• The network variables worksheet provides identical functions as local and global variables
worksheets.

Selecting a resource in the dialog 'Network_variables_worksheet Properties'

The dialog 'Network_variables_worksheet Properties' appears, if you select the context menu item
'Properties' of the network variables worksheet icon in the subtree 'Physical Hardware'.

Example:

The main purpose of this properties dialog is to select a PLC (resource) in order to open the
network variables settings dialog for this resource.

The dialog is divided into 3 tabs:

Tab 'Communication settings'

Resource Path This table lists all resources available in the current project
(network). The resource path contains the configuration name and
the resource name.
Settings Clicking on this button calls the dialog 'Network Variables Settings
for Resource resource_name' for the selected resource.

6
Dialogs and procedures for the network variables system Handling network variable groups

Tab 'Name'

Name indicates the name of the network variables worksheet. When


editing the text field, the button 'Apply' at the bottom of the dialog
becomes active in order to apply the changed worksheet name.
The icon name in the subtree 'Physical Hardware' is updated after
changing the name and closing the dialog.

Tab 'Security'

Read protection If this checkbox is activated, the network variables worksheet


cannot be displayed until you have logged in with the valid project
password.
Please observe the notes at the end of this table.
Write protection If this checkbox is activated, any changes you have made in the
network variables worksheet cannot be saved until you have logged
in with the valid project password.
Please observe the notes at the end of this table.
Notes:
If the network variables worksheet is read or write protected the
icon in the subtree 'Physical Hardware' is displayed with a key
symbol as shown in the following example:

The password protection does not apply to the settings and


properties dialogs but only to the network variables grid itself.

The security tab can be displayed in two different modes:


If no project password is active, it appears in Edit mode (i.e. active) and you can change the
settings. They will become valid after activating a project password using the dialog 'Project
password'. If the password protection is enabled, the dialog tab appears in view mode, i.e. inactive.
In this case you have to log in using the valid password, before you can change the settings. For
that purpose use the menu item 'Enter password...' in the submenu 'File'.
For detailed information please refer to the topic Protecting a project using a password.

How to work with the dialog:

• Mark the resource for which you want to edit the network variables settings with the left
mouse button.

• Click on the button 'Settings' to open the dialog 'Network Variables Settings for Resource
resource_name'.

Handling network variables groups in the dialog 'Network Variables Settings


for Resource resource_name'

The dialog 'Network Variables Settings for Resource resource_name' appears, if you mark a
resource in the dialog 'Network_variables_worksheet Properties' and then click on the button

7
Dialogs and procedures for the network variables system Handling network variable groups

'Settings'.

The dialog is used to add, select and delete network variables groups and to open the
corresponding properties dialog for a group.

Further information about grouping network variables are provided in the topic General information
about network variables.

Dialog tab 'Subscriber'

The tab 'Subscriber' contains network variables groups specifying the variables which are to be
subscribed (i.e. can be read) by the current resource.

Subscriber variables are network variables which are written (i.e. published) by another resource in
the network and are read−only for the current resource.

The tab contains at least one group. This default group is automatically created by the system and
is called 'AutoSubscriber'. On this dialog tab you can create a new subscriber network variables
group and then edit its properties.

Dialog tab 'Publisher'

The tab 'Publisher' contains network variables groups specifying the variables which are to be
published (i.e. written) by the current resource.

Publisher variables are network variables which are written by the current resource. This means,
that the current resource is the producer and owner of this variable. Any other resource in the
network can only be a subscriber of this variable.

The tab contains at least one group. This default group is automatically created by the system and
is called 'AutoPublisher'. On this dialog tab you can create a new publisher network variables group
and then edit its properties.

Further information about the publisher/subscriber data distribution model can be found in the topic
General information about network variables.

The buttons have the following meaning:

Add Adds a new group to the current dialog tab. After pressing the button the
dialog 'Properties of Subscriber Group' or 'Properties of Publisher Group'
appears for specifying the new group and assigning variables to it.

Delete Deletes the selected network variables group on the current dialog tab.

Notes:
After pressing this button, the group is deleted permanently without any
confirmation dialog. The deleted group can not be restored. The default
groups 'AutoSubscriber' and 'AutoPublisher' can not be deleted. If a group is
deleted the variables which were defined as subscriber or publisher variables
in this group are automatically re−assigned to the corresponding default
group.

8
Dialogs and procedures for the network variables system Specifying subscriber and publisher groups

Example: In the publisher group 'FastPub' the variable 'NetVar1' is marked.


After deleting the group 'FastPub' the variable 'NetVar1' is automatically
marked in (i.e. assigned to) the group 'AutoPublisher' of this resource. Further
information about assigning variables are provided in the topic Specifying
subscriber and publisher groups in the dialog 'Properties of
Subscriber/Publisher Group group_name'.

Properties Calls the dialog 'Properties of Subscriber/Publisher Group group_name' for


the marked group.

How to work with the dialog

• To add a new variables group click on the button 'Add' and then specify the group in the
appearing dialog 'Properties of Subscriber/Publisher Group group_name'. After confirming
the properties dialog, the new group is displayed in the group list.

• To delete a group mark the desired group with the left mouse button and then click on
'Delete'. The group is deleted without any further confirmation!

• To edit the properties of a variables group using the dialog 'Properties of


Subscriber/Publisher Group group_name' mark the desired group with the left mouse
button and then click on 'Properties'.

Specifying subscriber and publisher groups in the dialog 'Properties of


Subscriber/Publisher Group group_name'

The dialog 'Properties of Subscriber Group group_name' or 'Properties of Publisher Group


group_name' appears, if you mark a subscriber or publisher group in the dialog 'Network Variables
Settings for Resource resource_name' and then click on the button 'Properties'. (The dialog can
also be called by double clicking on the group name in the settings dialog.)

It is used to

• assign the variables group to a task,

• select a network variables driver and call the appropriate driver parameter dialog and to

• assign variables to the current group in the network variables list.

The dialog is identical for subscriber and publisher groups except for the third radio button at the
bottom of the dialog.

The dialog fields and buttons have the following meaning:

Name Indicates the name of the current group. This name can be
changed except for the default groups 'AutoSubscriber' and
'AutoPublisher'. The group name has to be an IEC string with a
maximum of 8 characters.

9
Dialogs and procedures for the network variables system Specifying subscriber and publisher groups

Task List box for selecting the task to which the group is assigned.
Each group has to be assigned to a task running on the
current resource. The variables marked in this group are
published/subscribed each time the task is executed. Due to
the possibility of grouping variables and assigning a group to a
task, task−specific communication between publishers and
subscribers is possible.

Comment User defined comment for the current group with no restriction
concerning the used characters.

Driver List box for selecting the network variables driver for the
current group. The list box contains all installed network
variables drivers for ProConOS.

Note: A driver name can consist of up to 10 characters.

Background: The main job of a network variable driver is to


establish the connection to a communication partner and to
manage the essential data transfer. In order to allow different
physical networks and different protocol mappings for the
network variable communication, the specific implementation is
fully done by a ProConOS driver.

Parameter Calls the parameter dialog for the network variables driver
selected in the 'Driver' list box. Depending on the group type
(publisher or subscriber group) and on the selected driver, the
dialog contains different parameter fields.

Variables This list shows the available network variables with the data
type. The list contents can be filtered using the radio buttons
below the list (see next row of this table). For each variable a
checkbox is provided. Variables which are assigned to the
current variables group are shown displayed with a marked
checkbox. For selecting/deselecting a variable click with the
left mouse button into the related checkbox. Please observe
the important notes below this table.

Radio buttons These radio buttons are used to filter the network variables list.
'All network variables' Activating the second radio button lists all network variables
'All used network variables' used in the current resource. Depending on the group type
'All subscriber/publisher variables' (subscriber or publisher) the most right radio button is named
either 'All publisher ...' or 'All subscriber variables'.

Important notes about selecting variables

• If a checkbox is marked, the corresponding variable is published/subscribed by the current


resource each time the task is executed to which the current group is assigned.

10
Dialogs and procedures for the network variables system Dialog 'Parameter for driver_name...'

• A checkbox can not be selected/deselected if the current group is a default group


('AutoSubscriber' or 'AutoPublisher').

• During compilation of the PLC program the accessed network variables are automatically
related to one of the AutoGroups of each resource.

• A variable which is connected to a manually inserted network variables group is


automatically disconnected from the corresponding default group (AutoSubscriber or
AutoPublisher).

• It is allowed to assign a network variable to more than one group. Therefore if an already
connected variable is assigned to a further group all other assignments remain, except the
connection to the automatic default groups (if still existing).

• If the last user defined network variables group of a resource is deleted, any variables
which were assigned to the deleted group are automatically re−assigned to the
appropriate default group. Due to this, the resource always stays a publisher/subscriber of
this variable, even the user defined group was removed.

How to work with the dialog

• If you are not working with a default group (AutoSubscriber or AutoPublisher), you can
change the group name, if required.

• Open the list box 'Task' and select a task to which the group should be assigned.

• Select the network variable 'Driver' and define its driver parameters (if required) by clicking
on the button 'Parameter'.

• In the variables list mark the variables to be assigned to the current group with a left
mouse click into the related checkbox. Please follow the important notes listed above.

Dialog 'Parameter for driver_name in Subscriber Group'

This dialog appears if you have opened the dialog 'Properties of Subscriber Group group_name'
and click on the button 'Parameter' beneath the list box 'Driver'.

This dialog is specific to the selected network variables driver. For different drivers the dialog may
provide different parameter fields.

The dialog is used to set the network variables driver parameter for the current subscriber group.
The main job of a network variable driver is to establish the connection to a communication partner
and to manage the essential data transfer. In order to allow different physical networks and
different protocol mappings for the network variables communication the specific implementation is
fully done by a ProConOS driver.

For information about the parameters to be set in this dialog please refer to the NDDS
documentation.

11
Dialogs and procedures for the network variables system Dialog 'Parameter for driver_name...'

Dialog 'Parameter for driver_name in Publisher Group'

This dialog appears if you have opened the dialog 'Properties of Publisher Group group_name' and
click on the button 'Parameter' beneath the list box 'Driver'.

This dialog is specific to the selected network variables driver. For different drivers the dialog may
provide different parameter fields.

The dialog is used to set the network variables driver parameter for the current publisher group.
The main job of a network variable driver is to establish the connection to a communication partner
and to manage the essential data transfer. In order to allow different physical networks and
different protocol mappings for the network variables communication the specific implementation is
fully done by a ProConOS driver.

For information about the parameters to be set in this dialog please refer to the NDDS
documentation.

12

You might also like