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®) .
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
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 syntax for some test functions (so you know you hit those externally, not the built-in JavaScript equivalents).