Interface miMod(Model) – step 0031 – January 2010

1 Introduction

There are several types of SrrTrains Models

Remark: SrrTrains does not pose any requirements on Non-SrrTrains Models, that might be used in SrrTrains model railroad layouts, too.

Intrinsic models are implemented as part of a module, using SRR objects directly. Such models do NOT provide the miMod(Model) interface.

Static models are provided as X3D prototypes, providing the miMod(Model) interface to be loaded and initialized by a module statically.

Vehicle models, providing the miMod(Model) interface to be loaded and initialized by the SRR Controller – TMM.

2 Static Models – Definition of miMod(Model)

Static models use SRR objects to implement (a part of) their functionality.

Furthermore they may use the SrrTracer prototype to output diagnostic information.

Both options require to have an object ID (objId) and to be initialized with the module parameters (modParam).

Therefore SrrTrains requires the following minimum interface from a static model:

<ProtoDeclare name='NameOfTheStaticModel'>
<ProtoInterface>
<field accessType='inputOutput' name='objId' type='SFString'/>
<field accessType='inputOutput' name='modParam' type='SFNode'/>
</ProtoInterface>
<ProtoBody>
:
:
:
</ProtoBody>
</ProtoDeclare>

3 Vehicle Models – Definition of miMod(Model)

Vehicle models are loaded by the SRR Controller – TMM. The convention is, that the file, that is referenced by an URL, must create one or more X3D nodes, when being loaded with Browser.createVrmlFromURL().

The second node will be taken as the model's instance.

After having loaded the model, the SRR Controller will

When unloading a model, the SRR Controller will

Hence, SrrTrains requires the following minimum interface from a vehicle model

4 Example of a Vehicle Model

<Scene>
<ProtoDeclare name='MyFirstWagon'>
<!-- **************************** external interface of the prototype ********************************* -->
<ProtoInterface>
<field accessType='inputOutput' name='vIdleRotation' type='SFFloat' value="1.0"/>
<field accessType='inputOutput' name='idleRotate' type='SFBool' value="false"/>
<field accessType='inputOutput' name='objId' type='SFString'/>
<field accessType='inputOutput' name='quasiModule' type='SFString'/>
<field accessType='inputOutput' name='modParam' type='SFNode'/>
<field accessType='inputOutput' name='standalone' type='SFBool' value="true"/>
<field accessType='outputOnly' name='initialized' type='SFNode'/>
<field accessType='inputOutput' name='enabled' type='SFBool' value='true'/>
</ProtoInterface>
<ProtoBody>
<!-- **************************** external prototypes ********************************* -->
<ExternProtoDeclare name='SrrWagon2axA' url='"../srr/SrrWagon2axA.x3d" "
http://members.chello.at/christoph.valentin/srr/SrrWagon2axA.x3d"'>
<field accessType='inputOutput' name='objType' type='SFString' value='SrrWagon2axA'/>
<field accessType='inputOutput' name='version' type='SFFloat' value='0.0031'/>
<field accessType='inputOutput' name='objId' type='SFString'/>
<field accessType='inputOutput' name='quasiModule' type='SFString'/>
<field accessType='inputOutput' name='mass' type='SFFloat' value="1000"/>
<field accessType='inputOutput' name='wee' type='SFFloat' value="0.0025"/>
<field accessType='inputOutput' name='length' type='SFFloat' value="5.0"/>
<field accessType='inputOutput' name='axlesPositions' type='MFFloat' value='1.0 4.0'/>
<field accessType='inputOutput' name='axle0' type='SFNode'/>
<field accessType='inputOutput' name='axle1' type='SFNode'/>
<field accessType='inputOutput' name='transformationWagon' type='SFNode'/>
<field accessType='inputOutput' name='vIdleRotation' type='SFFloat' value="1.0"/>
<field accessType='inputOutput' name='idleRotate' type='SFBool' value="false"/>
<field accessType='inputOutput' name='vConstControl' type='SFNode'/>
<field accessType='inputOutput' name='vConstEnableControl' type='SFNode'/>
<field accessType='inputOutput' name='dozeControl' type='SFNode'/>
<field accessType='inputOutput' name='standalone' type='SFBool' value='true'/>
<field accessType='inputOutput' name='visible' type='SFInt32'/>
<field accessType='outputOnly' name='basicallyInitialized' type='SFNode'/>
<field accessType='inputOutput' name='modParam' type='SFNode'/>
<field accessType='outputOnly' name='initialized' type='SFNode'/>
<field accessType='inputOutput' name='enabled' type='SFBool' value='true'/>
<field accessType='outputOnly' name='staticModel' type='SFBool'/>
<field accessType='inputOutput' name='exitViewpoint' type='SFNode'/>
<field accessType='inputOnly' name='deleteTrain' type='SFTime'/>
</ExternProtoDeclare>
:
:
:
<Group DEF='PrototypeRootNode'>
<Switch DEF='MasterOnOff'>
<Group>
<!-- **************************** graphical representation of the first axle ********************************* -->
<Transform DEF="FirstAxleTransform1" >
<Transform DEF="FirstAxleTransform2" >
:
:
:
</Transform>
</Transform>
<!-- **************************** graphical representation of the second axle ********************************* -->
<Transform DEF="SecondAxleTransform1" >
<Transform DEF="SecondAxleTransform2" >
:
:
:
</Transform>
</Transform>
<!-- **************************** graphical representation of the body of the wagon ********************************* -->
<Transform DEF="BodyTransform1">
<Transform DEF="BodyTransform2" >
:
:
:
</Transform>
</Transform>
</Group>
</Switch>
<!-- **************************** SRR-objects for the functionality of the wagon ********************************* -->
<ProtoInstance DEF="SrrWagon2ax" name='SrrWagon2axA'>
<fieldValue name='mass' value='1600'/>
<fieldValue name='length' value='8.155'/>
<fieldValue name='axlesPositions' value='2.235 5.92'/>
<fieldValue name="axle0">
<ProtoInstance DEF="Axle0" name="SrrAxle">
<fieldValue name="inverse" value="false"/>
<fieldValue name="transformation">
<ProtoInstance DEF="SrrTransformFromSrrObjectAxle0" name="SrrTransformationA"/>
</fieldValue>
<fieldValue name="wheelRadius" value="0.51"/>
</ProtoInstance>
</fieldValue>
<fieldValue name="axle1">
<ProtoInstance DEF="Axle1" name="SrrAxle">
<fieldValue name="inverse" value="false"/>
<fieldValue name="transformation">
<ProtoInstance DEF="SrrTransformFromSrrObjectAxle1" name="SrrTransformationA"/>
</fieldValue>
<fieldValue name="wheelRadius" value="0.51"/>
</ProtoInstance>
</fieldValue>
<fieldValue name="transformationWagon">
<ProtoInstance DEF="SrrTransformFromSrrObjectWagon" name="SrrTransformationA"/>
</fieldValue>
:
:
:
<IS>
<connect nodeField="standalone" protoField="standalone"/>
</IS>
</ProtoInstance>
<ROUTE fromField='visible' fromNode='SrrWagon2ax' toField='whichChoice' toNode='MasterOnOff'/>
<ROUTE fromField='transformation' fromNode='SrrTransformFromSrrObjectAxle0' toField='transfToX3D' toNode='SrrTransformFromSrrObjectAxle0'/>
<ROUTE fromField='translation' fromNode='SrrTransformFromSrrObjectAxle0' toField='translation' toNode='FirstAxleTransform1'/>
<ROUTE fromField='rotation1' fromNode='SrrTransformFromSrrObjectAxle0' toField='rotation' toNode='FirstAxleTransform1'/>
<ROUTE fromField='rotation2' fromNode='SrrTransformFromSrrObjectAxle0' toField='rotation' toNode='FirstAxleTransform2'/>
<ROUTE fromField='transformation' fromNode='SrrTransformFromSrrObjectAxle1' toField='transfToX3D' toNode='SrrTransformFromSrrObjectAxle1'/>
<ROUTE fromField='translation' fromNode='SrrTransformFromSrrObjectAxle1' toField='translation' toNode='SecondAxleTransform1'/>
<ROUTE fromField='rotation1' fromNode='SrrTransformFromSrrObjectAxle1' toField='rotation' toNode='SecondAxleTransform1'/>
<ROUTE fromField='rotation2' fromNode='SrrTransformFromSrrObjectAxle1' toField='rotation' toNode='SecondAxleTransform2'/>
<ROUTE fromField='transformation' fromNode='SrrTransformFromSrrObjectWagon' toField='transfToX3D' toNode='SrrTransformFromSrrObjectWagon'/>
<ROUTE fromField='translation' fromNode='SrrTransformFromSrrObjectWagon' toField='translation' toNode='BodyTransform1'/>
<ROUTE fromField='rotation1' fromNode='SrrTransformFromSrrObjectWagon' toField='rotation' toNode='BodyTransform1'/>
<ROUTE fromField='rotation2' fromNode='SrrTransformFromSrrObjectWagon' toField='rotation' toNode='BodyTransform2'/>
:
:
:
</Group>
</ProtoBody>
</ProtoDeclare>
<Viewpoint description="defaultViewpoint" position="3 1.75 3" orientation="0 1 0 1.0"/>
<ProtoInstance name='MyFirstWagon'/>
<NavigationInfo type='"EXAMINE"'/>
</Scene>