mosaik.simulator — Coordinate and execute simulators — mosaik 2.0a2 documentation

# `mosaik.simulator` — Coordinate and execute simulators

This module is responsible for performing the simulation of a scenario.

`mosaik.simulator.` `run`(world, until)

  Run the simulation for a `World` until the simulation time until has been reached.

  Return the final simulation time.

`mosaik.simulator.` `sim_process`(world, sim, until)

  SimPy simulation process for a certain simulator sim.

`mosaik.simulator.` `step_required`(world, sim)

  Return an `Event` that is triggered when sim needs to perform its next step.

  The event will already be triggered if the simulator is a “sink” (no other simulator depends on its outputs) or if another simulator is already waiting for it.

  world is a mosaik `World`.

`mosaik.simulator.` `wait_for_dependencies`(world, sim)

  Return an event (`simpy.events.AllOf`) that is triggered when all dependencies can provide input data for sim.

  Also notify any simulator that is already waiting to perform its next step.

  world is a mosaik `World`.

`mosaik.simulator.` `get_input_data`(world, sim)

  Return a dictionary with the input data for sim.

  The dict will look like:

      {
          'eid': {
              'attrname': [val_0, ..., val_n],
              ...
          },
          ...
      }

  For every entity, there is an entry in the dict and each entry is itself a dict with attributes and a list of values. This is, because we may have inputs from multiple simulators (e.g., different consumers that provide loads for a node in a power grid) and cannot know how to aggreate that data (sum, max, ...?).

  world is a mosaik `World`.

`mosaik.simulator.` `step`(world, sim, inputs)

  Advance (step) a simulator sim with the given inputs. Return an event that is triggered when the step was performed.

  inputs is a dictionary, that maps entity IDs to data dictionaries which map attribute names to lists of values (see `get_input_data()`).

`mosaik.simulator.` `get_outputs`(world, sim)

  Get all required output data from a simulator sim, notify all simulators that are waiting for that data and prune the data flow cache. Return an event that is triggered when all output data is received.

  world is a mosaik `World`.

`mosaik.simulator.` `get_progress`(sims, until)

  Return the current progress of the simulation in percent.