Skip to main content

Python implementation of the mosaik API.

Project description

Mosaik API for Python

Note that the mosaik-api package has been superceded by the mosaik-api-v3 package and is not updated anymore.

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.6 - 2024-07-08

  • [CHANGE] Move deprecation warning up (so it is shown even when packages are missing)

3.0.5 - 2024-06-26

  • [CHANGE] Adjust stacklevel of deprecation warning

3.0.4 - 2024-06-26

  • [CHANGE] Add deprecation warning referring users to mosaik-api-v3.

3.0.3 - 2022-12-14

  • [NEW] Add datetime utility

3.0.2 - 2022-06-01

  • [CHANGE] Use internal mosaik-simpy-io>=0.2.4 instead of simpy.io

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.

The author of the mosaik API version 3 is Thomas Raub.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mosaik-api-3.0.6.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

mosaik_api-3.0.6-py2.py3-none-any.whl (22.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file mosaik-api-3.0.6.tar.gz.

File metadata

  • Download URL: mosaik-api-3.0.6.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.13.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.66.4 CPython/3.8.10

File hashes

Hashes for mosaik-api-3.0.6.tar.gz
Algorithm Hash digest
SHA256 c4d1dd273068cf58e0b212d9c2d9cd6283cd93b27618d70e45b531e3c570ea86
MD5 cd284b65e450e8efbf551f085993bbf3
BLAKE2b-256 26b6b2f1410d52747994be679b3ce9a54a601d71f66d65f8ea54fffc0a3d13a3

See more details on using hashes here.

File details

Details for the file mosaik_api-3.0.6-py2.py3-none-any.whl.

File metadata

  • Download URL: mosaik_api-3.0.6-py2.py3-none-any.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.13.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.66.4 CPython/3.8.10

File hashes

Hashes for mosaik_api-3.0.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 697a6f802a18843ac82842eb6b6741d0709e6cd378a5d3e109cb1f9ace7e8868
MD5 fc70437b2446bbbe5367f745c22d0975
BLAKE2b-256 93e4eab41a6285f349c84c9b87606701fd493fff64e63dbf9154d2736c69b99c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page