-
Notifications
You must be signed in to change notification settings - Fork 17
front: handle times update on reduced nodes #590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: mrd/new-nodes-management-system
Are you sure you want to change the base?
front: handle times update on reduced nodes #590
Conversation
| ); | ||
| } | ||
|
|
||
| static getSectionTravelTime( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| static getSectionTravelTime( | |
| static getSectionDistributedTravelTime( |
| trsTimeStructure.travelTime = TrainrunsectionHelper.getTravelTime( | ||
| if (prevInitialTargetArrival !== null) { | ||
| // gérer les modulo 60 et positif | ||
| stopTime = (nextPair.trainrunSection.getSourceDeparture() - prevInitialTargetArrival) % 60; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to deal with negative stopTimes (dirty way):
| stopTime = (nextPair.trainrunSection.getSourceDeparture() - prevInitialTargetArrival) % 60; | |
| stopTime = (((nextPair.trainrunSection.getSourceDeparture() - prevInitialTargetArrival) % 60) + 60) % 60; |
Signed-off-by: Clara Ni <[email protected]>
14aff1d to
e5de33f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The left (source) -> right (target) works
The left (target) <- right (source) not; I'm trying to find a solution if you don't find it first :-)
You can test with this also:
reticulaire(3).json
Also, do not forget to remove the last commit
|
|
||
| export class NonStopTrainrunIterator extends TrainrunIterator { | ||
| /** Iterate on the trainrun sections until we find a node which is a stop of the trainrun and not collapsed */ | ||
| export class NextVisibleStopIterator extends TrainrunIterator { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we name it NextExpandedStopIterator? To re-use the "expanded"/"collapsed" paradigm
| expect(tt).toBe(1); | ||
| it("getLastSectionTravelTime -- 004", () => { | ||
| const tt = TrainrunsectionHelper.getLastSectionTravelTime(10, 2, 0); | ||
| expect(tt).toBe(20); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To fix the tests:
Chrome Headless 141.0.0.0 (Windows 10) TrainrunsectionHelper getLastSectionTravelTime -- 004 FAILED
Expected 8 to be 20.| expect(tt).toBe(20); | |
| expect(tt).toBe(8); |
| if (prevInitialTargetArrival !== null) { | ||
| stopTime = MathUtils.mod60(nextPair.trainrunSection.getSourceDeparture() - prevInitialTargetArrival); | ||
| trsTimeStructure.leftDepartureTime = trsTimeStructure.rightArrivalTime + stopTime; | ||
| trsTimeStructure.leftArrivalTime = trsTimeStructure.rightDepartureTime + stopTime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| trsTimeStructure.leftArrivalTime = trsTimeStructure.rightDepartureTime + stopTime; | |
| trsTimeStructure.leftArrivalTime = trsTimeStructure.rightDepartureTime - stopTime; |
Since the train goes from:
left -> rightthenleft <- right
You can try on a non-stop chain with more than 1 collapsed node
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, you're right !! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After further testing, happens this actually does not work for right times updates :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea to add the stop time prop!
This makes the easy case work (rightIsTarget = true) but not the other situation still.
Also, I think you have forgotten to add the stop time stuff in onNodeLeftArrivalTimeChanged()? I quickly tried to test but I'm not sure of what I'm saying rn
ps: you have formatting issues, npm run format
| ); | ||
| } else if (!this.lockStructure.travelTimeLock && this.lockStructure.leftLock) { | ||
| const extraHour = this.timeStructure.travelTime - (this.timeStructure.travelTime % 60); | ||
| // pas sûre d'avoir compris comment fonctionnait l'extraHour |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extraHour is the rest of the euclidian division of travelTime / 60 ; this is used for recalculating the travel time using the departure/arrival times, which are % 60
303min of travelTime = 300min of "base"
say departure is 2' and arrival 5', travelTime = 5 - 2 + 300 = 303min
Then, you are right to add the stop time value to this one also
fad0e73 to
48bc480
Compare
`TrainrunsectionHelper.getTravelTime()` computes the new travel time of a trainrunSection, either by using the `travelTimeFactor` and the current travel time of the section, or by using the total trainrun travel time and the sum of the new travel times computed up to that point. This logic can be split into 2 independent functions, which will be used depending on whether the considered section is the last one to compute or not. Signed-off-by: Clara Ni <[email protected]>
Until now, a time structure has represented one or several trainrun sections without any stops, so it could be described by its departure and arrival times (right and left) and its travel time. Since we are now going to handle several trainrun sections that include stops, we need to add a new property to store the total stop time in the time structure. Signed-off-by: Clara Ni <[email protected]>
…masked The behavior is pretty much the same as when a node is a non-stop node, except when updating the travel time, because we need to take into account the stop times of the reduced nodes. Signed-off-by: Clara Ni <[email protected]>
…ion tab Signed-off-by: Clara Ni <[email protected]>
This commit needs to be droped before the merge. Signed-off-by: Clara Ni <[email protected]>
48bc480 to
4206b78
Compare
Description
This PR allows to handle times updates correctly when a node is collapsed.
I will add more details later.
Issues
OpenRailAssociation/osrd#13347
Checklist
documentation/