MSIXML Design v1 7
MSIXML Design v1 7
VERSION: 1.7
This MSIXML Design Document is required for development of the XML Server Support for MicroLok Simulator
Project to be performed by Professional Software Associates, Inc., for Ansaldo STS (“Customer”).
APPROVED BY:
PREPARED BY:
1. PURPOSE................................................................................................................................................................................1
1.1 OBJECTIVE........................................................................................................................................................................1
1.2 REFERENCES.....................................................................................................................................................................1
2. OVERALL DESCRIPTION..................................................................................................................................................2
2.1 RECEIVING XML UPDATES OVER THE XML SERVER INTERFACE....................................................................................2
2.2 XML SERVER INTERFACE OVER A DIFFERENT PORT TO MLK SIMULATOR.....................................................................5
2.3 PROCESSING XML-RPC CALLS FOR MANAGING BITS AND CONFLICTS RESOLUTION.....................................................19
1. PURPOSE
1.1 Objective
The purpose of this document is to give the general overview of the approach to the XML Server Support for
MicroLok Simulator updates and provide the high-level design of the required updates and implementation of new
features.
The updates will be performed with regard to the following requirements and assumptions:
Ensure that the XML Schema is consistent with the configuration tool and device types and adheres to
the XML Schema Standards http://www.w3.org/standards/techs/xmlschema#w3c_all.
Provide support receiving XML updates over the XML Server interface so the Microlok Simulator does
not need to poll clients.
Add an additional XML Server interface over a different port to MLK Simulator that presents all bits
read only diagnostics.
Verify functionality for processing XML-RPC calls to set write status to bits that allow clients to
control bits, and ensure that Microlok Simulator is able to resolve conflicts of bit ownership without
masking.
1.2 References
The information contained within this Functional Requirements is prepared based on the following
documentation and sources:
Notes on the requirements gathering sessions with Ansaldo STS personnel.
2. OVERALL DESCRIPTION
A. Microlok Simulator opens a persistent bi-directional TCP connection with the TC-Server.
The IP address and Port of the TC-Server is defined in the Microlok Simulator GUI. The TC-Server does
not acknowledge the bi-directional TCP socket connection. It accepts the bi-directional TCP socket
connection, and the TC-Server is now listening for request on the connection, and publishing state
changes (updates) on the connection between the TC-Server and Microlok Simulator.
C B
D E
A. The Microlok Simulator sends a request to the TC-Server to get all the FIELD_DEVICES.VALUE
(This is the global database of devices and the device values, when people talk about the TC-
Server database, this is what they are referring to, and this is the method to get the global data)
refer to the XML-API document this is a FC <message length> <XML-DATA> F6 message:
XML-DATA:
<REQUESTS>
<CMD NAME="ADAPT">
<REQUEST> target={FIELD_DEVICES.VALUE} name={}</REQUEST>
</CMD>
</REQUESTS>
B. The TC-Server will respond to the Microlok Simulator with all FIELD_DEVICES.VALUES refer to the
XML-API document this is a F2 <message length> <XML-DATA> F6 message:
XML-DATA:
<FIELD_DEVICES>
<VALUE UPDATE="0">
<SWITCHES COUNT="1">
<SWITCH NAME="STREET.1">
<NWC-W>
<VALUE>1</VALUE>
</NWC-W>
<RWC-W>
<VALUE>0</VALUE>
</RWC-W>
</SWITCH>
</SWITCHES>
<SIGNAL_LAMPS COUNT="1">
<SIGNAL_LAMP NAME="STREET.2SGO">
<GO>
<VALUE>0</VALUE>
</GO>
</SIGNAL_LAMP>
</SIGNAL_LAMPS>
<TRACKS COUNT="1">
<TRACK NAME="STREET.1">
<OCCUPANCY>
<VALUE>1</VALUE>
</OCCUPANCY>
<SPEED_CODE>
<VALUE>0</VALUE>
</SPEED_CODE>
</TRACK>
</TRACKS>
</VALUE>
</FIELD_DEVICES>
C. The Microlok Simulator must parse the XML from the TC-Server.
D. Update MLC subsystem and a new device type raw<Device deviceId="" deviceName=" Microlok Name.Bit
Name" deviceType="raw"> and add metadata to the raw <Device> structure:
E. <OBJECT_TARGET> </OBJECT_TARGET> = XML root path in the TC-Server database
F. <OBJECT_NAME> </OBJECT_NAME> = Microlok Name.Bit Name
G. <OBJECT_TYPE> </OBJECT_TYPE>= READ or READ_WRITE
H.
I. XML tree path
J.
K. <root>
<child>
<subchild>.....</subchild>
</child>
</root>
L.
M. For Example:
N. <TRACK name=“N2_1251TR”>
<OCCUPANCY>
<VALUE>0</VALUE>
</OCCUPANCY>
</TRACK>
O.
P. Example MLC:
Q.
R. <?xml version="1.0" encoding="UTF-8"?>
S. <FieldDevices>
T. <Global Configuration="TC">
U. <server>172.21.8.10</server>
V. <port>5555</port>
W. <pollrate>2000</pollrate>
X. </Global>
Y.
Z. <Device deviceId="" deviceName="MKii8.N2_1251TR " deviceType="raw">
AA. <OBJECT_TARGET>TRACK.OCCUPANCY.VALUE</OBJECT_TARGET>
BB. <OBJECT_NAME>MKii8.N2_1251TR</OBJECT_NAME>
CC. <OBJECT_TYPE>READ_WRITE </OBJECT_TYPE>
DD. <Configuration>
EE. </Configuration>
Professional Software Associates, Inc.
Revised: 6 July 2016 Page 4
XML Server Support for MicroLok Simulator SOFTWARE DESIGN DOCUMENT Confidential
FF. <startupState>0</startupState>
GG. </Device>
HH. </FieldDevices>
II.
JJ.
KK. Parse the TC-Server response and update the Microlok Simulator bits values in the Data table that are
tagged in the MLC with OBJECT_TYPE>READ_WRITE</OBJECT_TYPE> only if the status is different that the
data from the TC-Server.
LL. The Microlok Simulator publishes an XML update to the TC-Server with all the bit values in the
Microlok Simulator Data table that are tagged in the MLC with OBJECT_TYPE>CONTROL, READ or
READ_WRITE</OBJECT_TYPE> only if the status is different than the data received from the TC-
Server. Refer to the XML-API document this is a FC <message length> <XML-DATA> F6 message.
MM.
B A
A. The TC-Server send an update to the Microlok Simulator with the XML-API message F2
<message length> <XML-DATA> F6 message.
B. The Microlok Simulator parses the TC-Server message and update the Microlok Simulator bits
values in the Data table that are tagged in the MLC with OBJECT_TYPE>INDICATOR, READ or
READ_WRITE</OBJECT_TYPE> only if the status is different than the data from the TC-Server.
A B
A. The Microlok Simulator sends an update to the TC-Server with the XML-API message F2
<message length> <XML-DATA> F6 message.
B. The TC-Server parses the message and updates the TC-Server values in the Database.
<root>
<child>
<subchild>.....</subchild>
</child>
</root>
A. Get all the field devices values (“FIELD_DEVICES.VALUE”), refer to the XML-API document
this is a FC <message length> <XML-DATA> F6 message:
XML-DATA:
<REQUESTS>
<CMD NAME="ADAPT">
<REQUEST> target={FIELD_DEVICES.VALUE} name={}</REQUEST>
</CMD>
</REQUESTS>
The Server will respond to the XML Client with all FIELD_DEVICES.VALUE refer to the XML-
API document this is a F2 <message length> <XML-DATA> F6 message:
XML-DATA:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<RESPONSES count="1"><RESPONSE><TC_DB>
<FIELD_DEVICES>
<VALUE UPDATE="3537762469.337">
<TRACKS COUNT="3">
<TRACK NAME="WM337T">
<OCCUPANCY>
<VALUE>0</VALUE>
</OCCUPANCY>
<SPEED_CODE>
<VALUE>0</VALUE>
</SPEED_CODE>
</TRACK>
<TRACK NAME="WM341T">
<OCCUPANCY>
<VALUE>0</VALUE>
</OCCUPANCY>
<SPEED_CODE>
<VALUE>0</VALUE>
</SPEED_CODE>
</TRACK>
Professional Software Associates, Inc.
Revised: 6 July 2016 Page 7
XML Server Support for MicroLok Simulator SOFTWARE DESIGN DOCUMENT Confidential
<TRACK NAME="DN349T">
<OCCUPANCY>
<VALUE>0</VALUE>
</OCCUPANCY>
<SPEED_CODE>
<VALUE>0</VALUE>
</SPEED_CODE>
</TRACK>
</TRACKS>
<SWITCHES COUNT="2">
<SWITCH NAME="DN.13B">
<NWR>
<VALUE>0</VALUE>
</NWR>
<RWR>
<VALUE>0</VALUE>
</RWR>
<NWP>
<VALUE>1</VALUE>
</NWP>
<RWP>
<VALUE>0</VALUE>
</RWP>
</SWITCH>
<SWITCH NAME="DN.13D">
<NWR>
<VALUE>0</VALUE>
</NWR>
<RWR>
<VALUE>0</VALUE>
</RWR>
<NWP>
<VALUE>1</VALUE>
</NWP>
<RWP>
<VALUE>0</VALUE>
</RWP>
</SWITCH>
</SWITCHES>
<TRAIN_STOPS COUNT="1">
<TRAIN_STOP NAME="_WM341">
<VR>
<VALUE>0</VALUE>
</VR>
<POSITION>
<VALUE>-</VALUE>
</POSITION>
<VRCP>
<VALUE>0</VALUE>
</VRCP>
<VNCP>
<VALUE>1</VALUE>
</VNCP>
</TRAIN_STOP>
</TRAIN_STOPS>
<SIGNAL_LAMPS COUNT="2">
<SIGNAL_LAMP NAME="DN366GT">
<DGE>
<VALUE>0</VALUE>
</DGE>
<HGE>
<VALUE>0</VALUE>
</HGE>
<RGE>
<VALUE>1</VALUE>
</RGE>
<UDGE>
<VALUE>0</VALUE>
</UDGE>
<URGE>
<VALUE>1</VALUE>
</URGE>
<SGE>
<VALUE>0</VALUE>
</SGE>
<LWGE>
<VALUE>0</VALUE>
</LWGE>
<KBL>
<VALUE>0</VALUE>
</KBL>
<RGP>
<VALUE>0</VALUE>
</RGP>
</SIGNAL_LAMP>
<SIGNAL_LAMP NAME="DN346GTST">
<DGE>
<VALUE>0</VALUE>
</DGE>
<HGE>
<VALUE>0</VALUE>
</HGE>
<RGE>
<VALUE>1</VALUE>
</RGE>
<LWGE>
<VALUE>0</VALUE>
</LWGE>
<RGP>
<VALUE>0</VALUE>
</RGP>
</SIGNAL_LAMP>
</SIGNAL_LAMPS>
</VALUE>
</FIELD_DEVICES>
</TC_DB>
<SERVER>
<CMD_DESCRIPTOR>
<REQUEST> TARGET={FIELD_DEVICES.VALUE} NAME={}</REQUEST>
</CMD_DESCRIPTOR>
<INDICATION>Retrieved</INDICATION>
<LATENCY_MS>4.004002</LATENCY_MS>
<TIME> 02/10/16 11:57:20.113</TIME>
</SERVER>
</RESPONSE> </RESPONSES>
B. Get the track circuits value ("TRACK"), refer to the XML-API document this is a FC
<message length> <XML-DATA> F6 message.
For example:
XML-DATA:
<REQUESTS>
<CMD name="ADAPT">
<REQUEST>target={TRACK.OCCUPANCY.VALUE} name={DN361T}</REQUEST>
</CMD>
</REQUESTS>
The Server will respond to the XML Client with the value of corresponding parameter,
refer to the XML-API document this is a F2 <message length> <XML-DATA> F6 message;
For example:
XML-DATA:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<RESPONSES count="1">
<RESPONSE>
<TC_DB>
<TRACK NAME="DN361T">
<OCCUPANCY>
<VALUE UPDATE="3537418593.186">1</VALUE>
</OCCUPANCY>
</TRACK>
</TC_DB>
<SERVER>
<CMD_DESCRIPTOR>
<REQUEST> TARGET={TRACK.OCCUPANCY.VALUE} NAME={DN361T}</REQUEST>
</CMD_DESCRIPTOR>
<INDICATION> Retrieved Asserted</INDICATION>
<LATENCY_MS>1.999378</LATENCY_MS>
<TIME> 02/04/16 11:16:33.185</TIME>
</SERVER>
</RESPONSE>
</RESPONSES>
C. Get switches value ("SWITCH"), refer to the XML-API document this is a FC <message
length> <XML-DATA> F6 message;
For example:
XML-DATA:
<REQUESTS>
<CMD name="ADAPT">
<REQUEST>target={SWITCH.RWP.VALUE} name={DN.15D}</REQUEST>
</CMD>
</REQUESTS>
The Server will respond to the XML Client with the value of requested parameter, refer to
the XML-API document this is a F2 <message length> <XML-DATA> F6 message;
For example:
XML-DATA:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<RESPONSES count="1">
<RESPONSE>
<TC_DB>
<SWITCH NAME="DN.15D">
<RWP>
<VALUE UPDATE="3537418674.763">1</VALUE>
</RWP>
Professional Software Associates, Inc.
Revised: 6 July 2016 Page 10
XML Server Support for MicroLok Simulator SOFTWARE DESIGN DOCUMENT Confidential
</SWITCH>
</TC_DB>
<SERVER>
<CMD_DESCRIPTOR>
<REQUEST> TARGET={SWITCH.RWP.VALUE} NAME={DN.15D}
</REQUEST></CMD_DESCRIPTOR>
<INDICATION> Retrieved Asserted</INDICATION>
<LATENCY_MS>0.999928</LATENCY_MS>
<TIME> 02/04/16 11:17:54.762</TIME>
</SERVER>
</RESPONSE>
</RESPONSES>
D. Get train stops value ("TRAIN_STOP"), refer to the XML-API document this is a FC
<message length> <XML-DATA> F6 message;
For example:
XML-DATA:
<REQUESTS>
<CMD name="ADAPT">
<REQUEST>target={TRAIN_STOP.VR.VALUE} name={_DN361}</REQUEST>
</CMD>
</REQUESTS>
The Server will respond to the XML Client with the value of requested parameter, refer to
the XML-API document this is a F2 <message length> <XML-DATA> F6 message;
For example:
XML-DATA:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<RESPONSES count="1">
<RESPONSE>
<TC_DB>
<TRAIN_STOP NAME="DN361">
<VR>
<VALUE UPDATE="3537417612.517">1</VALUE>
</VR>
</TRAIN_STOP>
</TC_DB>
<SERVER>
<CMD_DESCRIPTOR>
<REQUEST> TARGET={TRAIN_STOP.VR.VALUE 1} NAME={_DN361}</REQUEST>
</CMD_DESCRIPTOR>
<INDICATION> Retrieved Asserted</INDICATION>
<LATENCY_MS>2.987862</LATENCY_MS>
<TIME> 02/04/16 11:00:12.517</TIME>
</SERVER>
</RESPONSE>
</RESPONSES>
E. Get signal lamp value ("SIGNAL_LAMP"), refer to the XML-API document this is a FC
<message length> <XML-DATA> F6 message;
For example:
XML-DATA:
<REQUESTS>
<CMD name="ADAPT">
<REQUEST>target={ SIGNAL_LAMP.RGP.VALUE } name={}</REQUEST>
</CMD>
</REQUESTS>
The Server will respond to the XML Client with the value of requested parameter, refer to
the XML-API document this is a F2 <message length> <XML-DATA> F6 message;
For example:
XML-DATA:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<RESPONSES count="1">
<RESPONSE>
<TC_DB>
<SIGNAL_LAMP NAME="DNA362GT">
<RGP>
<VALUE UPDATE="3537418291.650">1</VALUE>
</RGP>
</SIGNAL_LAMP>
</TC_DB>
<SERVER>
<CMD_DESCRIPTOR>
<REQUEST> TARGET={SIGNAL_LAMP.RGP.VALUE} NAME={DNA362GT}</REQUEST>
</CMD_DESCRIPTOR>
<INDICATION> Retrieved Asserted</INDICATION>
<LATENCY_MS>4.000664</LATENCY_MS>
<TIME> 02/04/16 11:11:31.650</TIME>
</SERVER>
</RESPONSE>
</RESPONSES>
F. Get bit value ("BIT"), refer to the XML-API document this is a FC <message length> <XML-
DATA> F6 message;
For example:
XML-DATA:
<REQUESTS>
<CMD name="ADAPT">
<REQUEST>target={BIT.VALUE 1} name={DN361.FLR}</REQUEST>
</CMD>
</REQUESTS>
The Server will respond to the XML Client with the value of the corresponding bit, refer
to the XML-API document this is a F2 <message length> <XML-DATA> F6 message;
For example:
XML-DATA:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<RESPONSES count="1">
<RESPONSE>
<TC_DB>
<BIT NAME=" DN361.FLR ">
<VALUE UPDATE="3537418291.650">0</VALUE>
</BIT>
<TC_DB>
<SERVER>
<CMD_DESCRIPTOR>
<REQUEST> TARGET={BIT.VALUE 1} NAME={DN361.FLR}</REQUEST>
</CMD_DESCRIPTOR>
<INDICATION> Retrieved Asserted</INDICATION>
<LATENCY_MS>0.993729</LATENCY_MS>
<TIME> 02/04/16 11:06:49.782</TIME>
</SERVER>
</RESPONSE>
</RESPONSES>
Also, the XML server shall transmit XML messages with state changes to all its clients without any request from
them. These messages contain state changes for track circuits, switches, train stops, signal lamps and bits, these are
F2 <message length> <XML-DATA> F6 messages. Examples for each type of device are specified below:
A. Response for track value change:
XML-DATA:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<RESPONSES count="1">
<RESPONSE>
<TC_DB>
<TRACK NAME="DN361T">
<OCCUPANCY>
<VALUE UPDATE="3537418593.186">0</VALUE>
</OCCUPANCY>
</TRACK>
</TC_DB>
<SERVER>
<CMD_DESCRIPTOR>
<REQUEST> TARGET={TRACK.OCCUPANCY.VALUE 0} NAME={DN361T}</REQUEST>
</CMD_DESCRIPTOR>
<INDICATION>Asserted</INDICATION>
<LATENCY_MS>0.993729</LATENCY_MS>
<TIME> 02/04/16 11:06:49.782</TIME>
</SERVER>
</RESPONSE>
</RESPONSES>
</RESPONSE>
</RESPONSES>
</RESPONSE>
</RESPONSES>
<RGP>
<VALUE UPDATE="3537418291.650">1</VALUE>
</RGP>
</SIGNAL_LAMP>
</TC_DB>
<SERVER>
<CMD_DESCRIPTOR>
<REQUEST> TARGET={SIGNAL_LAMP.RGP.VALUE 1} NAME={DNA362GT}</REQUEST>
</CMD_DESCRIPTOR>
<INDICATION>Asserted</INDICATION>
<LATENCY_MS>0.993729</LATENCY_MS>
<TIME> 02/04/16 11:06:49.782</TIME>
</SERVER>
</RESPONSE>
</RESPONSES>
</RESPONSE>
</RESPONSES>
The following type of requests shall be processed to update the bit value if the write status of the bit is set:
XML-DATA:
<REQUESTS>
<CMD NAME="ADAPT">
<REQUEST> target={ BIT.VALUE 1} name={ DN361.FLR }</REQUEST>
</CMD>
</REQUESTS>
And the following response shall be broadcasted to all the XML Clients:
XML-DATA:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<RESPONSES count="1">
<RESPONSE>
<TC_DB>
<BIT NAME="">
<VALUE UPDATE="3537418291.650">1</VALUE>
</BIT>
<TC_DB>
<SERVER>
<CMD_DESCRIPTOR>
<REQUEST> TARGET={BIT.VALUE 1} NAME={ DN361.FLR }</REQUEST>
</CMD_DESCRIPTOR>
<INDICATION>Asserted</INDICATION>
<LATENCY_MS>0.993729</LATENCY_MS>
<TIME> 02/04/16 11:06:49.782</TIME>
</SERVER>
</RESPONSE>
If the write status of the bit is not set the request will be discarded.
Since the simulator software already contains of XML client that implements methods for parsing XML
request messages and generating XML response messages, this should be used in XML Server
implementation.
In accordance with suggested solution a typical communication flow of XML Server shall look as shown on
the figure below:
MLK Simulator
XML Client
(XML Server)
Connection to Establish TCP connection Accept Client
the server connection
Get ‘SWITCH’
...
...
value request
‘SWITCH’ value
Updating Response
‘SWITCH’ state
Post ‘SWITCH’
...
...
Switch or
status value Request is
Lamp/Signal
bits changed discarded
Actual ‘SWITCH’ value
Response
...
A Track circuit
...
...
Unrequested ‘SWITCH’
Updating changed
state data
‘SWITCH’ state
2.3 Processing XML-RPC calls for managing bits and conflicts resolution
Current implementation of the MicroLok simulator contains functionality that is responsible for processing
XML-RPC calls in order to provide clients with ability to control bits and resolve conflicts of bit ownership
with masking. Therefore the task is to verify that this processing logic operates properly. Therefore the
following steps shall be done to perform the task:
Review implementation details and analyze parts of related source code;
Prepare set of test cases which allows to generate XML-RPC calls for all possible bits types and ensure
that there is capability to control corresponding bits, verify absence of any conflicts of bit ownership;
Perform all prepared test scenarios;
Fix all the detected issues.