You are on page 1of 31

PcVue Solutions Training

Common drivers

Purpose
n Some communication concepts,
n Configure communication in PcVue,
n Optimize and maintain communication.
Contents

1. Introduction 3
1.1. PcVue version 3
1.2. Files used in this module 3
1.3. 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. About variable mappings 8
3.1.4. Modbus Simulator User Interface 10

3.2. Communication Configuration 12


3.3. Variable mapping 19
3.3.1. Variable mapping using the Variables Tree 19
3.3.2. Variable mapping using Communication 21
3.3.3. Starting the communications when PcVue starts 22

3.4. Optimisation and maintenance 25


3.4.1. PcVue Communication Manager 25
3.4.2. Maintenance and debugging 28

4. Summing-up 31

Module 09 _ Common drivers 2


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
1. Introduction

1.1. PcVue version

This module applies to PcVue version 15.0.

1.2. Files used in this module

The PcVue project as at the end of Module_08.

1.3. 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_09\Third party\.

Module 09 _ Common drivers 3


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
2. This feature in PcVue architecture

Figure 1

Module 09 _ Common drivers 4


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
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 equip-
ment across a network or networks. There are three types of industrial networks:

l Serial link: RS232 or RS485 cables. PcVue uses the computer’s COM port or a ded-
icated communication board such as Applicom.
For example Modbus RTU, Mitsubishi MELSEC-A Series etc...

l Ethernet: PcVue uses the computer’s Ethernet card.


For example Modbus TCP/IP, Siemens S7 etc...

l 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 pro-
tocol is a standard “language” used by two systems to communicate together. PcVue sup-
ports 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.

Module 09 _ Common drivers 5


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
In PcVue vocabulary, the PLC is called a Node.

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 Redund-
ancy 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.

Module 09 _ Common drivers 6


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
Figure 3

1/ The Master sends a frame to read some bits and waits for the reply.

2/ The Slave sends the reply. Then it waits for the next frame.

5 seconds later this process repeats and so on…

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 dia-
gram represents this process.

Module 09 _ Common drivers 7


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
Figure 4

1/ The Master sends a frame to read some bits and waits for the reply.

2/ The Slave sends the reply. Then it waits for the next frame.

5 seconds later this process repeats and so on...

3/ The Master sends a frame to read some words and waits for the reply..

4/ The Slave sends the reply. Then it waits for the next frame.

5 seconds later this process repeats and so on...

3.1.3. About variable mappings

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 start-
ing at address 0.

Module 09 _ Common drivers 8


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
Figure 5

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

a. Install the Modbus slave simulator.

l Run My Documents\Pcvue Training \Module_09\Third party\SimSetup.msi


and follow the instructions.

b. Create a shortcut on the desktop.

l Use Windows Explorer to locate the folder: C:\Program Files (x86)\Embed-


dedIntelligence\Mod_RSsim.

l Right click mod_RSsim.exe and select Create Shortcut. Follow the prompts to
create a shortcut on your PC’s desktop.

c. Start the Modbus TCP/IP Slave and enter the registration key.

l 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.

Module 09 _ Common drivers 9


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
l Click the About button and then the Register button and enter the User
Name and KEY exactly as in the screenshot below:

Figure 6

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

3.1.4. Modbus Simulator User Interface

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

Module 09 _ Common drivers 10


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
Figure 7

[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 mes-
sages 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 255 possible Modbus slaves
at the same time! You can disable a particular slave by clicking on its number. A slave num-
ber surrounded by a yellow box means that it has recently been polled.

Module 09 _ Common drivers 11


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
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:

l Network,

l Node,

l 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 Applic-
ation Explorer/Communication/Data Acquisition/Equipment/Configuring a pro-
tocol.

The configuration is done using the Communication Objects dialog. You can open it via
Configure / Communication / Equipment.

Figure 8

Module 09 _ Common drivers 12


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
Equipment configuration currently can only be accessed from the Menu (not
from the Application Explorer or Application Architect).

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 Modbus node to
manage both lifts. This odbus node will have two frames, one to read bits and
the other to read words.

Network

Module 09 _ Common drivers 13


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
The Network object defines the protocol and the board used. You can have up to 16 dif-
ferent protocols on the same project.

To create a network:

1. Step 1 Open the Communication Objects dialog.

2. Step 2 Double-click the Network / Creation field.

3. Step 3 The dialog Network board and protocol selection appears.

4. 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.

5. Step 5 The Network Parameters dialog appears.

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

Module 09 _ Common drivers 14


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
Figure 11

7. 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.

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

Parameters Valeur

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


Network name XBUS_IP

Node

The node object of a Network defines a device communicating with the corresponding pro-
tocol.

To create a Node:

1. Step 1 Select the Network.

2. Step 2 Double-click the Node / Creation field.

3. Step 3 Type the Node object name in the Equipment field.

4. Step 4 Enter any other parameters that are needed. The parameters depend on
the protocol and the PLC type.

Module 09 _ Common drivers 15


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
Figure 12

5. 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.

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

Module 09 _ Common drivers 16


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
Parameters Value

Node name PLC1


Equipment type MODBUS DEC
TCP/IP address 127.0.0.1 (your computer’s address)
Slave address 1

Frame

The Frame object defines the request to be sent to the node.

To create a Frame:

1. Step 1 Select the Node.

2. Step 2 Double-click the Frame / Creation field.

3. Step 3 Type the Frame object’s name in the Frame field.

4. Step 4 Select the Frame format and Access grant:

Figure 13

5. Step 5 Select the address by clicking on this button . The Enter address and
size dialog appears.
Each line displayed corresponds with an address zone in the Node, so it

Module 09 _ Common drivers 17


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
depends on the protocol and the node type.

Figure 14

6. Step 6 Select the appropriate Address zone, the Starting address and Quantity
of data then click the OK button.

7. Step 7 Configure the scan rate (polling period).

8. 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.

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

Module 09 _ Common drivers 18


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
Parameters Frame 1 Frame 2

Frame name R_BITS R_MOTS


Frame format BIT WORD
Access grant Read Read
Address zone Bit I Word I
Starting address 1 1
Quantity of data 10 10
Polling period 1 second 1 second

For one frame, select the starting address 0.


What happens? Why?

3.3. Variable mapping

Variable mapping is the final step in displaying values from equipment in PcVue 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 Variables Tree

We will first look at the variable mapping using the Variables Tree of the Application
Explorer.

1. Step 1 Open the Application Explorer and expand the Variables Tree to display

Module 09 _ Common drivers 19


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
BUILDING.LIFT_01.

2. Step 2 Select one of the variables and open its properties dialog. The properties
that we interested in are all in the Source tab. Here we must switch Source
value from Internal to XBUS_IP, then set values for Node and Frame fields.

Figure 15

3. Step 3 Click the Link button. The dialog box that the Link button opens shows the
entire frame and all variables that are linked to it. Double-click on the

Module 09 _ Common drivers 20


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
appropriate address.

Figure 16

3.3.2. Variable mapping using Communication

We will now look at the variable mapping using Communication node in the Application
Explorer.

1. Step 1 Open the Application Explorer and browse towards Communication.Data


acquisition.Equipment.XBUS_IP.

Figure 17

Module 09 _ Common drivers 21


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
2. Step 2 Select Mapping in the left pane or by right-clicking on the network. Then
browse towards a frame in order to view it.

3. Step 3 With a right-click on an address, you can open the Variable Selector in
order to map an existing variable, or automatically create a new variable
mapped with an address.

Figure 18

3.3.3. Starting the communications when PcVue starts

By default the native driver communication is off when PcVue starts up.

To start the communication automatically:

1. Step 1 In the Application Explorer configuration tree, select the node representing
the project. From the task list select Settings.

2. Step 2 In the left pane, select the Station start-up node.

3. Step 3 Tick the Equipment option.

Module 09 _ Common drivers 22


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
Figure 19

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

a. Map the variables of both lifts on Word and Bit frames as on the following
picture:

Module 09 _ Common drivers 23


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
Figure 20

b. Start the Modbus Slave. Select Analog Inputs and modify the value of the
first register (30001) in order to change the floor number for Lift 1.

c. Start the communication and, using the Application Explorer, check the vari-
ables’ values.

Disable the Modbus Slave. What are the variables’ val-


ues?

Module 09 _ Common drivers 24


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
When does the following Timestamp change?

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.

Module 09 _ Common drivers 25


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
Figure 21

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:

l The number of frames,

l The polling period,

l The write data.

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 words 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:

Module 09 _ Common drivers 26


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
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 trans-
porting 100 persons (assuming the speed of the car and the bus is the same of course)?

Figure 22

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 min-
imum number of frames.

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?

Write data
Module 09 _ Common drivers 27
Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
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 23

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 be 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. This function is described in the Recipe module which is
covered by another training course.

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, equip-
ment and frame. You can select them in real time by selecting the required network, equip-
ment and frame. The figure below shows the State/Counter for the selected network:

Module 09 _ Common drivers 28


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
Figure 24

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 com-
municating well or not. Here you can see various status values:

Network Node Frame Signification

0700 0700 a000 The communication is fine!


The communication is working but the “unstacking” is slower than the
0700 0700 e000 stacking.
Solution: Increase the scan period..
Network error: PcVue cannot communicate with the selected COM chan-
0413 nel.
Solution: COM port problem, Ethernet card disabled etc…
Communication out of order for this frame.
0701 0701 xxxx
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.

Module 09 _ Common drivers 29


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
This code depends on the driver’s implementation. Check the driver doc-
umentation (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.L_WORDS)

with

Status a021: Frame status

2: protocol status

1658: State counter 1

562: State counter 2

(1.XBUS_IP.PLC1.L_WORDS): Frame name

Exercise 6.

l Disconnect the Modbus Slave and check the different Communication status.

l Also check the Event viewer.

Module 09 _ Common drivers 30


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020
4. Summing-up

l PcVue is able to communicate with many protocols on a serial network, an Ethernet


network or proprietary networks.

l The communication configuration uses three objects: network, node and frame.

l You can debug failed communication using the communication object’s status.

l The communication MUST be optimised.

Module 09 _ Common drivers 31


Arc Informatique © Copyright 2020. All rights reserved Updated 12/11/2020

You might also like