NREL / altrios

https://nrel.github.io/altrios/
Other
15 stars 2 forks source link

Fix/more data in train history #49

Closed calbaker closed 2 months ago

calbaker commented 3 months ago

Added:

    /// Current link containing head end (i.e. pulling locomotives) of train
    pub head_end_link_idx: u32,
    /// Offset from start of current link
    pub offset_in_link: si::Length,

to TrainState and corresponding code to store this in history

SWRIganderson commented 3 months ago

@calbaker I spent some time on Saturday looking into this on Saturday, but I did not finish. So far things look pretty good. The discrepancy that got me sidetracked was the length of the link from the data vs what I was seeing in QGIS. I need to do a bit more digging on that. I'll keep you posted. I should be able to look at it more later today.

SWRIganderson commented 3 months ago

@calbaker I have run this branch on my machine and inspected the results. I believe it is working correctly. I verified this by saving the data at 1 Hz and comparing the maximum link offset to the length of the link. I did this for the first dozen links in the trip. Everything checked out.

The thing that I also discovered is that the length calculation that is being done by QGIS may not be taking into account elevation or curvature. I have tracked this partially in the QGIS code, but I haven't run it to ground yet. The link below is how far I have tracked it. The screenshot is from QGIS. They have two different ways of calculating distance. The length in the network file is 7596.7 m. We probably need to understand the differences between all of these calculations to make sure we are getting what we think we are. It may be worth opening an issue maybe aroud this?

image

https://github.com/qgis/QGIS/blob/master/src/analysis/processing/qgsalgorithmextractvertices.cpp