Implement a Modelica spawn connector for ETS (Energy Transfer System) that generates Modelica coupling files for one or more buildings based on system parameters.
What to implement:
A class SpawnConnectorETS that can be constructed with a SystemParameters object and can accept multiple Building objects via add_building(building).
On initialization, verify or enforce that the system parameters specify the spawn loading model, i.e., somewhere in system_parameters.param("buildings.custom")[0]["load_model"] should be "Spawn".
Ability to accumulate Building objects supplied by a GeoJSON translator (the tests iterate over translator.buildings and call add_building for each).
A to_modelica(scaffold) method that writes a Modelica file CouplingETS_SpawnBuilding.mo for each added building, placing it into a directory specific to that building within the scaffold’s loads path. The expected path pattern, as used by tests, is:
scaffold.loads_path.files_dir / <building_id> / CouplingETS_SpawnBuilding.mo
where <building_id> is the unique identifier for the building (as used by the test, e.g., B5a6b99ec37f4de7f94020090).
If a building directory does not exist, create it. If a CouplingETS_SpawnBuilding.mo file already exists, overwrite it (idempotent behavior).
The content of CouplingETS_SpawnBuilding.mo should be a valid, minimal Modelica model that can be consumed by the existing ModelicaRunner in tests. It does not need to be feature-complete, but must be syntactically valid and define a model named CouplingETS_SpawnBuilding (e.g., with a placeholder connector suitable for a spawn-based coupling).
Ensure compatibility with the existing scaffolding and path structure used by the tests, without requiring changes to the tests themselves.
Notes:
The implementation should live under app/ in the project structure and align with the existing module path for imports in tests:
geojson_modelica_translator.model_connectors.spawnBui_ETS_Coupling.SpawnConnectorETS
No external network or Modelica execution is required within the implementation; only file IO to generate the .mo files is necessary for the tests to proceed to the ModelicaRunner stage.