SRR Controller–TMM – step 0032 – March 2010
SrrControlTm manages the trains in an SrrTrains model railroad layout.
If a frame wants to support modules which contain tracks, it instantiates the SrrControlTm exactly once, e.g. in the main file. It adds the SrrControlTm to the srrControlModules field of the base module of the SRR Controller (see SrrControl.x3d).
SrrControlTm contains client software and server software, where the server software runs in only one of the scene instances. The client software runs in all scene instances.
SrrControlTm implements the communication between client and server via a network sensor (streamName/networkSensorId= “SrrControlTm”).
SrrControlTm provides the user interface for the frame to perform the control of the train simulation (interface uiControl, described in this document).
SrrControlTm is an external prototype, available at the directory srr/.
<ProtoDeclare name='SrrControlTm'>
<ProtoInterface>
<field accessType='inputOutput' name='objType' type='SFString' value='SrrControlTm'/>
<field accessType='inputOutput' name='version' type='SFFloat' value='0.0032'/>
<field accessType='inputOutput' name='moduleId' type='SFString' value='TrainManager'/>
<field accessType='inputOutput' name='commParam' type='SFNode'/>
<field accessType='outputOnly' name='initialized' type='SFNode'/>
<field accessType='inputOnly' name='afterInit' type='SFBool'/>
<field accessType='inputOutput' name='traceLevelControl' type='SFInt32'/>
<field accessType='inputOutput' name='traceLevelCustom' type='SFInt32'/>
<field accessType='inputOnly' name='registerVehicles' type='MFString'/>
<field accessType='outputOnly' name='registeredVehicleIds' type='MFString'/>
<field accessType='outputOnly' name='registeredVehicleUrls' type='MFString'/>
<field accessType='outputOnly' name='registeredSetupPointIds' type="MFString"/>
<field accessType='inputOnly' name='createVehicle' type="MFString"/>
</ProtoInterface>
The fields of the user interface can be arranged according to the following categories:
x) Initialization, Session Handling
The fields moduleId, commParam, initialized, afterInit are used by the SRR Controller – Base Module (SrrControl.x3d) and need not be described here.
x) Tracer
The fields traceLevelControl and traceLevelCustom are used by the SRR Controller – Base Module (SrrControl.x3d) and need not be described here.
x) Track Management
No fields at uiControl regarding this category.
x) Vehicle and Train Management (Vehicle Registration/Setup Points, Train/Vehicle Status)
Vehicle models must be registered, before a vehicle instance can be created.
With registerVehicles several vehicle models can be registered. Each string of the MFString contains a vehicle registration in the form <vehicleId>;<url>[,<url>]...
The vehicles are registered at the central train controller and the registration information is distributed to all scene instances, where the result is reported in the fields registeredVehicleIds and registeredVehicleUrls.
Each string in the MFString registeredVehicleUrls is of the form <url>[,<url>]...
Vehicles can be created at so-called setup-points. Each setup point refers to a specific position on the tracks (objId of the track edge, ess/isAtoB of the setup point)
If a setup point is initialized (see SrrSetupPoint.x3d), it will be registered at the train manager. The MFString registeredSetupPointIds contains one string for each setup point, containing the syntax <moduleName>-<objId>.
A vehicle can be created (exactly spoken, a train with one vehicle can be created), by sending an MFString to the createVehicle field. The MFString contains following information:
createVehicle [0]: <vehicleId>
createVehicle [1]: <setupPointId>
createVehicle [2]: <FBI>
createVehicle [3]: <objId>
The last element can be omitted, in which case the train manager will create an objId for the vehicle instance.
<FBI> is the “forward-backward-indicator”. If <FBI> == 'true' then the vehicle will be created according the setup-points “isAtoB” property, in case <FBI> = 'false' the value will be inverted.
x) Dynamic Model Support (activation and deactivation of modules)
No fields at uiControl regarding this category.