palaestrai_mosaik.simulator package — palaestrAI Mosaik Interface documentation

# palaestrai_mosaik.simulator package

## Submodules

## palaestrai_mosaik.simulator.arlsync_sim module

This module contains the `ARLSyncSimulator`, which is used by the `MosaikEnvironment` for synchronization.

class `palaestrai_mosaik.simulator.arlsync_sim.` `ARLSyncSimulator`

  Bases: `mosaik_api.Simulator`

  A simulator for the synchronization of palaestrAI and mosaik.

  `sid`

    The simulator id for this simulator given by mosaik

    Type

      str

  `step_size`

    The step_size of this simulator

    Type

      int

  `models`

    A dictionary containing all models of this simulator. Currently, there is no reason why there should be more than one agent model.

    Type

      dict

  `create`(num, model, **model_params)

    Initialize the simulation model instance (entity)

    Parameters

      - num (int) – The number of models to create in one go.

      - model (str) – The model to create. Needs to be present in the META.

    Returns

      A list of the entities created during this call.

    Return type

      list

  `get_data`(outputs)

    Return requested outputs (if feasible).

    Since this simulator does not generate output for its own, an empty dict is returned.

    Parameters

      outputs (dict) – Requested outputs.

    Returns

      An empty dictionary, since no output is generated.

    Return type

      dict

  `init`(sid, **sim_params)

    Initialize this simulator.

    Called exactly ones after the simulator has been started.

    Parameters

      sid (str) – Simulator id provided by mosaik.

    Returns

      The meta description for this simulator as dict.

    Return type

      dict

  `step`(time, inputs)

    Perform a simulation step.

    Parameters

      - time (int) – The current simulation time (the current step).

      - inputs (dict) – A dict with inputs for the models.

    Returns

      The simulation time at which this simulator should perform its next step.

    Return type

      int

## palaestrai_mosaik.simulator.exceptions module

This module contains exceptions.

exception `palaestrai_mosaik.simulator.exceptions.` `ShutdownError`

  Bases: `Exception`

  This error is raised to kill mosaik on purpose.

  Mosaik will not see the error raising and simply crash (in the same way mosaik is killed with a keyboard interrupt).

  No responsibility is taken for any damage on unfinished simulators waiting for their next step.

  Such a sadness!

## Module contents