Skip to main content

Sends mosaik simulation data to ZeroMQ socket.

Project description

mosaik-zmq

This adapter was built to send mosaik simulation data to the data stream management system Odysseus. Odysseus allows to process and visualise the simulation results online during the simulation. More information can be found in the mosaik documentation.

But due to the use of ZeroMQ, which is a high-performance asynchronous messaging library, the mosaik-zmq adapter can also be used to process or store results of a simulation in any software supporting ZeroMQ sockets.

Installation

mosaik-zmq can be installed using pip:

$ pip install mosaik-zmq

mosaik-zmq uses the pyzmq module. If you get an error during installation, install the python 3 headers and python-zmq package (e.g., sudo apt-get install python3-dev python-zmq)

If installation is still not working you may need to install a C compiler (e.g. sudo apt-get install build-essential)

Usage

The mosaik-zmq adapter can be added to a simulation scenario like any other component. First you have to add the following code to the sim_config:

sim_config = {
   'ZMQ': {
      'cmd': 'mosaik-zmq %(addr)s',
   },
}

Initialization

When you start mosaik-zmq, you have to provide a step_size and a duration argument. The step_size defines how often data will be sent. The duration is the simulation end time in seconds.

Example:

zmqModel = world.start('ZMQ', step_size=15*60, duration=15*60*24*30)

Model instantiation

Every instance of mosaik-zmq allows you to create instances of its Socket model. The Socket has the following parameters:

  • host (default: ‘tcp://*:’) is the address of the host the data will be sent to.

  • port (default: 5558) is the port on which the host will receive data.

  • socket_type (default: ‘PUB’) is the type of the ZeroMQ socket to open for connection between the adapter and the host. Two different patterns can be used. The default is ‘PUB’, which stands for the publish subscribe pattern . Alternatively the push pull pattern (‘PUSH’) can be used.

Example code:

zmq = zmqModel.Socket(host='tcp://*:', port=5558, socket_type='PUB')

Connection

To get data sent to the host the zmq model has to be connected to an other model in the scenario definition. Based on the mosaik-demo the scenario could look like this:

pvsim = world.start('CSV', sim_start=START, datafile=PV_DATA)
pvs = pvsim.PV.create(20)

zmqModel = world.start('ZMQ', step_size=15*60, duration=15*60*24*30)
zmq = zmqModel.Socket(host='tcp://*:', port=5558, socket_type='PUB')

connect_many_to_one(world, pvs, zmq, 'P')

Getting help

If you need help, please visit the mosaik-users mailing list.

Changelog

0.1.1 – 2016-01-20

  • Updated documentation

0.1 – 2015-12-16

  • Initial release

Authors

The mosaik ZeroMQ connector was created by Jan Sören Schwarz.

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-zmq-0.1.1.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

mosaik_zmq-0.1.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file mosaik-zmq-0.1.1.tar.gz.

File metadata

  • Download URL: mosaik-zmq-0.1.1.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mosaik-zmq-0.1.1.tar.gz
Algorithm Hash digest
SHA256 55d07d40ac536fc46624b94e40f129deef160e483e6e2c58047ca63ff0515ef2
MD5 cb158045f5a439307e676978ed507459
BLAKE2b-256 0462803b81a08d2fffc2c1d5bd17e3ebc1cc08d154446257d2091dbf4a5bb5ac

See more details on using hashes here.

Provenance

File details

Details for the file mosaik_zmq-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mosaik_zmq-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4967f526fa456e0f78b3292594b66525b47911397c2a229fab773b75520f0640
MD5 fe678fca562b7ab54bdaba5435dcc498
BLAKE2b-256 044536a5284076f4380f861994e87351b28de9597589a9ebf85e2634a7a2d125

See more details on using hashes here.

Provenance

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