Skip to content
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

core: add ETCS SVL logic to ETCS braking simulator #10402

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

Erashin
Copy link
Contributor

@Erashin Erashin commented Jan 16, 2025

Fixes #10404.
Add SVL logic to ETCS braking simulator.
How: compute svl and eoa indications, compute minimum curve, and compare it against overlay.
Limit: approximate braking curves' calculation when SvL is after the end of the path, due to the missing tractive effort and slopes post path.

@github-actions github-actions bot added the area:core Work on Core Service label Jan 16, 2025
@Erashin Erashin changed the base branch from dev to alch/core/add_loa_svl_etcs_logic January 16, 2025 10:06
@codecov-commenter
Copy link

codecov-commenter commented Jan 16, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.64%. Comparing base (37c3b08) to head (574a3e7).
Report is 8 commits behind head on dev.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #10402      +/-   ##
==========================================
- Coverage   80.66%   80.64%   -0.03%     
==========================================
  Files        1098     1080      -18     
  Lines      111787   110825     -962     
  Branches      744      745       +1     
==========================================
- Hits        90176    89375     -801     
+ Misses      21568    21407     -161     
  Partials       43       43              
Flag Coverage Δ
editoast 72.41% <ø> (+0.18%) ⬆️
front 89.93% <ø> (-0.01%) ⬇️
gateway 2.18% <ø> (ø)
osrdyne 2.53% <ø> (ø)
railjson_generator 87.58% <ø> (ø)
tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Erashin Erashin force-pushed the alch/core/add_loa_svl_etcs_logic branch 5 times, most recently from 5bfa910 to 8350dfe Compare January 16, 2025 11:18
@Erashin Erashin linked an issue Jan 16, 2025 that may be closed by this pull request
@Erashin Erashin changed the title core: add etcs SVL logic core: add ETCS SVL logic to ETCS braking simulator Jan 16, 2025
@Erashin Erashin force-pushed the alch/core/add_loa_svl_etcs_logic branch 6 times, most recently from 5fd6dac to e93a30e Compare January 17, 2025 14:46
Base automatically changed from alch/core/add_loa_svl_etcs_logic to dev January 17, 2025 15:46
@Erashin Erashin force-pushed the alch/core/add_svl_etcs_logic branch 9 times, most recently from 29d84bb to 6212f99 Compare February 21, 2025 08:31
@Erashin Erashin force-pushed the alch/core/add_svl_etcs_logic branch 4 times, most recently from ec6da6b to 390b821 Compare February 25, 2025 13:36
@github-actions github-actions bot added the area:integration-tests Work on Integration test, by nature related to different services label Feb 25, 2025
@Erashin Erashin force-pushed the alch/core/add_svl_etcs_logic branch 4 times, most recently from a8a8bb4 to ce5a895 Compare February 26, 2025 13:30
@Erashin Erashin marked this pull request as ready for review February 26, 2025 13:32
@Erashin Erashin requested review from a team as code owners February 26, 2025 13:32
@Erashin Erashin force-pushed the alch/core/add_svl_etcs_logic branch from ce5a895 to 7af533a Compare February 26, 2025 16:02
@Erashin Erashin force-pushed the alch/core/add_svl_etcs_logic branch from 7af533a to 1e7ce69 Compare February 27, 2025 15:05
Copy link
Contributor Author

@Erashin Erashin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bougue-pe : fixed in e3dbe47 and 1e7ce69.

@Erashin Erashin force-pushed the alch/core/add_svl_etcs_logic branch 4 times, most recently from cb65815 to 19652df Compare February 28, 2025 10:09
Copy link
Contributor

@bougue-pe bougue-pe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 Nice, thank you very much for the work !

Only nits and not-mandatory comments (or even just ideas for the future): no problem resolving them by yourself once decided/replied 👍

@shenriotpro shenriotpro removed their request for review March 3, 2025 10:43
@Erashin Erashin force-pushed the alch/core/add_svl_etcs_logic branch from 19652df to fb7fde5 Compare March 3, 2025 14:39
Copy link
Contributor

@eckter eckter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job on the tests

I only skimmed through the core changes, I trust PE's review on this

The path's context only extends until the end of the path. Hence, for an SvL located further along, the tractive effort and the slopes are missing. In this commit, we hack it to make it work, but we could potentially extend the path's context so it goes until the last SvL, if it breaks nothing.

Signed-off-by: Erashin <[email protected]>
Comment on lines +356 to +360
first_stop_offset = SVL_STOP_OFFSET
final_stop_offset = 45_060_000
stop_offsets = [
0,
first_stop_offset,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this SVL_STOP_OFFSET is not so "test generic", I would remove it and just explicitly use the named value:

Suggested change
first_stop_offset = SVL_STOP_OFFSET
final_stop_offset = 45_060_000
stop_offsets = [
0,
first_stop_offset,
svl_ph1_offset = 41_138_000
final_stop_offset = 45_060_000
stop_offsets = [
0,
svl_ph1_offset,

Comment on lines +454 to +458
# Check that the curves does respect the EoA + SvL (EoA = stops), and that there is an
# acceleration then deceleration in between (maintain speed when reach the MRSP).
# Here, the EoA is at 41038m, and the SvL is at the switch at 41138m.
distance_to_svl = 100_000
first_stop_offset = SVL_STOP_OFFSET - distance_to_svl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following the same idea:

Suggested change
# Check that the curves does respect the EoA + SvL (EoA = stops), and that there is an
# acceleration then deceleration in between (maintain speed when reach the MRSP).
# Here, the EoA is at 41038m, and the SvL is at the switch at 41138m.
distance_to_svl = 100_000
first_stop_offset = SVL_STOP_OFFSET - distance_to_svl
# Check that the curves does respect the EoA + SvL (EoA = stops), and that there is an
# acceleration then deceleration in between (maintain speed when reach the MRSP).
# Here, stop (EoA) is 100m before the PH1 switch (SvL).
svl_ph1_offset = 41_138_000
first_stop_offset = svl_ph1_offset - 100_000

prev_speed = current_speed

# Check that the braking curve starts and ends at the expected offsets.
offset_start_first_brake = START_SVL_BRAKE_ON_PH1_SWITCH - distance_to_svl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned, it looks to me like we shouldn't mutualize it, as it's only "lucky" that both EoA and SvL upper curve parts are under GUI influence and therefore separated by the same value as the EoA-SvL distance.
"Hard-documentation" though variable names seems too strong (and hides a lot of complexity about how the curves are computed) IMO.

Also, the values are not enough "test-generic" IMO (same as the SVL_STOP_OFFSET).

I wouldn't detail what's happening here at all (or just a comment, if you will).

Suggested change
offset_start_first_brake = START_SVL_BRAKE_ON_PH1_SWITCH - distance_to_svl
offset_start_first_brake = 33_361_530

🦜 Ditto for the "same location" test above.

Comment on lines +585 to +587
// TODO: have a tractive effort curve map which extends until the last SvL instead
// of the end of the path.
context.tractiveEffortCurveMap.get(min(position, context.path.length))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also part of the "end-of-the-path" hack (tracked it into #11036).
Yet, after thinking of it, we shouldn't have any of the 2 hacks in a separate commit, as the commit without the hacks will break: only one commit for the whole PR would be my pick on this 1️⃣.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:core Work on Core Service area:integration-tests Work on Integration test, by nature related to different services
Projects
None yet
Development

Successfully merging this pull request may close these issues.

core: ETCS: implement SVL braking curves logic
4 participants