Exceeding the 12 loco limit in DCC++

crusader27529 Jul 2, 2017

  1. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    Does anyone know what happens if you try to add another loco to DCC++ specifically, and other DCC systems in general, beyond the limits of the system?

    The electrical engineer/programmer in me says there are 3 likely results:

    1-the new loco addition is ignored
    2-the new loco is accepted, and one of the other locos(12 is the limit in the standard DCC++ code) gets dropped off the active loco list
    3-the new loco addition returns an error indication

    The least likely possibility is that the system crashes and reboots.

    I don't actually know the answer, and the code in this area is complex enough so that I can't figure out what would happen, so I'm looking for an answer.

    Has anyone ever reached the limit? What happened?

    Gregg Berman.......can you chime in?

    Thanks In Advance(TIA).
     
    Scott Eric Catalano likes this.
  2. Jimbo20

    Jimbo20 TrainBoard Member

    274
    178
    11
    I don't know specifically what would happen if you exceed the count, but after a brief look at the code I would suspect that you would get your option #1.

    You can apparently alter the maximum no of locos by editing the line in config.h I guess that the limit would be how much available memory you have?

    Code:
    #define MAX_MAIN_REGISTERS 12
    You could reduce this to say 2 and see what happens when you try and control a third loco.

    Conversely, you could increase it and see if it will work with the number of locos you need?
     
    Scott Eric Catalano likes this.
  3. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    A dataset of 2 isn't enough to verify how the code works......observation of only 2 would result in guessing.

    I really need the author of the code to tell me/us how it works.
     
    Scott Eric Catalano likes this.
  4. Jimbo20

    Jimbo20 TrainBoard Member

    274
    178
    11
    Here is a snippet of conversation between Rocrail And DCCPlusPlus on the Github:

    ******************************************************
    rocrail commented on Mar 16, 2016
    Because the number of CAB registers is limited to 12, a release command would be helpful for slot management in the host software. (JRMI, Rocrail,...)


    [​IMG]

    Owner
    DccPlusPlus commented on Mar 16, 2016
    Slot management, if needed, would be done in the JMRI software itself. Registers in the DCC++ BaseStation are simply overridden as needed - there is nothing to release. Note you can also increase the number of registers to greater than 12, especially if running on he Mega (not sure what the max would be, but I'm guessing about 50).
    *******************************************************

    https://github.com/DccPlusPlus/BaseStation/issues/4


    Unfortunately, even the author of DCC++ can only guess at the maximum..... :(

    Jim
     
    Last edited: Jul 4, 2017
    Scott Eric Catalano likes this.
  5. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    Excellent......that's the detail kind of data I wanted.

    I've removed all the non-loco control stuff out of a version of DCC++ to run on a NANO, and it looks like the limits of the NANO(same as the UNO) is 40 loco slots(based on resources). Remeber, the slots are only used to send commands to active locos, which should be defined as those needing speed or direction commands. Other commands are also sent, but they likely don't cause issues with the slot usage, as the slots seem to be dynamically allocated based on need.

    The bandwidth of the DCC specification is maximized at between 110 and 120 packets/second, simply based on the number of bits per average message and the frequency of the DCC signal. With 40 loco slots, every loco that needs a command to be sent will recieve about 3 commands per second.

    If the functions that I removed from the code are needed, then a second DCC++ system can be implemented with JMRI to do the ancillary functions, since those functions would be separate from commands sent to the rails. I stripped out those functions becasuse the code I've modified is for using DCC++ with up to 8 power districts.
     
    Scott Eric Catalano likes this.
  6. ThomasP

    ThomasP New Member

    8
    15
    4
    Hi altogether,
    Although crusader already got his answer, I wanted to show my way of exceeding the limit of usable registers in DCC++. Well, I don't exactly exceed the limit, I just avoid giving all the locos a pre-defined register number. I use the DCC++ controller under Processing. When the Controller is called, each loco initially receives its register to be zero. Then during operation, when a loco button is pressed and the loco register is still zero, and the number of registers already taken (e.g. 5) is less than the max of (in my case) 16, the loco which button has been pressed, receives the next free register (here: 6). And so on... as my layout is rather small, I normally do not have more than 16 trains activated during one "session", so the limit is never touched.

    Just making the most of the limited ressources of the Arduino Uno!

    Greetings from the old world, not only to the NC coast,
    Thomas.
     
    Scott Eric Catalano likes this.

Share This Page