fix(core): extract start values from dae attributes, pass experiment … · modelscript/modelscript@2dba007 · GitHub
Skip to content

Commit 2dba007

Browse files
committed
fix(core): extract start values from dae attributes, pass experiment annotations to fmu xml
1 parent 94319ea commit 2dba007

3 files changed

Lines changed: 28 additions & 12 deletions

File tree

‎packages/cli/src/commands/export-fmu.ts‎

Lines changed: 12 additions & 6 deletions

‎packages/core/src/compiler/modelica/fmi.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,13 @@ function mapVariable(v: ModelicaVariable, valueRef: number): FmiScalarVariable {
207207
};
208208
if (v.description) sv.description = v.description;
209209

210-
// Extract start value from the binding expression (if it's a literal)
211-
if (v.expression) {
210+
// Extract start value: first check the 'start' attribute, then the binding expression
211+
const startAttr = v.attributes.get("start");
212+
if (startAttr) {
213+
const startVal = extractNumericLiteral(startAttr);
214+
if (startVal !== null) sv.start = startVal;
215+
}
216+
if (sv.start === undefined && v.expression) {
212217
const startVal = extractNumericLiteral(v.expression);
213218
if (startVal !== null) sv.start = startVal;
214219
}

‎packages/core/src/compiler/modelica/fmu-codegen.ts‎

Lines changed: 9 additions & 4 deletions

0 commit comments

Comments
 (0)