Professional Documents
Culture Documents
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
4. Summing-up 31
Figure 1
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...
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.
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.
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.
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.
Of course a Master can read different types of data in the same Slave. The following dia-
gram represents this process.
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.
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.
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.
Exercise 1.
Install and configure Modbus slave simulator.(PLC simulator).
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.
Figure 6
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.
[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…
[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.
Configuring the communication is the first step to displaying values from equipment in
PcVue’s variables.
l Network,
l Node,
l Frame.
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
Figure 9
[A] : Three columns displaying the configured communication objects: Network, Node and
Frame. Of course by default it is empty.
[C] : On / Off buttons. Used to start and stop the entire communication manually.
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
To create a network:
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
7. Step 7 Click the Validate button then Cancel to close the dialog.
Exercise 2.
Create a new Network with the following parameters:
Parameters Valeur
Node
The node object of a Network defines a device communicating with the corresponding pro-
tocol.
To create a Node:
4. Step 4 Enter any other parameters that are needed. The parameters depend on
the protocol and the PLC type.
5. Step 5 Click the Validate button then Cancel to close the dialog.
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:
Frame
To create a Frame:
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
Figure 14
6. Step 6 Select the appropriate Address zone, the Starting address and Quantity
of data then click the OK button.
8. Step 8 Click the Validate button then Cancel to close the dialog.
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:
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.
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
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
Figure 16
We will now look at the variable mapping using Communication node in the Application
Explorer.
Figure 17
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
By default the native driver communication is off when PcVue starts up.
1. Step 1 In the Application Explorer configuration tree, select the node representing
the project. From the task list select Settings.
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:
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.
The Communication Manager is the module that manages the processing of frames as
shown below.
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:
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:
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!!
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.
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:
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:
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:
with
2: protocol status
Exercise 6.
l Disconnect the Modbus Slave and check the different Communication status.
l The communication configuration uses three objects: network, node and frame.
l You can debug failed communication using the communication object’s status.