Skip to content

Commit

Permalink
stdcm: pr comments and refacto
Browse files Browse the repository at this point in the history
Signed-off-by: Egor Berezovskiy <[email protected]>
  • Loading branch information
Wadjetz committed Oct 30, 2024
1 parent 6cdc03e commit fbc6a8c
Show file tree
Hide file tree
Showing 25 changed files with 533 additions and 367 deletions.
1 change: 1 addition & 0 deletions editoast/editoast_schemas/src/rolling_stock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ pub struct RollingStock {
pub locked: bool,
pub effort_curves: EffortCurves,
pub base_power_class: Option<String>,
/// In m
pub length: f64,
pub max_speed: f64,
pub startup_time: f64,
Expand Down
10 changes: 2 additions & 8 deletions editoast/editoast_schemas/src/rolling_stock/gamma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@ editoast_common::schemas! {
#[derivative(Hash)]
pub struct Gamma {
#[serde(rename = "type")]
gamma_type: String,
pub gamma_type: String,
#[derivative(Hash(hash_with = "editoast_common::hash_float::<3,_>"))]
value: f64,
}

impl Gamma {
pub fn new(gamma_type: String, value: f64) -> Self {
Self { gamma_type, value }
}
pub value: f64,
}
17 changes: 3 additions & 14 deletions editoast/editoast_schemas/src/rolling_stock/rolling_resistance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,13 @@ editoast_common::schemas! {
pub struct RollingResistance {
#[serde(rename = "type")]
pub rolling_resistance_type: String,
/// kN
/// Solid friction in kN
#[derivative(Hash(hash_with = "editoast_common::hash_float::<5,_>"))]
pub A: f64,
/// kN/(km/h)
/// Viscosity friction in kN/(km/h)
#[derivative(Hash(hash_with = "editoast_common::hash_float::<5,_>"))]
pub B: f64,
/// kN/(km/h)²
/// Aerodynamic drag in kN/(km/h)²
#[derivative(Hash(hash_with = "editoast_common::hash_float::<5,_>"))]
pub C: f64,
}

impl RollingResistance {
pub fn new(rolling_resistance_type: String, a: f64, b: f64, c: f64) -> Self {
Self {
rolling_resistance_type,
A: a,
B: b,
C: c,
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ pub struct TowedRollingStock {
pub name: String,
pub label: String,
pub railjson_version: String,

/// In kg
pub mass: f64,
/// In m
pub length: f64,
/// In m/s²
pub comfort_acceleration: f64,
/// In m/s²
pub startup_acceleration: f64,
pub inertia_coefficient: f64,
pub rolling_resistance: RollingResistance,
Expand Down
34 changes: 11 additions & 23 deletions editoast/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2514,6 +2514,10 @@ paths:
type: integer
format: int64
nullable: true
loading_gauge_type:
allOf:
- $ref: '#/components/schemas/LoadingGaugeType'
nullable: true
margin:
type: string
description: Can be a percentage `X%`, a time in minutes per 100 kilometer `Xmin/100km`
Expand Down Expand Up @@ -4261,7 +4265,6 @@ components:
- $ref: '#/components/schemas/EditoastRollingStockErrorKeyNotFound'
- $ref: '#/components/schemas/EditoastRollingStockErrorLiveryMultipartError'
- $ref: '#/components/schemas/EditoastRollingStockErrorNameAlreadyUsed'
- $ref: '#/components/schemas/EditoastSTDCMErrorConsistEntryInvalid'
- $ref: '#/components/schemas/EditoastSTDCMErrorInfraNotFound'
- $ref: '#/components/schemas/EditoastSTDCMErrorInvalidPathItems'
- $ref: '#/components/schemas/EditoastSTDCMErrorRollingStockNotFound'
Expand Down Expand Up @@ -5162,25 +5165,6 @@ components:
type: string
enum:
- editoast:rollingstocks:NameAlreadyUsed
EditoastSTDCMErrorConsistEntryInvalid:
type: object
required:
- type
- status
- message
properties:
context:
type: object
message:
type: string
status:
type: integer
enum:
- 400
type:
type: string
enum:
- editoast:stdcm_v2:ConsistEntryInvalid
EditoastSTDCMErrorInfraNotFound:
type: object
required:
Expand Down Expand Up @@ -8301,15 +8285,15 @@ components:
A:
type: number
format: double
description: kN
description: Solid friction in kN
B:
type: number
format: double
description: kN/(km/h)
description: Viscosity friction in kN/(km/h)
C:
type: number
format: double
description: kN/(km/h)²
description: Aerodynamic drag in kN/(km/h)²
type:
type: string
additionalProperties: false
Expand Down Expand Up @@ -8789,6 +8773,10 @@ components:
type: integer
format: int64
nullable: true
loading_gauge_type:
allOf:
- $ref: '#/components/schemas/LoadingGaugeType'
nullable: true
margin:
type: string
description: Can be a percentage `X%`, a time in minutes per 100 kilometer `Xmin/100km`
Expand Down
Loading

0 comments on commit fbc6a8c

Please sign in to comment.