Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions OMPython/ModelicaSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,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
Expand Down Expand Up @@ -1094,9 +1093,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()
Expand Down Expand Up @@ -1413,7 +1412,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
Expand All @@ -1425,7 +1424,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)

Expand Down
Loading