Run model

[65]

Before running a model, you should verify that the language and the engine able to run it are correctly installed in your eclipse. This is done using the --list-languages (-ll) option and the --list-engines (-le) options. (see Install language about how to install a language).

Then, in order to run a given model, you have to: - select a language that is able to run your model using the -l option - select an engine that is able to run this language using the -e option - optionally pass engine specific argument - optionally pass language argument

This is done by using the appropriate options as defined in Headless engine overview

Tip

You may omit -l and/or -e option if the default language/engine correspond to you need. This is usually the case if you have only one language installed.

1. Example: Install K3FSM language in GEMOC headless and run a sample model

As an example, in order to run a model from the official K3FSM example (see K3FSM Example), one possible way would be to follow these steps:

  • Prepare K3FSM languages jars and install them in the headless studio:

    • in a classic GEMOC Studio, get the K3FSM example (via the new example menu)
    • right click on the projects, export…​Plug-in DevelopmentDeployable plugins and fragments
    • select Archive file and browse to the dropins folder of your GemocStudioHeadless.

In the modeling workbench, Write or get some k3fsm model.

On the command line, from the GemocStudioHeadless folder:

$>./GemocStudioHeadless -e GEMOCKermetaSequentialEngine -l org.eclipse.gemoc.example.k3fsm.K3fsm -initMethod org.eclipse.gemoc.example.k3fsm.k3dsa.FSMAspect.initializeModel -mainMethod "public static void org.eclipse.gemoc.example.k3fsm.k3dsa.FSMAspect.main(org.eclipse.gemoc.example.k3fsm.FSM)" -modelEntryPoint \ -m $HOME/mysuperfsmmodels/TwoStatesUpcast.k3fsm — abababa

This will run the model TwoStatesUpcast.k3fsm and using the string "abababa" as parameter for the K3fsm language.

Tip

In order to get the correct parameters, especially for initMethod, mainMethod or modelEntryPoint of a given language you can create and save a launch configuration in the Modeling workbench. This is done in the tab common by setting a save as and a location. You can then open the .launch file which is actually an xml file.

Tip

GemocStudioHeadless is able to use model files from any location on your disk. However, it tries to link the file to its workspace. By default the workspace folder is located in the same folder as the GemocStudioHeadless executable.

If your model file is actually in a workspace (for example the workspace used by the classic GEMOC Studio), You can avoid to create the link to the file by telling to the GemocStudioHeadless where the workspace is by using the option -data <path to workspace>.

This might be useful if the model has some cross references to other files and use workspace relative references.