0% found this document useful (0 votes)
71 views36 pages

Module 08 - Common Drivers - Basics

Communication in PcVue uses protocols to communicate with industrial equipment over networks. It involves configuring networks, nodes (PLCs), and frames which are messages containing data requests. Variable mapping associates PcVue variables with addresses in the PLC's data table so the communication manager can dispatch values. The configuration is done through communication objects in the equipment configuration dialog. Optimizing communication involves tools like the communication manager and debugging aids.

Uploaded by

Marious Ees
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
71 views36 pages

Module 08 - Common Drivers - Basics

Communication in PcVue uses protocols to communicate with industrial equipment over networks. It involves configuring networks, nodes (PLCs), and frames which are messages containing data requests. Variable mapping associates PcVue variables with addresses in the PLC's data table so the communication manager can dispatch values. The configuration is done through communication objects in the equipment configuration dialog. Optimizing communication involves tools like the communication manager and debugging aids.

Uploaded by

Marious Ees
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 36

Communication

Module 08
Common drivers - Basics
Contents

1 Introduction 3
1.1 PcVue version 3
1.2 In this module you will learn 3
1.3 Files used in this module 3
1.4 Third party software used in this module 3

2 This feature in PcVue architecture 4


3 Basics 5
3.1 Communication concepts 5
3.1.1 Network, protocol and node 5
3.1.2 Master/Slave and Frame 6
3.1.3 Modbus Simulator User Interface 9
3.1.4 About variable mapping 10
3.2 Communication Configuration 11
3.2.1 Network 13
3.2.2 Node 15
3.2.3 Frame 17
3.3 Variable mapping 21
3.3.1 Variable mapping using the Architect 21
3.3.2 Variable mapping using the Application Explorer 26
3.4 Optimisation and maintenance 30
3.4.1 PcVue Communication Manager 30
3.4.2 Maintenance and debugging 33
3.4.3 Starting the communications when PcVue starts 35

4 Summing-up 36

V12 Module 08 - Common drivers - Basics Page 2/36


1 Introduction
1.1 PcVue version
This module is for PcVue version 12.

1.2 In this module you will learn


Some communication concepts,
How to configure communication in PcVue,
How to optimize and maintain communication.

1.3 Files used in this module


Copy the PcVue project located in My Documents\Pcvue Training\Module_08\Project
in C:\Pcvue projects\Usr\.

1.4 Third party software used in this module


We will use the Mod_RSsim Modbus TCP/IP simulator.
This can be found here: PcVue Training\Module_08\Third party\.

V12 Module 08 - Common drivers - Basics Page 3/36


2 This feature in PcVue architecture

Figure 1

V12 Module 08 - Common drivers - Basics Page 4/36


3 Basics
3.1 Communication concepts
3.1.1 Network, protocol and node
PcVue uses a set of communication protocols to communicate with the process
equipment across a network or networks. There are three types of industrial
networks:
Serial link: RS232 or RS485 cables. PcVue uses the computer’s COM port or a
dedicated communication board such as Applicom.
For example Modbus RTU, Mitsubishi MELSEC-A Series etc.
Ethernet: PcVue uses the computer’s Ethernet card.
For example Modbus TCP/IP, Siemens S7 etc.
Dedicated: A proprietary medium, for example Modicon Modbus+, Profibus etc.
The following diagram describes the classic architecture.

Figure 2

When two systems are communicating they need to “speak” the same language. A
protocol is a standard “language” used by two systems to communicate together.
PcVue supports a wide and increasing range of industrial protocols. During this
training course we will use Modbus TCP/IP as an example but what you will learn also
applies to many other protocols.
In PcVue vocabulary, the PLC is called a Node.

V12 Module 08 - Common drivers - Basics Page 5/36


3.1.2 Master/Slave and Frame
Usually a protocol implements two types of “speaker”: The Master and the Slave(s).
The Master is the one that makes the requests to the Slave(s) to read and/or write
the data.
The Slave “listens” on the network waiting for a request sent by the Master.

In the Ethernet environment the Master is sometimes called the


Client and the Slave is called the Server.
In most cases, PcVue is the Master and the PLC is the Slave.
In PcVue vocabulary, the request is called a Frame.
A frame is a message containing all the parameters needed to read or write data.
For example a Modbus frame contains the Node address, the function code (read or
write, bit or words, input or output etc.), the data address and quantity and a CRC
(Cyclic Redundancy Check – used to check that the message hasn’t been corrupted).
The process used by the master to collect the data is always the same: it periodically
sends a frame to the slave, waits for the answer, sends another frame and so on.
The following diagram represents the typical Master/Slave process.

Figure 3

 The Master sends a frame to read some bits and waits for the reply.
 The Slave sends the reply. Then it waits for the next frame.
5 seconds later this process repeats and so on…

V12 Module 08 - Common drivers - Basics Page 6/36


The period configured for a frame is called the polling period.

Of course a Master can read different types of data in the same Slave. The following
diagram represents this process.

Figure 4

 The Master sends a frame to read some bits and waits for the reply.
 The Slave sends the reply. Then it waits for the next frame.
5 seconds later this process repeats and so on...
 The Master sends a frame to read some words and waits for the reply.
 The Slave sends the reply. Then it waits for the next frame.
5 seconds later this process repeats and so on...

V12 Module 08 - Common drivers - Basics Page 7/36


Exercise 1.
Install and configure Modbus slave simulator.(PLC simulator).

1. Install the Modbus slave simulator.


a. Run My Documents\Pcvue Training \Module_08\Third
party\SimSetup.msi and follow the instructions.
2. Create a shortcut on the desktop.
a. Use Windows Explorer to locate the folder:
C:\Program Files (x86)\EmbeddedIntelligence\Mod_RSsim.
b. Right click mod_RSsim.exe and select Create Shortcut. Follow
the prompts to create a shortcut on your PC’s desktop.
3. Start the Modbus TCP/IP Slave and enter the registration key.
a. Run the shortcut mod_RSsim that you just created on the
desktop. If a dialog opens requesting permission for access
through the PC’s firewall, allow it.
b. Click the About button and then the Register button and enter
the User Name and KEY exactly as in the screenshot below.

Figure 5

c. That’s it! The Modbus slave simulator is good to go.

V12 Module 08 - Common drivers - Basics Page 8/36


3.1.3 Modbus Simulator User Interface
Before we go any further let’s learn a little about the simulator. Assuming it installed
correctly the simulator is pre-configured for Modbus TCPIP which is what we want to
use.

Figure 6

[A] Toolbar. The tools all have tooltips indicating their function. The most useful
are:
PLC emulation settings – Configuration of data table limits.
About MOD_simulator – The about screen. Used for self registration.
Simulation set-up – Configure auto-increment of values.
Zero all values – Reset all values to 0.
[B] Connection information. The number of simultaneous connections, the number
of messages sent and received etc.
[C] Data table selection and configuration.
[D] Data table. Double clicking a value allows you to change it.
[E] Slaves configuration. By default the simulator emulates all possible 245 Modbus
slaves at the same time! You can disable a particular slave by clicking on its
number. A slave number surrounded by a yellow box means that it has recently
been polled.

V12 Module 08 - Common drivers - Basics Page 9/36


3.1.4 About variable mapping
When the Communication Manager receives a reply it needs to dispatch the various
values to the PcVue variables. This means that it needs to know which PcVue variable
corresponds with each Slave address. This is the purpose of variable mapping.
The following diagram shows a mapping example for a frame requesting 10 Words
starting at address 0.

Figure 7

V12 Module 08 - Common drivers - Basics Page 10/36


3.2 Communication Configuration
Configuring the communication is the first step to displaying values from equipment
in PcVue’s variables.
Communication is defined in terms of the following communication objects:
Network,
Node,
Frame.
Each communication object has common parameters and
sometimes specific ones also.
You can find the specific parameters for a protocol in the Help
here:
The Application Explorer/Communication/Data
Acquisition/Equipment/Configuring a protocol.
The configuration is done using the Communication Objects dialog. You can open it
via Configure / Communication / Equipment.

Figure 8

Equipment configuration currently can only be accessed from the


Menu (not from the Application Explorer or Application Architect).

V12 Module 08 - Common drivers - Basics Page 11/36


Figure 9

[A] Three columns displaying the configured communication objects: Network, Node
and Frame. Of course by default it is empty.
[B] Status of the communication objects. Used for maintenance.
[C] On / Off buttons. Used to start and stop the entire communication manually.
[D] Validate / Cancel buttons.

In this module we will continue the BMS theme. We will add a new
template with variables, representing a Power Meter, to each of the
floors. Each Power Meter has a corresponding Modbus node. Each
Modbus node has two frames, one to read bits and the other to
read words.

V12 Module 08 - Common drivers - Basics Page 12/36


3.2.1 Network
The Network object defines the protocol and the board used. You can have up to 16
different protocols on the same project.
To create a network:
Step 1. Open the Communication Objects dialog.
Step 2. Double-click the Network / Creation field.
Step 3. The dialog Network board and protocol selection appears.
Step 4. In the left-hand column, select the appropriate protocol provider
and the protocol in the right-hand column. Click OK button.

Figure 10

We recommend that you always to select the MULTI PROTOCOL


Network Board option.

Step 5. The Network Parameters dialog appears.


Step 6. Type the Network object name in the Network field.

Figure 11

Step 7. Click the Validate button then Cancel to close the dialog.
Now a new Network has been added in the Network column.
To edit a Network object, double-click on it.

V12 Module 08 - Common drivers - Basics Page 13/36


Exercise 2.
Create a new Network with the following parameters:

Parameters Value 1

Protocol Modbus TCP/IP (XBUS-IP-MASTER)

Network name XBUS_IP

V12 Module 08 - Common drivers - Basics Page 14/36


3.2.2 Node
The node object of a Network defines a device communicating with the corresponding
protocol.
To create a Node:
Step 1. Select the Network.
Step 2. Double-click the Node / Creation field.
Step 3. Type the Node object name in the Equipment field.
Step 4. Enter any other parameters that are needed. The parameters
depend on the protocol and the PLC type.

Figure 12

Step 5. Click the Validate button then Cancel to close the dialog.
Now a new Node has been added in the Node column.
To edit a Node object, double-click on it.

You must keep the message time-out parameter at the default


value (0) except with some particular legacy devices.

V12 Module 08 - Common drivers - Basics Page 15/36


Exercise 3.
Create a new Node with the following parameters:

Parameters Value

Node name METER1

Equipment type MODBUS DEC

TCP/IP address 127.0.0.1 (your computer’s address)

Slave address 1

V12 Module 08 - Common drivers - Basics Page 16/36


3.2.3 Frame
The Frame object defines the request to be sent to the node.
To create a Frame:
Step 1. Select the Node.
Step 2. Double-click the Frame / Creation field.
Step 3. Type the Frame object’s name in the Frame field.
Step 4. Select the Frame format and Access grant.

Figure 13

V12 Module 08 - Common drivers - Basics Page 17/36


Step 5. Select the address by clicking on this button: . The Address
selection dialog appears.
Each line displayed corresponds with an address zone in the Node, so it
depends on the protocol and the node type.
The address zone corresponds to the Function configured in the Modbus Poll
tool as shown below.

Figure 14

Step 6. Select the appropriate Address zone, the Starting address and
Quantity of data then click the OK button.
Step 7. Configure the scan rate (polling period).
Step 8. Click the Validate button then Cancel to close the dialog.
Now a new Frame has been added in the Frame column.
To edit a Frame object, double-click on it.

The property Priority Mode should only be used under special


circumstances. Misuse can cause serious performance problems.

V12 Module 08 - Common drivers - Basics Page 18/36


Exercise 4.
Create two new Frames with the following parameters:

Parameters Frame 1 Frame 2

Frame name R_BITS R_WORDS

Frame format BIT WORD

Access grant Read Read

Address zone Bit I/O Word I/O

Starting address 1 1

Quantity of data 10 10

Polling period 1 second 1 second

For one frame, select the starting address 0.


What happened? Why?

V12 Module 08 - Common drivers - Basics Page 19/36


Exercise 5.
Create two more Nodes, each with the same frames
configuration as in the previous exercise. The nodes should
have the following parameters:

Parameters Value

Node name METER2

Equipment type MODBUS DEC

TCP/IP address 127.0.0.1 (your computer’s address)

Slave address 2

Parameters Value

Node name METER3

Equipment type MODBUS DEC

TCP/IP address 127.0.0.1 (your computer’s address)

Slave address 3

V12 Module 08 - Common drivers - Basics Page 20/36


3.3 Variable mapping
Variable mapping is the final step in displaying values from equipment in PcVue’s
variables. During variable mapping we link the real-time value of a variable to a
specific location in the equipment.
Variable mapping can be done either using the Application Architect or the Application
Explorer.

3.3.1 Variable mapping using the Architect


For the purpose of this section we are using a template called METER, representing a
Power Meter, with one bit variable (STATUS) and one register variable (KWH). You
will get to create it later in the exercises!
Step 1. Using the Application Architect select the template and then the
configuration element (variable) that is to be mapped. Change the Source
property to Equipment. Several more properties, related to mapping, appear.

Figure 15

Step 2. We must configure the Network, Node, Frame and Type. The other
mapping properties can be left at their default. Clicking on the button adjacent
to each property displays what is available (that you previously configured). For
example for Network there is XBUS_IP. Select the Network as XBUS_IP.
Step 3. Select the Equipment as METER1. Note that this will be changed
later (see section on Defining a Property by Input) but for now it must have a
valid entry so that the available values for the next property, Frame, are
populated.

In the Application Architect, the Equipment property represents the


communication Node.

Step 4. Select the Frame as R_WORDS.

V12 Module 08 - Common drivers - Basics Page 21/36


Step 5. Select the Type. This depends on the data type in the equipment.
For a register variable, in most cases it will be Integer 16 bits unsigned.
Now, before we finish the configuration we must change the Equipment property so
that it is defined in a different way.

3.3.1.1 Defining a property by input


In a real-life application it is likely that each Power Meter would be a separate piece of
equipment and that this would result in one node per Power Meter in the
communication configuration. This means that each time the METER template is
instantiated, the Equipment property of its variables must have a different value (the
node name).
We call this a dynamic property as the value changes according the instance.

Figure 16

As we have seen up until now, the Architect is very good at creating multiple
instances of variables – but each with the same configuration. In order to allow for a
property to be have a different value for each instance we need to introduce a feature
of the Architect known as “Defining a property by input”.
When you define a property by input, no value is entered for the property in the
template. Instead the value is entered when the template is instantiated.

V12 Module 08 - Common drivers - Basics Page 22/36


Step 6. Select the Node property again and right click to display the context
menu. Select Define by input.

Figure 17

Step 7. Now select the Instances tab and create an instance of the METER
template directly under FLOOR_01.
Step 8. Select the KWH variable and, in the lower right pane, enter the
value for the Equipment property for that instance.

Figure 18

Step 9. Save configuration and generate!


Of course in this case we only have one instance of the METER and so we could have
configured the Equipment property in the normal manner with a fixed value. But if
you can imagine 2 or more instances of the METER then you can see why it must be
done in the above way.

V12 Module 08 - Common drivers - Basics Page 23/36


Exercise 5.
Create a new template named METER and add a bit and register
variable. Map the variables to the communication network node and
frames.

1. Open the Application Architect and select the Templates tab. Create a
new template called METER in the Default Local Library.

2. Add two variables to METER using the following configuration.

Name Type Source Description Command Units Min/Max

STATUS Bit Equipment Meter status No

KWH Register Equipment Kilowatt hours No kWh 0 / 100

3. Configure the Equipment properties for the variables as follows.

Name Network Equipment Frame Type

STATUS XBUS_IP “Define by R_BITS Bit


input”

KWH XBUS_IP “Define by R_WORDS Integer 16 bits unsigned


input”

The other Equipment properties should be left at their default settings.

4. Save the changes.

V12 Module 08 - Common drivers - Basics Page 24/36


Exercise 6.
Instantiate the template, configure the value of the Input properties,
and generate.

1. Open the Application Architect and select the Instances tab. Create an
instance of the METER template under FLOOR_01. Name it METER.

2. Select each variable of the METER instance in turn (Right, central


pane), and enter METER1 for the Input Property referenced
[Equipment]Equipment. (Right, lower pane).

3. Copy and paste the FLOOR_01 node to create FLOOR_02 and


FLOOR_03. Edit the value for each of the Input Properties for
FLOOR_02 and FLOOR_03 so that they reference METER2 and METER3
respectively.

4. Save the changes and generate.

V12 Module 08 - Common drivers - Basics Page 25/36


3.3.2 Variable mapping using the Application Explorer
We will now look at the variable mapping that we just configured using the
Application Architect, but using the Application Explorer. The same process and
dialogs would be used if you were creating the mapping directly using the Explorer.
Step 1. Open the Application Explorer and expand the Variables Tree to
display BUILDING.FLOOR_01.METER. At this point, and assuming all the
conditions are met (communication in PcVue running, simulator running), we
should see that the two variables have valid values and that they have a good
quality. This confirms that the configuration made using the Architect was
successful!

Figure 19

Step 2. Select one of the variables and open its properties dialog. The
properties that we interested in are all in the Source tab.

Figure 20

V12 Module 08 - Common drivers - Basics Page 26/36


In the Source tab you can see same properties as were available in the
Application Architect. If you were configuring the communications here (rather
than just checking it) the properties can all be selected in a similar manner to in
the Architect using a drop down list boxes.
Step 3. Click the Link button. This is the big difference compared to the
Architect and the reason some developers prefer to use the Explorer to
configure the communication mapping. The dialog box that the Link button
opens shows the entire frame and all variables that are linked to it.

Figure 21

[A] Communication objects,


[B] Address.
Using the Mapping dialog you can change or add several variables to the
mapping in one action.

V12 Module 08 - Common drivers - Basics Page 27/36


Exercise 7.
Check communications between PcVue and the Modbus Slave
tool.

1. Start the Modbus Slave. Select Holding Registers and change


the value of the first register (40001). Note that, in this
particular simulator, the same value is used for all slaves.

2. Start the communication and, using the Application Explorer,


check the variables’ values.

Disable the Modbus Slave. What are the variables’ values?

V12 Module 08 - Common drivers - Basics Page 28/36


In the Modbus Slave, set the Word value to 150. What is the value of
the PcVue variable? Why?

When does the following Timestamp change?

V12 Module 08 - Common drivers - Basics Page 29/36


3.4 Optimisation and maintenance
Unfortunately it is unusual to implement communication successfully the first time!

3.4.1 PcVue Communication Manager


The Communication Manager is the module that manages the processing of frames as
shown below.

Figure 22

Here we have two frames: Frame2 and Frame10 have polling periods of 2 and 10
seconds respectively.
Each polling period, the frame is added to the communication stack. When at least
one frame is in the stack it is sent to the Slave. When the slave reply is received the
frame is removed from the stack.
When you are configuring communication you must try to optimize it as much as
possible. To do that you must tune these three parameters:
The number of frames,
The polling period,
The write data.

V12 Module 08 - Common drivers - Basics Page 30/36


3.4.1.1 Number of frames
It’s usual to suppose that a frame requesting 10 words is faster than a frame
requesting 100 words. Actually this is wrong. The time used to read 10 or 100 word is
the same. This is because during an exchange, most of the time consumed is used to
build and transmit the frame.
Therefore most of the time spent in the communication process is to manage the
frames whatever their size. To understand that, try to solve this basic problem:
100 people want to travel from a point A to point B linked by a highway. This highway
has a toll at the beginning and a toll at the end.
The question is: Which is the faster? 100 cars transporting one person each or one
bus transporting 100 persons (assuming the speed of the car and the bus is the same
of course)?

Figure 23

Of course it’s faster using the bus as it is only processed once at the tolls, whereas
each car must be processed individually. So using one frame “transporting” 100 data
items is faster than 100 frames “transporting” 1 data item.

To have smooth traffic you must configure the communication to


have the minimum number of frames.

V12 Module 08 - Common drivers - Basics Page 31/36


3.4.1.2 Polling period
The polling period is also an important parameter to optimise the communication. If
the Master is polling too fast it will increase the traffic on the network.
For example we know that when you are using a Modbus serial link communication
with 19,200 baud, one frame requires around 100ms to be sent to the slave and for
the answer to be returned to the Master. It means you can have up to 10 frames per
second. What will happen if you configure 15 frames with a polling period of 1 second
each?

3.4.1.3 Write data


Some projects need to write data to the PLC. In theory there is no problem with
sending a frame to write data in the Slave. But a performance problem occurs when
you send many controls at a fast rate. The following figure helps you to understand
why:

Figure 24

You can see that PcVue manages two stacks: the read frames stack and the write
frames stack. The write frames stack always gets priority because a control can be
very important.
If you send a control every second then PcVue will add the write frame every second
on the top of the write frames stack. Therefore the frames from the read frames stack
will never be sent and the HMI never refreshed!!
A classical mistake is to send a heartbeat to the PLC too frequently.
Don’t send controls that are too many and/or too fast.
If you need to send many values in one shot to the PLC you should
use the Recipe function. Check the Recipe module in this training
course.

V12 Module 08 - Common drivers - Basics Page 32/36


3.4.2 Maintenance and debugging
In case of failure, PcVue provides status information to help you to find the problem.
When a communication object is selected, the system supplies a set of states and
counters. Two hexadecimal state codes and two error counters are associated with
each network, equipment and frame. You can select them in real time by selecting
the required network, equipment and frame. The figure below shows the
State/Counter for the selected network.

Figure 25

It’s important to understand the difference between the Status and the Protocol
Status. The Status is set by the Communication Manager and informs you of whether
this object is communicating well or not. Here you can see various status values:
Network Node Frame Meaning

0700 0700 a000 The communication is fine!

0700 0700 e000 The communication is working but the


“unstacking” is slower than the stacking
(See Figure 22).
Solution: Increase the scan period.

0413 Network error: PcVue cannot


communicate with the selected COM
channel.
Solution: COM port problem, Ethernet
card disabled etc.

0701 0701 xxxx Communication out of order for this


frame.
Solution: Check the Protocol status and
check the frame parameters.

The protocol status is a code sent by the equipment or by the protocol driver. For
example if you try to read data which is outside of the PLC’s range it will send back a
code. PcVue will display this code in the Protocol status.

V12 Module 08 - Common drivers - Basics Page 33/36


This code depends on the driver’s implementation. Check the driver
documentation (in PcVue’s online Help) or the PLC’s
documentation.
When a communication failure occurs, PcVue sends an event to the Event Viewer.
Then you can debug in Runtime mode as well. The following message is an example:
Status a021 - 2 - 1658 - 562, (1.XBUS_IP.PLC1.R_WORDS)
with
Status a021: Frame status
2: protocol status
1658: State counter 1
562: State counter 2
(1.XBUS_IP.PLC1.R_WORDS): Frame name

Exercise 8.
Disconnect the Modbus Slave and check the different
Communication status.
Also check the Event viewer.

V12 Module 08 - Common drivers - Basics Page 34/36


3.4.3 Starting the communications when PcVue starts
By default the native driver communication is off when PcVue starts up.
To start the communication automatically:
Step 1. In the Application Explorer configuration tree, select the node
representing the project. From the task list select Settings.
Step 2. In the left pane, select the Station start-up node.
Step 3. Tick the Equipment option.

Figure 26

V12 Module 08 - Common drivers - Basics Page 35/36


4 Summing-up
PcVue is able to communicate with many protocols on a serial network, an
Ethernet network or proprietary networks.
The communication configuration uses three objects: network, node and frame.
You can debug failed communication using the communication object’s status.
The communication MUST be optimised.

V12 Module 08 - Common drivers - Basics Page 36/36

You might also like