From 7f3f01660ed4725a26eba51b79fe0a60f371db42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sj=C3=B6lund?= Date: Thu, 5 Nov 2026 09:36:10 +0100 Subject: [PATCH] Let FMUs of Buildings find the Spawn executable A Buildings model with EnergyPlus looks for the Spawn executable next to modelica://Buildings/legal.html, then on SPAWNPATH and on PATH. In an FMU, legal.html is a copy in the FMU resources, and Spawn (110 MB) is not there. So all EnergyPlus models failed to initialize in the FMI jobs (about 130 rows in master-fmi-cs-cvode, and the same in wasm-jit-cs), with "Failed to find spawn executable". Set SPAWNPATH to the Spawn that install.py puts into the library, for Buildings 12, 13 and latest. The wasm-jit jobs simulate inside omc, which did not get environmentSimulation. Set it in omc with setEnvironmentVar. Assisted-by: Claude Opus 5.5 --- configs/conf.json | 3 +++ testmodel.py | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/configs/conf.json b/configs/conf.json index e77de82..95e8f9d 100644 --- a/configs/conf.json +++ b/configs/conf.json @@ -196,6 +196,7 @@ "Buildings.ThermalZones.EnergyPlus_24_2_0.Examples.SmallOffice.Guideline36Summer":420 }, "runOnceBeforeTesting":[["$resourceLocation/src/ThermalZones/install.py", "--binaries-for-os-only"]], + "environmentSimulation":[["SPAWNPATH", "$libraryLocation/Resources/bin/Spawn-light-0.6.0-9f1b36b00b/linux64/bin"]], "referenceFileExtension":"csv", "referenceFileNameDelimiter":"_", "referenceFiles":"/mnt/ReferenceFiles/Buildings/csv/maint_12.x", @@ -214,6 +215,7 @@ "Buildings.ThermalZones.EnergyPlus_24_2_0.Examples.SmallOffice.Guideline36Summer":420 }, "runOnceBeforeTesting":[["$resourceLocation/src/ThermalZones/install.py", "--binaries-for-os-only"]], + "environmentSimulation":[["SPAWNPATH", "$libraryLocation/Resources/bin/Spawn-light-0.6.0-9f1b36b00b/linux64/bin"]], "referenceFileExtension":"csv", "referenceFileNameDelimiter":"_", "referenceFiles":"/mnt/ReferenceFiles/Buildings/csv/maint_13.x", @@ -236,6 +238,7 @@ "Buildings.ThermalZones.EnergyPlus_24_2_0.Examples.SmallOffice.Guideline36Winter":600 }, "runOnceBeforeTesting":[["$resourceLocation/src/ThermalZones/install.py", "--binaries-for-os-only"]], + "environmentSimulation":[["SPAWNPATH", "$libraryLocation/Resources/bin/Spawn-light-0.6.0-9f1b36b00b/linux64/bin"]], "referenceFileExtension":"csv", "referenceFileNameDelimiter":"_", "referenceFiles":"/mnt/ReferenceFiles/Buildings/csv/master" diff --git a/testmodel.py b/testmodel.py index 785fe65..932fe41 100755 --- a/testmodel.py +++ b/testmodel.py @@ -644,6 +644,11 @@ def createOmcSessionNew(): for cmd in conf["customCommands"]: omc.sendExpression(str(cmd), parsed = False) +# wasm-jit simulates inside omc, so omc needs the simulation environment. +if isWasmJit: + for (name, value) in conf["environmentSimulation"]: + omc.sendExpression('setEnvironmentVar("%s", "%s")' % (name, value.replace("\\","/")), parsed = False) + if conf.get("optlevel"): cflags = omc.sendExpression("getCFlags()") cflags = cflags.replace("${MODELICAUSERCFLAGS}","").replace("-O0","").replace("-O1","").replace("-O2","").replace("-O3","").strip()