Nick and anyone else who happens to read this thread looking for help with high volume message traffic issues,?
?
You should be aware of the fact that each iteration the wait() function inserted in the "intialize.py" script as earlier posted in this thread will cause the main JMRI program thread of the entire PanelPro program to pause for the specified duration.? In other words, Everything Stops!??
?
If your script is only run as one of the startup options, the cumulative delays might not be of much concern, at least right now.? Since you described a personal layout in the OP, you have control over all the future ramifications.
?
Other group members reading this may not have such freedom of control.??
?
In our club situation, it is not clear who will make what changes in the future or who will decide to run a script during a messed up Ops session or who will complain when something goes wrong due to some unexpected change or even if they will be aware of the implications of multithread execution.? It is also not clear that I will still be able to dig for answers to any such questions.??
?
The distributed example scripts named "InitAllTurnoutsSensors.py" and "InitLocoNetSensors.py" wrap their advertised decision process in classes derived from jmri.jmrit.automat.AbstractAutomaton as do several other examples, for a good reason.??
?
The big advantage for this discussion, is that the AbstractAutomation class runs on a thread that is not the main program thread.??
?
See for a lot of details, but of interest here is a very long list of functions with names that start with "wait..." that give us some slack to allow a hardware item to respond when or even if there is some external action.??
?
In particular a line of code copied directly from one of the aforementioned scripts that was inserted precisely because we have no control or even much insight into the workings of LocoNet internals:
?
? ?self.waitMsec(125) ?# stall for Command Station action
?
That and similar instructions were added because our club had the same problem you described more than 12 years ago, random incomplete initialization errors. If one searches this group's messages or the /g/LocoNet-Hackers/topics list or perhaps any network related website for message storm or related terminology, there is way too much sad information to share.??
?
The delays do not provide a fix, merely a workaround and are subject to periodic revision as additional LocoNet hardware keeps making new puzzles to deal with.
?
BillyBob provided instructive and useful information back then that helped me, and I am still grateful.
?
The JMRI document he pointed you to has evolved a lot since then.
?
Other DCC Command Stations have similar message traffic limitations for large layouts, but of the few that I have had experience with, better information has been available to the users.??
?
Cliff in Baja SoCal
? |