Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To connect odysseus and mosaik, the odysseus query has to run first and after that the simulation in mosaik can be started.

Options

...

In the mosaik documentation a tutorial can be found which describes the connection between mosaik and odysseus.

Options

  • cleanStrings If set to true, all underscores (_) in attribute names are replaced by hyphen (-), so that they can be used in expressions.

Example

PQL

Code Block
titleMosaikProtocolHandler
linenumberstrue
mosaik = ACCESS({TRANSPORT = 'TCPServer', 
                PROTOCOL='Mosaik',
                SOURCE = 'Mosaik', 
                DATAHANDLER = 'KeyValueObject', 
                WRAPPER = 'GenericPush',
                OPTIONS =[
                    ['port', '5555'],                    
					['mosaikPort', '5554'],
                    ['byteorder', 'LITTLE_ENDIAN']
                ]})

///short version:
mosaikInput = MOSAIK({source = 'MosaikReceiver',
                   type = 'simapi'})
///                type = 'zeromq'})

...

Code Block
languagepy
titleMosaik SimulatorInitialising mosaik simulator
linenumberstrue
sim_config = {’Odysseus’: 
	{’connect’: ’127.0.0.1:5554’ } 
}

odysseusModel = world.start(’Odysseus’, step_size=60*15)
odysseus = odysseusModel.Odysseus.create(1)

To receive data components have to be connected to the simulator in the mosaik scenario definition.

In the mosaik-demo this could be:

Code Block
languagepy
titleConnecting mosaik simulator
linenumberstrue
connect_many_to_one(world, nodes, odysseus[0], 'P', 'Vm')
connect_many_to_one(world, houses, odysseus[0], 'P_out')
connect_many_to_one(world, pvs, odysseus[0], 'P')

More details can be found in the mosaik documentation.