Skip to content

Problem when publishing with RMQFMU 'from_cosim' #66

@sagilar

Description

@sagilar

The behavior when logging variables using RMQFMU seems not to properly publish the data on the RMQ broker.

It's expected that the data would come from the co-simulation, using the default exchange fmi_digital_twin with routing key data.from_cosim. However, when bound to this routing key, the co-sim only outputs one message:

Received [x] b'{"internal_status":"ready", "internal_message":"waiting for input data for simulation"}'

Trying with the other existing exchange available by default on the MD.xml file, fmi_digital_twin_sh, with the same routing key, the co-simulation only logs the simAtTime field, but not the other fields which were set as inputs:

...
Received [x] b'{"simAtTime":"2025-01-31T15:00:48.133+00:00"}'
Received [x] b'{"simAtTime":"2025-01-31T15:00:48.616+00:00"}'
Received [x] b'{"simAtTime":"2025-01-31T15:00:49.200+00:00"}'
Received [x] b'{"simAtTime":"2025-01-31T15:00:49.650+00:00"}'
Received [x] b'{"simAtTime":"2025-01-31T15:00:50.202+00:00"}'
...

From the log of co-simulation itself, I can see that the inputs are being properly updated from the co-simulation (refs 26, 27, 28, 29, 30, and 31, defined in the MD.xml file):

i:35
 [x] Sent {"time": "2025-01-31T16:01:03.066+01:00", "moveDiscreteCommand": false, "MovementArgs_target_X": 0, "MovementArgs_target_Y": 0, "MovementArgs_target_Z": 0, "closeGripperCommand": false, "openGripperCommand": false}
16:01:03.068 [Thread-48] INFO  org.intocps.maestro.interpreter.Interpreter - logOk OK rmqfmu Got data '2025-01-31 16:01:03.066', '{"time": "2025-01-31T16:01:03.066+01:00", "moveDiscreteCommand": false, "MovementArgs_target_X": 0, "MovementArgs_target_Y": 0, "MovementArgs_target_Z": 0, "closeGripperCommand": false, "openGripperCommand": false}', '1738335663067832205'
16:01:03.068 [Thread-1] INFO  org.intocps.maestro.interpreter.Interpreter - logAll OK rmqfmu Step reached target time 18500 [ms]
16:01:03.068 [Thread-1] INFO  org.intocps.maestro.interpreter.Interpreter - logAll OK rmqfmu ************ Exit 2 FmuContainer::step ***************
16:01:03.069 [Thread-1] INFO  org.intocps.maestro.interpreter.Interpreter - logAll OK rmqfmu fmi2GetInteger 'rmqfmu'
16:01:03.069 [Thread-1] INFO  org.intocps.maestro.interpreter.Interpreter - logAll OK rmqfmu fmi2GetBoolean 'rmqfmu'
16:01:03.071 [Thread-1] INFO  org.intocps.maestro.interpreter.Interpreter - logAll OK rmqfmu fmi2SetReal 'rmqfmu'
16:01:03.071 [Thread-1] INFO  org.intocps.maestro.interpreter.Interpreter - logAll OK rmqfmu Setting real ref 26 = -2.584727
16:01:03.071 [Thread-1] INFO  org.intocps.maestro.interpreter.Interpreter - logAll OK rmqfmu Setting real ref 27 = -1.343846
16:01:03.071 [Thread-1] INFO  org.intocps.maestro.interpreter.Interpreter - logAll OK rmqfmu Setting real ref 28 = 1.361651
16:01:03.071 [Thread-1] INFO  org.intocps.maestro.interpreter.Interpreter - logAll OK rmqfmu Setting real ref 29 = -2.077081
16:01:03.071 [Thread-1] INFO  org.intocps.maestro.interpreter.Interpreter - logAll OK rmqfmu Setting real ref 30 = -0.927128
16:01:03.071 [Thread-1] INFO  org.intocps.maestro.interpreter.Interpreter - logAll OK rmqfmu Setting real ref 31 = -0.849338
16:01:03.162 [Thread-1] INFO  org.intocps.maestro.interpreter.Interpreter - logAll OK rmqfmu fmi2DoStep 'rmqfmu'
16:01:03.162 [Thread-1] INFO  org.intocps.maestro.interpreter.Interpreter - logAll OK rmqfmu ************ Enter FmuContainer::step ***************
16:01:03.162 [Thread-1] INFO  org.intocps.maestro.interpreter.Interpreter - logAll OK rmqfmu Step time 19.000000 s converted time 19000.000000 ms
16:01:03.162 [Thread-1] INFO  org.intocps.maestro.interpreter.Interpreter - logAll OK rmqfmu Sending to rabbitmq: COSIM TIME: {"simAtTime":"2025-01-31T15:01:03.162+00:00"}
16:01:03.163 [Thread-1] INFO  org.intocps.maestro.interpreter.Interpreter - logAll OK rmqfmu Send enabled on this step, for message 

I attach the MD.xml file (as .txt) that was used for this test.

Additional information:
OS: Ubuntu 24.04
Maestro version: 3.0.1

modelDescription.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions