The International Simutrans Forum

Simutrans Extended => Simutrans-Extended paksets => Pak128.Britain-Ex => Topic started by: AP on January 04, 2018, 08:00:56 PM

Title: Early single track railways - how?!
Post by: AP on January 04, 2018, 08:00:56 PM
Hi All


I can't help but notice the lack of signalling in the earliest days of the railways in the pakset. In particular, there is nothing to allow a single track railway to operate at all.


The Swansea and Mumbles railway was apparently single track (from 1807), I don't know how it operated, but clearly, they must have had a system to stop two trains entering a block from opposite ends at once.  The Whitby and Pickering was single track from 1836.


However in-game, absent any signalling, in 1829 for example, single track lines do not work because everything uses drive-by-sight.


It is really problematic, because building a single track line represents a substantial infrastructure saving and they can be very effective if well operated.




The only workaround I can see, absent signalling, is to use a rigid timetable, but unfortunately the simutrans system of nonstandard clocks and fractional wait times does  not make this straightforward at all, nor allow sufficient fine tuning, for anything beyond the simplest line. As soon as block sections are of uneven lengths, for example, the system isn't flexible enough to allow a timetable to be created which is reliable and robust. The inability to fast-forward for testing purposes in online play, further impedes that approach.


Can anything be done?
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 04, 2018, 10:37:13 PM
There were no signalling systems on the earliest days of railways. I am not aware of how the Swansea & Mumbles Railway operated in the very earliest days, but be aware that the line was closed for many decades before re-opening in the 1850s, so it might originally have been double track all the way. Certainly, the very earliest railways were double track where they had to run multiple trains, as there was no means of knowing when a train is coming in the other direction.

The very earliest system of single track working was "staff and ticket", but this was in the days of steam trains. When I was implementing the signalling systems two years ago, I considered whether this could sensibly be simulated, but decided that it would be extremely likely to lead to deadlocks if it were simulated in any way that gave it any meaningful distinction from the later token block system, which requires the electric telegraph.

In short, there is nothing within the confines of what is reasonably achievable in Simutrans-Extended that can be done.
Title: Re: Early single track railways - how?!
Post by: AP on January 04, 2018, 11:43:49 PM
I think this is a real balancing problem James.  There were early single track railways.  They are much cheaper to build (50% less earthworks, 50% less maintenance), yet we can't have them until someone invents electricity? It's nonsensical.

We need simple staff working implemented in the game or we are forced to build double track which is unreasonable.  You've chosen to restrict it to dead-end scenarios only (so called One Train Staff) which isn't realistic at all, it works perfectly well for intermediate block sections on a long single line.

You say "there was no means of knowing when a train is coming in the other direction" - yet with a train staff - one per block - there most certainly is (possession of the staff!).  Staff working of single track lines is intuitive, it does not rely on the electric telegraph, I strongly suspect that is how they were operated.

There are certainly records of train staffs being retrieved on horseback.
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 05, 2018, 12:18:11 AM
The trouble, as I wrote, is with the staff and ticket system, either this would be indistinguishable from token block or would lead to deadlocks. This has been discussed extensively in the past.

Also, how many early single track railways actually were there (pre-1850 or so)?
Title: Re: Early single track railways - how?!
Post by: DrSuperGood on January 05, 2018, 07:07:00 AM
Quoteeither this would be indistinguishable from token block or would lead to deadlocks.
In which case make it an early token block just for mechanics. One could make it more expensive to maintain than the much later form to encourage people upgrading when available, or even have it automatically upgrade.
Title: Re: Early single track railways - how?!
Post by: AP on January 05, 2018, 07:44:15 AM
Just did a bit of searching for early precedents:

The Stockton & Darlington Railway  (https://en.wikipedia.org/wiki/Stockton_and_Darlington_Railway) (1825) was single track as shown in artwork of it's early days:


(http://www.historyhome.co.uk/pictures/stock.jpg)

The Little Eaton Gangway  (https://en.wikipedia.org/wiki/Little_Eaton_Gangway)plateway (1792) was single track: "by 1825, there were nine passing places on the single-track line".
The Haytor Granite Tramway (https://en.wikipedia.org/wiki/Haytor_Granite_Tramway) of 1820 was single track (much of the stone track remains in place on dartmoor).

The Lake Lock Rail Road (https://en.wikipedia.org/wiki/Lake_Lock_Rail_Road) (1798) was single track:


(http://www.stanleyhistoryonline.com/0_0_0_0_547_359_csupload_35313821.jpg?u=426191429)




Quote from: DrSuperGood on January 05, 2018, 07:07:00 AMIn which case make it an early token block just for mechanics. One could make it more expensive to maintain than the much later form to encourage people upgrading when available, or even have it automatically upgrade.
'Make it automatic' sounds smart (i.e. as though prescribed by a change in the law). Putting artifical financial penalties in place for use of what is, basically, an inexpensive system ( a train staff is just a nice wooden stick!) , would also be a balancing issue, unless they were very slight.
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 05, 2018, 11:46:21 AM
Thank you for the research. AP - do you have any idea how these early railways regulated themselves? Did they use the staff and ticket system?

The trouble with the staff and ticket system is that there is no sensible way of determining whether a train should use the staff or a ticket, and if it makes the wrong choice, deadlock would result. There is also no sensible implementation for a mechanic to decide at which point that the staff should start. The token block system is an absolute block derived system, so will not be sufficient to simulate early working (as trains heading in the same direction would be regulated either by time interval, or, in the early days, drive by sight). In any event, an arbitrary financial penalty would be unbalanceable.
Title: Re: Early single track railways - how?!
Post by: Rollmaterial on January 05, 2018, 11:56:26 AM
Could it be possible to simulate fetching the token on horseback? The game would map a section of track limited by staff cabinets and calculate the distances between them. A cabinet would then only let a train past it when the time necessary to ride back and forth to the one where the token is has elapsed.
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 05, 2018, 12:04:07 PM
Quote from: Rollmaterial on January 05, 2018, 11:56:26 AM
Could it be possible to simulate fetching the token on horseback? The game would map a section of track limited by staff cabinets and calculate the distances between them. A cabinet would then only let a train past it when the time necessary to ride back and forth to the one where the token is has elapsed.

That would be fantastically complex, as it would involve route finding to the other end of the section (and what happens if there is no road?). Also, how would the game know when to fetch the token on horseback and when to wait?
Title: Re: Early single track railways - how?!
Post by: Rollmaterial on January 05, 2018, 12:06:43 PM
Quote from: jamespetts on January 05, 2018, 12:04:07 PM
Also, how would the game know when to fetch the token on horseback and when to wait?
When the token is returned at one cabinet, it would start a timer at all other cabinets of the cleared section.

Quote from: jamespetts on January 05, 2018, 12:04:07 PM
and what happens if there is no road?
I would assume riding along the line.
Title: Re: Early single track railways - how?!
Post by: AP on January 05, 2018, 01:09:42 PM
Quote from: jamespetts on January 05, 2018, 12:04:07 PM
Also, how would the game know when to fetch the token on horseback and when to wait?

It would rely on the block section or equipment knowing the direction last travelled. And enforcing a strict alternating of directions.  or adding a delay to a train wanting to breach that (consist with waiting for the horse) ). Where it gets awkward though is if the horse is dispatched,  then a oncoming train arrives and takes the token before the horse arrives to collect it, in which case the token reaches the waiting train sooner than expected. 

If the oncoming train arrives after the horse has collected up the token,  the oncoming train has to wait for the original train.


I'm not sure it's worth the effort to simulate it 'properly' like that. Maybe just enforcing rigid alternate direction and let players build accordingly. The extra horseback feature could be added later.

I agree with James there is no easy way to simulate the ticket portion of Staff and Ticket without timetabling functions we don't have.

In terms of how those early lines regulated themselves,  I've tried unsuccessfully to find info on this
But given they existed, and operated as single track systems somehow,  I strongly suspect they used a Train Staff or other unique physical token system,  which would have evolved into early staff and ticket system later. Staff working meets the KISS principle.

I will try to find the quote about transferring tokens on horseback.
Title: Re: Early single track railways - how?!
Post by: Vladki on January 06, 2018, 12:17:21 PM
From what I have found out about early central european (Austro-Hungarian empire) railways, all of them were single tracked from the beginning. Only if they proved to be busy and profitable, they upgraded to double track. Sometimes, the earthworks (tunnels), were built wide enough for double track in advance, but some of them remained single track to this day. For example Kaiser Ferdinand Nord Bahn (Wien - Břeclav - Přerov - Ostrava - Bochnia near Krakow) the earliest steam operated railway in Austria, started in 1837. It was upgraded to double track in 1895, at least in the section between Přerov and Ostrava, where single track tunnel was abandoned at that time, and the track made a detour). Maybe some parts were double tracked earlier, but I could not find any info about that.

Before the advent of electric telegraph, optical telegraph was used:
https://www.flickr.com/photos/31724156@N02/3003040732/
http://www.laenderbahn-forum.de/journal/heldenzuege_1859/heldenzuege_1859.html
https://www.mdc.sk/stranka/strucny-vyvoj-zeleznicnej-techniky-na-slovensku-zeleznicna-oznamovacia-technika/

Unfortunately, I was not able to devise the exact communication protocol from the information on the above pages. All I know it was used to signal the direction in which trains are allowed to travel. Single signals are explained there, but I am not sure how the information propagated, when they wanted to change the direction of travel. There was also some sort of code with flags carried on train (engine) that were used to signal if this is the last train in this direction or not. But what is for sure, is that there had to be watch (guard) houses along the track so often that you could see the the optical telegraph signal from one house to the other. Lets say one per km or one per mile. That was very expensive, and introduction of electric telegraph allowed the early railways to reduce staff considerably. On the other hand these signals allowed the above mentioned KFNB to establish an early absolute block working (3-state signals) on double tracked parts, even without the use of electricity.

Also the horse-drawn railways, like the Budweis-Linz railway (1825) were single tracked. There the operation was managed by strict adherence to timetable, and regularly spaced passing loops. Other than that it was just drive by sight, so several trains could follow after each other in a given timetable slot. However the carriages were light enough, so that they could be derailed manually if two trains in opposite direction met in the middle of the track (too far from passing loop).
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 06, 2018, 01:04:16 PM
There is real difficulty in implementing section staff working (even without tickets) because of the way in which signalling in Simutrans works. Players just place signals, and the trains calculate the block reservation with nothing other than their position and route, the position and state of signals and block reservations.

Junctions are a particular issue: at a junction, it is possible (in Simutrans terms) for a single cabinet to be an entry point into what would in reality be two separate sections, diverging in entirely different directions. The actual code for signalling has no concept of sections as such: just a list of tiles along a train's planned route. It does not have any way of knowing whether there is an entire diverging route (and, if so, where that route goes): the best that it can do is detect whether any given tile along the route is a junction or plain track (as used in time interval and track circuit block signalling for various purposes). Thus, there is no way (without a very major rewrite) of the code knowing how many staffs that each individual cabinet should have, and which staffs should be given to which trains.

Also, there is no way of the code knowing which cabinets should be paired with one another so that, from the start, only one cabinet has the staff.
Title: Early single track railways - how?!
Post by: Ves on January 06, 2018, 01:06:37 PM
I believe timetables where extensively used.
Trains know they have to wait until the known trains in the opposite direction has passed.
But I do not believe that such logic would be anywhere easy to implement?
It's "kind of" a token block, but where the time is the token...

Thinking about it, since more advanced timetables is quite off the table, we could instead turn the entire thing around and say that wherever the trains are IS according to the timetable. Then you could create a very simple signal, or post, where trains arriving will create a directional reservation, much like longblock signal does. The directional reservation would last according to existing rules up to a one way sign or choose signal.
Title: Re: Early single track railways - how?!
Post by: AP on January 06, 2018, 01:11:16 PM
Could a cabinet not be created,  coded,  such that one must place them in pairs? Similar to how you place track, you must click in two locations. Then they would,  like industry links, forever know which their partner was.

It would then be possible for them to at that moment find the shortest valid route between them (on track tiles) and make and remember a list of every such tile.  And each track tile could remember it is controlled by staff cabinets x & y, and has a status associated with that.  Similar to how they remember wear factor.

Then when a train interacts with the staff cabinet, it talks to the paired cabinet,  and switches the status of the track tiles within the block.

The record just needs to be that the staff is at cabinet x, cabinet y, going from x to y, or going from y to x.

I suppose you could also have the train 'know' it possesses the staff as well, the track tile status would mean it already knows that possession is required to pass
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 06, 2018, 01:21:41 PM
The trouble with that (AP's) system is junctions - in reality, a cabinet at a junction would have multiple staffs for each route. Being paired with one other cabinet would cause problems if a train wishes to take a route that does not pass that other cabinet.
Title: Re: Early single track railways - how?!
Post by: Ves on January 06, 2018, 01:47:38 PM
I edited my post without noticing both of you had replied! :-)
Quote from: Ves on January 06, 2018, 01:06:37 PM
Thinking about it, since more advanced timetables is quite off the table, we could instead turn the entire thing around and say that wherever the trains are IS according to the timetable. Then you could create a very simple signal, or post, where trains arriving will create a directional reservation, much like longblock signal does. The directional reservation would last according to existing rules up to a one way sign or choose signal.
Title: Re: Early single track railways - how?!
Post by: AP on January 06, 2018, 01:52:16 PM
Quote from: jamespetts on January 06, 2018, 01:21:41 PM
The trouble with that (AP's) system is junctions - in reality, a cabinet at a junction would have multiple staffs for each route. Being paired with one other cabinet would cause problems if a train wishes to take a route that does not pass that other cabinet.

How are junctions a problem.  if you mandate that junctions have to occur at passing loops, ie not inside the token block section, just as in reality.  You just have three block sections, meeting at the junction loop. With a cabinet for each.

If you want the cabinets to occur on the loop, not on the single track bit, you'd be looking at a pair of cabinets at each end.  And therefore that junction loops would have to be double tracked for 1 train length past the junction in each of the three directions.  But that isn't terrible or too unrealistic.
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 06, 2018, 01:58:36 PM
I am not sure that I understand - how would the game know which tiles of track form part of the loop and which do not?

Edit: As to Ves's suggestion - how is this meaningfully different from time interval with telegraph?
Title: Re: Early single track railways - how?!
Post by: AP on January 06, 2018, 02:09:30 PM
It would know by the fact that all of the cabinets associated with any given block were placed at the same time,  as a set.  Anything not in a block,  is therefore drive by sight.

Time interval with Telegraph allows multiple trains to pass in the same direction,  this requires strictly alternate direction operation.  Time interval with Telegraph allows multiple trains in the block at the same time given a long enough block and sufficient spaceing, this is absolutel block.
Title: Re: Early single track railways - how?!
Post by: Vladki on January 06, 2018, 02:14:32 PM
How about just allowing time interval with telegraph, (which IMHO works same as staff+ticket), in earlier years, with different graphics - optical telegraph pole instead of electric telegraph pole. These early optical signalboxes would have much higher maintenance costs to match the fact that there had to be signalboxes all along the way just to relay the signal. Also carrying the staff on horse could be considered as a sort of telegraph communication (although very very slow one).
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 06, 2018, 02:21:08 PM
AP - the trouble is that it would not know what the extent of "a given block" is - the best that it would have is a list of cabinets, which would, by itself, tell us nothing about which tiles of track constitute a block and which tiles of track constitute a passing loop.

Vladki - I wondered about this, but it would not be suitable for the British pakset because, as far as I am aware, the optical telegraph system was not used in the UK. Also, the signalling at junctions is different with time interval with telegraph; it works similarly to the absolute block system, and does not have the sighting distance restriction of 7 tiles that the plain time interval system has when reserving tiles at a junction. Further, doing it this way, the extra cost of signalling using this system would be fixed and would not depend, as it would in reality, on the distance between each end of the section.
Title: Re: Early single track railways - how?!
Post by: AP on January 06, 2018, 02:37:16 PM
James, no, I mean the cabinets when placed should run a routing check and record in themselves a list of all the track tiles on the shortest route between them.

At the same time,  flip a setting on each track tile so it knows it's part of the block. And possibly where the token is.

You want to ensure all the tokens start at the same end of each block,  so the first train along has one waiting at each loop. Maybe the end which has its cabinet placed first. Otherwise the first train could gridlock.
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 06, 2018, 04:28:05 PM
But then how would that work where the track diverges?

Edit: And also, what happens when a given tile is calculated as being in more than one section?
Title: Re: Early single track railways - how?!
Post by: AP on January 06, 2018, 05:28:00 PM
The track should not be diverging within a block section.  A block section can only have two ends. That's part of the definition.
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 06, 2018, 06:58:04 PM
Quote from: AP on January 06, 2018, 05:28:00 PM
The track should not be diverging within a block section.  A block section can only have two ends. That's part of the definition.

How would that be enforced?

Also, how would this actually work? Surely the train would always need to stop inside the passing loop - at a point before the line re-converges into single track. That means that the cabinets would always have to be on track that converges and then diverges again at the next passing loop, and thus even in the simplest arrangement, there would always be two independent routes between two different pairs of cabinets on each single track section.
Title: Re: Early single track railways - how?!
Post by: AP on January 06, 2018, 07:05:02 PM
If as was mentioned earlier,  you want two cabinets at each end, so they can be just inside each loop, clearly they will be in obvious geographical pairs. So you only need to find those pairs (by proximity of coordinate),  then a route between one of each pair. Or find routes between all 4 if you want to comprehensively define the block.

How would a prohibition on junctions mid block be enforced: by the signalling system breaking.  Players want it to work, ergo behaviour that is both unrealistic,  not as the tutorial, and disruptive to their own interests ,  seems unlikely.
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 06, 2018, 07:16:27 PM
I am asking these questions because I am trying to envisage the exact algorithm for this system, and I am still not able to do so from the information provided. You refer to geographical pairs by co-ordinates; how wide would you envisage the search area being? Remember, passing loops in Simutrans have to be much longer than in reality because of the relationship between the length of vehicles and the tile length, so, for long trains, one might imagine very long passing loops indeed. Now imagine every cabinet checking a radius of the maximum sensible length of a passing loop: this would give rise to two problems. Firstly, it would be very computationally expensive. One train staff cabinets check a radius of 1 tile. That is a total of 8 tiles to check. Increasing that radius by n would increase the number of tiles to be checked by n squared. Secondly, such a large radius could easily catch cabinets that are not intended to be caught, either on unconnected lines, branches, or even the next passing loop along in cases where the distance between passing loops is less than the maximum sensible length of a passing loop; given the proximity of passing loops on some early single track railways (1 mile, i.e., 1.6km on the Stockton & Darlington, for example), this can readily be imagined.

As to enforcing not having branching, the trouble is that players might want the signalling system not to function correctly if the incorrect functioning is beneficial, for example, allowing the far cabinet on a branching section to know whether the line ahead is clear without a train having passed it to give it the token, which I can imagine as one possibility.

The degree of complexity that one would need to overcome all of these difficulties would be very great, making this a seriously huge project to implement this one signalling system. Even if a workable algorithm could be found, it would be many years before I had the time to implement it, given other priorities. It would be different, of course, if another coder could be found to work on this; but the signalling system is very hard to work on, so an experienced coder would be required.
Title: Re: Early single track railways - how?!
Post by: AP on January 06, 2018, 07:32:09 PM
The cabinets should automatically know where each other are, because they are placed as a set, 4 sequential clicks. It should be recorded at that time.  As for finding routes between them,  I assume that Simutrans has a very efficient system for that already!

If cabinets must be placed in sets of 4, then an in block junction and branch (which only requires an additional two)  could not be created as the cabinets should only be placed on the 4th click.

Since setting up a successful block marks each track tile as belonging to block A,  if they try to place the spare cabinets elsewhere,  to circumvent the issue, the routefinding check should fail if via a tile already controlled by another token.
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 06, 2018, 07:49:44 PM
This does sound as if it would require a huge amount of work to implement; and I am not sure how the requirement to have exactly four cabinets would work on a terminus section with multiple platforms at the terminus (for a single platform terminus, one might use the one train staff system).

However, one interim solution might be to bring forward the introduction date of the time interval with telegraph from 1848 to 1839. This (http://www.cntr.salford.ac.uk/comms/ebirth.php) website gives the date of the earliest railway electric telegraph installation as 1839. This was the Cooke & Wheatstone system, which was more expensive than later telegraph systems, so what I propose to do is introduce an earlier version of the railway policeman's cottage with telegraph equipment that costs more to build and maintain than the the current version introduced in 1848, but that is introduced in 1839.

Edit: I have now committed the above change, allowing time interval with telegraph signals (using the vane signal graphics) to be built from February, 1839. I have doubts that there was any significant use of the staff system before 1839 in any event; I suspect that timetabling and drive by sight was used in those days.
Title: Re: Early single track railways - how?!
Post by: AP on January 06, 2018, 09:44:23 PM
Bringing it forward 10 years helps a little,  but doesn't help for the 40 or so game years before that.

If you're right and strict timetable working,  not staff working,  was the norm in that period,  Simutrans doesn't make any real provision for that. Which means that a chunk of the economic options to build cheaper industrial or light passenger railways,  is missing entirely.  Which may cause balancing issues. Maybe a bit of time needs to go on improving the timetabling functionality....
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 06, 2018, 09:59:14 PM
Quote from: AP on January 06, 2018, 09:44:23 PM
Bringing it forward 10 years helps a little,  but doesn't help for the 40 or so game years before that.

If you're right and strict timetable working,  not staff working,  was the norm in that period,  Simutrans doesn't make any real provision for that. Which means that a chunk of the economic options to build cheaper industrial or light passenger railways,  is missing entirely.  Which may cause balancing issues. Maybe a bit of time needs to go on improving the timetabling functionality....

I suspect that that would actually be much easier than the complexities involved in section staff signalling. What do you think that the minimum viable addition to the current timing system would be to allow for this?
Title: Re: Early single track railways - how?!
Post by: Vladki on January 06, 2018, 10:25:32 PM
Hmm, what about allowing simple train staff cabinets for normal line, not only dead end. Perhaps it works even now, although a bit unintended. Passing lopps signalled like this:
(http://list.extended.simutrans.org/~vladki/screenshots/simscr78.png).
I have that running fine, although now it is the only passing loop on the line (2 trains only). But I have an extra staff box on one dead end, at the entry to depot. But it works just fine. I think it works almost as token block.

In simple train staff system (without tickets), one would have to ensure that trains go in alternating directions to bring the staff forth and back. To enforce that, there would have to be a way to know where the staff really is. As the cabinet does not have any aspects like other signals, the staff presence could be encoded as an aspect (full/empty). Of course deadlocks will might occur, which would have to be resolved somehow. Maybe using the reservation clearing tool - first click will take the token from one box and second click will put it into another. Then a timer would run to simulate a courier carrying the staff (along the railway - either riding a horse or using a draisine). After the elapsed time, the staff will appear at the other box available for pickup.

This system is used even now: https://en.wikipedia.org/wiki/Kirnitzschtal_tramway
Just what I do not know how do they handle the train staffs in the morning, when whole line is empty and there is no tram in opposite direction to bring the staff back. And the same in the evening, when trams go to the depot. Either they cheat with the first few trams, or carry the tokens back by car - there is a road all along the track.
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 06, 2018, 10:37:59 PM
The one train staff system was intended to simulate one engine in steam working, rather than staff and ticket working: the idea is that the train reserves the whole route until it gets back to the (same or an immediately neighbouring) one train staff cabinet again.

I should note that the one train staff system already does use its aspect data to encode data about whether it is in use, albeit I cannot now recall the details.
Title: Re: Early single track railways - how?!
Post by: Ves on January 06, 2018, 10:52:40 PM
This turned out to a lengthy discussion. Just to elaborate my point earlier in the thread:
The distinction between time interval with telegraph and my proposal is that my proposal is making directional reservations with drive by sight. There would be no timer in the signal to enforce spacing between the trains. The datfile would be:
Working method=drive by sight
Longblocksignal=1

I think this actually was suggested once a while ago too.
Title: Re: Early single track railways - how?!
Post by: Vladki on January 06, 2018, 11:21:02 PM
Quote from: Ves on January 06, 2018, 10:52:40 PM
This turned out to a lengthy discussion. Just to elaborate my point earlier in the thread:
The distinction between time interval with telegraph and my proposal is that my proposal is making directional reservations with drive by sight. There would be no timer in the signal to enforce spacing between the trains. The datfile would be:
Working method=drive by sight
Longblocksignal=1

I think this actually was suggested once a while ago too.

Yes. Actually something like that is used even now, here in Brno, when they do some reconstructions on tram networks. Normally the whole network is double tracked, trams drive by sight, so no signals are needed (except for signals at crossroads, where trams go on the road with cars). But for reconstruction, they create a short (few 100 m) single tracked part (and repair the other track). There are signals on both entries that allow multiple trams to enter in the same direction. Trams have to drive by sight all time (even on double track). When the single track part is clear, trams from opposite direction can enter. So it is a combination of drive by sight and track circuit. For early years it would have to be something similar, just the negotiation of direction would not be track circuit but a token. All the problem is that the early forms of telecommunication (before electrical telegraph), were either expensive (optical telegraph), slow (courier on horseback), or unreliable (timetable, giving the staff to the last train), and at last not easy to properly implement in simutrans...
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 06, 2018, 11:32:40 PM
Yes, the real difficulty with this is accurately simulating the economic consequences of the inherent shortcomings in these systems.
Title: Re: Early single track railways - how?!
Post by: Ves on January 07, 2018, 08:25:20 AM
Now I came to think about it, my solution would simulate a timetable backwards, meaning that wherever the train happen to be at a certain time is according to the schedule.
But it could be made a little bit more challenging and also add to the immersion that there is a time schedule:
The "state" if the post (clear, danger) can be set to automatically shift with a timer, very much like how the street crossing light is working in simutrans.
Three settings needed:
• Frequency
• Offset
• "Clear" duration

Then it's the responsibility of the player to make realistic timing so the track is ever only traversable in one direction at all times.
Still it could create the directional reservation, and the player should be able to set the duration of the "clear" so multiple trains can go in one direction. The directional reservation would still be a good idea, since we assume all other train drivers on the map knows about the schedule and in which direction current travel is.
If two posts conflicts with their timings, either the directional reservation would take care of that, or it's simply poor design by the player.
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 07, 2018, 10:46:35 AM
The trouble is that that would not actually simulate any specific real life signalling system, and it would conflict with the other systems which do simulate a specific real life signalling system in some detail. This is not how timetabled working of single lines actually worked - it would be better to add a mechanic that allows (if and to the extent this is not already possible) this sort of working.

One thing that I had wondered is whether it would be a good idea to implement a mechanic for automatically resolving head-on collisions: if two trains meet head-on, one (the one with the lowest load, or, if they both have the same load, the one with the lowest convoy number) reverts to its previous destination on the schedule. I should note that this may not work, however, when there is another train behind the one that collided head-on and reverses.
Title: Re: Early single track railways - how?!
Post by: AP on January 07, 2018, 10:58:55 AM
Quote from: jamespetts on January 06, 2018, 09:59:14 PM
I suspect that that would actually be much easier than the complexities involved in section staff signalling. What do you think that the minimum viable addition to the current timing system would be to allow for this?

The first difficulty is that Simutrans doesn't use 24 h time,  it goes to 6:24:00 each month.  This is really counterintuitive. It should be 24h.

Secondly,  wait for time operates only on whole fractions of that, not in minutes. This makes finely tuning a timetable really tricky. It should be in actual minutes.

There is no way to have the duration between departures longer than 6:24:00 which for long routes is sometimes necessary.

We now have routes recording the distance between stops, and the time taken for a complete circuit,  but not the time between stops. This complicates setting up stop departure times. There is no way to account for hills and corners, which make trains take longer than expected en route. There is also no way to simulate this data in advance,  which ought to be possible, since we have a simulation at our disposal ; instead one must waste time with a test train to get the data.

The current system uses "multiple departure slots per month" which sounds good,  but in single track operation is a minefield,  because usually there is only one slot that a particular train must use, if it misses it, it can't take the next one,  because that's required for a following train.  The timetable must simply be right. 

There is no easy way to build a timetable,  and check it is right,  apart from lots of trial and error,  fast-forwarding offline games to see if it works smoothly. And of course,  whenever vehicles are upgraded,  get faster,  the whole timetable needs redoing.  It almost needs an in game train graph on a per line basis. If such were added to the graph function,  showing time vs distance and all the vehicle movements that would really really help with setting up the waits so the paths crossed at the right loops etc. Because visual editors are so intuitive,  it might even allow the difficulties with the time system to become tolerable, as it would provide instant feedback of whether waits were too many /long etc.

The multiple slots per month is a bit misleading because in fact the intention is usually that each slot corresponds to a specific train. Sometimes you want trains to skip a slot, either because the passing loops are asymmetric or there is another line e.g. freight train which has to be allowed to weave amongst the passenger trains. There is no way to make trains skip slots e.g ever 10 mins except 20 and 30 past the hour.
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 07, 2018, 11:30:43 AM
Quote from: AP on January 07, 2018, 10:58:55 AM
The first difficulty is that Simutrans doesn't use 24 h time,  it goes to 6:24:00 each month.  This is really counterintuitive. It should be 24h.

Because everything is balanced to work with this timescale, and because this is derived from some fundamental aspects of the game, changing this would be an unimaginably huge undertaking. Doing this alone would probably take more than a year of intensive work. Accordingly, this is not feasible in the foreseeable future.

QuoteSecondly,  wait for time operates only on whole fractions of that, not in minutes. This makes finely tuning a timetable really tricky. It should be in actual minutes.

This might be a little easier, but I am not sure quite how difficult that this would be. However, this would then make it harder to use the system as it was intended, viz. as a simple frequency regulator.

QuoteThere is no way to have the duration between departures longer than 6:24:00 which for long routes is sometimes necessary.

This might be relatively straightforward - I will have to look into this to check. This might be possible by allowing fractions of a month to be expressed in quantities greater than 1 (e.g. 12/10ths of a month) without changing the system of having this in fractions of a month.

QuoteWe now have routes recording the distance between stops, and the time taken for a complete circuit,  but not the time between stops. This complicates setting up stop departure times.

A third party developer has actually produced code for this, which I will hopefully be testing and integrating when I get back home, so this is in preparation.

QuoteThere is no way to account for hills and corners, which make trains take longer than expected en route. There is also no way to simulate this data in advance,  which ought to be possible, since we have a simulation at our disposal ; instead one must waste time with a test train to get the data.

Simulating this in advance would be difficult in the extreme, as one would need to run a full simulation of all the physics, all the signalling and the whole traffic on the route, so this is not likely to be feasible in the foreseeable future.

QuoteThe current system uses "multiple departure slots per month" which sounds good,  but in single track operation is a minefield,  because usually there is only one slot that a particular train must use, if it misses it, it can't take the next one,  because that's required for a following train.  The timetable must simply be right.

I do not understand what you mean by "must simply be right". Can you elaborate?

QuoteThere is no easy way to build a timetable,  and check it is right,  apart from lots of trial and error,  fast-forwarding offline games to see if it works smoothly. And of course,  whenever vehicles are upgraded,  get faster,  the whole timetable needs redoing.  It almost needs an in game train graph on a per line basis. If such were added to the graph function,  showing time vs distance and all the vehicle movements that would really really help with setting up the waits so the paths crossed at the right loops etc. Because visual editors are so intuitive,  it might even allow the difficulties with the time system to become tolerable, as it would provide instant feedback of whether waits were too many /long etc.

That would be a very large amount of work indeed. I should note that, in reality, timetables are exceedingly difficult to set up, which is why I have not allowed for more detailed timetabling before (the departures/month idea is really just about having a regular service, rather than a specific timetable, which is why it is in fractions of a month).

If actual timetabling cannot sensibly be achieved without this sort of extreme complexity of additional work, it is probably not worth doing at all, especially if players need (or are lead to believe that they need) to master this sort of complexity just to play.

QuoteThe multiple slots per month is a bit misleading because in fact the intention is usually that each slot corresponds to a specific train. Sometimes you want trains to skip a slot, either because the passing loops are asymmetric or there is another line e.g. freight train which has to be allowed to weave amongst the passenger trains. There is no way to make trains skip slots e.g ever 10 mins except 20 and 30 past the hour.

Given these descriptions, full timetabling is simply not feasible, either for players to deal with sensibly in the game, or for me to code. The amount of work required for coding all of these features would be measured in multiple years, and it would make it extraordinarily difficult for new players to interact with the game.

I suspect that what would be preferable to detailed timetabling mechanics, which are not feasible, are some relatively straightforward conditional provisions in schedules (e.g. "depart when convoy X reaches point Y in its schedule"). Such conditional provisions may well be necessary for some planned features in any event.
Title: Re: Early single track railways - how?!
Post by: AP on January 07, 2018, 11:37:40 AM
By "must simply be right"  I meant that a timetable for a single track route,  if commenced with errors in it, will quickly unravel and gridlock. On a double tracked route,  scheduled departure slots work rather well because there is no need to account for returning trains. On a single track route,  if one mistakenly allows insufficient time somewhere,  it will just gridlock. Then you have to send everything to depot and start again.  The player has to know with confidence they have everything right before commencing the timetabled service.

Your points about complexity and coding time are understood and appreciated,  it's why I was presuming setting up a simple staff working model would be the easier course of action.

Personally I don't think timetables are the way to go.
Title: Re: Early single track railways - how?!
Post by: Vladki on January 07, 2018, 11:56:51 AM
Quote from: jamespetts on January 07, 2018, 10:46:35 AM
The trouble is that that would not actually simulate any specific real life signalling system, and it would conflict with the other systems which do simulate a specific real life signalling system in some detail. This is not how timetabled working of single lines actually worked - it would be better to add a mechanic that allows (if and to the extent this is not already possible) this sort of working.

I think I have read somewhere about such system, but now I cannot find the reference. It was something like odd hours one way, even hours the other way, with some time (half-hour) left to clear the line.
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 07, 2018, 12:38:14 PM
The trouble is that both timetabling and section staff working would be a huge undertaking; the sort of section staff working that you envisage above would be by far the most complex of all the signalling systems so far to be implemented, and there is still, as far as I can see, no sensible way of dealing with terminus stations with multiple platforms where trains may start their journey into the single track section from either platform.

That is why I suspect that conditional schedules are probably the better solution.
Title: Re: Early single track railways - how?!
Post by: Ves on January 07, 2018, 01:54:19 PM
If you implement conditional scheduling, that would be awesome, and perhaps if it in general would open of for more advanced schedules. Remember, there are other areas that could benefit from that, like "only load x amount of cargo" "only load cargo y" etc. but that is another topic.

Still though, I think the signal I and vladki talk about could have some potential. It would indeed simulate a time table in its own way, and yes, the player would have to think ahead before setting it up, just like with most of the other working methods.
Title: Re: Early single track railways - how?!
Post by: AP on January 07, 2018, 01:56:04 PM
Quote from: jamespetts on January 07, 2018, 12:38:14 PM
There is still, as far as I can see, no sensible way of dealing with terminus stations with multiple platforms where trains may start their journey into the single track section from either platform.

Yes there is; you just include a "loop" immediately outside the station platforms, with the single track block section commencing at the end of it. The loop and terminus are "drive by sight".

So long as each block section ends on a loop, it doesn't matter what is beyond the loop, for the purposes of operating the single track section. You can put a junction, terminus, or anything, beyond the loop and solve them on their own terms. So long as the train entering and exiting the single track section can pass, all is well.
Title: Re: Early single track railways - how?!
Post by: Dutchman on Rails on January 08, 2018, 10:21:13 AM
Chiming in on this with a possible alternative.

As we know from the signalling system, Simutrans Extended is capable of 'seeing' up to 875 meters ahead. This because of 'seeing' the signal. We also know that trans can 'push' a reservation ahead. In the drive by sight method this reservation is turned off, probably to avoid trains running up behind each other.

The issue with drive by sight in single track railways is that the drivers can see each other, but just keep running into each other.

Perhaps the combination could work out with the following rules:

1. A train in the drive by sight method 'pushes' a reservation ahead as far as the line of sight of the driver, or as far as it encounters the edge of another reservation block, or another train.

2. A driver will stop if the front encounters a reservation block normally.

In that way it's up to the players. One must ensure that the line of sight extends into the next passing loop, so no more than 875m or 7 tiles ahead on the straight and level. So it does have its limitations.
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 08, 2018, 11:02:24 AM
Is a requirement to have a passing loop every 7 tiles likely to be worth bothering to have single track at all? Did very early single track railways actually use this system?
Title: Re: Early single track railways - how?!
Post by: Dutchman on Rails on January 08, 2018, 12:06:43 PM
About the systems you'd have to send a mail to the National Railway Museum or the Science Museum. Normally such museums have a few volunteers to explain such things. I do seem to remember that early railways often simply pushed the entire train off the track to let the other one pass (which in Simutrans would amount to a long stop, one of the trains remaining still and the other starting to move, then the first one starts moving again too), but that will probably be difficult to program (especially as later trains will progressively become too heavy to pull that off).

About the passing loops, it kind of makes sense. Currently the drivers behave a bit like irate motorists on a narrow bridge. They see each other coming, they know it's just one track, but they refuse to stop and give way, shouting instead: "Get the **** out of my way!".

A small addition might help with the distance though. If the train runs into a reservation block on a single track section (in other words, it 'sees' an oncoming train), it knows where it is (that's also shown in the signalling videos). It can calculate if it's more than halfway the next passing section. If it's before that point, it has to turn around, head back to the passing section it just came from, and wait there. It's not very efficient, but that's just another reason to start using signals.
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 08, 2018, 02:33:29 PM
Quote from: Dutchman on Rails on January 08, 2018, 12:06:43 PM
A small addition might help with the distance though. If the train runs into a reservation block on a single track section (in other words, it 'sees' an oncoming train), it knows where it is (that's also shown in the signalling videos). It can calculate if it's more than halfway the next passing section. If it's before that point, it has to turn around, head back to the passing section it just came from, and wait there. It's not very efficient, but that's just another reason to start using signals.

This is an interesting idea. There is no reasonably easy algorithm to determine where a passing loop is (as it would be fantastically difficult to tell a passing loop from a siding or branch), but a similar logic, albeit using stops instead of passing loops, might work well; if two trains meet head-on, the one that is closest to its previous stop reverts to the previous stop in its schedule and turns around. This will not be certain to avoid deadlocks where multiple trains area heading towards a head-on meeting, but might well alleviate things in more lightly trafficked areas.
Title: Re: Early single track railways - how?!
Post by: Dutchman on Rails on January 08, 2018, 06:16:59 PM
The solution for the point to 'know' where the passing loops are, is a sign. We already have the one-way sign, which can only be effectively used on two-track lines anyway.
Title: Re: Early single track railways - how?!
Post by: AP on January 08, 2018, 06:40:39 PM
Also a passing loop allows a P shape path to be found, where the circumference of the loop is unlikely to exceed a quantifiable value.
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 08, 2018, 07:33:22 PM
Quote from: Dutchman on Rails on January 08, 2018, 06:16:59 PM
The solution for the point to 'know' where the passing loops are, is a sign. We already have the one-way sign, which can only be effectively used on two-track lines anyway.

Measuring distance to the last/next one way sign on the route is much harder than to the last stop, and would require much more work to code (as well as considerably increasing the computational load), as this might involve actually calculating extra parts of the route. It is also not certain that the next/last one way sign on the route is in fact a passing place (imagine that the train merged onto a single track line from a double track line, and the last one way sign was on the double track line, for example), or that there is a one way sign anywhere on the route.

Edit: Also, there is no way of sending a train back only to the previous passing loop: without a major rewrite at least, a convoy can only be sent to a specific place in its schedule, such as the immediately previous stop.
Title: Re: Early single track railways - how?!
Post by: Dutchman on Rails on January 09, 2018, 05:20:43 PM
I can live with the last stop (or waypoint I suppose). It does mean taking good care of where to schedule stops and waypoints, but that's part of the charm.
Title: Re: Early single track railways - how?!
Post by: AP on January 09, 2018, 07:36:35 PM
It could be set out in the tutorial that,  for example, it is mandatory for single track operation,  that a waypoint be set on each passing loop.  Granted not ideal if add more later,  but nonetheless.
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 21, 2018, 01:43:03 PM
I have now added a feature, implemented in the current nightly build, whereby two trains coming into conflict in the drive by sight method (with both trains not heading in the same direction) will cause one of the trains to go back to its previous stop.

I should be grateful if people could let me know how this assists with the issue.
Title: Re: Early single track railways - how?!
Post by: nochiu on January 31, 2018, 04:29:59 AM
Quote from: jamespetts on January 06, 2018, 10:37:59 PM
The one train staff system was intended to simulate one engine in steam working, rather than staff and ticket working: the idea is that the train reserves the whole route until it gets back to the (same or an immediately neighbouring) one train staff cabinet again.

I should note that the one train staff system already does use its aspect data to encode data about whether it is in use, albeit I cannot now recall the details.
One Train Staff can also simulate what I call "Instant Section Staff". This save provides the first implementation of this.
Save (https://simutrans-germany.com/files/upload/Section_Staff_Better.sve)
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 31, 2018, 11:15:06 PM
Quote from: nochiu on January 31, 2018, 04:29:59 AM
One Train Staff can also simulate what I call "Instant Section Staff". This save provides the first implementation of this.
Save (https://simutrans-germany.com/files/upload/Section_Staff_Better.sve)

Interesting. This is not quite what was intended with this system, but it is interesting what you have managed to do with it.
Title: Re: Early single track railways - how?!
Post by: AP on January 31, 2018, 11:30:23 PM
I was able to mock up a rudimentary single line operation as well with it on the Canterbury server,  but it was fragile in use if convoys clustered for any reason.
Title: Re: Early single track railways - how?!
Post by: jamespetts on January 31, 2018, 11:32:56 PM
Quote from: AP on January 31, 2018, 11:30:23 PM
I was able to mock up a rudimentary single line operation as well with it on the Canterbury server,  but it was fragile in use if convoys clustered for any reason.

I do wonder whether any of the features discussed here (https://forum.simutrans.com/index.php?topic=17852.0) might assist with some of the issues described here?