The International Simutrans Forum

 

Author Topic: Priority through signals  (Read 18697 times)

0 Members and 1 Guest are viewing this topic.

Offline KrazyJay

  • *
  • Posts: 172
  • Infrastructure & Transportation Junk
Priority through signals
« on: November 04, 2009, 06:26:11 PM »
Concerns: Train/tram transportation.
Issue: On intersections or where tracks merge it could be very useful if trains on a track get priority over a side track preventing delays on the main tracks.
Idea: Long block signals could be recoded or a new kind of priority signal could be implemented to set priority on tracks.
Current signals: Right now a signal checks and reserves a stretch of track until the next signal (or station). Signals that reserve 2 blocks ahead exist already, but the train stops until there are 2 blocks ahead available causing the train to stop too early.
Solution: To create a priority signal that checks 2 blocks ahead, tries to reserve 2 blocks ahead, but if there is just 1 block available, then still allows proceeding until next signal.
Optional: A check for the second block (with immediate reservation) regularly during the trip from the priority signal until the next signal. this is strongly preferred but may cause Simutrans to slow down severely... (coders, any feedback on this?)

Please feel free to discuss this further. I believe this is easier to implement than setting priorities to train/tram lines.

Offline TheMacpau

  • *
  • Posts: 37
Re: Priority through signals
« Reply #1 on: November 04, 2009, 06:44:06 PM »
This is sort of like something that I was trying to get a plan for, a type of blend signal. With the behaviour of letting a train pass only if it won't interupt the flow of trains currently on line, because atm I can't think of any arrangement that acts like a motorway entry and exit lane, where you don't have trains standing still on an express line.

Offline VS

  • Senior Plumber (Devotee)
  • Devotee
  • *
  • Posts: 4855
  • Vladimír Slávik
    • VS's Simutrans site
  • Languages: CS,EN
Re: Priority through signals
« Reply #2 on: November 04, 2009, 07:17:06 PM »
Can't you already get something similar? If you used some signal on the priority line that made trains reserve a block or two ahead and a normal on the other? I mean reversing the logic on where is the reservation... or maybe I didn't understand.

Offline TheMacpau

  • *
  • Posts: 37
Re: Priority through signals
« Reply #3 on: November 04, 2009, 07:37:14 PM »
No I think the system being proposed is different for one key reason. At the moment we have a system of absolute reservation and use, such that the track is "owned" by one train or another. This results in the priority line train stopping on track if there is a waiting train in the siding.
while it clears the area that the priority train wants, be that by signal or presignal.
The proposed system wants a signal that permits a train to reserve an area of track in advance of itself to prevent another train taking it, but in the event of finding that track already reserved, doesn't stop at the signal.


Moving left to right

standard signal=s
Pre-signal=p
junction = /

(Priority train)---p------s---------s---------------
(Siding train)------------s/

In this system if the siding train gets to the junction before the Priority train reaches the presignal it will result priority train stopping at the presignal since the area of the junction is reserved by the siding train


alternative proposed signal = Y

(Priority train)---Y------s---------s---------------
(Siding train)------------s/

In his system if the siding train arrives before the Priority train the Siding train will reserve the junction track as before, but this time the Priority train will having attempted to reserve the track, as before in the presignal case, not stop but reserve the track up to the signal before the junction. During the time that the siding train is traveling across the junction and past the last signal (i.e out of the way), the priority train will move on towards the signal before the junction, reserving the junction section as soon as it becomes free.
This will result in the trains on the priority line never stopping to wait for the siding train, provided the length of the section between Y and S is long enough for the siding train to clear the junction region before the priority train gets to  the pre junction signal on the priority line.

This is what I understand to be the request. Think of a T road junction where a minor road meets a major road, the car joining waits for a large enough gap so as to not interupt the flow of traffic.

If anyone does have away of doing this with existing signals I apologise, and would the please explain how to do it to me :-D



Offline KrazyJay

  • *
  • Posts: 172
  • Infrastructure & Transportation Junk
Re: Priority through signals
« Reply #4 on: November 04, 2009, 08:37:20 PM »
thanks for clarifying. Basically it's a mix between a presignal and a regular signal. A train stops in front of a presignal if the 2 following blocks cannot be reserved. The proposed signal will reservate the block until the next signal, and will reservate the 2nd following block but a train will not stop if it cannot be reservated inmediately, but continues and reserves the 2nd block as soon as the 2nd block becomes available...[color]

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9568
  • Languages: De,EN,JP
Re: Priority through signals
« Reply #5 on: November 04, 2009, 09:32:40 PM »
The choose signal reserves the entire route. Other than that only the next signal is checked and, in case of presignals, the next two blocks are reserved. Others than that first comes first serves. If a train reserves severeal blocks ahead, it would have to have several blocks between two trains. That is identical to the case of having no signals at all, just larger block distances.

Usually a signal tries to reserve the next block four tiles ahead. If you set a waypoint before the signal, you can reduce this to a single tile.

Offline TheMacpau

  • *
  • Posts: 37
Re: Priority through signals
« Reply #6 on: November 04, 2009, 09:37:41 PM »
I think we both understand how the current signals work, but are unable to achieve the desired behaviour as I outlined in my post above. Can you suggest a layout of current signals that would behave as requested?

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9568
  • Languages: De,EN,JP
Re: Priority through signals
« Reply #7 on: November 04, 2009, 09:43:34 PM »
It This is not like signals work. Modern singal-less signalisation works like that, but the old style signals were either red (occupied) or green (free). But the waypoint just in front of the signal on the side line give it more disadvantage than the main line. And you can get more by placing a singal directly after the morge and directly before on the side line (or even dirtectly two following each other so you do not need the waypoint) and the other signal on the mainline a little more back.

-S+-----S main line
   S
   S
   | side line

That should help with traffic flow.

Offline KrazyJay

  • *
  • Posts: 172
  • Infrastructure & Transportation Junk
Re: Priority through signals
« Reply #8 on: November 06, 2009, 08:00:03 AM »
Thanks for your replies. But still, I'm not totally satisfied. What I would like to know, is whether my proposal is technically possible using Simutrans' current source code? Now I'm asking anyways, can all code for this kind of signal be put in a dat+img=pak file (like vehicles) or do we need a full patch? And what language do I need to master to create a signal like this? Thanks in advance.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9568
  • Languages: De,EN,JP
Re: Priority through signals
« Reply #9 on: November 06, 2009, 10:58:03 AM »
It needs programming. No other solution is possible, since the train has to try at each steps to reserve the next block.

Offline KrazyJay

  • *
  • Posts: 172
  • Infrastructure & Transportation Junk
Re: Priority through signals
« Reply #10 on: November 06, 2009, 11:25:16 AM »
Would it be easier to keep the block reservation check like it is now, i.e. only a few tiles before a signal, but expand the check to the 2nd and 3rd block, and places a reservation if possible, but does not stop a train if the reservation on the 2nd and 3rd block fails? I'm willing to learn some programming. Basically, it would be a pre-signal but with an optional reservation rather than stopping a train until a whole 2 block reservation is made... By the way, I can't find a pre-signal in Pak96.comic, is that my bad?

Offline KrazyJay

  • *
  • Posts: 172
  • Infrastructure & Transportation Junk
Re: Priority through signals
« Reply #11 on: November 08, 2009, 08:38:35 AM »
Since this topic has been silent, another related question. Can someone provide me with a dat file for a random rail signal? I really want to put effort in achieving what I want, but I sense some unwillingness since my question about signals and how to code a signal by myself. At least, if it's really not possible, let it be a waste of my own time. But I need to know where to start, and a good start would be a dat file of a random rail signal or a push in the right direction... Anyone?

Offline Combuijs

  • Web Team
  • Devotee
  • *
  • Posts: 1392
  • Maintainer of maps.simutrans.com
    • Combuijs
  • Languages: EN, NL
Re: Priority through signals
« Reply #12 on: November 08, 2009, 10:35:11 AM »
Quote
dat file of a random rail signal

Code: [Select]
# images S, N, E, W red, then green, then yellow (for presignal)
# repeat (if you like) for electrification
#
# normal signal
obj=roadsign
copyright=prissi
name=Signals
waytype=track
cost=750
is_signal=1
intro_year = 1810
intro_month = 9
Image[0]=rail-signals.0.0
Image[1]=rail-signals.0.1
Image[2]=rail-signals.0.2
Image[3]=rail-signals.0.3
Image[4]=rail-signals.0.4
Image[5]=rail-signals.0.5
Image[6]=rail-signals.0.6
Image[7]=rail-signals.0.7
Image[8]=rail-signals.1.0
Image[9]=rail-signals.1.1
Image[10]=rail-signals.1.2
Image[11]=rail-signals.1.3
Image[12]=rail-signals.1.4
Image[13]=rail-signals.1.5
Image[14]=rail-signals.1.6
Image[15]=rail-signals.1.7
Icon=> rail-signals.0.12
Cursor=rail-signals.0.13

Quote
a push in the right direction

This is from the open source pak64 which has all kind of signals in it.

If you are ok with german (and as you speak Dutch that language should not be too difficult to understand) you will find all available information in the wiki at http://simutrans-germany.com/wiki/wiki/tiki-index.php?page=en_SignalsDef

Offline KrazyJay

  • *
  • Posts: 172
  • Infrastructure & Transportation Junk
Re: Priority through signals
« Reply #13 on: November 08, 2009, 11:32:52 AM »
Thanks a lot Combuijs! Now I can spend my Sunday afternoon wisely!

Offline AP

  • Devotee
  • *
  • Posts: 1202
  • Languages: EN
Re: Priority through signals
« Reply #14 on: November 29, 2009, 11:49:39 PM »
For the record, as a humble player-without-coding-knowledge but a frequent user of rail, I would really like this kind of signal. It would go half-way to the creation of fast and slow loop lines, allowing mixed speed trains to use the same track and holding slow trains on such a loop whilst the fast trains pass - a feature I've been trying unsuccessfully to work out a way to create with current signalling for some time!

Offline KrazyJay

  • *
  • Posts: 172
  • Infrastructure & Transportation Junk
Re: Priority through signals
« Reply #15 on: November 30, 2009, 11:41:22 AM »
I've still been studying on some programming languages, I am not done yet, so if it solely depends on me, it might take a while, but I really want to make it happen. The dat file is useful, until a certain extent, as it only points to basic information like introduction date, which rotation to use when, and that it is in fact a signal. In the source files, there are more settings like what kind of signal it is. That's I guess where to work needs to be done. Any help, would still be very useful.

Offline Spike

  • *
  • Posts: 1361
  • First Simutrans Developer and Graphics Artist
Re: Priority through signals
« Reply #16 on: November 30, 2009, 12:36:52 PM »
For new functionality, it's likely that not only the signal must be modified, but also the vehicle code, in order to give them the desired behavior for this kind of signal.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18745
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Priority through signals
« Reply #17 on: November 30, 2009, 04:11:36 PM »
The other alternative would be something similar to the functionality in Railroad Tycoon, where trains are assigned priorities high/medium/low. In Simutrans, with block reservation, both high and medium trains could reserve two blocks in advance, with low reserving one block in advance, as is the present behaviour. The far block reserved by a "medium" could then be over-ridden by a "high". This might be simpler for players to understand and implement, and more effective, than having priority signals.

Offline Isaac.Eiland-Hall us

  • Benevolent Dictator
  • Administrator
  • *
  • Posts: 3659
  • PanamaCityPC.com/support/
    • Facebook Profile
  • Languages: EN
Re: Priority through signals
« Reply #18 on: November 30, 2009, 09:15:57 PM »
Hmm... I like the sound of that idea, but I'm trying to think how it wouldn't end up making deadlocks, as the slower train might well be in the way of the faster train, and any solution I can think of (make it stop; force it to re-route) makes it likely in my mind that it would cause stuck trains.

Unless, perhaps, there's a way to code it like passing cars - where it won't actually reroute until:
1. Faster train checks for all routes. If it wants to "take over" a slower train's route, the slower trains must attempt to reroute themselves, taking into account the faster train's desired route.

2. If [all of] the slower train(s) can reroute out of the way in X number of tiles, it does so, and the rerouting of all the trains succeeds.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18745
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Priority through signals
« Reply #19 on: November 30, 2009, 10:31:08 PM »
Hmm... I like the sound of that idea, but I'm trying to think how it wouldn't end up making deadlocks, as the slower train might well be in the way of the faster train, and any solution I can think of (make it stop; force it to re-route) makes it likely in my mind that it would cause stuck trains.

My idea is simpler than that: it would just require faster trains to reserve two blocks ahead instead of one. If this is done, then slower trains may indeed sometimes block faster trains, but they would be less likely to do so.

Offline wlindley us

  • Devotee
  • *
  • Posts: 978
    • Hacking for fun and profit since 1977
  • Languages: EN, DE
Re: Priority through signals
« Reply #20 on: December 02, 2009, 03:23:13 PM »
Sounds like three-aspect absolute block signals.  Red means the next block is occupied; Yellow means the block-after-the-next-block is occupied (trains proceed at reduced speed); Green means both following blocks are free.

Offline TrainMith

  • *
  • Posts: 60
Re: Priority through signals
« Reply #21 on: January 25, 2010, 05:55:13 PM »
I would personally like to see the reduced speed ability implemented.  Quite often I find a heavy train finally gets to speed only to slam on the brakes for the second or two that the preceding train takes to clear the block.

Offline Erik

  • *
  • Posts: 219
  • Languages: NL, EN
Re: Priority through signals
« Reply #22 on: December 05, 2010, 04:03:48 PM »
Pity I hasn't seen this topic earlyer.

This is exactly something what is missing in Simutrans.

At the moment I working on a dutch signal set.
I have the graphics ready for this.

EDIT:
(Also speed limit by signals are not possible with the current way speed limits are enforced and routes are searched.)

Ok, it's not possible jet.
But how much work would it be to chance it?
« Last Edit: December 09, 2010, 10:03:44 PM by Erik »

Offline Erik

  • *
  • Posts: 219
  • Languages: NL, EN
Re: Priority through signals
« Reply #23 on: December 28, 2010, 11:02:50 PM »
I have downloaded the source code.

I think it is not too hard to chance it.
At the moment I try to make it possible by my self.

However the first try has just failed.

Offline Erik

  • *
  • Posts: 219
  • Languages: NL, EN
Re: Priority through signals
« Reply #24 on: January 04, 2011, 04:38:28 PM »
ok, I have some progress after the help of a friend.
My programming skills are quiet limited.
So it will go slow.

I have altered the code of the presignal and now hid speed is cut by half of his original speed.
(However there are still a view bugs.)

Now I tried to make a new definition of a signal.
I am half way of it. But I have jet to chance something some were.

If I compile the code I have no errors and I can play the game.
But the game doesn't recognize the new signal jet.

So can someone tell me in witch file's I can find the recognizance of the signals?
« Last Edit: January 08, 2011, 03:58:56 PM by Erik »

Offline arnoud

  • *
  • Posts: 54
Re: Priority through signals
« Reply #25 on: January 04, 2011, 05:31:50 PM »
I can't wait

Offline KrazyJay

  • *
  • Posts: 172
  • Infrastructure & Transportation Junk
Re: Priority through signals
« Reply #26 on: January 05, 2011, 03:51:40 PM »
That sounds very promising! Lacking programming skills, I unfortunately couldn't pull it off myself.

Offline Erik

  • *
  • Posts: 219
  • Languages: NL, EN
Re: Priority through signals
« Reply #27 on: January 15, 2011, 10:58:23 PM »
One step further, but in witch direction?
Finally I has found the file were the signals are read from the pak files.
But now the game crashed when a train reach any signal. :-[

I have changed something wrong. But I do not know jet what.
I'm keep chancing and trying.
« Last Edit: January 22, 2011, 05:36:15 PM by Erik »

Offline Erik

  • *
  • Posts: 219
  • Languages: NL, EN
Re: Priority through signals
« Reply #28 on: January 22, 2011, 06:08:29 PM »
The problem of the crashes were probably from a chance of a configfile from a new nightly.
I have updated the source files and put in the changes I had already made.
Now I can load the save games again.

O and I forgot to thank you all for the graduates that I'm try to make this signal.

Still I'm unable to add the new signal.
So, a little help from a developer could be really help full.

I have add the signal to
- roadsign_writer.cc
- roadsign.cc
- roadsign_besch.h
- simvehikel.h
- simvehikel.cc

Witch file is missing?

On the dat file I have
Code: [Select]
is_signal=1
is_prosignal=1
When I load the game the signal is only seen as a normal signal.

When I remove the
Code: [Select]
is_signal=1from the dat file.
I can't place the signal somewere.
I get a error message like the track is not suitable for that kind of signal.
« Last Edit: January 22, 2011, 06:47:04 PM by Erik »

Offline VS

  • Senior Plumber (Devotee)
  • Devotee
  • *
  • Posts: 4855
  • Vladimír Slávik
    • VS's Simutrans site
  • Languages: CS,EN
Re: Priority through signals
« Reply #29 on: January 22, 2011, 08:43:18 PM »
you have

is_prosignal

but it should be

is_presignal

...?

Offline Erik

  • *
  • Posts: 219
  • Languages: NL, EN
Re: Priority through signals
« Reply #30 on: January 22, 2011, 08:49:31 PM »
No
That is not the point.

Presignal exist already.
But I wand build a signal who let the train go with a reduced speed in specific circumstances.

I had it already particly working bij altering the presignal code.
So I know it can.
But I would make it as a whole new signal.

Offline VS

  • Senior Plumber (Devotee)
  • Devotee
  • *
  • Posts: 4855
  • Vladimír Slávik
    • VS's Simutrans site
  • Languages: CS,EN
Re: Priority through signals
« Reply #31 on: January 22, 2011, 09:25:18 PM »
Ah, ok. Then the only advice is to make the text more different, perhaps is_slow_signal or such... Now it looks like a typo.

Good luck :)

Offline Erik

  • *
  • Posts: 219
  • Languages: NL, EN
Re: Priority through signals
« Reply #32 on: January 22, 2011, 09:40:06 PM »
yea, ok
A bigger differense in name.
Point for later.

First is to recognise the new signal at all.
I have make a chance log and add it in the attachment.

Offline Erik

  • *
  • Posts: 219
  • Languages: NL, EN
Re: Priority through signals
« Reply #33 on: February 03, 2011, 11:46:26 PM »
By a huge help of a friend there is progress.
Some things did work different as I has suspected.
It was HELL, but now I have put a new signal on the game. :D

Finley, I can begin by programming the speed limits of a the signal.

Offline arnoud

  • *
  • Posts: 54
Re: Priority through signals
« Reply #34 on: February 04, 2011, 04:36:29 PM »
Nice and please hurry up: I can not wait for it.