From 36a00787bff1558ea99c311afe4cd93e4c5d0a9e Mon Sep 17 00:00:00 2001 From: syntron Date: Mon, 23 Jun 2025 21:27:58 +0200 Subject: [PATCH 1/3] [ModelicaSystem] simplify definition of optimizeOptions --- OMPython/ModelicaSystem.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/OMPython/ModelicaSystem.py b/OMPython/ModelicaSystem.py index ae480dde..80c19490 100644 --- a/OMPython/ModelicaSystem.py +++ b/OMPython/ModelicaSystem.py @@ -361,8 +361,7 @@ def __init__( self._override_variables: dict[str, str] = {} self._simulate_options_override: dict[str, str] = {} self._linearization_options = {'startTime': 0.0, 'stopTime': 1.0, 'stepSize': 0.002, 'tolerance': 1e-8} - self._optimization_options = {'startTime': 0.0, 'stopTime': 1.0, 'numberOfIntervals': 500, 'stepSize': 0.002, - 'tolerance': 1e-8} + self._optimization_options = self._linearization_options | {'numberOfIntervals': 500} self._linearized_inputs: list[str] = [] # linearization input list self._linearized_outputs: list[str] = [] # linearization output list self._linearized_states: list[str] = [] # linearization states list From 3632429db8f57a9847333486060c14578687b401 Mon Sep 17 00:00:00 2001 From: syntron Date: Mon, 23 Jun 2025 09:09:10 +0200 Subject: [PATCH 2/3] [ModelicaSystem] add ',' for last element of list definitions --- OMPython/ModelicaSystem.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OMPython/ModelicaSystem.py b/OMPython/ModelicaSystem.py index 80c19490..0a2c93ca 100644 --- a/OMPython/ModelicaSystem.py +++ b/OMPython/ModelicaSystem.py @@ -1401,7 +1401,7 @@ def _createCSVData(self, csvfile: Optional[pathlib.Path] = None) -> pathlib.Path interpolated_inputs[signal_name] = np.interp( all_times, signal[:, 0], # times - signal[:, 1] # values + signal[:, 1], # values ) # Write CSV file @@ -1413,7 +1413,7 @@ def _createCSVData(self, csvfile: Optional[pathlib.Path] = None) -> pathlib.Path row = [ t, # time *(interpolated_inputs[name][i] for name in input_names), # input values - 0 # trailing 'end' column + 0, # trailing 'end' column ] csv_rows.append(row) From 1d8e9926ddde992d4769e337ad5a026c8f96959a Mon Sep 17 00:00:00 2001 From: syntron Date: Thu, 7 Aug 2025 21:48:35 +0200 Subject: [PATCH 3/3] [ModelicaSystem] cleanup check for result file --- OMPython/ModelicaSystem.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OMPython/ModelicaSystem.py b/OMPython/ModelicaSystem.py index 0a2c93ca..aea44108 100644 --- a/OMPython/ModelicaSystem.py +++ b/OMPython/ModelicaSystem.py @@ -1082,9 +1082,9 @@ def getSolutions(self, varList: Optional[str | list[str]] = None, resultfile: Op else: result_file = pathlib.Path(resultfile) - # check for result file exits + # check if the result file exits if not result_file.is_file(): - raise ModelicaSystemError(f"Result file does not exist {result_file}") + raise ModelicaSystemError(f"Result file does not exist {result_file.as_posix()}") # get absolute path result_file = result_file.absolute()