Professional Documents
Culture Documents
xx
TONS driver, User information and design
Citect for Windows, V5.xx TONS driver
Contents
1. GENERAL .........................................................................................................6
1.1 ABBREVIATIONS.............................................................................................6
1.2 OVERVIEW .....................................................................................................6
1.3 DRIVER DESCRIPTION .....................................................................................6
2. USER INFORMATION ....................................................................................8
2.1 APPLICATION NOTES FOR DEVICE VETHX1....................................................8
2.1.1 Overview.................................................................................................8
2.1.2 Communication Configuration – VETHX1 ..............................................8
2.1.3 Hints, Tips, and Frequently asked Questions.........................................11
2.2 APPLICATION NOTES FOR TOSHIBA ONS SERVICE ........................................13
2.2.1 ONS Installation Guide.........................................................................13
2.2.2 ONS Verification Guide ........................................................................14
2.2.3 ONS Architecture..................................................................................14
2.3 DRIVER REFERENCE .....................................................................................15
2.3.1 Description ...........................................................................................15
2.3.2 Installation Requirements .....................................................................16
2.3.3 Driver Methodology..............................................................................17
2.3.4 ONS API Access....................................................................................17
2.3.5 Reference: Required Components .........................................................18
2.3.6 Reference: Communications forms........................................................18
2.3.7 Citect Tag Address Format ...................................................................19
2.3.8 Reference: Supported Data Types .........................................................20
2.3.9 Parameters, Options, and Settings ....................................................2321
2.3.10 Advanced ..........................................................................................2421
3. ANALYSIS...................................................................................................2825
3.1 OVERVIEW ...............................................................................................2825
3.2 PROGRAMMING REFERENCE .....................................................................2825
3.2.1 ONS API Functions Reference ..........................................................2825
3.2.2 ONS API Usage Reference ................................................................2825
3.2.3 Required Build Settings.....................................................................2926
3.3 CITECT TAG ADDRESS FORMAT CONVENTION...........................................3128
3.4 SYSTEM TAG TYPES .................................................................................3128
3.4.1 General Tag Format .........................................................................3128
3.4.2 Tag Bases .........................................................................................3128
3.5 PARAMETER TAG TYPES...........................................................................3229
3.5.1 General Tag Format .........................................................................3229
3.5.2 Tag Bases .........................................................................................3330
3.6 PROCESS TAG TYPES ................................................................................3330
3.6.1 General Tag Format .........................................................................3330
3.6.2 Process Tag Types ............................................................................3330
3.7 MESSAGE TAG TYPES...............................................................................3431
3.7.1 Message Tag Format ........................................................................3431
3.7.2 Message.Cache.Reset Tag Format ....................................................3431
3.7.3 Message Tag Types...........................................................................3532
3.7.4 msgPRO_ALARM_CHANGE Message Class ....................................3532
3.7.5 msgSYS_ALARM_CHANGE..............................................................3633
3.7.6 msgPRM_ALARM_CHANGE............................................................3835
3.7.7 msgEVT_SYSTEM_EVENT ...............................................................3936
3.8 TAG ADDRESS FORMAT SPECIFICATION ....................................................3936
3.8.1 Compiler File Specification...............................................................3936
3.8.2 Include Projects ................................................................................4138
3.8.3 ONS Array Support ...........................................................................4239
3.9 DRIVER SPECIFIC ERRORS ........................................................................4239
3.10 DRIVER ERROR HELP ...............................................................................4239
3.11 DRIVER IMPLEMENTATION NOTES ............................................................4340
3.11.1 OIS TCP/IP Configuration for Redundancy ......................................4340
3.11.2 Online / Offline conditions ................................................................4340
3.11.3 Watchdog Timeout ............................................................................4441
3.11.4 Thread Synchronisation ....................................................................4441
3.11.5 Data Type Mapping and Precedence.................................................4441
3.11.6 PROTDIR.DBF.................................................................................4643
3.11.7 TONS.DBF .......................................................................................4643
3.11.8 Distribution Files..............................................................................4643
3.12 DEVELOPMENT RESOURCES ......................................................................4643
3.12.1 Contacts............................................................................................4643
Ian Emmett ....................................................................................................4643
Michael Preston.............................................................................................4744
3.12.2 Documents ........................................................................................4744
3.13 RISK AREAS .............................................................................................4744
3.14 DEVELOPMENT PLAN ................................................................................4845
4. TESTING RELEASE 1.0.00.26...................................................................4946
4.1 PROCEDURE .............................................................................................4946
4.2 RESULTS ..................................................................................................4946
4.2.1 Test Conditions .................................................................................4946
4.2.2 Citect Startup Testing........................................................................5148
4.2.3 Communication Failure Testing........................................................5148
4.2.4 Redundancy Testing ..........................................................................5249
4.2.5 Error Reporting Testing ....................................................................5249
4.2.6 Data Type Read / Write Testing ........................................................5350
4.2.7 Data Type Matching Testing .............................................................5350
4.2.8 Soak Testing......................................................................................5552
4.2.9 Multiple Unit Tests............................................................................5552
4.3 PERFORMANCE TESTING ...........................................................................5552
4.3.1 Introduction ......................................................................................5552
4.3.2 Calculating the Blocking Constant ....................................................5552
4.3.3 Max Pending Calculation..................................................................5653
5. TESTING RELEASE 1.0.01.09...................................................................5653
5.1 PROCEDURE .............................................................................................5653
5.2 RESULTS ..................................................................................................5653
5.2.1 Test Conditions .................................................................................5653
5.2.2 Citect Startup Testing........................................................................5754
5.2.3 Communication Failure Testing........................................................5754
5.2.4 Soak Testing......................................................................................5754
1. General
1.1 Abbreviations
API Application Programming Interface
DCB Driver Control Block. The internal data structure used by a Citect
I/O server when communicating with drivers.
DDK Driver Development Kit
DLL Dynamic Link Library
DPCS Distributed Process Control Station
LAN Local Area Network
MFC Microsoft Foundation Class libraries (Win32 C++ object libraries)
NIC Network Interface Card
OIS Operator Interface Station
ONS Toshiba’s Open Network Service
PCMP Toshiba’s Process Control Message Protocol
TONS The Citect driver (DLL and compiler files) for Toshiba’s ONS
WAN Wide Area Network
1.2 Overview
The TONS driver supports communication with any ONS protocol-compatible device.
A similar range of communication control cards are available for other systems,
including the S3 PLC, however this specification refers primarily to DPCS systems
for clarity.
The Toshiba Open Network Service is both a protocol and a suite of NT services
implementing the protocol, for communication via TCP/IP ethernet with the VETHX1
card, and thereby with the DPCS MC bus, or individual cards in the DPCS system.
A development interface, the ONS API, is available for accessing the ONS services
from third party software. The TONS driver uses the ONS API to request information
from and send information to ONS systems, such as the DPCS VETHX1 card.
The ONS API and ONS services require a correctly configured NT ethernet card in
the Citect IO server, running the TCP/IP protocol, as well as a small amount of
configuration of the ONS NT services and ONS systems themselves. The
configuration procedures for the Windows NT components are included in this
specification.
rather re-formats requests from Citect and passes them through to the ONS API. The
ONS API is the access point for the ONS service, which in turn contains the code to
format API requests as physical TCP/IP packets and send them to the I/O devices.
The TONS driver itself is structured as a front-end / back-end driver with a separate
back-end thread launched to service requests for each online unit. A multithreaded
approach is required since all ONS API functions are blocking functions, and calling
them in the foreground driver thread would unacceptably block the Citect process.
2. User information
2.1 Application notes for Device VETHX1
Property Detail
Manufacturer Toshiba Corporation
Device name Communication Control Card VETHX1 for TOSDIC-CIE DS
Comms method TCP/IP via 10base5, 10baseT or 100baseT ethernet, or Serial1
Please note that the TONS driver supports communication with any ONS-compatible
communication device.
2.1.1 Overview
This section details the communication configuration for one type of ONS-compatible
device, the DPCS VETHX1 Communication Control Card, and demonstrates
configurations supporting full (4-channel) redundancy.
Please refer to the manufacturer’s documentation for configuration procedures for
other devices.
Example: The following table illustrates the correct IP address configuration for a
DPCS station assigned station number 14, with two VETHX1 cards, each using both
Bus A and Bus B. (NB The configuration will of course change accordingly for other
station numbers):
1
For information on configuring serial communication, please refer to the VETHX1
installation manual 6F8C0789. Serial communication configuration does not form
part of this specification since the TONS driver is independent of the communications
layer, which is entirely abstracted behind the ONS API.
:
10bT or 100bT Hub
ethernet LAN
DPCS stations
(1 VETHX1 card per station)
Standard Ethernet
Cards supporting
TCP/IP
:
10bT or 100bT Hub 1 Hub 2
ONS LAN 1
10bT or 100bT
ONS LAN 2
DPCS stations
(2 VETHX1 cards per station)
:
Hub 3 10bT or 100bT
ONS LAN 1
:
Hub 1 Hub 2
10bT or 100bT
ONS LAN 1
DPCS stations
(2 VETHX1 cards per station)
Hub A Hub B
: 172.16.64.1
172.16.128.1
ONS LAN A
ONS LAN B
172.16.64.10 172.16.64.42
172.16.128.10 172.16.128.42
VETHX1 VETHX1
Slot 11 Slot 13
(Primary) (Standby)
DPCS Station
With all four communication paths connected, a request for “$C0A.SST” defaults to
communication with 172.16.64.10 (VETHX1 in slot 11 primary port) via OIS card
172.16.64.1. All other channels remain in standby mode.
With Hub B link to 172.16.128.10 broken, the primary VETHX1 card automatically
switches out of RUN mode, and a request for “$C0A.SST” switches to
communication with 172.16.64.42 (VETHX1 in slot 13 primary port) via OIS card
172.16.64.1. The remaining channel is in standby mode.
Restoring either of the network links to the secondary VETHX1 card will restore
communications.
Once the primary VETHX1 card has left RUN mode, it must be reset, and the network
links reconnected before it will pick up communications again.
It must be noted that although the IP address of the secondary VETHX1 card
corresponds to DPCS station number 42 (0x2A), the tag $C2A.SST is not available.
When redundancy is properly configured, $C0A.SST is an automatic alias for
$C2A.SST, and in general station N is an alias for station N+0x20.
There are three classes of tag names defined in the ONS protocol: System Tags,
Parameter Tags and Process Tags.
• System tags provide direct access to information in the DPCS hardware, and the
tag name uniquely identifies a station number, and / or a slot number and / or a
data point. System tag names and atoms always resolve to exactly one data point
(and always the same data point). The naming convention for DPCS systems is
set by the ONS protocol in the document 9B8C0661.
• Parameter tags provide access to user parameter tables, and are also accessed by
formatting a tag name that identifies a station number and / or slot number and /or
I/O point. Parameter tables are generally used within a DPCS program as lookup
tables for conversion processes or as general user memory. The tag and atom
naming convention for DPCS systems is set by the ONS protocol in the document
9B8C0662.
• Process tags provide access to physical I/O values, and are addressed by a user-
configured tag name. The ONS API allows any tag name to be used, and the
Signal List editor of the PCS-DS Engineering Tool can be used to relate a tag
name with a DPCS station, slot and I/O point type. The ONS system allows
arbitrary tag names, however the tag atoms for each tag type are generally fixed.
The allowable tag atoms for DPCS systems are listed in the document 9B8C0604.
A fourth class of tags known as Message Tags are implemented by the TONS driver
itself and are described in section ???.
The tag names referred to above should not be confused with Citect tag names, which
have scope only within the Citect project development environment. The TONS
driver does not have access to the Citect tag names, only to the Citect tag address;
Citect tag names do not form part of the discussion in this specification.
2.3.1 Description
The TONS driver for Citect 5.21 is used to communicate with ONS-compatible
devices such as the VETHX1 communications card via the ONS API under Windows
NT
Property Detail
Driver name TONS
Maximum array size2 1024 bits
A maximum array size of 1024 bits is chosen to allow Citect to retrieve strings of up
to 128 characters from the driver. Although an ONS string is limited to 16 characters
(128 bits) in length, the ONS data type D_TIME can be retrieved as either an integer
or as a string, and when retrieved as a string, 16 characters is insufficient to hold the
formatted date/time information.
The maximum array size does not affect Citect blocking since the TONS driver
disables all blocking features by means of the %R compiler option (in TONS.DBF).
2
Equivalent to ‘Maximum Request Length’
2.3.2.1 CTREGION.DLL
In order to use the driver with Citect version 5.21 and above, the version of
CTREGION.DLL that normally resides in the \CITECT\BIN directory must be
updated with the CTREGION.DLL version from the DDK.
2.3.2.2 DB3UTILS.DLL
The TONS driver makes use of an updated version of the Dbase III file access
routines in DB3UTILS.DLL. In order to use the driver with Citect version 5.21 and
above, DB3UTILS.DLL must be copied to the \CITECT\BIN directory.
The TONS driver itself also operates as its own front-end/back-end driver, where the
front end marshals requests from Citect and queues them for servicing by separate 32-
bit back end threads. The back end must run as a thread since requests to the ONS
API block the calling process, which is unacceptable in the foreground Citect process.
3
The ONS API offers quadruple-path redundancy with DPCS systems as described in
section 2.1.1 and double-path redundancy with S3 PLC systems, with no additional
configuration required via the API.
card4. The use of string tag names presents particular problems for the TONS driver,
which is normally provided only with integer UnitType and UnitAddress information
by the Citect compiler (parsed from a Citect tag’s Address field using the definitions
in DRIVER.DBF). To accommodate the arbitrary tag names allowed by the API, the
TONS driver uses the %N+ format option in TONS.DBF to bypass the compiler
translation stage and instead force Citect to provide the driver with a logical record
index into VARIABLE.DBF at runtime. When the driver receives a read or write
request from Citect at runtime, the numerical record index is stored in UnitAddress is
resolved into a string tag name by reading VARIABLE.DBF (or any included
VARIABLE.DBF files) directly, and extracting the string address field.
To assist the driver performance, variable tag information is pre-processed and cached
to memory by the driver during channel initialisation5. This process is invisible to the
user, and is only performed once per Citect IO Server.
2.3.5.1 Software
• Windows NT 4.0 Server or Workstation
• Windows NT Service Pack 5 or above
• Toshiba PCMP/IRCP Support Software 1.21 (previous PCMP versions do not
properly support redundancy).
• Toshiba ONS Support Software, Jan 2001 (specific version information not
available)
2.3.5.2 Hardware
• VETHX1 communication card or similar
• RJ45 UTP ethernet crossover cable
or
• RJ45 UTP ethernet straight-through cables x 2 + 10bT / 100bT ethernet hub
Boards form
Field Default Allowable values
4
Obviously the procedure for resolving tag names to DPCS stations is simplified for
System and Parameter tags where system number and slot number is explicit.
5
The cache is initialised during the call to InitChannel() to allow for initialisation
retries if a VARIABLE.DBF file is temporarily locked by another process, and to
minimise the number of tests for whether the cache is initialised or not, per IO Server.
Board Name This field is user defined, and is not used by the driver.
Board Type TONS TONS
Address 0 0
I/O Port Blank Not used, any value
Interrupt Blank Not used, any value
Special Opt Blank Not used, any value
Comment This field is user defined and is not used by the driver.
Ports form
Field Default Allowable values
Port Name This field is user defined and is not used by the driver.
Port number User defined Any value
Board name Refers to the board previously defined in ‘boards’form.
Baud rate Blank Not used, any value
Data bits Blank Not used, any value
Stop bits Blank Not used, any value
Parity Blank Not used, any value
Special Opt Blank Not used, any value
Comment This field is user defined and is not used by the driver.
For example, if the IO Device Address field specifies $C13.SST[0], the decimal
station number 19 (= 0x13) will be extracted. For a tag specified in the Citect
VARIABLE.DBF file as $C__.SST[2], the characters in positions 3 and 4 (the __
characters) will be replaced is “13” to form the tag name $C13.SST[2].
The ONS system supports a number of distinct data types for different I/O points that
must be mapped to appropriate Citect data types in order to be read or written. The
following table details the Citect data types that should be used for each ONS data
type. Where applicable, any alternative Citect data types that can be used to read the
same ONS data type are also listed, in italics.
D_TEXTS RDT_STRING[]
D_STRING RDT_STRING
D_STRINGS RDT_STRING[]
D_BIT8 RDT_BYTE
RDT_INTEGER
RDT_LONG
D_BIT8S RDT_BYTE[]
D_BIT16 RDT_INTEGER
RDT_LONG
D_BIT16S RDT_INTEGER[]
D_BIT32 RDT_LONG
D_BIT32S RDT_LONG[]
D_TIME RDT_LONG
RDT_STRING6
D_TIMES RDT_LONG[]
RDT_STRING[]6
6
When retrieving a D_TIME or D_TIMES type as a string (or array of strings), the
data is returned in the format “Friday, 24th March 2000 16:00:00”
Polynomial lines are special data sets in the ONS system that are logically grouped
together, e.g. used to linearise analog inputs in thermocouples . thermocouples. Find
more info in Toshiba document 6F8C0802 .6F8C0802.
Although it is possible to define many of these (variable name to address) and have
mutiliple units, only ONE memory set of variables exist. Thus the user must ensure
parallel operations/use does not occur if multiple clients use the same ioserver.
CICODE example
To guarantee correct read and write values the Cicode ReRead function should be
used as in the examples below to refresh data.
// Setting
POLYTAG = "%C09ply1401_.tbl" ; // Set basetag string name
POLYOP = 0; // Clear values
POLYVAR00 = 1.2; // Set values
....
POLYVAR25 = 0.0;
POLYOP = 1; // Write values out
ReRead(1) // Refresh the value of POLYOP
if (POLYOP <> 0) then error
// Reading
POLYTAG = "%C09ply1401_.tbl" ; // Set basetag string name
POLYOP = -1; // Read values into POLYVARxx
ReRead(1) // Refresh the value of POLYOP
if (POLYOP <> 0) then error
Message.Reset.Cache Tag
A tag with this ADDRESS name when written to will clear the TONS drivers cache of
alarm statuses. This will force fresh reads of all tags as they are requested from Citect.
2.3.9 Blocking
TONS, being a tag based driver, has unique issues when it comes to blocking data
together for more effeciency. The user must ensure that tags are logically grouped
together because Citect uses the TONS variable.dbf record number as the tags
ADDRESS to the driver.
A special “^” operator has been used in the tags ADDRESS field to group like tags
together. Any data item can be grouped, it should use a unique UNIT TYPE number
in the 0x09000000 range.
For efficient handling of alarm tags, all tags with “^abcdef” ADDRESSes, should be
placed at the beginning of the VARIABLE.DBF database. This is so that the driver
can quickly match an ONS alarm tag, when it comes in from the ONS system, to the
Citect tag.
Standard Parameters
Parameter Default Allowable values
Block (bytes) 2 2 (don’t change)
Delay (mS) 0 0 (not used)
MaxPending 32 1 to 32
Polltime (mS) 0 0 (not used)
Timeout (mS) 1000 1000 (not used)
Retry 1 1 (not used)
WatchTime (Sec) 30 30
When using a project with many units and a MaxPending of 32, it may be possible to
run out of Citect data queues. The solution is to add
[Code]queue=1000
to your citect.ini. This will resolve the problem.
Other Parameters
Parameter Default Allowable values
[LAN]Timeout 40000 40000
[TONS]Checkallt 0 0 or 1
ags
[TONS]Trace 0 0, 1 or 2
[TONS] 10 10 to 999 ms
Batchsleeptime
It is recommended none of the other driver parameters are changed unless there is a
specific reason to do so.
CHECKALLTAGS – If set will check all tags at startup to see if they can be read
from the ONS system. NB: Tags starting with % or $ will fail. For projects with a
large TAG set, this will take a LONG time. TRACE=1 needs to be set for the results
to be seen. This option should only be used at project setup as a check. The other
option is to use the “TagReadKit” which is available from Citect’s WEB site under
“Citect Toolbox” .
TRACE – This should only be used when asked for by Citect Support. It provides
extra traces in the code to a file called “tons_trace.txt” under citect\bin .
BATCHSLEEPTIME – This is the time each thread (one per unit) waits for ONS
requests to be collected. Thus is needed for 2 reasons, to give other units access to
ONS, and to allow requests to “batch” together.
OFFLINECHECKTIME – This is the time used to determine that a unit is the standby
unit. The logic uses the fact that no data requests have occurred in this time period.
This value can be made lower to improve the detection time of being the offline unit.
This is required to ensure correct handling of alarms. e.g. the active unit stores alarm
events and these are removed on a regular period by the alarm scan system. The
standby unit, is also storing these events. Once we know that the standby unit is a
standby unit, we can discard these events, because we don’t want repeats of events to
occur when the active unit switches to the standby unit.
2.3.102.3.12 Advanced
Note that the statistics on the number of requests to the ONS API is based on the
number of DCB requests sent by Citect since a single DCB always translates to a
single batch command in the API.
Because TONS can block (from Citect) as well as batch (to the API), this poses issues
for reporting problems. The logic is as follows :
- Report the first "point" (equivalent to Citect TAG) error to the user. When the block count is
one then no issue exists, if a block had 10 items , then the first errored item in the block is
reported. NB: Other errors may exist after this item.
- Report a ONS Batch error only if NO ONS point errors have occured previously. This will
occur for the last TAG of the batch,
- Both batch & point errors are reported in the tons_trace.txt file IF enabled. NB:
tons_trace.txt is a diagnostic tool, not an operational tool.
Debug messages are enabled via the kernel using the debug <portname>
[all|error|write] command
where
Ddd is the day of the week as a string
Mmm is the month of the year as a string
Dd is the numerical day of the month
hh:mm:ss is the current time in hours:minutes:seconds
Yyyy is the year in numeric format
hh:nn:ss.uuu is the uptime of the IO Server in
hours:minutes:seconds:msec
[READ|WRITE] is the operation: read or write
t:[D|I|R|L|S|B|?] is the data type: Digital, Integer, Real, Long, String,
Byte or Unknown.
a:xxxxxx is the UnitAddress in 6 digit hex format
c:xxxxxx is the UnitCount in 6 digit hex format
w:xx is the BitWidth in 2 digit hex format
e:xx is the Element count
(BitWidth*UnitCount/RawBitWidth)
[xxxxxx] is the index into the variable.dbf cache in 6 digit
hex format
‘tttt’ is the ONS tag name as a string
Nn is the length of the ASCII debug data that follows
Vvvv is the value being read or written
If the Citect request involves a blocked command, then several <’tttt’ = vvvv>
blocks will be displayed, as per the calculated Element count.
where
Ddd is the day of the week as a string
Mmm is the month of the year as a string
dd is the numerical day of the month
hh:mm:ss is the current time in hours:minutes:seconds
yyyy is the year in numeric format
hh:nn:ss.uuu is the uptime of the IO Server in
hours:minutes:seconds:msec
Ssss is the error description as a string
nnnn is the ???
pppppp is the port name as a string
uuuuuu is the unit name as a string
t:[D|I|R|L|S|B|?] is the data type: Digital, Integer, Real, Long, String,
Byte or Unknown.
a:xxxxxx is the UnitAddress in 6 digit hex format
c:xxxxxx is the UnitCount in 6 digit hex format
w:xx is the BitWidth in 2 digit hex format
e:xx is the Element count
(BitWidth*UnitCount/RawBitWidth)
[xxxxxx] is the index into the variable.dbf cache in 6 digit
hex format
‘tttt’ is the ONS tag name as a string
gggggg is the generic error value
dddddd is the driver-specific error value in decimal format
DDDDDD is the driver-specific value in 8 digit hex format
Individual points within blocked command are not displayed in the error message,
however the driver-specific error code will indicate the cause of the error.
3. Analysis
3.1 Overview
This section provides extended information on the ONS system, including a
breakdown of API anomalies encountered, expected usage and configuration
examples, and information on the TONS driver implementation.
For example, if DPCS station 05 is available, the tag $C05.SST exists, as does
$C05.mod, however $C05.MOD will return the error D_ILLEGAL_ATOM.
The TONS driver supports blocked requests from Citect, however the blocking
facility has been currently disabled due to conflicts with the use of the %N compiler
option. Blocking is disabled by using the %R compiler option in TONS.DBF which
assigns a unique UnitType to each address.
Currently, if blocking is enabled, the use of the %N option causes Citect to make
incorrect BitWidth and UnitCount requests of the driver, leading to stability issues
and garbage read values. Once this issue is resolved, the %R option may be removed
from TONS.DBF and driver blocking safely re-enabled.
These build settings apply to Microsoft Visual C++ 5.0 Service Pack 3 and 6.0
Service Pack 3.
The include directories can be set under the Tools | Options | Directories tab.
Library Description
Scanner.lib DDK 5.0 standard library
Ctregion.lib DDK 5.0 standard library
DB3UTILS.lib DDK 5.0 standard library
RegChk32.lib DDK 5.0 registration library
MFC42.LIB MFC 4.2 library
MFCS42.LIB Static helper library
MSVCRT.LIB Multithread DLL link for MSVCRT.DLL
OLDNAMES.LIB C Library Backward Compatibility
Libdba.lib ONS API standard library
Libuti.lib ONS API standard library
Libint.lib ONS API standard library
Librep.lib ONS API standard library
Libmem.lib ONS API standard library
Libons.lib ONS API standard library
The above modification has been performed for the TONS driver.
A module name is always 3 characters long, including the “-“ character where
applicable.
The list of corresponding tag atoms for these tag bases is defined in the document
9B8C0661, and is not repeated here.
The list of corresponding tag atoms for these tag bases is defined in the document
9B8C0662, and is not repeated here.
Msg Element Name Msg Start Bytes Msg TONS Ext ONS Data Citect Common
Byte Type Data Type Alias
Count
ALIT 52 4 ALIT D_LONG LONG ALIT
STIT 56 4 STIT D_LONG LONG STIT
FLIT 60 4 FLIT D_LONG LONG FLIT
Bit change data 68+<bit#>*10 2 ALIT[<bit#>] D_BIT DIGITAL
Msg Element Name Msg Start Bytes Msg TONS Ext ONS Data Citect Common
Byte Type Data Type Alias
Count
ALIT 52 4 ALIT D_LONG LONG ALIT
STIT 56 4 STIT D_LONG LONG STIT
FLIT 60 4 FLIT D_LONG LONG FLIT
Msg Element Name Msg Start Bytes Msg TONS Ext ONS Data Citect Common
Byte Type Data Type Alias
Count
ALIT 52 4 ALIT D_LONG LONG ALIT
STIT 56 4 STIT D_LONG LONG STIT
FLIT 60 4 FLIT D_LONG LONG FLIT
This message contains a variable byte count, as required by the data type associated
with the tag atom ‘<atom>’.
Msg Element Name Msg Start Bytes Msg TONS Ext ONS Data Citect Common
Byte Type Data Type Alias
Count
Before 1 <atom> D_BYTE INT
This message contains a variable byte count, as required by the data type associated
with the tag atom ‘<atom>’.
Msg Element Name Msg Start Bytes Msg TONS Ext ONS Data Citect Common
Byte Type Data Type Alias
Count
After 1 <atom> D_BYTE INT
1 <atom>[<bit#>] D_BIT DIGITAL
2 <atom> D_SHORT INT
2 <atom>[<bit#>] D_BIT DIGITAL
4 <atom> D_LONG INT
4 <atom>[<bit#>] D_BIT DIGITAL
8 <atom> D_FLOAT REAL
Msg Element Name Msg Start Bytes Msg TONS Ext ONS Data Citect Common
Byte Type Data Type Alias
Count
DI before 52 2 DIPRE D_SHORT INT
DI after 54 2 DIPOST D_SHORT INT
DO before 56 2 DOPRE D_SHORT INT
DO after 58 2 DOPOST D_SHORT INT
Msg Element Name Msg Start Bytes Msg TONS Ext ONS Data Citect Common
Byte Type Data Type Alias
Count
ALIT 52 4 ALIT D_LONG LONG
STIT 56 4 STIT D_LONG LONG
FLIT 60 4 FLIT D_LONG LONG
Msg Element Name Msg Start Bytes Msg TONS Ext ONS Data Citect Common
Byte Type Data Type Alias
Count
FO[<FO#>] 52+<FO#> 1 FO[<FO#>] D_BYTE INT
3.7.5 msgSYS_ALARM_CHANGE
System Tag Alarm Change
Msg Element Name Msg Start Bytes Msg TONS Ext ONS Data Citect Common
Byte Type Data Type Alias
Count
ALIT 52 4 ALIT D_LONG LONG
STIT 56 4 STIT D_LONG LONG
FLIT 60 4 FLIT D_LONG LONG
Bit change data 68+<bit#>*24 2 ALIT[<bit#>] D_BIT DIGITAL
Not implemented.
Msg Element Name Msg Start Bytes Msg TONS Ext ONS Data Citect Common
Byte Type Data Type Alias
Count
This message contains a variable byte count, as required by the data type associated
with the tag atom ‘<atom>’.
Msg Element Name Msg Start Bytes Msg TONS Ext ONS Data Citect Common
Byte Type Data Type Alias
Count
Before 1 <atom> D_BYTE INT
1 <atom>[<bit#>] D_BIT DIGITAL
2 <atom> D_SHORT INT
2 <atom>[<bit#>] D_BIT DIGITAL
4 <atom> D_LONG INT
4 <atom>[<bit#>] D_BIT DIGITAL
8 <atom> D_FLOAT REAL
This message contains a variable byte count, as required by the data type associated
with the tag atom ‘<atom>’.
Msg Element Name Msg Start Bytes Msg TONS Ext ONS Data Citect Common
Byte Type Data Type Alias
Count
After 1 <atom> D_BYTE INT
1 <atom>[<bit#>] D_BIT DIGITAL
2 <atom> D_SHORT INT
2 <atom>[<bit#>] D_BIT DIGITAL
4 <atom> D_LONG INT
4 <atom>[<bit#>] D_BIT DIGITAL
8 <atom> D_FLOAT REAL
Not implemented.
Msg Element Name Msg Start Bytes Msg TONS Ext ONS Data Citect Common
Byte Type Data Type Alias
Count
Not implemented.
Msg Element Name Msg Start Bytes Msg TONS Ext ONS Data Citect Common
Byte Type Data Type Alias
Count
Not implemented.
Msg Element Name Msg Start Bytes Msg TONS Ext ONS Data Citect Common
Byte Type Data Type Alias
Count
Not implemented.
Msg Element Name Msg Start Bytes Msg TONS Ext ONS Data Citect Common
Byte Type Data Type Alias
Count
Not implemented.
Msg Element Name Msg Start Bytes Msg TONS Ext ONS Data Citect Common
Byte Type Data Type Alias
Count
Not implemented.
Msg Element Name Msg Start Bytes Msg TONS Ext ONS Data Citect Common
Byte Type Data Type Alias
Count
3.7.6 msgPRM_ALARM_CHANGE
Parameter Tag Alarm Change
Not implemented.
Msg Element Name Msg Start Bytes Msg TONS Ext ONS Data Citect Common
Byte Type Data Type Alias
Count
Not implemented.
Msg Element Name Msg Start Bytes Msg TONS Ext ONS Data Citect Common
Byte Type Data Type Alias
Count
3.7.7 msgEVT_SYSTEM_EVENT
Not implemented.
Msg Element Name Msg Start Bytes Msg TONS Ext ONS Data Citect Common
Byte Type Data Type Alias
Count
Not implemented.
Msg Element Name Msg Start Bytes Msg TONS Ext ONS Data Citect Common
Byte Type Data Type Alias
Count
Digital tag type blocking also presents an additional problem, since Citect will never
request (under any circumstances!) just a single bit of data, and will generally block
digital types together in groups of 16. To solve this problem, all digital
UnitAddresses are multiplied by 16 so that each digital request lies on a 16-bit
boundary. To retrieve the original digital address, the UnitAddress is divided by 16.
To service a blocked request the driver translates the number of IO points requested
by Citect into a list of dbaPoint structures which will be sent to the ONS API using
the dbaCnt() and dbaPut() or dbaGet() functions.
The actual number of IO points requested can be calculated as:
IO Points = BitWidth * Un itCount / RawBitWidth
where RawBitWidth is determined by the RawType value, and represents the
number of bits in the raw data type.
All requests queued for servicing by the driver’s back-end threads are packaged into a
single ONSDCB structure. The ONSDCB structure encapsulates the original CTDCB,
an array of dbaPoint structures representing the batched request, a write data buffer
and various other status values.
Because the memory map of each UnitType is not contiguous7, a Citect request for
3 consecutive addresses may translate into only two dbaPoint requests, if the data
type of the tag at the middle address does not match the raw data type of the original
Citect request.
7
To put this another way, the %N compiler option means that the UnitAddress
determines the UnitType. Even if addresses 0x0002 and 0x0004 are INTEGERs,
address 0x0003 is not necessarily an integer, since UnitAddresses are only indexes
into VARIABLE.DBF.
For example, if the first and third tags declared in a Citect project are of type LONG,
and the second is of type DIGITAL, then if blocking is enabled, Citect would request
both LONG addresses in a single blocked request by setting RawType = RDT_LONG,
BitWidth = 16 and UnitCount = 6 (equivalent to 3 LONGs). In preparing the
ONSDCB structure with its linked list of dbaPoint structures, the TONS driver would
verify that the type of each ONS tag address retrieved from the VARIABLE.DBF
cache matched the RawType value specified by Citect. If the types did not match,
then the corresponding dbaPoint structure would be marked as invalid by setting the
tag name to "". The driver back end would then skip over any invalid dbaPoints,
and would consequently make only 2 requests to the ONS API. The value returned to
Citect in place of any invalid addresses is always 0.
This strategy is safe since, as in the above example, the LONG value returned for
address 2 would never be used. If the tag at address 2 is used on a Citect graphics
page, it would be requested in a separate block of DIGITALs starting at address 2.
The TONS driver makes provision for Citect INCLUDE projects when caching
VARIABLE.DBF information, and caches tags sequentially, starting with the current
project, and then processing any included projects recursively.
Include projects should not be used with the TONS driver however, since the %N
compiler option does not provide unique UnitAddress values across Include projects,
and the first tag in each project is always currently assigned UnitAddress 1.
This issue is currently under review, and support for Include projects will be available
once it is resolved.
All TONS driver tags should currently be placed in a single Citect project, and always
in the top-level Citect project.
The TONS driver does not currently support retrieval of ONS arrays, and each Citect
tag should resolve to a single ONS datapoint. If the tag does resolve to an array, the
TONS driver will return the value of the first element in the array only.
4. If the online test tag can be retrieved, then the Citect request is returned with
an appropriate error code, but the unit remains online.
5. If the online test tag cannot be retrieved, then the unit is immediately placed
offline.
Since all calls to the ONS API are blocking functions, the driver cannot control or
detect timeouts occurring behind the API. On communication failure, a call to
dbaGet(), dbaPut() or dbaCnt() will block for up to 30 seconds. The
increased Citect watchdog timer timeout of 40s will correctly prevent “PLC Server
Request timeout from I/O Server” hardware alarms.
The table also lists all data type precedence supported by the TONS driver. Data type
precedence allows the same ONS data type to be retrieved through several Citect data
types, providing that the cast type (Citect type) is larger than the ONS type.
For example, a BIT type can be retrieved as a DIGITAL, BYTE, SHORT, INTEGER
or LONG data type, however a LONG data type cannot be retrieved as a BYTE
without unacceptable loss of information. In the above, a DIGITAL type precedes a
BYTE type, and the BYTE, SHORT, INTEGER and LONG types are known as
antecedent types.
Data type precedence is not supported between array and non-array types. For
example, a BIT[] type cannot be retrieved as BIT, and a STRING type cannot be
retrieved as a LONG, etc.
Data type precedence is a function of the TONS driver, and cannot be pre-determined
since the Citect tag address fields are not parsed in advance. A decision on data type
precedence is made by the driver only after the Citect tag string address is retrieved
and the ONS API queried for type information on the tag. Once this has been done,
the ONS data type can be compared with the Citect data type, and a precedence
decision made.
The first Citect data type shown below is the best-fit data type and any antecedent
types are shown after in italics.
ONS Data Type Win32 C Type Cast Citect Data Type Description / Special Usage /
(Antecedent Type) Limitations / Valid Ranges
D_NOTYPE
UNDEFINED
D_BIT char RDT_DIGITAL
RDT_BYTE
RDT_INTEGER
RDT_LONG
D_BITS char* RDT_DIGITAL[]
RDT_BYTE[]
RDT_INTEGER[]
RDT_LONG[]
D_BYTE char RDT_BYTE
RDT_INTEGER
RDT_LONG
D_BYTES char* RDT_BYTE[]
RDT_INTEGER[]
RDT_LONG[]
D_U_BYTE unsigned char RDT_BYTE
RDT_INTEGER
RDT_LONG
D_U_BYTES unsigned char* RDT_BYTE[]
RDT_INTEGER[]
RDT_LONG[]
D_SHORT short RDT_INTEGER
RDT_LONG
D_SHORTS short* RDT_INTEGER[]
RDT_LONG[]
D_U_SHORT unsigned short RDT_INTEGER
RDT_LONG
D_U_SHORTS unsigned short* RDT_INTEGER[]
RDT_LONG[]
D_LONG int RDT_LONG
D_LONGS int* RDT_LONG[]
D_U_LONG unsigned int RDT_LONG Caution: Loss of sign
D_U_LONGS unsigned int* RDT_LONG[] Caution: Loss of sign
D_FLOAT float RDT_REAL
D_FLOATS float* RDT_REAL[]
D_DOUBLE double RDT_REAL
D_DOUBLES double* RDT_REAL[]
D_TEXT char* RDT_STRING
D_TEXTS char** RDT_STRING[]
D_STRING char* RDT_STRING
D_STRINGS char** RDT_STRING[]
D_BIT8 unsigned char RDT_BYTE
RDT_INTEGER
RDT_LONG
D_BIT8S unsigned char* RDT_BYTE[]
D_BIT16 unsigned short RDT_INTEGER
RDT_LONG
D_BIT16S unsigned short* RDT_INTEGER[]
D_BIT32 unsigned long RDT_LONG
3.11.6 PROTDIR.DBF
TAG FILE BIT_BLOCK MAX_LENGTH OPTIONS
TONS TONS 1024 1024 0x0cf
3.11.7 TONS.DBF
The %! compiler option indicates that the rest of the address field should be ignored.
This is added as a safety precaution to prevent the Citect compiler from matching any
characters after the %N%R specifiers.
3.12.1 Contacts
Ian Emmett
Senior Engineer
Process Control Department
8
When retrieving a D_TIME or D_TIMES type as a string (or array of strings), the
data is returned in the format “Friday, 24th March 2000 16:00:00”
Michael Preston
Manager
Automation Division
Toshiba International Corp. Pty. Ltd.
2 Morton St
Parramatta NSW 2150
Ph (02) 9768-6633
Fax (02) 9890-7542
Mobile 0419 296 846
Email preston@tic.toshiba.com.au
3.12.2 Documents
1. Toshiba Integrated Control System TOSDIC-CIE DS Communication Control
Card VETHX1 Instruction Manual 6F8C0789, First Edition, June 1999
2. Toshiba Integrated Control System TOSDIC-CIE DS Open Network Service
Support Package for PC Instruction Manual 6F8C0793, First Edition, July
1999
3. CIEMAC-DS DPCS Parameter Tag Data Structure Specification
9B8C0662, Rev 2, 24/6/98 (Japanese version)
4. CIEMAC-DS DPCS System Tag Data Structure Specification, 9B8C0661,
Rev 7, 14/7/99 (Japanese version)
5. CIEMAC-DS DPCS Process Tag Data Structure Specification, 9B8C0604,
Rev 8, 7/9/99 (Japanese version)
however that the approach has little impact on network bandwidth or CPU usage
on a Citect I/O server.
• Citect Include projects. The implications of Citect include projects on retrieving
Citect tag string addresses has not been fully resolved, however no particular
problems are anticipated.
9
The target completion dates shown are guidelines only and may change subject to
approval.
A sample Project is available which can be used as a starting point for the
programmer’s test Project. When the programmer has completed basic testing and
debugging this Project should be backed up and supplied to the Citect Testing
department.
4.1 Procedure
The following are points that should be covered by basic testing.
• On startup the IO Device comes online without errors.
• The driver reports the IO Device offline when the IO Device is a) powered down,
b) disconnected. Redundant comms path testing must be included.
• The driver will re-establish communication with the IO Device after a) power
cycle, b) disconnection/ reconnection. Redundant comms path testing should be
included.
• Confirm that retries (if supported) and error reporting operate correctly.
• Confirm errors reported by the ONS API are reported correctly to Citect
• Confirm that data type mismatches are reported correctly to Citect
• The driver reads all the device data types documented as readable in this
specification.
• The driver writes to all the device data types documented as write-able in this
specification.
• Let the driver run over night and check that no retries or other errors have
occurred.
• If hardware is available then the protocol should be tested with more than one IO
Device connected.
4.2 Results
The following tests were performed in accordance with the testing procedure
documented in section 4.1.
Hub
:
172.16.64.2 ONS LAN A
172.16.128.2 ONS LAN B
172.16.64.5 172.16.64.37
172.16.128.5 172.16.128.37
VETHX1 VETHX1
Slot 11 Slot 13
(Primary) (Standby)
DPCS Station
All tests were performed with the release build (Public build) of the driver DLL,
unless debugging required the temporary use of a debug build. After debugging, the
driver was re-built as release before continuing testing.
IO Servers:
Name “PRIMARY”
Boards:
Name / Server “ONSB1” / PRIMARY
Type TONS
Address / Port / Interrupt 0 / Blank / Blank
Ports
Name / Number / Server “ONSP1” / 1 / PRIMARY
Board ONSB1
Baud / Bits / Stop / Parity Blank / Blank / Blank / Blank
Options Blank
IO Devices
Name / Number / Server “DPCS1” / 1 / PRIMARY
Address $C05.SST[0]
Protocol TONS
Port ONSP1
Note that both IO devices are configured to use the same DPCS chassis, however the
use of different addresses allows testing of Citect redundancy features.
Power down the unit, observe offline status, power up the unit, observe online status.
Repeat several times.
• Both IO devices were observed to go offline simultaneously after a 30 second
timeout.
• After going offline, both IO devices were observed to attempt reconnection to
the unit every 30 seconds.
• All reconnect attempts failed until power was restored to the unit, and the
VETHX1 cards had completed initialisation.
• Once the VETHX1 cards finished initialisation, normal communication
resumed at the next IO device reconnect attempt.
DRIVER_ILLEGAL_ATOM Passed
DRIVER_SECURITY_VIOLATION Could not generate this error
DRIVER_ILLEGAL_TAG_ATOM Could not generate this error
DRIVER_BAD_ACCESS_VERSION Could not generate this error
DRIVER_MODULE_NOT_FOUND Passed
DRIVER_BATCH_FAIL Could not generate this error
DRIVER_PARTIAL_BATCH_FAIL Could not generate this error
DRIVER_POINT_ERROR Passed
DRIVER_BATCH_ERROR Passed
The blocking constant performance tests were not conducted for the TONS driver
since the %R compiler option forces each tag to have a unique UnitType. Blocking is
therefore disabled in the TONS driver.
256
{50% of maximum}
512
{75% of maximum}
768
{maximum}
1024
From these results the overhead and rate are determined and the ideal blocking
constant is calculated
Overhead [mS] =
Word Rate [words / mS] =
Note that the calculated blocking constant must now be set by the programmer in the
Constants structure (the Block field) in bytes and in the PROTDIR.DBF (the
BIT_BLOCK field) in bits.
A MaxPending value of 4 is seen as the best compromise between response time and
reads per second.
5.1 Procedure
The following are points that should be covered by basic testing.
• On startup the IO Device comes online without errors.
• The driver reports the IO Device offline when the IO Device is a) powered down,
b) disconnected.
• The driver will re-establish communication with the IO Device after a) power
cycle, b) disconnection/ reconnection.
• Let the driver run over night and check that no retries or other errors have
occurred.
5.2 Results
The following tests were performed in accordance with the testing procedure
documented in section 4.1.
All tests were performed with the release build (Public build) of the driver DLL
Power down the unit, observe offline status, power up the unit, observe online status.
Repeat several times.
• Both IO devices were observed to go offline simultaneously after a 30 second
timeout.
• After going offline, both IO devices were observed to attempt reconnection to
the unit every 30 seconds.
• All reconnect attempts failed until power was restored to the unit, and the
VETHX1 cards had completed initialisation.
• Once the VETHX1 cards finished initialisation, normal communication
resumed at the next IO device reconnect attempt.
4 0.051s 76
8 0.056s 120
16 0.051s 190
24 0.048s 259
32 0.044s 278
48 0.048s 280
64 0.050s 273
128 0.055s 265
192 0.048s 270
A MaxPending value of 32 is seen as the best compromise between response time and
reads per second.