NatLabRockies / NatLabRockies/Spawn

Simulating multiple instances of the same FMU fails

Open
#65 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
19
Forks
10
PR merge metrics
No merged PRs in 30d

Description

I use a standalone FMU which is based on Spawn of EnergyPlus. Simulating the FMU with FMPy works fine. Since the simulation takes a long time and I want to compare different controllers, I want to use Python multiprocessing to do the simulations in parallel.

One instance is created and simulated, but the other fail with the following error message:

"remove_all: The process cannot access the file because it is being used by another process.: 
"C:/.../spawn-MultizoneModel_v2_final_closedDoors.flo\EnergyPlus""
[ERROR] Error: The following error was detected at time: 15552000
[ERROR] 15552000.000 MultizoneModel_v2_final_closedDoors.flo.building: Executing 
'""C:\Spawn-light-0.4.3-7048a72798-win64\bin/spawn-0.4.3-7048a72798.exe" energyplus create-fmu  
--output-path "C:/.../spawn-MultizoneModel_v2_final_closedDoors.flo/EnergyPlus.fmu" 
"C:/.../spawn-MultizoneModel_v2_final_closedDoors.flo/ModelicaBuildingsEnergyPlus.json""' 
failed to generate fmu 'C:/.../spawn-MultizoneModel_v2_final_closedDoors.flo/EnergyPlus.fmu'.
[ERROR] The stack of functions is:
[ERROR] Buildings.ThermalZones.EnergyPlus_9_6_0.BaseClasses.initialize
[ERROR] Buildings.ThermalZones.EnergyPlus_9_6_0.BaseClasses.initialize(
flo.wes.fmuZon.adapter, 
flo.building.isSynchronized)
[ERROR] 

Setting an instance name has no effect, as only the output folder spawn-MultizoneModel_v2_final_closedDoors.flo is created.
I already used FMUs created from EnergyPlusToFMU and they create their own output folder and multiprocessing works fine.

Also, I can't help with the exact settings used to create the FMU as I don't have a Dymola lincense.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with Python multiprocessing and the Spawn command shown in the error, especially the energyplus create-fmu step. Inspect how the shared output folder is created and cleaned during parallel FMU initialization. Done means multiple instances can initialize and simulate concurrently without remove_all file-access failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.