Routes with actions

Het baanplan

In dit ontwerp is 1 wissel toegepast en zijn 2 rijwegen gedefinieerd.

<plan title="plan.xml" rocguiversion="1.4.999 revision 924" rocrailversion="1.4.999 revision 924">
  <zlevel title="example" z="0" active="true"/>
  <tklist>
    <tk type="straight" id="tk20091025102741245" x="3" y="2" z="0"/>
    <tk type="straight" id="tk20091025102741717" x="4" y="2" z="0"/>
    <tk type="straight" id="tk20091025102801615" x="6" y="1" z="0"/>
    <tk type="straight" id="tk20091025102802741" x="7" y="1" z="0"/>
    <tk type="straight" id="tk20091025102803693" x="6" y="2" z="0"/>
    <tk type="straight" id="tk20091025102804102" x="7" y="2" z="0"/>
    <tk type="straight" id="tk20091025102808046" x="8" y="1" z="0"/>
    <tk type="straight" id="tk20091025102808510" x="8" y="2" z="0"/>
    <tk type="curve" id="tk20091025102842839" x="5" y="1" z="0" ori="north"/>
    <tk type="straight" id="tk20091025102848135" x="10" y="1" z="0"/>
    <tk type="straight" id="tk20091025102848975" x="10" y="2" z="0"/>
    <tk type="straight" id="tk20091025102850567" x="1" y="2" z="0"/>
  </tklist>
  <swlist>
    <sw type="left" id="w1" x="5" y="2" z="0" switched="9" ori="east" prev_id="w1" blockid="" accnr="1" savepos="none" dir="false" swtype="default" road="false" iid="" bus="0" addr1="0" port1="999" gate1="0" inv="false" singlegate="false" addr2="0" port2="0" inv2="false" actdelay="false" delay="0" prot="D" fbRinv="false" fbGinv="false" fb2Rinv="false" fb2Ginv="false" state="turnout">
      <accessoryctrl active="false" interval="0" delay="0" lockroutes=""/>
    </sw>
  </swlist>
  <colist>
    <co id="a1" x="9" y="1" z="0" desc="" show="true" svgtype="3" blockid="" routeids="" iid="" bus="0" addr="0" port="0" gate="0" prot="D" ori="west"/>
    <co id="a2" x="9" y="2" z="0" desc="" show="true" svgtype="3" blockid="" routeids="" iid="" bus="0" addr="0" port="0" gate="0" prot="D" ori="west"/>
    <co id="a3" x="2" y="2" z="0" desc="" show="true" svgtype="3" blockid="" routeids="" iid="" bus="0" addr="0" port="0" gate="0" prot="D" ori="west" state="off"/>
  </colist>
  <stlist>
    <st id="w_b1" prev_id="w_b1" bka="" bkb="" bkc="" modid="" dir="true" lcdir="true" speed="none" reduceV="true" swap="false" swappost="false" crossingblocksignals="false" typeperm="all" maxlen="0">
      <swcmd id="w1" cmd="straight" lock="true"/>
    </st>
    <st id="w_b2" prev_id="w_b2" bka="" bkb="" bkc="" modid="" dir="true" lcdir="true" speed="none" reduceV="true" swap="false" swappost="false" crossingblocksignals="false" typeperm="all" maxlen="0">
      <swcmd id="w1" cmd="turnout" lock="true"/>
    </st>
  </stlist>
</plan>

De Akties

we hebben twee akties nodig om de rijweg te triggeren. Dit kan via het aktie-menu.

in het ontwerp worden de volgende regels toegevoegd :

<aclist>
    <ac id="ac_b1" timed="false" hour="0" min="0" cmd="" oid="w_b1" actiontime="0" param="" timer="0" type="st"/>
    <ac id="ac_b2" timed="false" hour="0" min="0" cmd="" oid="w_b2" actiontime="0" param="" timer="0" type="st"/>
</aclist>

De Knoppen

Wat we willen is dat na het drukken op de startknop de volgende knop in het plan de rijweg vastgelegd. We willen dus een voorwaarde zodat de aktie uitgevoerd wordt als knop 1 ingedrukt is.

<co id="a2" x="9" y="2" z="0" desc="" show="true" svgtype="3" blockid="" routeids="" iid="" bus="0" addr="0" port="0" gate="0" prot="D" ori="west">
    <actionctrl id="ac_b1">
        <actioncond id="a1" state="on" type="co"/>
    </actionctrl>
</co>
<co id="a3" x="2" y="2" z="0" desc="" show="true" svgtype="3" blockid="" routeids="" iid="" bus="0" addr="0" port="0" gate="0" prot="D" ori="west" state="off">
    <actionctrl id="ac_b2">
        <actioncond id="a1" state="on" type="co"/>
    </actionctrl>
</co>

maar nu blijven de knoppen “aan” nadat de rijweg gezet is. Er moet dus een tweede aktie vastgelegd worden om de knoppen weer “uit” te zetten.

De aclist wordt dus uitgebreid met:

  <aclist>
    <ac id="ac_b1" timed="false" hour="0" min="0" cmd="" oid="w_b1" actiontime="0" param="" timer="0" type="st"/>
    <ac id="ac_b2" timed="false" hour="0" min="0" cmd="" oid="w_b2" actiontime="0" param="" timer="0" type="st"/>
    <ac id="a1_off" timed="false" hour="0" min="0" cmd="off" oid="a1" actiontime="0" param="" timer="0" type="co"/>
    <ac id="a2_off" timed="false" hour="0" min="0" cmd="off" oid="a2" actiontime="0" param="" timer="0" type="co"/>
    <ac id="aw_off" timed="false" hour="0" min="0" cmd="off" oid="aw" actiontime="0" param="" timer="0" type="co"/>
  </aclist>

en voeg de akties aan de knoppen toe:

  <colist>
    <co id="a1" x="9" y="1" z="0" desc="" show="true" svgtype="3" blockid="" routeids="" iid="" bus="0" addr="0" port="0" gate="0" prot="D" ori="west" state="off">
      <actionctrl id="ac_b1">
        <actioncond id="aW" state="on" type="co"/>
      </actionctrl>
      <actionctrl id="aw_off"/>
      <actionctrl id="a1_off"/>
      <actionctrl id="a2_off"/>
    </co>
    <co id="aw" x="2" y="2" z="0" desc="" show="true" svgtype="3" blockid="" routeids="" iid="" bus="0" addr="0" port="0" gate="0" prot="D" ori="west" state="off"/>
    <co id="a2" x="9" y="2" z="0" desc="" show="true" svgtype="3" blockid="" routeids="" iid="" bus="0" addr="0" port="0" gate="0" prot="D" ori="west" state="off">
      <actionctrl id="ac_b2">
        <actioncond id="aW" state="on" type="co"/>
      </actionctrl>
      <actionctrl id="aw_off"/>
      <actionctrl id="a1_off"/>
      <actionctrl id="a2_off"/>
    </co>
  </colist>

Het uiteindelijke spoorplan

ziet er zo uit:

<plan title="plan.xml" rocguiversion="1.4.999 revision 924" rocrailversion="1.4.999 revision 924">
  <zlevel title="example" z="0" active="true"/>
  <tklist>
    <tk type="straight" id="tk20091025102741245" x="3" y="2" z="0"/>
    <tk type="straight" id="tk20091025102741717" x="4" y="2" z="0"/>
    <tk type="straight" id="tk20091025102801615" x="6" y="1" z="0"/>
    <tk type="straight" id="tk20091025102802741" x="7" y="1" z="0"/>
    <tk type="straight" id="tk20091025102803693" x="6" y="2" z="0"/>
    <tk type="straight" id="tk20091025102804102" x="7" y="2" z="0"/>
    <tk type="straight" id="tk20091025102808046" x="8" y="1" z="0"/>
    <tk type="straight" id="tk20091025102808510" x="8" y="2" z="0"/>
    <tk type="curve" id="tk20091025102842839" x="5" y="1" z="0" ori="north"/>
    <tk type="straight" id="tk20091025102848135" x="10" y="1" z="0"/>
    <tk type="straight" id="tk20091025102848975" x="10" y="2" z="0"/>
    <tk type="straight" id="tk20091025102850567" x="1" y="2" z="0"/>
  </tklist>
  <swlist>
    <sw type="left" id="w1" x="5" y="2" z="0" switched="29" ori="east" prev_id="w1" blockid="" accnr="1" savepos="none" dir="false" swtype="default" road="false" iid="" bus="0" addr1="0" port1="999" gate1="0" inv="false" singlegate="false" addr2="0" port2="0" inv2="false" actdelay="false" delay="0" prot="D" fbRinv="false" fbGinv="false" fb2Rinv="false" fb2Ginv="false" state="turnout">
      <accessoryctrl active="false" interval="0" delay="0" lockroutes=""/>
    </sw>
  </swlist>
  <colist>
    <co id="a1" x="9" y="1" z="0" desc="" show="true" svgtype="3" blockid="" routeids="" iid="" bus="0" addr="0" port="0" gate="0" prot="D" ori="west" state="off">
      <actionctrl id="ac_b1">
        <actioncond id="aw" state="on" type="co"/>
      </actionctrl>
      <actionctrl id="aw_off"/>
      <actionctrl id="a1_off"/>
      <actionctrl id="a2_off"/>
    </co>
    <co id="aw" x="2" y="2" z="0" desc="" show="true" svgtype="3" blockid="" routeids="" iid="" bus="0" addr="0" port="0" gate="0" prot="D" ori="west" state="off"/>
    <co id="a2" x="9" y="2" z="0" desc="" show="true" svgtype="3" blockid="" routeids="" iid="" bus="0" addr="0" port="0" gate="0" prot="D" ori="west" state="off">
      <actionctrl id="ac_b2">
        <actioncond id="aw" state="on" type="co"/>
      </actionctrl>
      <actionctrl id="aw_off"/>
      <actionctrl id="a1_off"/>
      <actionctrl id="a2_off"/>
    </co>
  </colist>
  <stlist>
    <st id="w_b1" prev_id="w_b1" bka="" bkb="" bkc="" modid="" dir="true" lcdir="true" speed="none" reduceV="true" swap="false" swappost="false" crossingblocksignals="false" typeperm="all" maxlen="0">
      <swcmd id="w1" cmd="turnout" lock="true"/>
    </st>
    <st id="w_b2" prev_id="w_b2" bka="" bkb="" bkc="" modid="" dir="true" lcdir="true" speed="none" reduceV="true" swap="false" swappost="false" crossingblocksignals="false" typeperm="all" maxlen="0">
      <swcmd id="w1" cmd="straight" lock="true"/>
    </st>
  </stlist>
  <aclist>
    <ac id="ac_b1" timed="false" hour="0" min="0" cmd="" oid="w_b1" actiontime="0" param="" timer="0" type="st"/>
    <ac id="ac_b2" timed="false" hour="0" min="0" cmd="" oid="w_b2" actiontime="0" param="" timer="0" type="st"/>
    <ac id="a1_off" timed="false" hour="0" min="0" cmd="off" oid="a1" actiontime="0" param="" timer="0" type="co"/>
    <ac id="a2_off" timed="false" hour="0" min="0" cmd="off" oid="a2" actiontime="0" param="" timer="0" type="co"/>
    <ac id="aw_off" timed="false" hour="0" min="0" cmd="off" oid="aw" actiontime="0" param="" timer="0" type="co"/>
  </aclist>
</plan>

Alles kan vanuit de grafische omgeving, de gui, gedaan worden maar het is misschien eenvoudiger om de xml file direct te editten.


Personal Tools