Module 08 - Common Drivers - Basics
Module 08 - Common Drivers - Basics
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
4 Summing-up 36
Figure 1
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.
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…
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...
Figure 5
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.
Figure 7
Figure 8
[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.
Figure 10
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.
Parameters Value 1
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.
Parameters Value
Slave address 1
Figure 13
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.
Starting address 1 1
Quantity of data 10 10
Parameters Value
Slave address 2
Parameters Value
Slave address 3
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.
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.
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
1. Open the Application Architect and select the Templates tab. Create a
new template called METER in the Default Local Library.
1. Open the Application Architect and select the Instances tab. Create an
instance of the METER template under FLOOR_01. Name it METER.
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
Figure 21
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.
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.
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.
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
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.
Exercise 8.
Disconnect the Modbus Slave and check the different
Communication status.
Also check the Event viewer.
Figure 26