DCC++EX EX-RAIL Usage and Development

RoadRailer Nov 13, 2021

  1. RoadRailer

    RoadRailer TrainBoard Member

    41
    11
    4
    In reviewing the information for the DCC++EX EX-RAIIL beta, it looks very interesting.

    I have a few questions for my clarification/understanding. Suppose instead of the example layout (shown below), we have a multi-track Yard A and a multi-track Yard B in place of Station A and Station B.

    [​IMG]

    Each yard track would be its own block, with Yard A's tracks (blocks) numbered 101, 102, 103, 104, etc. and Yard B's tracks (blocks) numbered 201, 202, 203, 204, etc.

    1. For now, starting out, we will assume each locomotive consist is assigned to a specific yard track. Would the initialization be as follows to associate a consist with its current block?

    Sequence(0)
    SetLoco(3111) Reserve(101)
    SetLoco(5812) Reserve(102)
    SetLoco(7613) Reserve(103)
    SetLoco(9214) Reserve(104)
    SetLoco(4221) Reserve(201)
    SetLoco(6322) Reserve(202)
    SetLoco(8423) Reserve(203)
    SetLoco(0124) Reserve(204)



    2. Once a locomotive or consist has been associated with a block, is it possible to just track occupied blocks, or is there some way to determine which locomotive/consist currently has a reservation on a given block (e.g. similar to READ_LOCO(), but reading block reservation instead)?


    3. Suppose—for the sake of visual interest on an automated layout—that yard departures are randomized. Is there a way to check if a block is occupied (reserved) without automatically reserving it like IfReserve() does? For example, if a block is occupied (reserved), we would to start the train in that block, but if that block is not occupied, we would leave its state along and check another block.


    4. Is there a way to handle "Else If" and "Else" conditional branches? At least at the present, it doesn't appear that there are any "Else"-related keywords defined.


    Thank you!
     
  2. Ash

    Ash TrainBoard Member

    106
    67
    8
    Relaying a reply from UKBloke (aka Chris) ... from the DCC++EX discord server.

    1. For now, starting out, we will assume each locomotive consist is assigned to a specific yard track. Would the initialization be as follows to associate a consist with its current block?​

    Well, its not quite that simple because EXRAIL is not interested in which "loco" has reserved which "block"... and its definitely not a 1:1 between block reserved and block occupied because you often have to reserve several blocks ahead to make sure you can, for example, safely cross a double track main line.

    Having said that, I can see from your example scenario that some way of recording "I am loco 57 and I am parked on siding B" might well be useful for someone who wants to say "take the loco from siding B to Siding X"... This of course means that you still need a sequence to get out of siding B... to some point where there is a common sequence to get into siding X... and there is no automatic route joining so you actually need all combinations of B and X as separate routes although the middle part might be shared code.

    2.... is there some way to determine which locomotive/consist currently has a reservation on a given block
    No... see above.

    3. ... Is there a way to check if a block is occupied (reserved) without automatically reserving it like IfReserve() does?

    A IFCANRESERVE(...) kind of function is feasible.

    4. Is there a way to handle "Else If" and "Else" conditional branches? At least at the present, it doesn't appear that there are any "Else"-related keywords defined.

    Imagine you are coding Assembler... that doesn't have block structure or else/elseif etc... So for example
    Code:
    IF(a)
          ... DO STUFF FOR a
         FOLLOW(991)
      ENDIF
      ... do stuff for not-a
      SEQUENCE(991)
     .. carry on
    Its a compromise I have to make given the tools available.
     
  3. RoadRailer

    RoadRailer TrainBoard Member

    41
    11
    4
    I appreciate the relay. Perhaps—in order to keep things simple and the code footprint small—this scenario is beyond the intended capability of EX-RAIL?

    To clarify with respect to the response, I would agree that there is no expectation of a 1:1 relationship between a reserved block and an occupied block. However, at initialization, everything is stopped, so the immediate need at that point is just to define where everything is located and ensure currently-occupied blocks are reserved.

    From the documentation:
    To perhaps back up a bit, my expectation would be that any locomotive/consist should have a reservation for at least the block(s) it is occupying, even if it is not yet being routed.
    • Might be occupying just 1 block
    • Might be occupying multiple blocks
    • [Potential other block reservation types that are out of scope for this discussion]
      • Helper locomotives, etc. that might be added to a train
      • Cars only (no associated locomotive/consist)
      • Out-of-service trackage, etc.

    For the yard scenario described earlier, though, a Reserve/SendLoco combination is not desirable because we don't want them to all leaving the yard one right after the other. Perhaps using IfRandom, a train in a given yard track would be selected and routed to an open track in the opposite yard, and this would continue back and forth between the yards.

    Over time, as trains continue to move in a randomized fashion, is there any way to determine which locomotives/consists are on which yard tracks (as SendLoco() requires both locomotive/consist ID and route ID), or is such tracking really beyond the intended capabilities of EX-RAIL?


    Each yard track would be its own block and would have a unique route defined for entering/exiting the yard, so I don't anticipate an absence of auto-routing to be an issue.
     
  4. UkBloke

    UkBloke TrainBoard Member

    42
    5
    3
    This copied from our Discord server:
    1. Bear in mind each train is likely to need different throttle speed settings and may be facing backwards or have different functions for sounds etc etc. This isnt possible if you work from the track perspective instead of the train perspective so your idea above above is kind of down the wrong end of the telescope.

      To handle say multiple trains in a yard at one end and a few available yards at the other end of a single track (which I think is what the OP is suggesting) one can consider this in a slightly different way.... Lets say you have 8 tracks at one end (West) and 2 at the other (East) . Rather than randomly select movement from any track to any track, lets simplify the problem by having each loco have its own track at W and have a known shared track at E. e.g. W1 and W2 share E1, W3 and W4 share E2. This isn't so unrealistic as E1 may be a passenger platform and E2 be a goods bay. Similarly, having a 'home' at the W end may be helpful where some strains are longer than others and may not fit on the outer edges of the yard. So the sequence for train T1 (which we assume is sitting at W1) would be something like this (assuming the aliases have been defined)

      SEQUENCE(T1) // I'm using Aliases here for readability
      DELAYRANDOM(min, max)
      RESERVE(E1)
      RESERVE(MAIN)
      Throw/close turnouts and signals etc for W1 to E1
      lights, whistles, etc
      FWD(50)
      AT(SENSOR_E1)
      STOP
      FREE(MAIN)
      DELAYRANDOM... some time
      RESERVE(MAIN)
      Throw/close turnouts and signals etc for E1 to W1
      REV(50)
      AT(SENSOR_W1)
      STOP
      FREE(E1)
      FREE(MAIN)
      FOLLOW(T1)

      There will be an almost identical sequence for W2-->E1->W2 and so on for each W track. At start up we can place a train on W1 and SENDLOCO(3,W1), same for the other tracks. There is no need to pre-reserve because each train owns its own W track. Because all the trains have a continuously running sequence, but with random delays between movements it should not be obvious what is going to move next. Technically it is possible to expand this to random choices at each end but the script size increases exponentially unless I add some simple to code but very complex to explain opcodes to exrail.



    2. And as you build on this model, you may have perhaps a little backwater station half way along the main... and only one of the trains stops briefly at it or randomly just goes to the station and back without needing an E siding or parks in a passing place so others can go around it. . (This kind of detail adds interest and is trivial when you have a different sequence for each train.) (edited)

    Message #ex-rail
     

Share This Page