HOWTO use Mathematica v12.3.1.0 as an external maths engine for SysML Parametrics (ConstraintBlocks) in Magic Model Analyst (Cameo Simulation Toolkit) version 2021x or 2021xR1

Icon class
icon_class
far fa-sticky-note
icon_class_computed
far fa-sticky-note
Note kind
UML keywords
SysMLv1.x keywords
Webel IT Australia promotes the amazing Mathematica tool and the powerful Wolfram Language and offers professional Mathematica services for computational computing and data analysis. Our Mathematica tips, issue tracking, and wishlist is offered here most constructively to help improve the tool and language and support the Mathematica user community.
DISCLAIMER: Wolfram Research does not officially endorse analysis by Webel IT Australia.
Keywords
Click on the image to view it full size

The Built-In maths and other languages available for Constraints in Magic Model Analyst® (Cameo Simulation Toolkit®) can handle quite a lot, but they can't do as much as the amazing Wolfram Mathematica, and they can only solve for a LHS variable, not implicit equations.

Mathematica since at least v12.3.1.0 uses JLink, so to get it work as an external maths engine for SysML Parametrics in Magic Model Analyst® (Cameo Simulation Toolkit®) you have to use a JDK version that recognises JLink, such as OpenJDK-11.0.2, which is known to work for the Catia MAGIC v2021x or v2021xR1 components required for Magic Model Analyst® (Cameo Simulation Toolkit®) .

Lower JDK versions will not see JLink and will silently fail to see Mathematica as an external maths engine!
Some higher or lower JDK versions may not run some other CATIA Magic component versions!

You'll need multiple setup steps, but they are easy. The following is known to work on mac OS Big Sur and Mojave (you may need to adapt a little to other platforms):

Step1: Install at least OpenJDK-11.0.2 (OS specific, on a Mac just copy unzipped folder to /Library/Java/JavaVirtualMachines/).

Step2: Under the main MagicDraw or Cameo host app install folder under bin edit magicdraw.properties (or hostappname.properties) and set the JAVA_HOME (which will also tell it where it can find the runtime):


JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home

Step3: Run your host app (MagicDraw or Cameo) and in a SysML Project, under Project Options (not Environment Options) set the Default Parametric Evaluator to 'Mathematica'. (You can actually set the language on a per Constraint basis, but this is a good way to check that the host app is seeing Mathematica properly.)

On Mac this is under: Options > Project > General > Simulation > Default Parametric Evaluator

If you can't see 'Mathematica' offered as an option try restarting your host app
Make sure once you've applied both your Project Options and JAVA_HOME settings that you restart MagicDraw/Cameo twice!!

You "should" now be able to run a usage of a ConstraintBlock with a Constraint that has Mathematica as the language. The first time it runs, you may see a little popup that reports its starting a connection to the external maths engine.

It is strongly recommended that you try a very simple constraint equation first, and use the LHS as the default target variable, before trying anything fancy like implicit equations or causality settings.


a = Exp[b] + Sin[c]

It's a good idea to use Mathematica spellings for some test functions (so you know you hit those externally, not the built-in JavaScript equivalents).


Thanks to CATIA Magic support for help diagnosing this problem for these specific versions!
Relates to
Related notes
Related notes (backlinks)
Related snippets (extracts)
Visit also
Visit also (backlinks)
External links