model.schedule¶
Classes¶
This represents a stop time of a |
|
The type of a trip. Used in analysis to determine schedule efficiency. |
|
A trip is a single run of a bus on a |
|
A rotation is a sequence of trips that are performed by a bus in a single day. |
Functions¶
|
|
|
A Rotation needs to be contiguous in time and space |
Module Contents¶
- class model.schedule.StopTime¶
Bases:
eflips.model.BaseThis represents a stop time of a
Tripat aStation.A trip is not guaranteed to have any stop times, but it either has none (with only the arrival and departure times set) or every stop (including the first and last) has a stop time.
- __tablename__ = 'StopTime'¶
- id: sqlalchemy.orm.Mapped[int]¶
The unique identifier of the battery type. Auto-incremented.
- scenario_id: sqlalchemy.orm.Mapped[int]¶
The unique identifier of the scenario. Foreign key to
Scenario.id.
- scenario: sqlalchemy.orm.Mapped[eflips.model.Scenario]¶
The scenario.
- station_id: sqlalchemy.orm.Mapped[int]¶
The unique identifier of the station. Foreign key to
Station.id.
- station: sqlalchemy.orm.Mapped[eflips.model.Station]¶
The station.
- arrival_time: sqlalchemy.orm.Mapped[datetime.datetime]¶
The arrival time at the station.
- dwell_duration: sqlalchemy.orm.Mapped[datetime.timedelta]¶
The dwell time at the station. Defaults to 0 if unspecified.
- __table_args__¶
- __repr__()¶
- Return type:
str
- class model.schedule.TripType(*args, **kwds)¶
Bases:
enum.EnumThe type of a trip. Used in analysis to determine schedule efficiency.
- EMPTY¶
= deadheading, vehicle if repositioning itself for passenger trip
- PASSENGER¶
Passengers may board
- class model.schedule.Trip¶
Bases:
eflips.model.BaseA trip is a single run of a bus on a
Route. It is part of aRotation.- __tablename__ = 'Trip'¶
- id: sqlalchemy.orm.Mapped[int]¶
The unique identifier of the battery type. Auto-incremented.
- scenario_id: sqlalchemy.orm.Mapped[int]¶
The unique identifier of the scenario. Foreign key to
Scenario.id.
- scenario: sqlalchemy.orm.Mapped[eflips.model.Scenario]¶
The scenario.
- route_id: sqlalchemy.orm.Mapped[int]¶
The unique identifier of the route. Foreign key to
Route.id.
- route: sqlalchemy.orm.Mapped[eflips.model.Route]¶
The route.
- rotation_id: sqlalchemy.orm.Mapped[int]¶
The unique identifier of the rotation. Foreign key to
Rotation.id.
- departure_time: sqlalchemy.orm.Mapped[datetime.datetime]¶
The departure time at the first station.
This must be specified as full seconds, e.g. the “microseconds” part of the datetime must be 0. This is done because lots of later parts of the code assume that the departure time is a full second.
- arrival_time: sqlalchemy.orm.Mapped[datetime.datetime]¶
The arrival time at the last station.
This must be specified as full seconds, e.g. the “microseconds” part of the datetime must be 0. This is done because lots of later parts of the code assume that the departure time is a full second
- trip_type¶
The type of the trip. Either EMPTY or PASSENGER.
- loaded_mass¶
The level of load on the bus in kg.
- stations¶
The stations of the trip.
- events: sqlalchemy.orm.Mapped[List[eflips.model.Event]]¶
- __table_args__¶
- __repr__()¶
- Return type:
str
- model.schedule.check_trip_before_commit(_, __, target)¶
Check if the arrival or departure time is not a full second, warn the user if it is not.
2) Before a trip is flushed to the database, if it has stop times: - Ensure that the arrival time of the first stop time is the departure time of the trip - Ensure that the arrival time of the last stop time is the arrival time of the trip - Ensure that the first stop time is the first stop of the route - Ensure that the last stop time is the last stop of the route
- Parameters:
target (Trip) – a trip
_ (Any)
__ (Any)
- Returns:
Nothing. Raises an exception if something is wrong.
- Return type:
None
- class model.schedule.Rotation¶
Bases:
eflips.model.BaseA rotation is a sequence of trips that are performed by a bus in a single day.
- __tablename__ = 'Rotation'¶
- id: sqlalchemy.orm.Mapped[int]¶
The unique identifier of the battery type. Auto-incremented.
- scenario_id: sqlalchemy.orm.Mapped[int]¶
The unique identifier of the scenario. Foreign key to
Scenario.id.
- scenario: sqlalchemy.orm.Mapped[eflips.model.Scenario]¶
The scenario.
- vehicle_type_id: sqlalchemy.orm.Mapped[int]¶
The unique identifier of the vehicle type. Foreign key to
VehicleType.id.
- vehicle_type: sqlalchemy.orm.Mapped[eflips.model.VehicleType]¶
The vehicle type.
- vehicle_id: sqlalchemy.orm.Mapped[int]¶
The unique identifier of the vehicle. Foreign key to
Vehicle.id.
- vehicle: sqlalchemy.orm.Mapped[eflips.model.Vehicle]¶
- allow_opportunity_charging: sqlalchemy.orm.Mapped[bool]¶
Whether opportunity charging is permitted. To actually charge, the vehicle type must support opportunity charging.
- name: sqlalchemy.orm.Mapped[str]¶
The name of the rotation.
- __repr__()¶
- Return type:
str
- model.schedule.check_rotation_before_commit(_, __, target)¶
A Rotation needs to be contiguous in time and space - the end station of a trip must be the start station of the next trip - the departure time of a trip must be after the arrival time of the previous trip
- Parameters:
target (Rotation) – A Rotation object
_ (Any)
__ (Any)
- Returns:
Nothing. Raises an exception if something is wrong.
- Return type:
None