Page 1 of 1

Matlab Integration breaks Simulation execution

PostPosted: Thu Aug 18, 2022 3:57 am
by frank.leuenberger@airbus.com
After integration Matlab into Cameo Systems Modeler 19.0SP4 the simulation toolkit stops working. I can choose Matlab in the simulation console, but nothing will be executed. It's also not possible anymore to execute any activity or state machine diagram, regardless if it contains matlab specific code or not. Starting a simulation just does nothing and no session shows up in the session window. After removing Matlab integrtion the simuation toolkit works without issue again. I have tried several solutions from other posts regarding this topic, but none of them worked.
I'm running Windows 10 Enterprise 20H2

below you can find more detailed description of my environment:

Windows Path variable

Code: Select all
%MD_MATLAB_MATHENGINE%;C:\Program Files\AdoptOpenJDK\jdk-8.0.212.04-hotspot\bin;C:\ProgramData\Oracle\Java\javapath;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%SYSTEMROOT%\System32\OpenSSH\;C:\Program Files\MATLAB\R2020b\runtime\win64;C:\Program Files\MATLAB\R2020b\bin;C:\Program Files\MATLAB\R2020b\bin\win64;%USERPROFILE%\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;


Environment Variable

Code: Select all
MD_MATLAB_MATHENGINE=C:\Program Files\MATLAB\R2020b\runtime\win64;C:\Program Files\MATLAB\R2020b\bin;C:\Program Files\MATLAB\R2020b\bin\win64


Java version

Code: Select all
C:\>java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.212-b04, mixed mode)

C:\Program Files\Cameo Systems Modeler\jre\bin>java -version
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)


Matlab command line

Code: Select all
>> version

ans =

    '9.9.0.1467703 (R2020b)'
   
>> comserver('query')
             User: 'C:\Program Files\MATLAB\R2020b\bin\win64\matlab.exe'
    Administrator: 'C:\Program Files\MATLAB\R2020b\bin\win64\MATLAB.exe'


Cameo csm.log

Code: Select all
[...]
2022-08-17 16:53:02,064 [main] INFO  PLUGINS - found engine: JSR 223 JRuby Engine 1.7.26 language: ruby jruby 1.7.26 [rb]
2022-08-17 16:53:02,065 [main] INFO  PLUGINS - found engine: Oracle Nashorn 1.8.0_202 language: ECMAScript ECMA - 262 Edition 5.1 [js]
2022-08-17 16:53:02,065 [main] INFO  PLUGINS - found engine: Built-in Math  language: Built-in Math  []
2022-08-17 16:53:02,066 [main] INFO  PLUGINS - found engine: JavaScript Rhino 1.6R7 language: JavaScript Rhino 1.6 [js]
2022-08-17 16:53:02,066 [main] INFO  PLUGINS - found engine: Matlab 17.0.5 language: Matlab 17.0.5 []
2022-08-17 16:53:02,066 [main] INFO  PLUGINS - found engine: BeanShell Engine 2.1.7 language: BeanShell 2.1.7 [bsh]
2022-08-17 16:53:02,245 [main] INFO  PLUGINS - found engine: Groovy Scripting Engine 2.0 language: Groovy 2.4.15 [groovy]
2022-08-17 16:53:02,246 [main] INFO  PLUGINS - found engine: jython 2.5.3 language: python 2.5 [py]
2022-08-17 16:53:02,262 [main] INFO  PLUGINS - Plugin started: Automaton
2022-08-17 16:53:02,263 [main] INFO  PLUGINS - Plugin started: JPython interpreter
2022-08-17 16:53:02,300 [main] INFO  PLUGINS - Plugin started: Parametrics Engine
2022-08-17 16:53:02,304 [main] INFO  PLUGINS - Plugin started: Robustness diagram tools
2022-08-17 16:53:02,313 [main] INFO  PLUGINS - Plugin started: SCXML Engine
2022-08-17 16:53:02,315 [main] INFO  PLUGINS - Plugin started: Software Engineering Portal
2022-08-17 16:53:02,315 [main] INFO  GENERAL - PATH = C:\Program Files\MATLAB\R2020b\bin\win64;C:\Program Files\Simcenter\2019.2\Amesim;C:\Program Files\Simcenter\2019.2\Amesim\win64;C:\Program Files\Simcenter\2019.2\Amesim\win32;C:\Program Files\Simcenter\2019.2\Amesim\sys\mingw32\bin;C:\Program Files\Simcenter\2019.2\Amesim\sys\python\win64;C:\Program Files\Simcenter\2019.2\System Architect\win64;C:\ProgramData\Anaconda3;C:\ProgramData\Anaconda3\Library\mingw-w64\bin;C:\ProgramData\Anaconda3\Library\usr\bin;C:\ProgramData\Anaconda3\Library\bin;C:\ProgramData\Anaconda3\Scripts;C:\Program Files\AdoptOpenJDK\jdk-8.0.212.04-hotspot\bin;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Sennheiser\SenncomSDK\;C:\PROGRA~2\IMAGEM~1\TIMESI~1;C:\Program Files (x86)\OpenText\Viewer\bin;C:\Program Files\MATLAB\R2020b\runtime\win64;C:\Program Files\MATLAB\R2020b\bin;C:\Program Files\MATLAB\R2020b\bin\win64;C:\Users\tha2lf\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Users\tha2lf\AppData\Local\Microsoft\WindowsApps;C:\ProgramData\Anaconda3\Library\bin\graphviz;;C:\Users\tha2lf\AppData\Local\Programs\Microsoft VS Code\bin
2022-08-17 16:53:02,317 [main] INFO  GENERAL - com.nomagic.jmatengine.jni.NativeEngine load file = C:\Program Files\Cameo Systems Modeler\plugins;\com.nomagic.magicdraw.simulation.matlab\lib\jmatengine_x64.dll
2022-08-17 16:53:02,317 [main] INFO  GENERAL - Checking path variable ...
2022-08-17 16:53:02,318 [main] INFO  GENERAL - MATLAB Home : C:\Program Files\MATLAB\R2020b\bin\win64
2022-08-17 16:53:02,319 [main] INFO  GENERAL - MATLAB Home : C:\Program Files\MATLAB\R2020b
2022-08-17 16:53:02,331 [main] INFO  PLUGINS - Plugin started: Matlab Engine
2022-08-17 16:53:02,340 [main] WARN  GUI - NO ICON FOR: group=options name=MBPLEEnvironmentOptionsGroup
2022-08-17 16:53:02,368 [main] INFO  PLUGINS - Plugin started: Product Line Engineering
2022-08-17 16:53:02,371 [main] INFO  PLUGINS - Plugin started: Bound element name creator
2022-08-17 16:53:02,398 [main] INFO  PLUGINS - Plugin started: Image Library
2022-08-17 16:53:02,398 [main] INFO  PLUGINS - Plugin started: Dialog Table
2022-08-17 16:53:02,400 [main] INFO  PLUGINS - Plugin started: CSV Import
2022-08-17 16:53:02,404 [main] INFO  PLUGINS - Plugin started: Up-Sell
2022-08-17 16:53:02,404 [main] INFO  PLUGINS - Plugin started: Information Flows Management
2022-08-17 16:53:02,417 [main] INFO  PLUGINS - Plugin started: Find in Diagram
2022-08-17 16:53:02,420 [main] INFO  PLUGINS - Plugin started: ECore Export
2022-08-17 16:53:02,441 [main] INFO  PLUGINS - Plugin started: Metrics
2022-08-17 16:53:02,452 [main] INFO  PLUGINS - Plugin started: Copy diagram as image to system clipboard
2022-08-17 16:53:03,148 [main] INFO  PLUGINS - Plugin started: SysML
2022-08-17 16:53:03,149 [main] INFO  PLUGINS - Plugin started: Abstract MagicDraw integrator with other applications
[...]
2022-08-17 16:53:46,343 [Thread-30] INFO  GENERAL - engine.jar url resource file:/C:/Program%20Files/MATLAB/R2020b/extern/engines/java/jar/engine.jar .
2022-08-17 16:53:46,344 [Thread-30] ERROR GENERAL - com.nomagic.magicdraw.simulation.matlab.japi.MatlabJAPIEngine
2022-08-17 16:54:25,084 [SIM-Thread-2] ERROR GENERAL - com.nomagic.magicdraw.simulation.matlab.japi.MatlabJAPIEngine

Re: Matlab Integration breaks Simulation execution

PostPosted: Tue Aug 30, 2022 11:21 am
by frank.leuenberger@airbus.com
Ok, I solved this now. The main issue was that the link in the cameo plugins folder
Code: Select all
plugins\com.nomagic.magicdraw.simulation.matlab\integration\windows\permissionJava.exe

was pointing to an invalid target. After changing it to
Code: Select all
C:\Program Files\Cameo Systems Modeler\jre\bin\java.exe

on my machine solved it. Aditionally I had to register Matlab manually by entering the command
Code: Select all
comserver("register","User","current")

at the Matlab prompt.