unit_conversions#
attributes#
entities#
- class FlowEntityGroup(name: str | None = None)#
Bases:
EntityGroup
- attributes: t.Dict[str, attribute.AttributeField] = {'cargo_flow': <movici_simulation_core.core.attribute.AttributeField object>, 'cargo_vehicle_flow': <movici_simulation_core.core.attribute.AttributeField object>, 'passenger_flow': <movici_simulation_core.core.attribute.AttributeField object>, 'passenger_vehicle_flow': <movici_simulation_core.core.attribute.AttributeField object>}#
- cargo_flow#
- cargo_vehicle_flow#
- passenger_flow#
- passenger_vehicle_flow#
- class ODEntityGroup(name: str | None = None)#
Bases:
EntityGroup
- attributes: t.Dict[str, attribute.AttributeField] = {'inward_cargo': <movici_simulation_core.core.attribute.AttributeField object>, 'inward_cargo_vehicle': <movici_simulation_core.core.attribute.AttributeField object>, 'inward_passenger': <movici_simulation_core.core.attribute.AttributeField object>, 'inward_passenger_vehicle': <movici_simulation_core.core.attribute.AttributeField object>, 'outward_cargo': <movici_simulation_core.core.attribute.AttributeField object>, 'outward_cargo_vehicle': <movici_simulation_core.core.attribute.AttributeField object>, 'outward_passenger': <movici_simulation_core.core.attribute.AttributeField object>, 'outward_passenger_vehicle': <movici_simulation_core.core.attribute.AttributeField object>}#
- inward_cargo#
- inward_cargo_vehicle#
- inward_passenger#
- inward_passenger_vehicle#
- outward_cargo#
- outward_cargo_vehicle#
- outward_passenger#
- outward_passenger_vehicle#
model#
- class Model(model_config: dict)#
Bases:
TrackedModel
Implementation of the unit conversions model. Reads a csv with coefficients. Turns values in _vehicles into tons or passengers.
Asgarpour, S., Konstantinos, K., Hartmann, A., and Neef, R. (2021). Modeling interdependent infrastructures under future scenarios. Work in Progress.
- flow_entities: List[FlowEntityGroup]#
- flow_types: List[str]#
- classmethod get_schema_attributes() Iterable[AttributeSpec] #
- initialize_coefficients(data_handler: InitDataHandler, name: str)#
- od_entities: List[ODEntityGroup]#
- od_types: List[str]#
- setup(state: TrackedState, init_data_handler: InitDataHandler, **_)#
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
- setup_flow_conversion(conversion: dict, state: TrackedState)#
- setup_od_conversion(conversion: dict, state: TrackedState)#
- update(state: TrackedState, moment: Moment)#
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
- convert_v1_v2(config)#