Skip to content

Commit bf8988b

Browse files
committed
[ModelicaSystemDoE] cleanup & extend & document dict key constants
* remove DICT_RESULT_FILENAME * add comment * add DICT_ID_STRUCTURE and DICT_ID_NON_STRUCTURE * rename param_simple => param_non_structure
1 parent 407f963 commit bf8988b

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

OMPython/ModelicaSystem.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,7 +1810,10 @@ def run_doe():
18101810
18111811
"""
18121812

1813-
DICT_RESULT_FILENAME: str = 'result filename'
1813+
# Dictionary keys used in simulation dict (see _sim_dict or get_doe()). These dict keys contain a space and, thus,
1814+
# cannot be used as OM variable identifiers. They are defined here as reference for any evaluation of the data.
1815+
DICT_ID_STRUCTURE: str = 'ID structure'
1816+
DICT_ID_NON_STRUCTURE: str = 'ID non-structure'
18141817
DICT_RESULT_AVAILABLE: str = 'result available'
18151818

18161819
def __init__(
@@ -1879,18 +1882,18 @@ def prepare(self) -> int:
18791882
"""
18801883

18811884
param_structure = {}
1882-
param_simple = {}
1885+
param_non_structure = {}
18831886
for param_name in self._parameters.keys():
18841887
changeable = self._mod.isParameterChangeable(name=param_name)
18851888
logger.info(f"Parameter {repr(param_name)} is changeable? {changeable}")
18861889

18871890
if changeable:
1888-
param_simple[param_name] = self._parameters[param_name]
1891+
param_non_structure[param_name] = self._parameters[param_name]
18891892
else:
18901893
param_structure[param_name] = self._parameters[param_name]
18911894

18921895
param_structure_combinations = list(itertools.product(*param_structure.values()))
1893-
param_simple_combinations = list(itertools.product(*param_simple.values()))
1896+
param_simple_combinations = list(itertools.product(*param_non_structure.values()))
18941897

18951898
self._sim_dict = {}
18961899
for idx_pc_structure, pc_structure in enumerate(param_structure_combinations):
@@ -1926,7 +1929,7 @@ def prepare(self) -> int:
19261929

19271930
for idx_pc_simple, pc_simple in enumerate(param_simple_combinations):
19281931
sim_param_simple = {}
1929-
for idx_simple, pk_simple in enumerate(param_simple.keys()):
1932+
for idx_simple, pk_simple in enumerate(param_non_structure.keys()):
19301933
sim_param_simple[pk_simple] = cast(Any, pc_simple[idx_simple])
19311934

19321935
resfilename = f"DOE_{idx_pc_structure:09d}_{idx_pc_simple:09d}.mat"
@@ -1937,11 +1940,11 @@ def prepare(self) -> int:
19371940

19381941
df_data = (
19391942
{
1940-
'ID structure': idx_pc_structure,
1943+
self.DICT_ID_STRUCTURE: idx_pc_structure,
19411944
}
19421945
| sim_param_structure
19431946
| {
1944-
'ID non-structure': idx_pc_simple,
1947+
self.DICT_ID_NON_STRUCTURE: idx_pc_simple,
19451948
}
19461949
| sim_param_simple
19471950
| {

0 commit comments

Comments
 (0)