Search code examples
opc-uaopenmodelica

How to interact with Openmodelica embedded opc-ua server


I have built and started an OPC UA embedded Openmodelica server with the BouncingBall model like so:

$ omc +s path/to/model
$ ./BouncingBall -embeddedServer=opc-ua -rt=1

Now I'm trying to interact with it using an OPCUA client. However, I don't understand how I'm supposed to interact with the server properly. As far as I know this is undocumented.

  1. The most promising approach seems to be to set enableStopTime to false and run to true. Then the simulation seems to run indefinitely and the values seem to make sense. It seems I'm only able to extract the values in real time however. While running, when I set run to false it seems that the server enters an erroneous state and it refuses to give any values back.

  2. If I restart the executable and instead set step to true nothing seems to change and after trying to set step to true a second time the server becomes unresponsive. The -rt=1 option doesn't seem to matter. Seems like it enters the same state as above (1).

  3. (After restart) If I leave enableStopTime to be true and set run to true the simulation runs to stop and then the server quits with message The simulation finished successfully. Maybe this is intended. Kind of seems odd. Would make sense to be able to restart the simulation or trigger it with new options.

What I would hope to be able to do: Start and stop simulation as well as rewind to a certain point to check the value at that point. It seems to me that the API "affords" this functionality and it could probably be provided by hackingly wrapping the executable and API. Are the above bugs or intended? What is the intended way to interact with an OPC UA server in these cases?

The OpenModelica compiler version is 1.16.0~1-g84b4a71


Solution

  • Please try the latest nightly build It includes the following commit.

    That might solve it. I believe things worked without subscriptions before, since I could never reproduce this without them.

    (By the way, do people go on our git commit feed and try to reproduce bugs fixed in the last 24 hours; we quite often get questions that were just recently fixed)