Book a Demo

Author Topic: Send output of simulation to serial port or another program  (Read 4277 times)

michielper

  • EA User
  • **
  • Posts: 176
  • Karma: +2/-1
    • View Profile
Send output of simulation to serial port or another program
« on: February 28, 2020, 07:53:56 pm »
Is it possible to send the output of a simulation (execution of state model or activity model or BPMN model etc.) to a serial port so that it can be used in another program on another computer?
Or, as an alternative, could the output of an execution be sent to another program on the same computer, perhaps via stdout/stdin or so?

My idea is to link Sparx EA to Blender 3D..... that should be fun!

Thanks for any suggestions!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Send output of simulation to serial port or another program
« Reply #1 on: March 04, 2020, 09:58:21 am »
Yes, it is possible. (In fact I once saw a demo where an EA simulation was driving an RC car)

You do this by creating a COM object from the simulation.
https://www.sparxsystems.com/enterprise_architect_user_guide/15.1/model_simulation/dynamic_simulation_with_javasc.html
Quote
One very important feature of the implementation of JavaScript in Enterprise Architect's simulator is that it supports the creation of COM objects. This provides the ability to connect the running Simulation with almost any other local or remote process and either influence the Simulation based on external data, or potentially change data or behavior in the external world based on the current Simulation state (for example, update a mechanical model or software simulation external to Enterprise Architect). The syntax for creating COM objects is shown here:

     this.name="Odd Even";
     var logger = new COMObject("MySim.Logger");
     logger.Show();
     logger.Log("Simulation started");

michielper

  • EA User
  • **
  • Posts: 176
  • Karma: +2/-1
    • View Profile
Re: Send output of simulation to serial port or another program
« Reply #2 on: March 04, 2020, 11:19:20 pm »
Very cool. I would like to see an example.....

Yes, it is possible. (In fact I once saw a demo where an EA simulation was driving an RC car)

You do this by creating a COM object from the simulation.
https://www.sparxsystems.com/enterprise_architect_user_guide/15.1/model_simulation/dynamic_simulation_with_javasc.html
Quote
One very important feature of the implementation of JavaScript in Enterprise Architect's simulator is that it supports the creation of COM objects. This provides the ability to connect the running Simulation with almost any other local or remote process and either influence the Simulation based on external data, or potentially change data or behavior in the external world based on the current Simulation state (for example, update a mechanical model or software simulation external to Enterprise Architect). The syntax for creating COM objects is shown here:

     this.name="Odd Even";
     var logger = new COMObject("MySim.Logger");
     logger.Show();
     logger.Log("Simulation started");