¿ªÔÆÌåÓý

Locked Re: Jython Script output problem #timetable-tool


 

Iain,

I have uploaded the TimeTableExport.py file to my folder in ProblemsBeingWorkedOn:

/g/jmriusers/files/ProblemsBeingWorkedOn/dsand/TimeTableExport.py

The generated CSV file will be located in your user files location (panels, roster, etc.) with the name TimeTableExport.csv. This file can be imported into a spreadsheet program for additional processing.


Dave Sand

On Dec 17, 2018, at 12:36 PM, Dave Sand <ds@...> wrote:

Iain,

The 24/0 wrap is caused by not having a defined wait time that spans the 24 to 0 time period. As indicated in the help document, this is required to prevent strange issues like you see.

For your data output you need to think of a 5x50 grid. You need to account for every cell in the grid. If a train does not have a stop at a station, that grid cell needs to be ¡°empty¡±. Since there are arrive and depart times, maybe the grid is 5x100. The other thing to keep in mind is that some trains run from station 1 to station 5 AND other trains run from station 5 to station 1.

The easiest solution is to export the data using a CSV (comma separated values) file. This is actually on my TODO list.

In the meantime, I will create a python version. The rows will be station and train arrive and depart times are the columns.


Dave Sand



On Dec 17, 2018, at 11:42 AM, Iain <iain@...> wrote:

Dave,

I have spent many hours entering my data into Timetable for the Ullapool - Lochinver segment. That is 5 stations and some 50 or so trains. I have put the data file into the problems list if you want to look at it. The graph output is interesting in that the 24hr to 0hr wrap-round goes right across the page.

I have taken your code fragment and produced this:

import java
import jmri

# Get the Timetable data manager
tdm = jmri.jmrit.timetable.TimeTableDataManager.getDataManager();


for stop in tdm.getStops(0, station.getStationId(), False):
train = tdm.getTrain(stop.getTrainId())
print train, stop.getArriveTime()

Which lists for one station (Lochinver) the UNSORTED arrival (and departure by coincidence) time of all trains at that station.

What I need is to produce an output (table/matrix) something like:
station 1 station 2 station 3 station 4 station 5
train 1 arr dep arr dep
train 2
train 3
etc

Which when inverted would produce a timetable for the line. I don't need the station names of course.

There is a snag since there are more trains between stations 1 and 2 than the other stations. I am not sure how that gets dealt with?

If I wanted to graph it I would need to output station-no train time pairs for the y/x axes:

train1 station-no arr-time station-no dep time station-no arr-time station-no dep time etc......
train2
train3
etc.


Join [email protected] to automatically receive all group messages.