Two pre-signal challenges.

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

audigex
Tycoon
Tycoon
Posts: 2010
Joined: 09 Dec 2007 21:28
Contact:

Two pre-signal challenges.

Post by audigex »

Okay, I've got two challenges which require some form of advanced pre-signalling (ie priorities and load balancers) - hopefully not horrendously complex (ie the counter someone made)

I'll try my best to explain these, but feel free to ask for clarification :-) I'll put up some pics if it helps.

1) Enable a faster train to overtake a slower train
Situation:
For this situation, I'm going to assume that the train behind is at least as fast as the train in front. Take a single track line, with a faster train behind a slower one.
Create a setup which allows the faster train to overtake the slower one. Basically, it's a priority but checking BEHIND the train on the same line. The idea is that for any train, if there's a train behind it, divert into a side-line where it will wait until the train behind has passed.
Problem
The difficulty being, that if there are 3 trains in a row, the second train will also try to divert into the side line. To solve this, the train must only PREFER the side line over the main line if the line behind is occupied. I've got it working for two trains, but I can't avoid a deadlock if 3+ trains arrive consecutively.

2)Simulate "splitting" of trains at a station
Okay, this one's slightly trickier.
Situation:
Assume, for argument's sake, a small station - there's no need to expand this into a large station with multiple options.
Take a three platform station, two platforms are 3 tiles - the other 6 tiles. Three trains are involved with this operation. Two 6-car (3-tile) HSTs, and one 12-car (6 tile) HST - the longer train being the supposed combined train.

The aim is to copy the real-life situation where two trains from different lines combine into one train.

Real World Example:
On the west coast main line, First Transpennine Express runs services from Manchester to various destinations. A large number of these services (to Barrow, Windermere, Blackpool, Glasgow and Edinburgh) all travel up the west coast main line. To send the trains individually would be pointless, requiring more drivers and more "paths" (blocking other traffic) In reality, these trains are often run two or three together as one unit, splitting en route. Eg the trains for Blackpool and Glasgow may travel together from Manchester to Preston as a 6-car unit, at which point they split into two 3-car trains, one to Blackpool and the other to Glasgow. Similarly the Barrow and Windermere trains may split at Carnforth or Lancaster, the Glasgow and Edinburgh trains may split at Carlisle. The point being, that for a portion of the journey it is run as one large train, rather than multiple smaller ones, simplifying signalling requirements and allowing more trains to pass through a section of line.

Problem:
Well, it may be easy, but I can't get this to work at all. Essentially the problem should be quite simple - the train at any one platform can leave if, and only if, both of the other two ARE occupied. For the sake of argument, I assume that all platforms are bays (leaving the back of the platform available for signalling using monorail/maglev) but I can't get it working properly.

So, can any smarter man then I manage either of these problems?
Feel free to use absolutely any trick of tracks, stations, waypoints, signals and objects to accomplish them, although the ability to use tunnels to hide the "logic" away from the track would be a bonus :)
Jon
audigex
Tycoon
Tycoon
Posts: 2010
Joined: 09 Dec 2007 21:28
Contact:

Re: Two pre-signal challenges.

Post by audigex »

No takers then? Shame, I was hoping to use one or both of these to eye-candy up my current game :-(
Jon
Johnny.B
Engineer
Engineer
Posts: 12
Joined: 20 Jul 2009 14:23

Re: Two pre-signal challenges.

Post by Johnny.B »

Hi,

With PBS, your first challenge is not that tricky. Just have a look at the picture. It works.
Attachments
Fahrhaven Transport, 26 Jun 1940.png
(299.38 KiB) Downloaded 573 times
User avatar
lawton27
Tycoon
Tycoon
Posts: 1418
Joined: 03 Aug 2009 14:29
Location: Manchester

Re: Two pre-signal challenges.

Post by lawton27 »

Done your second challenge, in order to work this also simulates the train splitting again, it's important that the splitting station does not supply passengers so only those fed in will be taken, its not 100% perfect but it works, I've used Jezukim's shed stations to hide the waiting trains.

If anyone can think of a more efficient way of doing this please tell me.
Attachments
Rewood Transport, 4th Feb 2921.png
Rewood Transport, 4th Feb 2921.png (110.6 KiB) Viewed 1040 times
audigex
Tycoon
Tycoon
Posts: 2010
Joined: 09 Dec 2007 21:28
Contact:

Re: Two pre-signal challenges.

Post by audigex »

Quite a nice idea for it, although I'd still love a pre-signal version. Couldn't the shorter trains steal off each other though? Thats why I was trying to check for the presence of the trains, rather than the passengers.

Looking at openttdcoop, it basically looks at needing a combination of the AND gate there, and and NOT (to reverse the input to red, ottdcoop blog assumes green = true). I've had a quick go, but I can't get it right yet - one works fine, but it's a bit harder to combine several :)
Jon
User avatar
FHS
Director
Director
Posts: 577
Joined: 18 Apr 2009 17:17
Location: Basel, CH

Re: Two pre-signal challenges.

Post by FHS »

This here would work if youd make the faster trains longer, just a sketch, for a efficient not-gate look in the led counter thread.
Attachments
Scheme
Scheme
Untitled.png (12.01 KiB) Viewed 6141 times
audigex
Tycoon
Tycoon
Posts: 2010
Joined: 09 Dec 2007 21:28
Contact:

Re: Two pre-signal challenges.

Post by audigex »

I don't really understand that sketch - where do the trains come from etc?

Is the presumption that the first train takes the top track, the second train takes the bottom track and the top train is halted until the bottom train passes?
Jon
User avatar
FHS
Director
Director
Posts: 577
Joined: 18 Apr 2009 17:17
Location: Basel, CH

Re: Two pre-signal challenges.

Post by FHS »

It would mean that if the shorter train is slower it would be diverted to the upper line, and if the faster train is longer itd be continuing on the bottom line, the trains are coming from the right side.
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Two pre-signal challenges.

Post by petert »

With added priorities?
User avatar
Timitry
Transport Coordinator
Transport Coordinator
Posts: 313
Joined: 01 Oct 2004 15:28
Contact:

Re: Two pre-signal challenges.

Post by Timitry »

audigex wrote:I've got it working for two trains, but I can't avoid a deadlock if 3+ trains arrive consecutively.
Heyho!
Although i can't add anything useful regarding your problem, i'd like to see the solution for the two trains... Would you mind posting a screenshot? :)
audigex
Tycoon
Tycoon
Posts: 2010
Joined: 09 Dec 2007 21:28
Contact:

Re: Two pre-signal challenges.

Post by audigex »

Muahahahaha, I've got it :-)

It's essentially a backward-facing priority, so instead of giving priority to another line it just gives priority to the line behind it.

Pros:
+ Fast trains can overtake slow trains
+ Compact
+ Can be extended to any train length

Cons:
+ Trains of the same speed may bunny hop each other, wasting time
+ If a slower train waits for a faster train to pass, another, even slower train may pass the first train by catching up to the priority system before the first train leaves.
+ Reduces throughput for multiple trains of the same speed - can be fixed by having multiple "penalty" tracks, at the expense of space

As such, it's best used after a relatively long, junctionless straight - allowing fast trains to pull away from slower trains (and avoiding being overtaken) while catching up with slower trains in front of them.

Anyway, here it is. Basically make the section between the stop signal and pbs signal (where the penalty station is) 1tl, and the space for the train to stop 1tl. Extend the priority back along the mainline for more than one signal (I show one for simplicity) in order to allow for trains not being immediately behind or if the following train is not significantly faster than the one in front (in which case the signal may not catch it with one signal.

By placing the penalty on the other line, a true passing loop could be made, where the slower train diverts off the mainline - but fast trains would also divert off the main line if there is no slower train in front.

Enough text...

1: The slower train has been caught up by the following express trains
1
1
overtake1.png (87.66 KiB) Viewed 5254 times
2: The slower train pulls into the passing siding, whereupon the signal in front of it turns red due to the presence of a following train, which proceeds to pass it on the other track.
2
2
overtake2.png (90.07 KiB) Viewed 5258 times
3: The first train has passed, but the presence of a second train behind the first means the signal stays red, the second train passes the first.
3
3
overtake3.png (87.98 KiB) Viewed 5258 times
Jon
audigex
Tycoon
Tycoon
Posts: 2010
Joined: 09 Dec 2007 21:28
Contact:

Re: Two pre-signal challenges.

Post by audigex »

And finally, 4:
There are no trains in either the passing track or immediately before, at which point the signal turns green and the slower train moves off. Overtake complete.
4
4
overtake4.png (89.62 KiB) Viewed 5257 times
Edit:
In fact, I've just found an improvement in terms of realism.
Pro over last time: more compact, realistic layout
Con over last time: the third train waits for the second to completely clear the passing loop, reducing throughput.
5
5
overtake5.png (80.87 KiB) Viewed 5270 times
Jon
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Two pre-signal challenges.

Post by petert »

Check this save out, take a look at the behavior of the slower train.
Weird.sav
(25.23 KiB) Downloaded 134 times
audigex
Tycoon
Tycoon
Posts: 2010
Joined: 09 Dec 2007 21:28
Contact:

Re: Two pre-signal challenges.

Post by audigex »

That's bloody strange - the track layouts are, as far as I can tell, identical.

Presumably it's something to do with pathfinder settings, but I don't recall doing anything unusual to mine. What's your station penalty?
I'll describe the process, since I'm not sure what your experience level is.
Press the ` key (above tab)
Type:
patch pf.yapf.rail_pbs_station_penalty
And see what the result is, presumably 800
Jon
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Two pre-signal challenges.

Post by petert »

Yes, I don't use patch, I usually use setting.
800 was for mine? That's weird, it should be 1500.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Two pre-signal challenges.

Post by Yexo »

petert wrote:Yes, I don't use patch, I usually use setting.
800 was for mine? That's weird, it should be 1500.
The default value is 800.
audigex
Tycoon
Tycoon
Posts: 2010
Joined: 09 Dec 2007 21:28
Contact:

Re: Two pre-signal challenges.

Post by audigex »

Yup, I was expecting yours to be lower. I'd guess that the train is working out the route to the END pre-signal, rather than the PBS signal ahead. I'll have another look later if I remember :)
Jon
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Two pre-signal challenges.

Post by petert »

No, I checked and it was 800, could you submit a savegame of what you made?
audigex
Tycoon
Tycoon
Posts: 2010
Joined: 09 Dec 2007 21:28
Contact:

Re: Two pre-signal challenges.

Post by audigex »

I didn't bother saving it as the premise was so simple, but here's a more complex version

Clean install of 0.7.2 (although some settings may be kept from my opentt.cfg file, presumably), no GRFs.

All trains prefer the inner line by default (I checked which line they preferred first, then built around that, figuring that it's easier than trying to force them onto another track with penalties), with a nice long "overtake priority" behind. You'll see the TGV and Asiastar both overtake the HST together, the asiastar overtake the TGV and HST seperately and the TGV overtake the HST. (It may start anywhere in this series of events, I can't remember where I saved)

One thing I changed was to place the exit signal behind the start signal, as the trains seemed to be getting a route to that first as it was closer. It makes no difference to the rest of the working.

Edit: Moving the exit signal also seems to solve the problem in your savegame.
Attachments
Overtakes.sav
Overtaking example.
(10.79 KiB) Downloaded 123 times
Jon
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: Two pre-signal challenges.

Post by petert »

Good job, but I still want to run some more tests on your theory to makes sure it holds under backwards pbs and such.
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 33 guests