def init_models(self, use_ukf, use_fmu_mpc, use_fmu_emu): print("Initialising models") #self.emu = systems.RealFromCSV(self.meas_file,self.meas_vars,self. meas_varmap, tz_name = self.weather.tz_name) if use_fmu_emu == 0: print( "%%%%%%%%%%%%%%%%% Compiling new FMUs for emulation %%%%%%%%%%%%%%%%" ) self.emu = systems.EmulationFromFMU( self.meas_vars_emu, moinfo=self.moinfo_emu, weather_data=self.weather.data, control_data=self.control.data, other_inputs=self.other_input.data, tz_name=self.weather.tz_name) else: print( "%%%%%%%%%%%%%% Using existing FMUs for emulation %%%%%%%%%%%%%%%%%%%%%%%" ) print("Emulation FMU: " + str(self.fmupath_emu)) self.emu = systems.EmulationFromFMU( self.meas_vars_emu, fmupath=self.fmupath_emu, weather_data=self.weather.data, control_data=self.control.data, other_inputs=self.other_input.data, tz_name=self.weather.tz_name)
def init_refmodel(self, use_fmu, use_const, const_path): print("%%%---Initialising Reference Simulation---%%%") # Define control profile for reference self.control_ref = exodata.ControlFromCSV(self.control_file, self.contr_varmap, tz_name=self.weather.tz_name) index = pd.date_range(self.sim_start, self.sim_end, freq=str(self.meas_sampl_ref) + 'S') if use_const == 1: t_set = load_namespace( os.path.join(const_path, 'constraints_' + self.building) ).data['TAir']['Slack_GTE'].get_base_data() + 1.0 else: t_set = pd.Series(20 + 273.15, index=index) for i in index: if i.hour >= 6 and i.hour <= 9: t_set[i] = 20 + 273.15 if i.hour >= 17 and i.hour <= 23: t_set[i] = 20 + 273.15 # Define control data self.control_ref.data = { "SetPoint": variables.Timeseries('SetPoint', t_set, units.K, tz_name=self.weather.tz_name) } if use_fmu == 0: self.emuref = systems.EmulationFromFMU( self.meas_vars_ref, moinfo=self.moinfo_emu_ref, weather_data=self.weather.data, control_data=self.control_ref.data, other_inputs=self.other_input.data, tz_name=self.weather.tz_name) else: self.emuref = systems.EmulationFromFMU( self.meas_vars_ref, fmupath=self.fmupath_ref, weather_data=self.weather.data, control_data=self.control_ref.data, other_inputs=self.other_input.data, tz_name=self.weather.tz_name)
def init_models(self, use_ukf, use_fmu_mpc, use_fmu_emu): print("Initialising models") #self.emu = systems.RealFromCSV(self.meas_file,self.meas_vars,self. meas_varmap, tz_name = self.weather.tz_name) if use_fmu_emu == 0: print( "%%%%%%%%%%%%%%%%% Compiling new FMUs for emulation %%%%%%%%%%%%%%%%" ) self.emu = systems.EmulationFromFMU( self.meas_vars, moinfo=self.moinfo_emu, weather_data=self.weather.data, control_data=self.control.data, other_inputs=self.other_input.data, tz_name=self.weather.tz_name) else: print( "%%%%%%%%%%%%%% Using existing FMUs for emulation %%%%%%%%%%%%%%%%%%%%%%%" ) print("Emulation FMU: " + str(self.fmupath_emu)) self.emu = systems.EmulationFromFMU( self.meas_vars, fmupath=self.fmupath_emu, weather_data=self.weather.data, control_data=self.control.data, other_inputs=self.other_input.data, tz_name=self.weather.tz_name) #self.emu.collect_measurements(self.sim_start, self.sim_end) if use_ukf == 1: if use_fmu_mpc == 1: print( "%%%%%%%%%%%%%% Using existing MPC FMUs %%%%%%%%%%%%%%%%%%%%%%%" ) print("MPC FMU: " + str(self.fmupath_mpc)) self.mpc = models.Modelica(models.UKF, models.RMSE, self.emu.measurements, fmupath=self.fmupath_mpc, parameter_data=self.parameters.data, weather_data=self.weather.data, control_data=self.control.data, other_inputs=self.other_input.data, tz_name=self.weather.tz_name, version='1.0') self.mpc.moinfo = self.moinfo_mpc else: print("%%%%%%%%%%%%%%%%% Compiling new FMUs %%%%%%%%%%%%%%%%") self.mpc = models.Modelica(models.UKF, models.RMSE, self.emu.measurements, moinfo=self.moinfo_mpc, parameter_data=self.parameters.data, weather_data=self.weather.data, control_data=self.control.data, other_inputs=self.other_input.data, tz_name=self.weather.tz_name, version='1.0') else: if use_fmu_mpc == 1: print( "%%%%%%%%%%%%%% Using existing MPC FMUs %%%%%%%%%%%%%%%%%%%%%%%" ) print("MPC FMU: " + str(self.fmupath_mpc)) self.mpc = models.Modelica( models.JModelica, models.RMSE, self.emu.measurements, fmupath=self.fmupath_mpc, parameter_data=self.parameters.data, weather_data=self.weather.data, control_data=self.control.data, other_inputs=self.other_input.data, tz_name=self.weather.tz_name, ) self.mpc.moinfo = self.moinfo_mpc else: print( "%%%%%%%%%%%%%%%%% Compiling new MPC FMUs %%%%%%%%%%%%%%%%" ) self.mpc = models.Modelica(models.JModelica, models.RMSE, self.emu.measurements, moinfo=self.moinfo_mpc, parameter_data=self.parameters.data, weather_data=self.weather.data, control_data=self.control.data, other_inputs=self.other_input.data, tz_name=self.weather.tz_name)