Initializing MATLAB Engine from Batch Mode

Moderator: Moderators

Initializing MATLAB Engine from Batch Mode

Postby cpadilla@tamu.edu » Fri Feb 15, 2019 10:45 am

Hello, I've created a CommandLine plugin using the Java Open API, and I am trying to run a simulation on an "instance specification" element that uses MATLAB to execute. I've ensured MATLAB is integrated and running, and the simulation runs fine when I manually run it from normal startup using the GUI.

I'm using
Code: Select all
SimulationSession mySim = SimulationManager.execute(run1, true, true);
to attempt to execute simulation on the element.

The following is from my log file during batch mode. It looks as though it recognizes it needs MATLAB, and the Engine is trying to start but fails. Is there a way for me to initialize the Math Engine in batch mode using the Java API?

2019-02-15 10:29:22,142 [main] INFO GENERAL - engine.jar url resource file:/C:/Program%20Files/MATLAB/R2018b/extern/engines/java/jar/engine.jar .
2019-02-15 10:29:22,144 [main] ERROR GENERAL - com.nomagic.magicdraw.simulation.matlab.japi.MatlabJAPIEngine
2019-02-15 10:29:22,315 [main] ERROR GENERAL -
java.lang.NullPointerException
at com.nomagic.magicdraw.simulation.solvers.EvaluationHelper.initScriptEngine(EvaluationHelper.java:2236)
at com.nomagic.magicdraw.simulation.utils.i.a(i.java:2989)
at com.nomagic.magicdraw.simulation.utils.i.a(i.java:2745)
at com.nomagic.magicdraw.simulation.SimulationManager.execute(SimulationManager.java:88)
at automationplugin.AutomationPluginAction.execute(AutomationPluginAction.java:127)


When running the simulation manually using the GUI I don't get an error:
2019-02-15 10:40:39,276 [SIM-Thread-2] INFO GENERAL - engine.jar url resource file:/C:/Program%20Files/MATLAB/R2018b/extern/engines/java/jar/engine.jar .
2019-02-15 10:40:58,298 [pool-MagicDraw-thread-3:DiagramPresentationElement.loadContents] INFO com.nomagic.magicdraw.uml.symbols.DiagramPersistenceHelper - Load diagram Simulation::Simulation::Mission Performance::Mission::Mission started.
2019-02-15 10:40:58,437 [AWT-EventQueue-0] INFO GENERAL - Action RUN execution time: 0.19
cpadilla@tamu.edu
Forum Newbie
Forum Newbie
 
Posts: 6
Posts Rating:0
Joined: Tue Feb 12, 2019 3:00 pm

Return to Cameo Simulation Toolkits

Who is online

Users browsing this forum: No registered users and 0 guests