synchronous mode in ZeroMQ
synchronous mode in ZeroMQ
Hello! ZeroMQ remote API is very convenient, but I don't know how to config synchronous mode in ZeroMQ with python, Can you give me a demo? And I want to set timestep "dt" in my code.
Re: synchronous mode in ZeroMQ
Hello,
here a demo in stepped (or synchronous) mode:
Cheers
here a demo in stepped (or synchronous) mode:
Code: Select all
import time
from zmqRemoteApi import RemoteAPIClient
print('Program started')
client = RemoteAPIClient()
sim = client.getObject('sim')
# Run a simulation in stepping mode:
client.setStepping(True)
sim.startSimulation()
while (t := sim.getSimulationTime()) < 3:
s = f'Simulation time: {t:.2f} [s] (simulation running synchronously '\
'to client, i.e. stepped)'
print(s)
sim.addLog(sim.verbosity_scriptinfos, s)
client.step() # triggers next simulation step
sim.stopSimulation()
print('Program ended')