Chapter 3 Device and Tag

advertisement
Chapter 3 Device and Tag
Chapter 3 Device and Tag
Centent
Establish new communication channel
Establish new device
Establish new block
Define basic tag
Define data model
Summry
The chapter tell how to define deivce and tag. Basic tag and data model wiil be used in the
training project.
The acquisition system of KingSCADA3.0 can communicate with field devices to collect
field data and control field device modules called collectors or IO Server. The system is a
standalone application and can be operated without KingSCADA3.0 software, but the
KingSCADA3.0 driver must be installed to allow communication through the device driver with
the IO Server. The acquisition system is composed of the communication channels, equipment and
data blocks.
Communication Channels: Communication channels are paths for data to travel so the
computer and a device are connected. Link categories include: serial, Ethernet, GPRS, modem,
communication card, collecting card and no link.
Devices: Equipment through the serial port or other interface that connect with the
KingSCADA3.0 data acquisition system for the data exchange of information. Devices include a
Programmable Logic Controller (PLC), Distributed Control System (DCS), loop controllers,
Remote Terminal Unit (RTU), intelligent instruments, board, frequency converter and more.
Data Blocks: Data is acquired from equipment in data packets. Packets are then grouped together
in blocks. Blocks can also have the data defined with a serial address allowing data to be acquired
in one procedure. Blocks can also be used to enhance acquisition efficiency, by defining the most
important data and assigning a higher frequency that other data blocks, data will be acquired faster
than other blocks.
Wellintech Development Co., Ltd
Chapter 3 Device and Tag
Section 1 Establish device system
New channel
Step 1: select “Device” → “IO Servers” icon, click the “new” icon in the toolbar, then pop-up
dialogue box, as figure 3-1 shows.
Figure 3-1 new IO Server
Several IO Server can be established in one project, and it also can work itself by
disengaging KingScada3.0. IO Servers have local IO Servers that they are in the same PC with
KingScada3.0 and remote IO Servers that they are not in the same PC with KingScada3.0. The
name, type, path can be set in the dialogue box, if it is the remote IO Server, the IP and Port
should be write correctly. But in this training, we select local IO Server, so the two options should
not be set. Now wo set the name IO Server1, and default the path.
After setting, click the “OK” icon, the IO Server is crested, as Figure 3-2 shows.
Figure 3-2 IO Server
Step 2: Select the established IO Server, right click and select new channel. This will display the
new channel window, as figure 3-3 shows.
Wellintech Development Co., Ltd
Chapter 3 Device and Tag
Figure 3-3 New channel
Select device driver Siemens S7200 PPI, it communicates by serial port, click ”next”, pop-up
redundancy channel dialogue box, as figure 3-4 shows.
Figure 3-4 New Channel dialogue box 2
Wellintech Development Co., Ltd
Chapter 3 Device and Tag
Because this has not redundancy channel, so do not need to set the dialogue box, click “Next”
icon, pop-up optimizing set dialogue, as figure 3-5 shows.
Figure 3-5 New channel dialogue box 3
When the write instruction is frequent, many write packages are formed in IO Server inside,
for these packages you can set the following options:
Write only latest value for Non-Bool: when tag is Non-Bool, discard the other write packages
about this tag, treat the latest write package. (default)
Write only latest value for all item: all tags, discard the other write packages, treat the latest
package.
Write all values for all datatype item: treat all write packages.
The proportion about write packages to read packages: when write frequently, the read
packages is not treat for a long time, because the write first mechanism in IO Server. Then the
pictures do not refresh for a long time. For decreasing the bad effect, we set the proportion about
write packages to read packages. The default value is 10, it means it would treat one read package
after treating 10 write packages.
Wellintech Development Co., Ltd
Chapter 3 Device and Tag
We use the default value, click “Next”, pop-up circle query time set dialogue box, as figure
3-6 shows.
Figure 3-6 New channel dialogue box 4
This box is used to set the delay time:
The delay time after treating one package: default 0
The delay time after treating a circle and the time treating a circle, could choose one from the
two options. The default situation is the firest option, and the delay time is 0. If customers want to
set the two blocks collecting times are 1s and 2s, set the circle time is 2s, and set the collecting
times is 2 and 1 in block property.
We use the default in this training, click “next”, pop-up the communication parameter
dialogue box, as figue 3-7 shows.
Figue 3-7 New channel dialogue box 5
Wellintech Development Co., Ltd
Chapter 3 Device and Tag
In this dialogue box the serial port parameters can be configed, inculed band rate, data bit,
stop bit, parity, etc. The configuration must be the same as the real device, if not the
communication would be fail.
Click “next” to finish the channel.
New device
Establishing device is the process confirms which communication protocol fixes the device.
Select the estabilshed channel, right click and from the menu select new device, pop-up the
dialogue box, as figure 3-8 shows.
Figure 3-8 New device dialogue box 1
We seclect the Siemens s7-200 device, put a device name: S7200PLC, click “next”, pop-up
timeout dialogue box, as figure 3-9 shows.
Figure 3-9 New device dialogue box 2
Wellintech Development Co., Ltd
Chapter 3 Device and Tag
Communication timeout: it is the time waiting for reback relevant instruction after sen the
instruction, default time is 3000 milliseconds.
Device communication failed times: default 3 times, after 3 times failed, the divice is
considered fault, the data blocks belong to the device are not collected.
Select default value, click “next”, pop-up the recovery dialogue box, as figure 3-10 shows.
Figure 3-10 New device dialogue box 3
Recovery Interval: When KingSCADA3.0 fails to communicate with the equipment,
KingSCADA3.0 will try to reconnect to the device using the recovery interval time.
Recovery Time: When KingSCADA3.0 fails to communicate with the equipment during the
recovery time, after the time has expired KingSCADA3.0 will no longer try to communicate with
the device.
Choose the default time and click next to complete the new device settings
New block
Select an existing device, right click and select new block from the menu. Pop-up a block
settings dialogue box, as figure 3-11 shows.
Figure 3-11 New block dialogue box
Wellintech Development Co., Ltd
Chapter 3 Device and Tag
Establish a block, it include M1-M100, when it is runtime, the data of M1-M100 would be a
package, the system collects the data in the package at the same time.
Section 2 Tag Definition
The tags defined in KingSCADA3.0 have great difference with those defined in general
program languages such as BASIC, PASCAL and C language. They should not only satisfy
general requirements of language programming but also special requirements of industrial control
software. The tag types that are supported by KingSCADA3.0 are as follows:
System tag: Basic tag, each tag is an individual object and cannot be modified.
Basic tag: Basic tag, each tag is an individual object.
Structure tag: The tag exists in the format of structure and is the collection of several basic
tags.
Reference tag: using a group of tags to substitute tags all of which have the same data type.
The data types of basic tags are as follows:
I/O tag: Boolean, real number, integer type and string
Memory tag: Boolean, real number, integer type and string
Tag Definition
The progress about tag definition:
Step 1: Select “Database”  “Tag Dictionary” in turn in the tree-structured directory of
KingSCADAMake, and all custom tags and system tags in current project is shown in the display
place which is located at the right of the directory. Click the “New” button, the “Tag Properties”
dialog box will be popped up as figure 3-12 shows.
Figure 3-12 New tag definition dialogue box
Wellintech Development Co., Ltd
Chapter 3 Device and Tag
There are three default property tabs in the dialog box: General, History and Alarm. If you
select an I/O tag type in the list box of data type, an I/O property tab is added.
Figure 3-12 property card
Step 2: define the tags which the training project needs.
Name: temperature
Tag type: basic
Data type: Mem float
Description: reacter temperature
Initial value: 0
Sensitivity: 0
Max: 100
Min: 0
Save value: selected
Name: liquid_level
Tag type: basic
Data type: Mem float
Description: reacter liquid level
Initial value: 0
Sensitivity: 0
Max: 100
Min: 0
Save value: selected
Name: valve_gate1
Tag type: basic Disc
Data type: Mem
Description: reacter feed-in valve 1
Initial value: closed
Wellintech Development Co., Ltd
Chapter 3 Device and Tag
Save value: selected
Name: valve_gate2
Tag type: basic
Data type: Mem Disc
Description: reacter feed-in valve 2
Initial value: closed
Save value: selected
Name: valve_gate3
Tag type: basic
Data type: Mem Disc
Description: reacter discharging valve
Initial value: closed
Save value: selected
Name: water_pump
Tag type: basic
Data type: Mem Disc
Description: reacter discharging water pump
Initial value: closed
Save value: selected
Name: motor
Tag type: basic
Data type: Mem Disc
Description: reacter stir motor
Initial value: closed
Save value: selected
Defining these tags for demonstrating, in the real project tags should be IO value. The
following is IO value properties introduction.
The meanings of each item are as follows:
Access Name: Set the source of IO tag, click the button “…” and choose an IOServer that has
already been defined in the dialog box popped up.
Data Block: Data block refers to a section of continuous address in the device, and there are
several tags in a data block, tags in the same data block are acquired in one data frame. This item
is used to set the data block that a tag belongs to and input the name of the data block.
Wellintech Development Co., Ltd
Chapter 3 Device and Tag
Frequency: Set the acquisition frequency of the tag, and that is the time interval between each
acquisition of the data by KingSCADA3.0 in the device. The item is valid only if the tag does not
belong to any data block.
Data type: set the data type of the register corresponding to the tag, and users can select one
of the nine data types:
BIT: 1 bit
ranges between 0 and 1.
BYTE: 8 bits, 1 byte
SHORT: 2 bytes
ranges between 0 and 255.
ranges between -32768 and 32767.
UNSHORT: 16 bits, 2 bytes
BCD: 16 bits, 2 bytes
ranges between 0 and 65535.
ranges between 0 and 9999.
LONG: 32 bits, 4 bytes
ranges between -2147483648 and 2147483647.
LONGBCD: 32 bits, 4 bytes
FLOAT: 32 bits, 4 bytes
ranges between 0 and 4294967295.
ranges between 0 and 255.
STRING: the maximum length is 128 characters.
DOUBLE : 64 bits, negative values range from -1.79769313486231570E+308 to
-4.94065645841246544E-324, and positive values range from 4.94065645841246544E-324 to
1.79769313486231570E+308. 6464
Read/Write Mode:
Read Only: The value of the tag that is defined as Read Only needs to be acquired but does
not need to be modified.
Read/Write: Tags that are defined as Read/Write not only need to be outputted but also need
to be read back.
Write only: Tags that only need to be outputted but do not need to be read back can be
defined as Write Only.
NOTE: If the acquisition frequency of Write Only Tag is set to be 0, write operation will be
triggered only if the value of the data is changed. The recommended value of the acquisition
frequency for write only tag is 0.
Min Raw Value: The property is invalid for string tag and discrete tag, the value is the lower
limit of the actual numerical value acquired from the driver and the data type of the value is the
same as that of the tag.
Max Raw Value: The property is invalid for string tag and discrete tag, the value is the upper
limit of the actual numerical value acquired from the driver and the data type of the value is the
same as that of the tag.
Wellintech Development Co., Ltd
Chapter 3 Device and Tag
Enabled: Set whether the value of the tag is to be acquired or not, if the item is selected, the
value of the tag is acquired, while KingSCADA3.0 is running, otherwise, the value will not be
acquired. User can also change the property value dynamically with IOEnable in TouchView.
Force Read: The item is a check button, and if it is selected, Record, Alarm and other
operation are all conducted every time the data is acquired (data reported), no matter that the data
has not been changed. User can also change the property value dynamically with IOEnable in
TouchView.
Force Write: The item is a check button, and if it is selected, reset or input the value of the
tag in the picture of KingSCADA3.0, the write operation is executed once, and the data is written
to the device, no matter that the value is not changed user. User can also change the property value
dynamically with IOEnable in TouchView.
If the definition of the tag is finished, click the “OK” button, and the new tag is added into
the Tag Dictionary.
Creating a Data Model
Data Model: Data models simulate the data of actual industrial equipments. The model is a
combination of variables and script algorithms Using and configuring relevant parameters of the
data model, users can quickly apply these data and scripts to a project.
Using the data model, you could ahieve quick tag definition function. The function is very
important to establish complicated and more tags project.
We establish 3 data models of liquid level, valve, water pump. Put the control logic relation
about liquid level, valve and water pump into data model. When the liquid level below the low
limit, start pump and valve automatically. When it above the high limit, close the valve, stop the
pump.
Create a data model
Step 1: In the kingMake directory tree of KingSCADA3.0 select database, then data model
and click the new button from the right hand side edit area. Pop-up the dialogue box, as figue 3-14
shows.
Wellintech Development Co., Ltd
Chapter 3 Device and Tag
Figure 3-14 create data model dialogue box
Name, description and other properties are put as needs, the ID is created by system, it should
be default.
After setting, click “OK” icon, the data model would be showed in the exhibition area, as
figure 3-15 shows.
Figure 3-15 data model in edition area
Step 2: select the data model icon and click edit or double click the data model icon. A dialog
box will appears as shown in Figure 3-16. If a password has been assigned then the system will
automatically prompt for a password to be entered. Once the password has been validated the
windown shown in the following figure will be displayed:
Wellintech Development Co., Ltd
Chapter 3 Device and Tag
Figure 3-16 dada model definition dialogue box
A data model can include variables, parameters and scripts. Using this window, variables,
parameters and control scripts of data models can be created. Configuration is explained in the
following sections.
Parameters of Data Models
When defining a data models variables, the variables property value can be directly related to
or include parameters. When data model instantiates to data objects change, the parameters value
can change a property value of variables. Parameters have the function of macro substitution.
Supported data types: String, Long Integer, Float, Bool.
We define two parameters: HiLimit, LiLimit.
Select the parameters in the left hand window pane and right click the mouse button. From
the sub menu click new parameter to display the window shown below 3-17.
Wellintech Development Co., Ltd
Chapter 3 Device and Tag
Figure 3-17 New parameter dialogue box
Define the parameter in data model as below:
Name: HiLimit
Description: liquid level high limit value
Data type: float
Default value: 95.5
Name: LoLimit
Description: liquid level low limit value
Data type: float
Default value: 15.5
Data Model Variables:
Data model tags properties can be locked and when locked a change of data model properties
will spread to the instantiated data objects and modify the property change. Otherwise the change
will not be spread to the data objects. Click the
changes to the
behind the properties and when this button
symbol then the property is locked.
Select the tags shown in figure 3-16, right click and from the pop up menu select new tags.
The tag properties window shown in Figure 3-18 will be displayed:
Wellintech Development Co., Ltd
Chapter 3 Device and Tag
Figure 3-18 New tag properties
Define the tag in data model as below:
Name: liquid_level
Data type: Mem Float
Description: liquid level
Initial value: 0
Sensitivity: 0
Min: 0
Max: 100
Save value: selected
Locked properities
Click “Alarm” option, setting high, low alarm value, hilimit value connects the HiLimit tag,
Lolimit value connects the LiLimit tag, click
icon, select the relevant parameter, as figure 3-19
shows, after selecting, as figure 3-20 shows.
Wellintech Development Co., Ltd
Chapter 3 Device and Tag
Figure 3-19 parameter selector
Figure 3-20 alarm setting
Define the other tag in data model:
Name: valve_gate
Data type: Mem Disc
Description: pump status.
Initial value: closed
Wellintech Development Co., Ltd
Chapter 3 Device and Tag
Save value: selected
Locked properties
Name: water_pump
Data type: Mem Disc
Description: pump status
Initial value: closed
Save value: selected
Locked properties
Data Model Scripts
Data model scripts are script programs which are written for data models. Only defined tags
and system tags can be used in scripts, such as: $Year、$Month、$Day etc. Additional functions
provided by KingSCADA3.0 can also be used. The supported script types are: Data Change,
Expression, Custom Function, Timer Script.
We use the expression to make the control logic come true, the relation is: When the liquid
level below the low limit, start pump and valve automatically. When it above the high limit, close
the valve, stop the pump.
Click “new” icon in expression area, pop-up dialogue box as figure 3-21 shows.
Figure 3-21 expression
Wellintech Development Co., Ltd
Chapter 3 Device and Tag
Create 3 expression scripts:
1. Write in condition:
liquid_level>liquid_level.HiLimit
Write in entering:
valve_gate=0;
water_pump=0;
2. Write in condition:
liquid_level<liquid_level.LoLimit
Write in entering:
valve_gate=1;
water_pump=1;
3. Write in condition:
valve_gate==1
Write in existing:
liquid_level=liquid_level+0.78;
Step 3: the product of data model instance is data model variable
In the KingMake directory tree of KingSCADA3.0 select database and then select data model
instances. Click the new button from the right hand side edit area and the dialog window shown
below will appear.
Figure 3-22 Data model instance properties
Wellintech Development Co., Ltd
Chapter 3 Device and Tag
Name: activator
Data model: Control
Click “OK” icon,
Using the same way to create another object
Name: material
Data model: Control
The two data model variables have the same data model, the model has 3 variables. That
means 6 variables be created. When the data model instance is finished, the variables are the data
model variables, they are the same as the project variables, they could be used in everywhere in
project, the used method is the same too.
So far, the devices and tag definition are finished. Next we would learn how to use the
Graphy editor.
After-school practice:
1. Try to establish the Siemens S7-300 with MPI to communication.
2. Try to establish the Omron PLC with hostlink to communication.
Wellintech Development Co., Ltd
Download