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

editoast: stdcm fix train simulation #9660

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

Wadjetz
Copy link
Member

@Wadjetz Wadjetz commented Nov 8, 2024

fix #9544

@Wadjetz Wadjetz self-assigned this Nov 8, 2024
@Wadjetz Wadjetz added kind:bug Something isn't working area:editoast Work on Editoast Service module:stdcm Short-Term DCM labels Nov 8, 2024
@codecov-commenter
Copy link

codecov-commenter commented Nov 8, 2024

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

Codecov Report

Attention: Patch coverage is 93.69369% with 7 lines in your changes missing coverage. Please review.

Project coverage is 38.20%. Comparing base (ab6cdbb) to head (9fa4b7f).
Report is 1 commits behind head on dev.

Files with missing lines Patch % Lines
editoast/src/views/path/pathfinding.rs 40.00% 6 Missing ⚠️
editoast/src/views/timetable/stdcm.rs 96.87% 1 Missing ⚠️

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

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #9660      +/-   ##
==========================================
- Coverage   38.22%   38.20%   -0.02%     
==========================================
  Files         995      995              
  Lines       91910    91961      +51     
  Branches     1193     1193              
==========================================
+ Hits        35128    35136       +8     
- Misses      56327    56370      +43     
  Partials      455      455              
Flag Coverage Δ
editoast 73.24% <93.69%> (-0.10%) ⬇️
front 20.19% <ø> (ø)
gateway 2.18% <ø> (ø)
osrdyne 3.28% <ø> (ø)
railjson_generator 87.49% <ø> (ø)
tests 87.00% <ø> (ø)

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.

@Wadjetz Wadjetz force-pushed the ebe/editoast/stdcm/fix-train-simulation branch from f0f89c1 to e5e6b33 Compare November 8, 2024 15:07
@github-actions github-actions bot removed the area:editoast Work on Editoast Service label Nov 8, 2024
@Wadjetz Wadjetz force-pushed the ebe/editoast/stdcm/fix-train-simulation branch from e5e6b33 to fbf7d12 Compare November 8, 2024 15:11
@Wadjetz Wadjetz force-pushed the ebe/editoast/stdcm/fix-train-simulation branch 4 times, most recently from bedcaf7 to 54c85fb Compare November 20, 2024 13:40
Copy link
Contributor

@flomonster flomonster left a comment

Choose a reason for hiding this comment

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

You have three functions (train_simulation_batch, get_train_batch_simulation and consist_train_simulation_batch). Only two of them are required.

  • train_simulation_batch(&[TrainSchedule])
    • Retrieve rolling stocks from rolling_stock_name field`
    • Convert this rolling stocks into PhysicsConsistParameters
    • Call consist_train_simulation_batch
  • consist_train_simulation_batch(&[TrainScheduleWithPhysicsConsist])
    • Check valkey cache
    • Call the pathfinding
    • Cal the simulation
    • Cache the response
    • Return the response

conn: &mut DbConnection,
valkey_client: Arc<ValkeyClient>,
core: Arc<CoreClient>,
train_schedules: &[TrainSchedule],
infra: &Infra,
electrical_profile_set_id: Option<i64>,
physics_consist_parameters: PhysicsConsistParameters,
Copy link
Contributor

Choose a reason for hiding this comment

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

This parameter must be set for each train schedule, not globaly.

The consist_train_simulation_batch should be the function that actually do the simulation.

Comment on lines 441 to 445
train_schedules: &[TrainSchedule],
rolling_stocks: HashMap<String, RollingStockModel>,
pathfinding_results: Vec<PathfindingResult>,
electrical_profile_set_id: Option<i64>,
physics_consist_parameters: Option<PhysicsConsistParameters>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
train_schedules: &[TrainSchedule],
rolling_stocks: HashMap<String, RollingStockModel>,
pathfinding_results: Vec<PathfindingResult>,
electrical_profile_set_id: Option<i64>,
physics_consist_parameters: Option<PhysicsConsistParameters>,
train_schedules: &[TrainSchedule],
pathfinding_results: Vec<PathfindingResult>,
electrical_profile_set_id: Option<i64>,

The get_train_batch_simulation should simply build the PhysicsConsistParameters from the rolling stock names then call the consist_train_simulation_batch

/// Compute in batch the simulation of a list of train schedule
///
/// Note: The order of the returned simulations is the same as the order of the train schedules.
pub async fn train_simulation_batch(
Copy link
Contributor

Choose a reason for hiding this comment

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

The train_simulation_batch should simply build the PhysicsConsistParameters from the rolling stock names then call the consist_train_simulation_batch

@Wadjetz Wadjetz force-pushed the ebe/editoast/stdcm/fix-train-simulation branch from 54c85fb to 6339879 Compare November 22, 2024 12:20
@github-actions github-actions bot added the area:editoast Work on Editoast Service label Nov 22, 2024
@Wadjetz Wadjetz force-pushed the ebe/editoast/stdcm/fix-train-simulation branch 2 times, most recently from e76a0cc to 463e084 Compare November 25, 2024 09:35
Signed-off-by: Egor Berezovskiy <egor@berezify.fr>
Signed-off-by: Egor Berezovskiy <egor@berezify.fr>
@Wadjetz Wadjetz force-pushed the ebe/editoast/stdcm/fix-train-simulation branch from 463e084 to 9fa4b7f Compare November 28, 2024 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:editoast Work on Editoast Service kind:bug Something isn't working module:stdcm Short-Term DCM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

stdcm: towed rolling stock parameters aren't used for preprocessing simulations
3 participants