A signaling simulator I wrote

General discussion of computer gaming and railroad simulations. Topics include MS Train Simulator (MSTS), Auran Trainz, Railroad Tycoon, Railroad Dispatcher and more...

Moderators: LIRRMEDFORD, 8th Notch

A signaling simulator I wrote

Postby MattW » Tue Dec 20, 2016 3:17 pm

For about 3 or so years, I've been working on and off (mostly off) on a railroad signaling simulator. I am pleased to say that I am releasing version 1 to the wild. Now this isn't a train simulator, or even a dispatching simulator. It only simulates the progression of train signals as trains operate along a section of track. This is primarily written from a north American perspective. Basic worldwide signaling should be possible, however some systems have some key signaling features that are not included in this such as approach-release.

I primarily wrote this as an eventual means of improving model railroad signaling. Every signaling scheme I could find almost requires programming each and every signal individually, and using lots of if-else logic. As a programmer, that made my hair hurt for multiple reasons so I set out to find a better way. Essentially, I use arrays and numerical signal indications to run the logic. So rather than something like:
Code: Select all
if(next_indication == 30 && !block_occupied) //receive clear signal, display clear signal
  indication = 30;
elseif(next_indication == 20 && !block_occupied) //receive approach signal, display clear signal
 indication = 30;
elseif(next_indication == 0 && !block_occupied) //receive stop signal, display approach signal
 indication = 20;


I do something like this:
Code: Select all
indication = indications[next_indication];


Additionally, signaling is defined in a set of signal rules that is much more user-friendly, and able to be reused by any similar signals (i.e. all intermediate signals will have the same reactions, on a certain line all passing siding signals will have the same reactions, etc.).

To run, download the .zip file at the link, extract it, and follow the instructions in the manual. That's really it, I'm just trying to share my efforts with the railfan community. So, here it is. If there's any questions or comments, please let me know!

https://drive.google.com/open?id=0B9HD0 ... 19yaC1TLVE

P.S. Yes, the wording here is identical to a post I'm making on another forum, there's just no reason to change the wording for the same piece of software.
MattW
 
Posts: 511
Joined: Thu May 13, 2010 8:00 pm
Location: Atlanta, GA (ATL)

Re: A signaling simulator I wrote

Postby ctclark1 » Wed Dec 21, 2016 12:46 am

I tried running this just for the heck of it, when I load a scenario file the menu just repeats forever, never giving me the chance to even tell it to run.
ctclark1
 
Posts: 292
Joined: Tue Jan 31, 2012 10:46 am

Re: A signaling simulator I wrote

Postby MattW » Wed Dec 21, 2016 9:21 am

ctclark1 wrote:I tried running this just for the heck of it, when I load a scenario file the menu just repeats forever, never giving me the chance to even tell it to run.

Could you tell me exactly how you tried running it? As in exactly what you typed in and when?
MattW
 
Posts: 511
Joined: Thu May 13, 2010 8:00 pm
Location: Atlanta, GA (ATL)

Re: A signaling simulator I wrote

Postby ctclark1 » Thu Dec 29, 2016 8:42 pm

Well that's a good question, now I can't duplicate it, it's running fine. *shrug*
ctclark1
 
Posts: 292
Joined: Tue Jan 31, 2012 10:46 am


Return to Gaming & Simulations

Who is online

Users browsing this forum: No registered users and 1 guest