Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

eFMI Algorithm Code Export (GALEC)

Rumoca can project a compiled model into eFMI Algorithm Code — the GALEC (Guarded Algorithmic Language for Embedded Control) .alg representation — and package it as a schema-valid eFMU container.

The three targets

All three GALEC targets consume the dae IR and accept fixed-sample discrete models only — models with no continuous states and no der().

TargetOutputeFMI container?
galeceFMI Algorithm Code eFMU: AlgorithmCode/Model.alg + manifest.xml, plus __content.xml and schemas/Yes
galec-productioneFMI Production Code eFMU: adds ProductionCode/ C99 + LogicalData manifest, co-emits the AlgorithmCode/ representationYes
embedded-c-galecGALEC-derived embedded C (.h + .c): block-state struct with startup/recalibrate/dostepNo — not an eFMI container

The eFMI container? column describes the CLI packaging step. The GUI’s Generate Code (below) renders the inspectable .alg/.h/.c sources for any target but does not itself build the container.

Exporting from the CLI

rumoca compile Model.mo --target galec -o out/
rumoca compile Model.mo --target galec-production -o out/
rumoca compile Model.mo --target embedded-c-galec -o out/

The galec and galec-production targets write the eFMU container in two forms — a directory and the equivalent .efmu zip:

out/
  Model/                eFMU container, directory form
    __content.xml
    schemas/
    AlgorithmCode/      Model.alg + manifest.xml
    ProductionCode/     galec-production only: Model.c/.h + manifest.xml
  Model.efmu            eFMU container, zip form (same content)

The embedded-c-galec target instead writes plain out/Model.h and out/Model.c — no manifest and no container.

Code generation in the GUI

The scenario config editor (the VS Code custom editor and its web build) exposes a Code Generation task. Pick a GALEC target from the codegen target dropdown (galec, galec-production, or embedded-c-galec), choose an output location, and select Generate Code.

The GUI renders the inspectable GALEC sources in stages: first the .alg Algorithm Code text, then generated C header/source from the current .alg editor contents. This browser render is identity-free — it does not mint the eFMU container (the __content.xml registry, per-representation manifest.xml, and checksum web). For galec/galec-production, those container artifacts are produced by the CLI packaging step (rumoca compile … --target galec-production). Use the GUI to inspect and edit the target-language code, and use the CLI when you need the full eFMU package.

Try GALEC Production Code in the guide

The example below is a fixed-sample discrete counter, which is the subset the current GALEC projection accepts. Select Generate .alg to project the Modelica source into GALEC Algorithm Code. The .alg artifact opens in the same Monaco editor surface as the Modelica input, with GALEC syntax highlighting and the GALEC language service diagnostics/hover/definition hooks active. Then select Generate C/H in the .alg panel to generate C header and source from the current GALEC editor text.

// rumoca-live-scenario: ../repo-examples/codegen/rumoca-scenario.galec_counter_production.toml

Native run:

cargo run -p rumoca -- \
  compile examples/models/GalecCounter.mo \
  --model GalecCounter \
  --target galec-production \
  --output examples/codegen/gen/galec_counter_production

See also

  • Targets and Templates — the full target list and the live rumoca targets readiness table.
  • The authoritative contract for what each target emits and which conformance rung it claims is SPEC_0034; this page does not restate its rules.