generalized_journey_time#

crowdedness#

crowdedness(load_factor: ndarray)#
linreg(values)#

gjt_model#

class GJTCalculator(network: Network, travel_time: UniformAttribute, passenger_flow: UniformAttribute, frequency: CSRAttribute, train_capacity: UniformAttribute, logger: Logger | None = None)#

Bases: object

Calculates the generalized journey time (GJT) for railway traffic demand. GJT is the perceived travel time for passengers that is composed of the in-train-time, the average waiting time and penalties for traveling in crowded trains and the fact that waiting time “counts more” than in-vehicle time. The formula for calculating GJT is as following

\[GJT = w \cdot TT + \frac{f}{2 \cdot freq}\]

where w is a crowdedness factor, TT is the in-vehicle travel time, f is a penalty factor for average waiting time and freq is the train frequency.

This class reads the passenger flow of every track segment, and for every OD-pair calculates:

  • The travel-time weighted average passenger flow based on the shortest path between O

    and D

  • The capacity of the OD route based on a general train frequency on the OD-route

  • The corresponding w of the OD-route

  • The travel time based on the shortest path calculation

  • factor f (possibly as a function of travel time)

  • GJT based on the above

average_passenger_flow()#
crowdedness()#
gjt()#
update_travel_time()#
class GJTModel(model_config: dict)#

Bases: TrackedModel

static get_schema_attributes() List[AttributeSpec]#
initialize(**_)#

The initialize method is called when all of the state’s INIT attribute arrays are filled with data. This may be during the model engines initialization phase or during t=0. Data that is required for the model to initialize attribute may be published in another model’s t0-update, and the TrackedModelAdapter can wait for this to happen before calling initialize. When the simulation progresses to t>0 before the model’s INIT attributes have been filled, an Exception is raised, indicating that the model was not ready yet.

Model.initialize may raise NotReady to indicate that it does not have its required input data yet. This is for example useful if a model has a number OPT`ional required attributes of which at least one must be set. The model would check whether this is the case, and raise `NotReady if it is not. Once a model has succesfully run its initialize method, this method will not be called again for the duration of the simulation.

Parameters:

state – The model’s TrackedState object, managed by the TrackedModelAdapter

setup(state: TrackedState, schema: AttributeSchema, logger: Logger, **_)#

In setup, a model receives a state object, it’s config and other parameters. The goal of setup is to prepare the state by giving it information of the attributes it needs to track (by subscribing (INIT/SUB/OPT) or publishing (PUB) attributes) from which datasets. These attributes may be grouped together in EntityGroup classes or created directly. The main entry points for registering are:

  • state.add_dataset() for registering a bunch of EntityGroup classes for a certain dataset name at once

  • state.add_entity_group() for registering a single EntityGroup class (or instance) for a dataset name

  • state.register_attribute() for registering a single attribute in a dataset/entity_group combination

During setup there is no data available in the state. These will be downloaded automatically by the TrackedModelAdapter. However, additional datasets may be requested directly through the init_data_handler parameter.

Parameters:
  • state – The model’s TrackedState object, managed by the TrackedModelAdapter

  • settings – global settings

  • schema – The AttributeSchema with all registered attributes

  • init_data_handler – an InitDataHandler that may be used to retrieve additional datasets

  • logger – a logging.Logger instance

update(**_) Moment | None#

The update method is called for every update coming from the model engine. However it is only called the first time once all PUB attributes have their arrays filled with data. When the simulation progresses to t>0 before the model’s SUB attributes have been filled, an Exception is raised, indicating that the model was not ready yet.

Parameters:
  • state – The model’s TrackedState object, managed by the TrackedModelAdapter

  • moment – The current simulation Moment

Returns:

an optional Moment indicating the next time a model want to be woken up, as per the model engine’s protocol

class GJTTrackSegmentEntity(name: str | None = None)#

Bases: TransportSegmentEntity

attributes: t.Dict[str, attribute.AttributeField] = {'_max_speed': <movici_simulation_core.core.attribute.AttributeField object>, 'capacity': <movici_simulation_core.core.attribute.AttributeField object>}#
capacity#
class GJTVirtualLinkEntity(name: str | None = None)#

Bases: VirtualLinkEntity

attributes: t.Dict[str, attribute.AttributeField] = {'capacity': <movici_simulation_core.core.attribute.AttributeField object>, 'max_speed': <movici_simulation_core.core.attribute.AttributeField object>}#
capacity#
max_speed#
class TrackDemandNodeEntity(name: str | None = None)#

Bases: PointEntity

attributes: t.Dict[str, attribute.AttributeField] = {'frequency': <movici_simulation_core.core.attribute.AttributeField object>, 'gjt': <movici_simulation_core.core.attribute.AttributeField object>, 'train_capacity': <movici_simulation_core.core.attribute.AttributeField object>}#
frequency#
gjt#
train_capacity#
convert_v1_v2(config)#

Module contents#

class GJTModel(model_config: dict)#

Bases: TrackedModel

static get_schema_attributes() List[AttributeSpec]#
initialize(**_)#

The initialize method is called when all of the state’s INIT attribute arrays are filled with data. This may be during the model engines initialization phase or during t=0. Data that is required for the model to initialize attribute may be published in another model’s t0-update, and the TrackedModelAdapter can wait for this to happen before calling initialize. When the simulation progresses to t>0 before the model’s INIT attributes have been filled, an Exception is raised, indicating that the model was not ready yet.

Model.initialize may raise NotReady to indicate that it does not have its required input data yet. This is for example useful if a model has a number OPT`ional required attributes of which at least one must be set. The model would check whether this is the case, and raise `NotReady if it is not. Once a model has succesfully run its initialize method, this method will not be called again for the duration of the simulation.

Parameters:

state – The model’s TrackedState object, managed by the TrackedModelAdapter

setup(state: TrackedState, schema: AttributeSchema, logger: Logger, **_)#

In setup, a model receives a state object, it’s config and other parameters. The goal of setup is to prepare the state by giving it information of the attributes it needs to track (by subscribing (INIT/SUB/OPT) or publishing (PUB) attributes) from which datasets. These attributes may be grouped together in EntityGroup classes or created directly. The main entry points for registering are:

  • state.add_dataset() for registering a bunch of EntityGroup classes for a certain dataset name at once

  • state.add_entity_group() for registering a single EntityGroup class (or instance) for a dataset name

  • state.register_attribute() for registering a single attribute in a dataset/entity_group combination

During setup there is no data available in the state. These will be downloaded automatically by the TrackedModelAdapter. However, additional datasets may be requested directly through the init_data_handler parameter.

Parameters:
  • state – The model’s TrackedState object, managed by the TrackedModelAdapter

  • settings – global settings

  • schema – The AttributeSchema with all registered attributes

  • init_data_handler – an InitDataHandler that may be used to retrieve additional datasets

  • logger – a logging.Logger instance

update(**_) Moment | None#

The update method is called for every update coming from the model engine. However it is only called the first time once all PUB attributes have their arrays filled with data. When the simulation progresses to t>0 before the model’s SUB attributes have been filled, an Exception is raised, indicating that the model was not ready yet.

Parameters:
  • state – The model’s TrackedState object, managed by the TrackedModelAdapter

  • moment – The current simulation Moment

Returns:

an optional Moment indicating the next time a model want to be woken up, as per the model engine’s protocol