Loading AutoCSM/languages/modelica/create_fmu_dymola.py +3 −2 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ def insert_selected_solver(model_path, experimentSettings): else: print(f'The pattern "{end_pattern}" not found at the end of {model_path}. Solver not added.') def main(package_list, model_path, output_path, experimentSettings={}, showwindow=False): def main(package_list, model_path, output_path, experimentSettings={}, showwindow=False, includeVariables=None): # Add solver to model file insert_selected_solver(model_path, experimentSettings) Loading Loading @@ -95,7 +95,8 @@ def main(package_list, model_path, output_path, experimentSettings={}, showwindo dymola.translateModelFMU(modelToOpen=pathlib.Path(model_path).stem, fmiVersion = '2', fmiType='csSolver') fmiType='csSolver', includeVariables=includeVariables) log_file_path = os.path.join(output_path,'fmu_log.txt') dymola.savelog(log_file_path) Loading AutoCSM/languages/modelica/methods.py +6 −2 Original line number Diff line number Diff line Loading @@ -152,12 +152,16 @@ class ModelicaMethods(LanguageMethod): if compiler == 'dymola': # Extract parameters from kwargs showwindow = kwargs.pop('showwindow', False) includeVariables = kwargs.pop('includeVariables', None) if includeVariables == []: includeVariables = None create_fmu_dymola.main(dependencies, self.parent.model_path, pathlib.Path(self.parent.output_path).resolve(), experimentSettings, showwindow) showwindow, includeVariables) #TODO: Add new fmu compiler methods here except FileNotFoundError as e: raise RuntimeError(f"Dependency file not found: {e}") Loading examples/modelica/run_autocsm.py +2 −1 Original line number Diff line number Diff line Loading @@ -47,4 +47,5 @@ if __name__ == "__main__": csm.create_setup(dependencies, compiler='dymola') # Generate the FMU (i.e., Simulator.fmu) csm.create_fmu(dependencies, experimentSettings={'solver':'Sdirk34hw','tolerance':1e-5}) No newline at end of file # includeVariables is optional. Use this to specify the exact variables that are desired in FMU. All others will be concealed. csm.create_fmu(dependencies, experimentSettings={'solver':'Sdirk34hw','tolerance':1e-5}, includeVariables=None) No newline at end of file Loading
AutoCSM/languages/modelica/create_fmu_dymola.py +3 −2 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ def insert_selected_solver(model_path, experimentSettings): else: print(f'The pattern "{end_pattern}" not found at the end of {model_path}. Solver not added.') def main(package_list, model_path, output_path, experimentSettings={}, showwindow=False): def main(package_list, model_path, output_path, experimentSettings={}, showwindow=False, includeVariables=None): # Add solver to model file insert_selected_solver(model_path, experimentSettings) Loading Loading @@ -95,7 +95,8 @@ def main(package_list, model_path, output_path, experimentSettings={}, showwindo dymola.translateModelFMU(modelToOpen=pathlib.Path(model_path).stem, fmiVersion = '2', fmiType='csSolver') fmiType='csSolver', includeVariables=includeVariables) log_file_path = os.path.join(output_path,'fmu_log.txt') dymola.savelog(log_file_path) Loading
AutoCSM/languages/modelica/methods.py +6 −2 Original line number Diff line number Diff line Loading @@ -152,12 +152,16 @@ class ModelicaMethods(LanguageMethod): if compiler == 'dymola': # Extract parameters from kwargs showwindow = kwargs.pop('showwindow', False) includeVariables = kwargs.pop('includeVariables', None) if includeVariables == []: includeVariables = None create_fmu_dymola.main(dependencies, self.parent.model_path, pathlib.Path(self.parent.output_path).resolve(), experimentSettings, showwindow) showwindow, includeVariables) #TODO: Add new fmu compiler methods here except FileNotFoundError as e: raise RuntimeError(f"Dependency file not found: {e}") Loading
examples/modelica/run_autocsm.py +2 −1 Original line number Diff line number Diff line Loading @@ -47,4 +47,5 @@ if __name__ == "__main__": csm.create_setup(dependencies, compiler='dymola') # Generate the FMU (i.e., Simulator.fmu) csm.create_fmu(dependencies, experimentSettings={'solver':'Sdirk34hw','tolerance':1e-5}) No newline at end of file # includeVariables is optional. Use this to specify the exact variables that are desired in FMU. All others will be concealed. csm.create_fmu(dependencies, experimentSettings={'solver':'Sdirk34hw','tolerance':1e-5}, includeVariables=None) No newline at end of file