def test_log_file_name(self): model = load_fmu("bouncingBall.fmu",os.path.join(path_to_fmus,"CS1.0")) assert os.path.exists("bouncingBall_log.txt") model = load_fmu("bouncingBall.fmu",os.path.join(path_to_fmus,"CS1.0"),log_file_name="Test_log.txt") assert os.path.exists("Test_log.txt") model = FMUModelCS1("bouncingBall.fmu",os.path.join(path_to_fmus,"CS1.0")) assert os.path.exists("bouncingBall_log.txt") model = FMUModelCS1("bouncingBall.fmu",os.path.join(path_to_fmus,"CS1.0"),log_file_name="Test_log.txt") assert os.path.exists("Test_log.txt")
def test_log_file_name(self): model = FMUModelCS1("bouncingBall.fmu", os.path.join(file_path, "files", "FMUs", "XML", "CS1.0"), _connect_dll=False) assert os.path.exists("bouncingBall_log.txt") model = FMUModelCS1("bouncingBall.fmu", os.path.join(file_path, "files", "FMUs", "XML", "CS1.0"), _connect_dll=False, log_file_name="Test_log.txt") assert os.path.exists("Test_log.txt")
def __init__(self, states_vref, *args, **kwargs): FMUModelCS1.__init__(self, *args, **kwargs) self.variables = self.get_model_variables(include_alias=False) self.states_vref = states_vref self.values = {} for var in self.variables: try: start = self.get_variable_start(var) except FMUException: start = 0.0 self.values[self.variables[var].value_reference] = start
def test_loading_xml_cs1(self): model = FMUModelCS1("CoupledClutches.fmu", os.path.join(file_path, "files", "FMUs", "XML", "CS1.0"), _connect_dll=False) assert model.get_name() == "CoupledClutches", model.get_name()
def test_result_name_file(self): #rlc_name = compile_fmu("RLC_Circuit",os.path.join(path_to_mofiles,"RLC_Circuit.mo"),target="cs") rlc = FMUModelCS1("RLC_Circuit.fmu") res = rlc.simulate() #Default name assert res.result_file == "RLC_Circuit_result.txt" assert os.path.exists(res.result_file) rlc = FMUModelCS1("RLC_Circuit.fmu") res = rlc.simulate( options={"result_file_name": "RLC_Circuit_result_test.txt"}) #User defined name assert res.result_file == "RLC_Circuit_result_test.txt" assert os.path.exists(res.result_file)
def test_default_experiment(self): model = FMUModelCS1("CoupledClutches.fmu", os.path.join(file_path, "files", "FMUs", "XML", "CS1.0"), _connect_dll=False) assert np.abs(model.get_default_experiment_start_time()) < 1e-4 assert np.abs(model.get_default_experiment_stop_time() - 1.5) < 1e-4 assert np.abs(model.get_default_experiment_tolerance() - 0.0001) < 1e-4