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: remove neutral section hacks to improve reliability #7413

Merged
merged 1 commit into from
May 14, 2024

Conversation

multun
Copy link
Contributor

@multun multun commented May 14, 2024

The current implementation of neutral ranges has at least two troublesome hacks:

  • when leaving a neutral section, the train takes time to start drawing power again.
    due to the design of the current implementation, this time is converted into an
    approximate distance
  • power is cut ahead of time using an announce zone, instead of having the driver
    react to the signal. this zone is there regardless of routes

These hacks bring about several bugs:

  • the length of neutral section is extended by an approximation of the distance
    required to start drawing power again. This approximation is always too high
    if the train is slowing down. If the train is slowing down to a stop, it can
    get stuck in this approximated extension. This issue will vanish once this
    gets simulated over time instead.
  • if a train stops inside the neutral section announce zone, it has to start
    drawing power anyway to start back up, then cut power in the neutral section.
    this behavior is very hard to emulate with the current simulation engine.
  • if a sign announces a neutral section just before a switch, the announce zone
    is directional. getting this right probably means treating annonce signs as
    signals, and treat those as route dependant. This is a lot of work, and needs
    to wait until trains can react to signals (train sim v3).

These hacks were a bad idea in the first place, and the features they were meant
to implement will be a lot easier to implement once trains:

  • are simulated in a causal way
  • can react to signals

@multun multun requested a review from a team as a code owner May 14, 2024 11:14
@multun multun requested a review from Khoyo May 14, 2024 11:14
@multun multun force-pushed the neutral-section-less-hacks branch from ff8cb0c to efbb6da Compare May 14, 2024 11:14
@multun multun changed the title core: remove neutral ranges hacks to improve reliability core: remove neutral section hacks to improve reliability May 14, 2024
@codecov-commenter
Copy link

codecov-commenter commented May 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 29.44%. Comparing base (6079b64) to head (be21975).
Report is 6 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    #7413       +/-   ##
=============================================
+ Coverage     18.79%   29.44%   +10.64%     
+ Complexity     2016     2012        -4     
=============================================
  Files           903     1162      +259     
  Lines        114916   143499    +28583     
  Branches       2809     2808        -1     
=============================================
+ Hits          21594    42247    +20653     
- Misses        91668    99594     +7926     
- Partials       1654     1658        +4     
Flag Coverage Δ
core 76.24% <100.00%> (-0.05%) ⬇️
editoast 72.31% <ø> (?)
front 9.83% <ø> (ø)
gateway 2.41% <ø> (-0.03%) ⬇️
railjson_generator 87.49% <ø> (ø)
tests 83.96% <ø> (ø)

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.

Copy link
Contributor

@bloussou bloussou left a comment

Choose a reason for hiding this comment

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

Thanks a lot 🧹

The current implementation of neutral ranges has at least two troublesome hacks:

- when leaving a neutral section, the train takes time to start drawing power again.
  due to the design of the current implementation, this time is converted into an
  approximate distance
- power is cut ahead of time using an announce zone, instead of having the driver
  react to the signal. this zone is there regardless of routes

These hacks bring about several bugs:

- the length of neutral section is extended by an approximation of the distance
  required to start drawing power again. This approximation is always too high
  if the train is slowing down. If the train is slowing down to a stop, it can
  get stuck in this approximated extension. This issue will vanish once this
  gets simulated over time instead.
- if a train stops inside the neutral section announce zone, it has to start
  drawing power anyway to start back up, then cut power in the neutral section.
  this behavior is very hard to emulate with the current simulation engine.
- if a sign announces a neutral section just before a switch, the announce zone
  is directional. getting this right probably means treating annonce signs as
  signals, and treat those as route dependant. This is a lot of work, and needs
  to wait until trains can react to signals (train sim v3).

These hacks were a bad idea in the first place, and the features they were meant
to implement will be a lot easier to implement once trains:

- are simulated in a causal way
- can react to signals
@multun multun force-pushed the neutral-section-less-hacks branch from efbb6da to be21975 Compare May 14, 2024 13:15
@multun multun added this pull request to the merge queue May 14, 2024
Merged via the queue into dev with commit 1a87889 May 14, 2024
17 checks passed
@multun multun deleted the neutral-section-less-hacks branch May 14, 2024 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants