Skip to content

Commit f691dd9

Browse files
committed
refactor: process simulations to separate section
1 parent 2542fbe commit f691dd9

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

src/libecalc/presentation/yaml/yaml_types/components/yaml_asset.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from libecalc.presentation.yaml.yaml_types import YamlBase
66
from libecalc.presentation.yaml.yaml_types.components.yaml_installation import YamlInstallation
77
from libecalc.presentation.yaml.yaml_types.components.yaml_process_system import (
8+
YamlProcessSimulation,
89
YamlProcessSystem,
910
YamlProcessUnit,
1011
)
@@ -75,6 +76,11 @@ class YamlAsset(YamlBase):
7576
title="PROCESS_SYSTEMS",
7677
description="Defines process systems to use in process simulations.",
7778
)
79+
process_simulations: list[YamlProcessSimulation] = Field(
80+
default_factory=list,
81+
title="PROCESS_SIMULATIONS",
82+
description="Defines one or more process simulations to be run.",
83+
)
7884
installations: list[YamlInstallation] = Field(
7985
...,
8086
title="INSTALLATIONS",
@@ -118,10 +124,6 @@ def validate_unique_component_names(self, info: ValidationInfo):
118124
for venting_emitter in installation.venting_emitters or []:
119125
names.append(venting_emitter.name)
120126

121-
if installation.process_simulations is not None:
122-
if installation.process_simulations is not None:
123-
names.extend(installation.process_simulations.keys())
124-
125127
duplicated_names = get_duplicates(names)
126128

127129
if len(duplicated_names) > 0:
@@ -168,6 +170,13 @@ def validate_unique_references(self):
168170
if self.process_systems is not None:
169171
references.extend(self.process_systems.keys())
170172

173+
if self.process_units is not None:
174+
references.extend(self.process_units.keys())
175+
176+
if self.process_simulations is not None:
177+
for process_simulation in self.process_simulations:
178+
references.append(process_simulation.name)
179+
171180
if self.fluid_models is not None:
172181
references.extend(self.fluid_models.keys())
173182

src/libecalc/presentation/yaml/yaml_types/components/yaml_installation.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from libecalc.presentation.yaml.yaml_types.components.yaml_generator_set import (
1818
YamlGeneratorSet,
1919
)
20-
from libecalc.presentation.yaml.yaml_types.components.yaml_process_system import YamlProcessSimulation
2120
from libecalc.presentation.yaml.yaml_types.emitters.yaml_venting_emitter import (
2221
YamlVentingEmitter,
2322
)
@@ -75,11 +74,6 @@ class YamlInstallation(YamlBase):
7574
title="VENTING_EMITTERS",
7675
description="Covers the direct emissions on the installation that are not consuming energy",
7776
)
78-
process_simulations: list[YamlProcessSimulation] | None = Field(
79-
None,
80-
title="PROCESS_SIMULATIONS",
81-
description="Defines one or more process simulations to be run for the installation.",
82-
)
8377

8478
@model_validator(mode="after")
8579
def check_some_consumer_or_emitter(self):

0 commit comments

Comments
 (0)