Skip to content

Commit

Permalink
schemas: fix towed rolling stock structure
Browse files Browse the repository at this point in the history
Signed-off-by: Jean SIMARD <woshilapin@tuziwo.info>
  • Loading branch information
woshilapin committed Oct 23, 2024
1 parent f7d17ed commit 8c03cbf
Showing 1 changed file with 16 additions and 42 deletions.
58 changes: 16 additions & 42 deletions python/osrd_schemas/osrd_schemas/rolling_stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,28 +202,26 @@ class RollingStock(BaseModel, extra="forbid"):
power_restrictions: Optional[PowerRestrictions] = Field(
description="Mapping from train's power restriction codes to power classes", default=None
)
length: PositiveFloat = Field(description="The length of the train, in m")
max_speed: PositiveFloat = Field(description="Maximum speed in m/s")
startup_time: float = Field(ge=0, description="The time the train takes before it can start accelerating in s")
startup_acceleration: float = Field(ge=0, description="The maximum acceleration during startup in m/s^2")
comfort_acceleration: PositiveFloat = Field(description="The maximum operational acceleration in m/s^2")
length: NonNegativeFloat = Field(description="The length of the train, in m")
max_speed: NonNegativeFloat = Field(description="Maximum speed in m/s")
startup_time: NonNegativeFloat = Field(description="The time the train takes before it can start accelerating in s")
startup_acceleration: NonNegativeFloat = Field(description="The maximum acceleration during startup in m/s^2")
comfort_acceleration: NonNegativeFloat = Field(description="The maximum operational acceleration in m/s^2")
gamma: Gamma = Field(description="The max or const braking coefficient in m/s^2")
inertia_coefficient: float = Field(gt=0)
mass: PositiveFloat = Field(description="The mass of the train, in kg")
inertia_coefficient: NonNegativeFloat = Field(description="The coefficient of inertia")
mass: NonNegativeFloat = Field(description="The mass of the train, in kg")
rolling_resistance: RollingResistance = Field(description="The formula to use to compute rolling resistance")
loading_gauge: LoadingGaugeType
metadata: Mapping[str, str] = Field(description="Properties used in the frontend to display the rolling stock")
energy_sources: List[EnergySource] = Field(default_factory=list)
electrical_power_startup_time: Optional[float] = Field(
electrical_power_startup_time: Optional[NonNegativeFloat] = Field(
description="The time the train takes before actually using electrical power (in s). "
+ "Is null if the train is not electric.",
default=None,
ge=0,
)
raise_pantograph_time: Optional[float] = Field(
raise_pantograph_time: Optional[NonNegativeFloat] = Field(
description="The time it takes to raise this train's pantograph in s. Is null if the train is not electric.",
default=None,
ge=0,
)
supported_signaling_systems: List[str] = Field(default_factory=list)

Expand All @@ -234,40 +232,16 @@ class TowedRollingStock(BaseModel, extra="forbid"):
all the traction properties.
"""

railjson_version: RAILJSON_ROLLING_STOCK_VERSION_TYPE = Field(default=RAILJSON_ROLLING_STOCK_VERSION)
name: str = Field(max_length=255)
railjson_version: RAILJSON_ROLLING_STOCK_VERSION_TYPE = Field(default=RAILJSON_ROLLING_STOCK_VERSION)
locked: bool = Field(default=False, description="Whether the rolling stock can be edited/deleted or not")
effort_curves: EffortCurves = Field(description="Curves mapping speed (in m/s) to maximum traction (in newtons)")
base_power_class: Optional[str] = Field(
description="The power usage class of the train (optional because it is specific to SNCF)", default=None
)
power_restrictions: Optional[PowerRestrictions] = Field(
description="Mapping from train's power restriction codes to power classes", default=None
)
length: PositiveFloat = Field(description="The length of the train, in m")
max_speed: PositiveFloat = Field(description="Maximum speed in m/s")
startup_time: float = Field(ge=0, description="The time the train takes before it can start accelerating in s")
startup_acceleration: float = Field(ge=0, description="The maximum acceleration during startup in m/s^2")
comfort_acceleration: PositiveFloat = Field(description="The maximum operational acceleration in m/s^2")
gamma: Gamma = Field(description="The max or const braking coefficient in m/s^2")
inertia_coefficient: float = Field(gt=0)
mass: PositiveFloat = Field(description="The mass of the train, in kg")
mass: NonNegativeFloat = Field(description="The mass of the train, in kg")
length: NonNegativeFloat = Field(description="The length of the train, in m")
comfort_acceleration: NonNegativeFloat = Field(description="The maximum operational acceleration in m/s^2")
startup_acceleration: NonNegativeFloat = Field(description="The maximum acceleration during startup in m/s^2")
inertia_coefficient: NonNegativeFloat = Field(description="The coefficient of inertia")
rolling_resistance: RollingResistance = Field(description="The formula to use to compute rolling resistance")
loading_gauge: LoadingGaugeType
metadata: Mapping[str, str] = Field(description="Properties used in the frontend to display the rolling stock")
energy_sources: List[EnergySource] = Field(default_factory=list)
electrical_power_startup_time: Optional[float] = Field(
description="The time the train takes before actually using electrical power (in s). "
+ "Is null if the train is not electric.",
default=None,
ge=0,
)
raise_pantograph_time: Optional[float] = Field(
description="The time it takes to raise this train's pantograph in s. Is null if the train is not electric.",
default=None,
ge=0,
)
supported_signaling_systems: List[str] = Field(default_factory=list)
gamma: Gamma = Field(description="The max or const braking coefficient in m/s^2")


if __name__ == "__main__":
Expand Down

0 comments on commit 8c03cbf

Please sign in to comment.