-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow multiple compatible reservation #114
Comments
Currently I've implemented:
|
Bridge reservation currently works with a bit mask, both paths have their own bit, see: https://github.com/traintastic/traintastic/blob/master/server/src/board/tile/rail/bridgerailtile.cpp Regarding the "Italian" way of turnout control, easiest would be to just use the same address for both turnouts. (Or somehow link them if the both have a different address,) Then the user can easily decide how they want it to work. Other option could be to do it automagically based on the used signaling system. |
Hm, it didn't work when I've tested it. I'll test again later |
We should add some tests to check that, also the other things you mentioned for turnout control while it is reserved. |
I've added a test to check if two paths can be reserved on a bridge, see af41429 |
It was working indeed, I had confused the colors. This commit is a good example to learn how to cover coded with tests. Thanks! |
The tests really help, apart from the hardware most Traintastic code can be tested. Makes it much easier to do changes later. When adding this test I also discovered that the |
@gfgit we can close this one I think, as the bridge reservation works as expected right? |
Describe the bug
Some path reservation are compatible to each other, meaning they both can be active at same time.
But they could share some tiles like a bridge which can allow both trains to pass above and below, as opposed to a crossing which allows only one train at a time (and so only one reserved path).
So for bridges we to allow multiple reservations otherwise when releasing first path, the bridge will look as released (reserve state is zero) but the other path reservation is still active.
I suggest a system similar to reference-counting. When it's zero the object is free (es. a turnout can be switched) otherwise if reference count is greater than zero the object is locked (es turnout locked in reserved position).
Future expansion
In the future this could be expanded to allow moving turnouts not directly traveled by train in path but needed to ensure no other train would collide with it.
At least for Italian railways the situation in the picture above would be wrong.
The upper turnout which currently is in "Left" position should be in "Right" position (straight).
This ensures that if a train accidentally departs from "block_13" it will not collide with our train entering (or exiting) the station trough the reserved path.
Instead a train coming from "block_13" would go to the dead track ("block_16" in this case).
EDIT: to be precise, in Italy the 2 turnouts would have been switched by the same command together so the picture above is an impossible situation. But there are other cases where "independence" of 2 paths is achieved by additionally moving other turnouts to dead tracks.
The text was updated successfully, but these errors were encountered: