Upcoming Games

(UTC times)


Full list
Add a game

Upcoming Events

No events to display

Timetable importer

You are here: Home > Forum > General > Timetabling > Timetable importer

Page 1 of 2

Timetable importer 07/02/2022 at 13:33 #145067
lukebriner
Avatar
56 posts
Since starting to work on my first real timetable, I've realised a lot of time is spent entering data via the GUI to the TT editor whereas it is easier to visualise/prove in a spreadsheet.

Am I right in thinking that there isn't a CSV to XML importer for timetables?

If so, would there be any objections to me trying to knock one together as a .Net desktop app? It probably wouldn't support all of the bells and whistles but could certainly allow some basic volume of data imports including timings and headcodes and could even generate placeholders for rules at minimum as a reminder to fill in the relevant deets.

I'm happy for it to go on github etc. if that is a good idea and I appreciate that it will vary for each simulation but I suspect it will be relatively easy to separate the schema of each simulation into a file for error checking. Otherwise it might be as simple as specifying the list of location codes from the timetable for each sim and the user simply has to use the correct code on each line so that the correct XML is generated.

Log in to reply
The following user said thank you: Dionysusnu
Timetable importer 07/02/2022 at 18:30 #145080
GeoffM
Avatar
6376 posts
We always welcome helpful third party additions.
SimSig Boss
Log in to reply
The following user said thank you: lukebriner
Timetable importer 07/02/2022 at 18:53 #145082
simple68
Avatar
80 posts
crack on. I think many here would be very grateful for such a thing.

Si

Log in to reply
Timetable importer 14/02/2022 at 14:10 #145201
lukebriner
Avatar
56 posts
Hi Geoff (or Devs), I can understand the timetable format fairly easily from the XML although there are a couple of fields in the "Trip" object (location) that are not directly from the user input but are obviously related to the physical layout of the locations on the simulation:

DownDirection
NextPathStartDown
PrevPathEndDown

Presumably these have to be computed from knowledge of the layout and whether the next/prev locations are "up" or "down" from the current one, which I guess is looked up/computed as the user enters locations?

Firstly, if I didn't add these, would SimSig fill them in at some point if I was to open/edit the generated timetable? If not, presumably I would need some knowledge of the locations in the importer so that I could derive this information myself? Otherwise, I assume I cannot import this information directly from SimSig?

Thanks

Log in to reply
Timetable importer 14/02/2022 at 17:15 #145209
GeoffM
Avatar
6376 posts
lukebriner in post 145201 said:
Hi Geoff (or Devs), I can understand the timetable format fairly easily from the XML although there are a couple of fields in the "Trip" object (location) that are not directly from the user input but are obviously related to the physical layout of the locations on the simulation:

DownDirection
NextPathStartDown
PrevPathEndDown

Presumably these have to be computed from knowledge of the layout and whether the next/prev locations are "up" or "down" from the current one, which I guess is looked up/computed as the user enters locations?

Firstly, if I didn't add these, would SimSig fill them in at some point if I was to open/edit the generated timetable? If not, presumably I would need some knowledge of the locations in the importer so that I could derive this information myself? Otherwise, I assume I cannot import this information directly from SimSig?

Thanks
I think those fields get re-populated upon use (ie when a train enters / gets formed) so you can leave them out.

SimSig Boss
Log in to reply
The following user said thank you: lukebriner
Timetable importer 14/02/2022 at 18:29 #145211
clive
Avatar
2789 posts
GeoffM in post 145209 said:
lukebriner in post 145201 said:
Hi Geoff (or Devs), I can understand the timetable format fairly easily from the XML although there are a couple of fields in the "Trip" object (location) that are not directly from the user input but are obviously related to the physical layout of the locations on the simulation:

DownDirection
NextPathStartDown
PrevPathEndDown

Presumably these have to be computed from knowledge of the layout and whether the next/prev locations are "up" or "down" from the current one, which I guess is looked up/computed as the user enters locations?

Firstly, if I didn't add these, would SimSig fill them in at some point if I was to open/edit the generated timetable? If not, presumably I would need some knowledge of the locations in the importer so that I could derive this information myself? Otherwise, I assume I cannot import this information directly from SimSig?

Thanks
I think those fields get re-populated upon use (ie when a train enters / gets formed) so you can leave them out.
If I recall correctly, it's on timetable validation, which happens when a train gets formed but also if you do a timetable analyze.

So don't fill them in, load the timetable into the sim, do an analyze, and then save it again and all will be well.

Log in to reply
The following user said thank you: lukebriner
Timetable importer 19/02/2022 at 20:10 #145270
lukebriner
Avatar
56 posts
OK, so the first version is nearly ready. The only really important part left is to copy train info from the train categories into the timetables since otherwise the fields are not set when you edit the timetable.

After that I need to do some basic tidying up like allowing you to choose the output file name etc and also allow you to import multiple sheets for e.g. Up and Down workings but it already looks cool and should hopefully save people an awful lot of time.

I think it should work fairly well with any of the other sims also, it will just be a case of knowing relevant version numbers, sim names and perhaps producing a list of all TIPLOCs in each simulation for people to extract into their simplifiers.

I am also going to add a day selector so you can import the job lot and then choose which day to export the timetable for and it can auto-filter based on the day code.

I have put it on Github, it is private for now but I can invite people early on or eventually I will make it public so people can raise issues and pull-requests if they are so inclined.

Log in to reply
Timetable importer 19/02/2022 at 22:17 #145275
Newhampshires
Avatar
101 posts
If there is some role of Beta Tester somewhere in this, sign me up as one.
Log in to reply
Timetable importer 20/02/2022 at 17:43 #145284
lukebriner
Avatar
56 posts
There will be soon. Just need to work out how we should test this. In many ways, it won't be terrible if there are minor bugs but I might just start by testing the MSI installer and see if anything is wrong.
Log in to reply
Timetable importer 22/02/2022 at 20:55 #145314
lukebriner
Avatar
56 posts
Intro video (will tidy up later): https://youtu.be/iT8YjwxnozM

Site: https://github.com/lukos/SimSig_importer/

See how you get on with the instructions and if you get any errors let me know. I know there is an issue because the software is not signed so it will warn you when running the downloaded installer.

Log in to reply
The following users said thank you: haydenrobertson, broodje, Newhampshires
Timetable importer 23/02/2022 at 09:55 #145317
broodje
Avatar
184 posts
Online
I've been playing around with it, trying to create a small freight timetable for the Vale of Glamorgan. I think the idea is fantastic, creating a timetable from a WTT is much easier this way. I do think some improvements from both Simsig and the tool would make it even greater ;).

First of all, it would be handy if SimSig had a location exporter (It already has for dev licences) but it should not only export the internal code-name, but also the translation. Even a small sim as Vale Of Glamorgan has 42 internal locations and 9 entrance locations. And most developers have had to create their own location names to make shunt moves possible. And I don't think any one can guess these names in any way. I for one could never have guessed that ABTHRCP would be Alberthaw Power station UP for example. (I know why it is, it is the location of the reception sdgs before the power station, but I would not be able to guess this).

My 2nd request would be for the importer tool. Would it be possible to import a timetable to read out the train types from it? In this case I was trying to create a timetable for the Cardiff sims. And all timetables would need the same train types to get it working. It would be very handy if I could read in the train types from an existing timetable. I know, I could type it out once and copy them over afterwards, but it would be a cool feature.

And because I started with a freight timetable I immediately ran into all the pathing time these freights have in their WTT. would it be possible to ad these to the same line as their receptive passing time? So something like this: CADOXTN|Cadoxton|0624 [1](7)|

otherwise I would have to add an ARR and DEP line to an whole lot of extra locations that are only needed for ENG or PATH times.

Log in to reply
Timetable importer 23/02/2022 at 17:43 #145329
GeoffM
Avatar
6376 posts
broodje in post 145317 said:
First of all, it would be handy if SimSig had a location exporter (It already has for dev licences) but it should not only export the internal code-name, but also the translation.
I've added to Mantis, 35774.

broodje in post 145317 said:
I for one could never have guessed that ABTHRCP would be Alberthaw Power station UP for example.
This site is useful for looking up codes. With the exception of very old simulations, and locations which have no formal identifier and are thus invented for SimSig purposes, most everything should be there. Of course, it won't give you an exact location though, just the full name.

SimSig Boss
Last edited: 23/02/2022 at 17:43 by GeoffM
Reason: None given

Log in to reply
The following user said thank you: broodje
Timetable importer 23/02/2022 at 21:01 #145340
lukebriner
Avatar
56 posts
Having an active link to SimSig to get locations would be cool but to be honest, since they don't change much, probably even a static list could be turned into a text file and added to the importer, as long as the locations are in the correct up or down order I guess, which might take some manual schenanigans.

I will add the pathing stuff to the issues list.

Log in to reply
Timetable importer 23/02/2022 at 21:24 #145341
GeoffM
Avatar
6376 posts
lukebriner in post 145340 said:
Having an active link to SimSig to get locations would be cool but to be honest, since they don't change much, probably even a static list could be turned into a text file and added to the importer, as long as the locations are in the correct up or down order I guess, which might take some manual schenanigans.
We do have a simple ordering system as each location and entry point has a number. The lower the number the more "up" it is. Branches and triangles take some thinking about though.

SimSig Boss
Log in to reply
Timetable importer 23/02/2022 at 21:41 #145342
lukebriner
Avatar
56 posts
Cool, I'm sure we could get some fellow SimSiggers to help us get the locations put in TT order. The other thing is that the importer can (once I test it!) import multiple spreadsheets so for example, with Wolverhampton, for trains that go round the chord from Stafford towards Oxley (which change from Up to Down) we can just create another timetable sheet with the locations in the correct order and it will import correctly so not the end of the world.

I need to do a bit more work by the weekend and I can probably fairly easily add pathing and eng allowances using the syntax from my WTT like [3] for eng and (2) for pathing.

Log in to reply
Timetable importer 23/02/2022 at 21:45 #145343
broodje
Avatar
184 posts
Online
I just added some extra work on github, I've got some problems with exporting the 4th train on the down line. Sorry ;). Filling in the (in this case) freight trains goes really fast though and I really like the fact that you left a lot of room to leave notes in the excel. It makes matching trains a lot easier.
Log in to reply
Timetable importer 24/02/2022 at 15:54 #145375
lukebriner
Avatar
56 posts
I have fixed those two bugs and uploaded another installer. I haven't really thought about upgrade installers so you should uninstall the current one before installing the new one, just to make sure it doesn't do anything weird!
Log in to reply
Timetable importer 24/02/2022 at 21:50 #145385
lukebriner
Avatar
56 posts
OK, latest installer has been uploaded.

All the bugs fixed.

Features:
* Importing unique id (example in the included spreadsheet)
* Importing allowances (example in the included spreadsheet, docs updated)
* Can import multiple sheets and they are simply merged - the only restriction is that you cannot link a working to a train type that has not already been imported so best start by importing train types in the first import. Multiple sheets don't need to have the same locations in it so this is a workaround for workings that change direction from Up to Down, simply create a list of the locations in order on another spreadsheet and import that.

Log in to reply
Timetable importer 24/02/2022 at 22:19 #145386
broodje
Avatar
184 posts
Online
This works great, edited and imported the new XLS and it works like a charm.

The sim however has some interesting bugs ;). It looks like some paths are missing, I can't get into the docks for example. I've got the down trains working, I might try the up trains tomorrow. If anyone is interested to see how I've done it I can share the Excel.

Last edited: 24/02/2022 at 23:50 by broodje
Reason: None given

Log in to reply
Timetable importer 25/02/2022 at 02:01 #145390
Newhampshires
Avatar
101 posts
broodje in post 145386 said:
This works great, edited and imported the new XLS and it works like a charm.

The sim however has some interesting bugs ;). It looks like some paths are missing, I can't get into the docks for example. I've got the down trains working, I might try the up trains tomorrow. If anyone is interested to see how I've done it I can share the Excel.
I'd be interested in seeing more example Excel sheets. I think my brain is wrapped up on how one transfers information from the WTT into the Excel sheet of this program. Are you all manually inputting it (as shown in the tutorial video?)? Or is there a way to do an API pull from Network Rail or RealTrainTimes (for example) and have that data formatted in a way to match up with the format of this importer program?

Log in to reply
Timetable importer 25/02/2022 at 21:00 #145403
lukebriner
Avatar
56 posts
I am currently working on a Generate function, which if you have a template for the simulation you are working on, it generates a blank spreadsheet with the correct locations laid out like a WTT and then it is pretty much transferring data from the WTT directly into the spreadsheet and it just works.

Except when it doesn't!

I've just realised that the codes for Entry points are not the same as the TIPLOC codes for the location e.g. Oxley CS entry point is code EOXCS whereas the tiploc code is OXLEYCS or OXLEYS depending on whether you are going to the MD or the sidings - the sim uses OXLEYCS.

So I will need to rework the format slightly and work out the easiest way for the importer to distinguish between "enters here" and "passes here" so that it can use the correct code. Slightly annoying but all part of the learning curve! If anyone wants to add a template for the simulations you are working on in the format of the attached, I would be happy to include the. They are ordered in the up direction e.g. furthest from london at the top moving up as you move down the document (this order goes into the Up sheet).

You can add some optional properties:

UpEntry (default false) whether this is an entry location in the up direction
DownEntry (default false) same as above in the down direction
Direction (default null) is "Up", location only applies to up trains and vice-versa for "Down"
ArrDep (default false) whether to split a location into two rows for arrival and departure times
Plat (default false) whether to add a Platform row - requires ArrDep: true
Path (default false) whether to add a Path row - requires ArrDep: true
Line (default false) whether to add a Line row - requires ArrDep: true

I will add another video about using the generate function even though it isn't quite ready yet so you can start building your spreadsheets (you can always copy the data in later from another spreadsheet).

Post has attachments. Log in to view them.
Log in to reply
Timetable importer 25/02/2022 at 21:26 #145404
Meld
Avatar
1111 posts
lukebriner in post 145403 said:


I've just realised that the codes for Entry points are not the same as the TIPLOC codes for the location e.g. Oxley CS entry point is code EOXCS whereas the tiploc code is OXLEYCS or OXLEYS depending on whether you are going to the MD or the sidings - the sim uses OXLEYCS.

Luke

In most simulations, and I do stress most, the entry points are the TIPLOC code prefixed with the letter 'E' so on Chester the entry point from Hooton is EHOOTON but the exit is the normal TIPLOC HOOTON.

Exceptions do occur in the case of Birkenhead depot, with different entry points all the exit points are BRKNMUD but the entry points are EBRKNMUD1528 & EBRKNMUD575 for the different entry locations

Passed the age to be doing 'Spoon Feeding' !!!
Log in to reply
Timetable importer 25/02/2022 at 22:03 #145405
headshot119
Avatar
4869 posts
If it helps you here is a list of the entry point codes for Sandhills, along with there in simulation name.

EBOOTLBJ
Bootle Branch Junction (OOU)

EBRKNCDS
Birkenhead Central SDG 1-2

EBRKNCDS3
Birkenhead Central SDG 3-5

EBRKNDKS
Canning Street North

EBRKNMUD1528
Birkenhead North EMUD (1528)

EBRKNMUD575
Birkenhead North EMUD (575)

EBRSCGHB
Burscough Bridge

EDMARSHJ
Dee Marsh Junction

EEDGELAJ
Edge Lane Junction

EHALLRWS
Hall Road Wall Siding

EHOOTON
Hooton

EKRKDLCS
Kirkdale Depot (Dn)

EKRKDLCSU
Kirkdale Depot (Up)

ELVRPSPY
Liverpool South Parkway

ERGNTSRX
Strand Road

ESOUTBRD
Bradford Sidings

ESOUTCHS1
Southport Carriage 1

ESOUTCHS10
Southport Carriage 10

ESOUTCHS1102
Southport Stabling Sdgs (1102)

ESOUTCHS1105
Southport Stabling Sdgs (1105)

ESOUTCHS3
Southport Carriage 3

ESOUTCHS8
Southport Carriage 8

ESOUTCHS9
Southport Carriage 9

"Passengers for New Lane, should be seated in the rear coach of the train " - Opinions are my own and not those of my employer
Last edited: 25/02/2022 at 22:03 by headshot119
Reason: None given

Log in to reply
The following user said thank you: lukebriner
Timetable importer 25/02/2022 at 22:31 #145406
clive
Avatar
2789 posts
I try to put a list of TIPLOCS, both real and fake, and entry point codes in the the manual of each sim I do.

I would hope other developers would do it as well, but I can't force them.

Log in to reply
The following users said thank you: DonRiver, lukebriner
Timetable importer 26/02/2022 at 12:15 #145412
lukebriner
Avatar
56 posts
The issue here with entry points is they have to be correct per sim. Even if *most* sims use the tipoc code with E, I can't assume that otherwise it won't work but it will mostly involve working through various sims, exporting timetables and reading what codes are used and then creating the template.

On Wolverhampton, for example, the entry point for Stafford is EUST (Entry up stour trent valley) which is not the tiploc code. Same for Oxley, where the entry point is quite different.

It's fine, I just need to work out how to input these on the spreadsheet so it doesn't get too complicated, I might just have both codes on the same row e.g. OXLEYCS/#EOXCS so the time can go in the same row regardless and the importer can work out if it is entering there and therefore to use the second code.

Log in to reply