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
Metadata
Release files for mosaik-zmq 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mosaik-zmq-0.1.1.tar.gz | 12.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mosaik_zmq-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.2 kB
Release files / mosaik-zmq-0.1.1.tar.gz
| Download URL | mosaik-zmq-0.1.1.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
55d07d40ac536fc46624b94e40f129deef160e483e6e2c58047ca63ff0515ef2
|
|
BLAKE2b-256 checksum How to use checksums |
0462803b81a08d2fffc2c1d5bd17e3ebc1cc08d154446257d2091dbf4a5bb5ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / mosaik_zmq-0.1.1-py3-none-any.whl
| Download URL | mosaik_zmq-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4967f526fa456e0f78b3292594b66525b47911397c2a229fab773b75520f0640
|
|
BLAKE2b-256 checksum How to use checksums |
044536a5284076f4380f861994e87351b28de9597589a9ebf85e2634a7a2d125
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |