File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1141,6 +1141,28 @@ def simulate(
11411141
11421142 self ._simulated = True
11431143
1144+ def plot (
1145+ self ,
1146+ plotdata : str ,
1147+ resultfile : Optional [str ] = None ,
1148+ ) -> None :
1149+ """
1150+ Plot via OMC.
1151+ """
1152+
1153+ if resultfile is None :
1154+ # default result file generated by OM
1155+ plot_result_file = self .getWorkDirectory () / f"{ self ._model_name } _res.mat"
1156+ elif os .path .exists (resultfile ):
1157+ plot_result_file = pathlib .Path (resultfile )
1158+ else :
1159+ ModelicaSystemError ("No resultfile available - either run simulate() before plotting "
1160+ "or provide a result file!" )
1161+
1162+ expr = f'plot({ plotdata } , fileName="{ plot_result_file .as_posix ()} ")'
1163+
1164+ self .sendExpression (expr = expr )
1165+
11441166 def getSolutions (
11451167 self ,
11461168 varList : Optional [str | list [str ]] = None ,
You can’t perform that action at this time.
0 commit comments