Network Variables
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
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.
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.
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'.
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.
• 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.
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
4
Network variables interface in your programming system Working with network variables
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.
5
Dialogs and procedures for the network variables
system
The following dialogs are used to handle the network variables system.
• Dialog 'Network Variables Settings for Resource resource_name' which is used to add,
select and open subscriber and publisher variables groups.
• 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.
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.
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'
Tab 'Security'
• 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'.
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.
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.
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.
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
• 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!
It is used to
• select a network variables driver and call the appropriate driver parameter dialog and to
The dialog is identical for subscriber and publisher groups except for the third radio button at the
bottom of the dialog.
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.
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'.
10
Dialogs and procedures for the network variables system Dialog 'Parameter for driver_name...'
• During compilation of the PLC program the accessed network variables are automatically
related to one of the AutoGroups of each resource.
• 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.
• 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.
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...'
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