Skip to main content

Mosaik API for Python

This is an implementation of the mosaik API for simulators written in Python. It hides all the messaging and networking related stuff and provides a simple base class that you can implement.

Installation

Just use pip to install it:

$ pip install mosaik-api

Documentation

Please refer to mosaik’s documentation of the API.

Example Simulator

This distribution contains an example simulator in the example_sim package.

It can be started via the pyexamplesim command; pyexamplesim --help shows you how to use it.

It can also be run in-process by importing and calling example_sim.mosaik.main().

Example MAS

This distribution contains an example “multi-agent system” that uses the asyncronous remote calls to mosaik (get_progress(), get_related_entities(), get_data(), set_data()).

It can be started via the pyexamplemas command; pyexamplemas --help shows you how to use it.

It can also be run in-process by importing and calling example_mas.mosaik.main().

Development setup

To setup a devleopment environment, create a virtualenv and install the packages from requirements.txt:

$ mkvirtualenv --python=/usr/bin/python3 mosaik-api-python
(mosaik-api-python)$ pip install -r requirements.txt

To run the tests for the Python version you are currently using, execute py.test. You should also add the test coverage check:

(mosaik-api-python)$ py.test --cov=example_mas --cov=example_sim --cov=mosaik_api

To run the tests for all supported Python versions, run tox:

(mosaik-api-python)$ tox

Mosaik’s documentation contains more details.

Changelog

3.0.1 - 2022-04-22

  • [CHANGE] Set external events via highlevel function call

3.0.0 - 2021-05-02

  • [CHANGE] Added time_resolution to init function

  • [CHANGE] Added max_advance to step function

  • [NEW] Implemented set_events capability (external events)

2.4.2 - 2020-11-24

  • [FIX] Constrain simpy to version <4 due to simpy.io incompatibility

2.4 - 2019-02-05

  • [NEW] Simulator can now be started on a different node than mosaik, using the remote flag “-r” and the timeout flag “-t”. Mosaik can the integrate the simulator using the “connect” method of the simmanager.

2.3 – 2019-01-24

  • [BugFix] Bugfix Tests

2.2 – 2016-02-15

  • [NEW] API version 2.2: Added an optional “setup_done()” method.

  • [CHANGE] API version validation: The API version is no longer an integer but a “major.minor” string. The major part has to math with mosaiks major version. The minor part may be lower or equal to mosaik’s minor version.

  • [FIX] Various minor fixes and stability improvements.

2.1 – 2014-10-24

2.0 – 2014-09-22

  • Initial release of the mosaik 2 Sim API for Python.

Authors

The original concepts for the mosaik API were developed by Steffen Schütten and Stefan Scherfke.

The author of the mosaik API version 2 is Stefan Scherfke.

Additional contributors: André El-Ama, Okko Nannen, Thomas Raub, Jan Sören Schwarz, Cornelius Steinbrink

Metadata

Release files for mosaik-api 3.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mosaik-api 3.0.1
File Size Uploaded
mosaik-api-3.0.1.tar.gz 21.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mosaik-api 3.0.1
File Interpreter ABI Platform
mosaik_api-3.0.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 43.1 kB

Release files / mosaik-api-3.0.1.tar.gz

Download URL mosaik-api-3.0.1.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f80fa8a52cc237e21849b19e1147a0035bf0f417b70741efa2fb506111611945
BLAKE2b-256 checksum
How to use checksums
a5dfd561532e3f6fde77dbe636d2226c0af89643f4ab0d697fe42a773ee3c4e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.11.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.8.10

Release files / mosaik_api-3.0.1-py2.py3-none-any.whl

Download URL mosaik_api-3.0.1-py2.py3-none-any.whl
Size 21.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
6e90b9251c8a5f626044128ca60a20a32bdf63497277fe3f78d8cd0d416edf7f
BLAKE2b-256 checksum
How to use checksums
8dfecb43794d9979d45b96aabed46fbbf33f7a153d86e137189c4230d633403a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.11.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.8.10
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page