def get_DRinfo(self,start,end,**kwargs):
     self.price = exodata.PriceFromCSV(self.price_file,
                                     self.price_varmap,
                                     tz_name = self.weather.tz_name)
     self.flex_cost = exodata.PriceFromCSV(self.price_file,
                                     self.flex_cost_varmap,
                                     tz_name = self.weather.tz_name)
     self.rho = exodata.PriceFromCSV(self.price_file,
                                     self.rho_varmap,
                                     tz_name = self.weather.tz_name)
     self.ref_profile = exodata.ControlFromCSV(self.control_file,
                                     self.ref_profile_varmap,
                                     tz_name = self.weather.tz_name)
     self.addobj = exodata.ControlFromCSV(self.price_file,
                                     self.addobj_varmap,
                                     tz_name = self.weather.tz_name)
     index = pd.date_range(start, end, freq = str(self.meas_sampl)+'S')
     # Random control signal
     index = pd.date_range(start, end, freq = '1800S') #half-hourly price signal
     price_signal = pd.Series(np.random.rand(len(index))*40,index=index)
     
     for i in index:
         if i.hour >= 7 and i.hour <= 11:
             price_signal[i] = np.random.uniform(0.8,1)*60
         if i.hour >= 18 and i.hour <= 19:
             price_signal[i] = np.random.uniform(0.9,1)*90
         if i.hour >= 20 and i.hour <= 22:
             price_signal[i] = np.random.uniform(0.8,1)*60
     
     index = pd.date_range(start, end, freq = str(self.meas_sampl)+'S')
     flex_signal = pd.Series(0,index=index)
     k = pd.Series(1,index=index)
     ref_signal = pd.Series(0.3,index=index)
     rho_signal = pd.Series(1000,index=index)
     #ref_signal = load_namespace(self.ref_profile_file)[0]
     #print(type(ref_signal))
     
     self.price.data = {"pi_e": variables.Timeseries('pi_e', price_signal,units.cents_kWh,tz_name=self.weather.tz_name)
     }
     
     self.flex_cost.data = {"flex_cost": variables.Timeseries('flex_cost', flex_signal,units.cents_kWh,tz_name=self.weather.tz_name)
     }
     
     self.ref_profile.data = {"ref_profile": variables.Timeseries('ref_profile', ref_signal, units.W,tz_name=self.weather.tz_name)
     }
     
     self.rho.data = {"rho": variables.Timeseries('rho', rho_signal, units.unit1,tz_name=self.weather.tz_name)
     }
     
     self.addobj.data = {}
     
     for item in self.slack_var:
         self.addobj.data[item] = variables.Timeseries(item, pd.Series(0,index=index), units.unit1,tz_name=self.weather.tz_name)
         
     #print(self.addobj.data)
     
     store_namespace('price_'+self.building,self.price)
     store_namespace('flex_cost_'+self.building,self.flex_cost)
     store_namespace('ref_profile_'+self.building,self.ref_profile)
     store_namespace('rho_'+self.building,self.rho)
Пример #2
0
 def test_extra_control_data(self):
     '''Test the optimization of a model where there is extra control data.
     
     '''
     
     modelpath = 'Simple.RC';   
     # Gather inputs with extra data
     start_time_exo = '1/1/2017';
     final_time_exo = '1/10/2017';
     control_csv_filepath = os.path.join(self.get_unittest_path(), 'resources', 'model', 'SimpleRC_Input.csv');
     control_variable_map = {'q_flow_csv' : ('q_flow', units.W),
                             'extra_input' : ('not_input', units.W)};
     self.controls = exodata.ControlFromCSV(control_csv_filepath, control_variable_map);
     self.controls.collect_data(start_time_exo, final_time_exo);
     # Instantiate model
     model = models.Modelica(models.JModelica, \
                             models.RMSE, \
                             self.measurements, \
                             moinfo = (self.mopath, modelpath, {}), \
                             control_data = self.controls.data);
     # Instantiate optimization problem
     opt_problem = optimization.Optimization(model, \
                                             optimization.EnergyMin, \
                                             optimization.JModelica, \
                                             'q_flow', \
                                             constraint_data = self.constraints.data);                              
     # Solve optimization problem with default res_control_step                   
     opt_problem.optimize(self.start_time, self.final_time);
     # Check references
     df_test = opt_problem.display_measurements('Simulated');
     self.check_df(df_test, 'optimize_measurements.csv');
     df_test = model.control_data['q_flow'].display_data().to_frame();
     df_test.index.name = 'Time'
     self.check_df(df_test, 'optimize_control_default.csv');
Пример #3
0
 def setUp(self):
     self.start_time = '1/1/2017'
     self.final_time = '1/10/2017'
     # Set measurements
     self.measurements = {}
     self.measurements['T_db'] = {
         'Sample': variables.Static('T_db_sample', 1800, units.s)
     }
     # Set model paths
     mopath = os.path.join(self.get_unittest_path(), 'resources', 'model',
                           'Simple.mo')
     modelpath = 'Simple.RC_nostart'
     self.moinfo = (mopath, modelpath, {})
     # Gather parameters
     parameter_csv_filepath = os.path.join(self.get_unittest_path(),
                                           'resources', 'model',
                                           'SimpleRC_Parameters.csv')
     self.parameters = exodata.ParameterFromCSV(parameter_csv_filepath)
     self.parameters.collect_data()
     # Gather control inputs
     control_csv_filepath = os.path.join(self.get_unittest_path(),
                                         'resources', 'model',
                                         'SimpleRC_Input.csv')
     variable_map = {
         'q_flow_csv': ('q_flow', units.W)
     }
     self.controls = exodata.ControlFromCSV(control_csv_filepath,
                                            variable_map)
     self.controls.collect_data(self.start_time, self.final_time)
     # Instantiate system
     self.system = systems.EmulationFromFMU(self.measurements, \
                                            moinfo = self.moinfo, \
                                            control_data = self.controls.data)
     # Get measurements
     self.system.collect_measurements(self.start_time, self.final_time)
Пример #4
0
 def setUp(self):
     # Setup building
     self.building_source_file_path = os.path.join(self.get_unittest_path(), 'resources', 'building', \
                                                   'LBNL71T_Emulation_JModelica_v2.fmu');   
     self.zone_names = ['wes', 'hal', 'eas'];
     weather_path = os.path.join(self.get_unittest_path(), 'resources', 'weather', \
                                 'USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw');
     internal_path = os.path.join(self.get_unittest_path(), 'resources', 'internal', 'sampleCSV.csv');
     internal_variable_map = {'intRad_wes' : ('wes', 'intRad', units.W_m2), \
                              'intCon_wes' : ('wes', 'intCon', units.W_m2), \
                              'intLat_wes' : ('wes', 'intLat', units.W_m2), \
                              'intRad_hal' : ('hal', 'intRad', units.W_m2), \
                              'intCon_hal' : ('hal', 'intCon', units.W_m2), \
                              'intLat_hal' : ('hal', 'intLat', units.W_m2), \
                              'intRad_eas' : ('eas', 'intRad', units.W_m2), \
                              'intCon_eas' : ('eas', 'intCon', units.W_m2), \
                              'intLat_eas' : ('eas', 'intLat', units.W_m2)};        
     control_path = os.path.join(self.get_unittest_path(), 'resources', 'building', 'ControlCSV_0.csv');
     control_variable_map = {'conHeat_wes' : ('conHeat_wes', units.unit1), \
                                  'conHeat_hal' : ('conHeat_hal', units.unit1), \
                                  'conHeat_eas' : ('conHeat_eas', units.unit1)};        
     # Measurements
     self.measurements = {};
     self.measurements['wesTdb'] = {'Sample' : variables.Static('wesTdb_sample', 600, units.s)};
     self.measurements['halTdb'] = {'Sample' : variables.Static('halTdb_sample', 1200, units.s)};
     self.measurements['easTdb'] = {'Sample' : variables.Static('easTdb_sample', 1200, units.s)};           
     # Exodata
     self.weather = exodata.WeatherFromEPW(weather_path);
     self.internal = exodata.InternalFromCSV(internal_path, internal_variable_map, tz_name = self.weather.tz_name);
     self.control = exodata.ControlFromCSV(control_path, control_variable_map, tz_name = self.weather.tz_name);
     # Parameters
     self.parameter_data = {};
     self.parameter_data['lat'] = {};
     self.parameter_data['lat']['Value'] = self.weather.lat;
Пример #5
0
 def setUp(self):
     self.start_time = '1/1/2017'
     self.final_time = '1/2/2017'
     # Set .mo path
     self.mopath = os.path.join(utility.get_MPCPy_path(), 'resources',
                                'model', 'Simple.mo')
     # Gather inputs
     control_csv_filepath = utility.get_MPCPy_path(
     ) + os.sep + 'resources' + os.sep + 'model' + os.sep + 'SimpleRC_Input.csv'
     control_variable_map = {
         'q_flow_csv': ('q_flow', units.W)
     }
     self.controls = exodata.ControlFromCSV(control_csv_filepath,
                                            control_variable_map)
     self.controls.collect_data(self.start_time, self.final_time)
     # Set measurements
     self.measurements = {}
     self.measurements['T_db'] = {
         'Sample': variables.Static('T_db_sample', 1800, units.s)
     }
     self.measurements['q_flow'] = {
         'Sample': variables.Static('q_flow_sample', 1800, units.s)
     }
     # Gather constraints
     constraint_csv_filepath = utility.get_MPCPy_path(
     ) + os.sep + 'resources' + os.sep + 'optimization' + os.sep + 'SimpleRC_Constraints.csv'
     constraint_variable_map = {'q_flow_min' : ('q_flow', 'GTE', units.W), \
                                'T_db_min' : ('T_db', 'GTE', units.K), \
                                'T_db_max' : ('T_db', 'LTE', units.K)}
     self.constraints = exodata.ConstraintFromCSV(constraint_csv_filepath,
                                                  constraint_variable_map)
     self.constraints.collect_data(self.start_time, self.final_time)
     self.constraints.data['T_db']['Initial'] = variables.Static(
         'T_db_start', 295, units.K)
Пример #6
0
 def test_simulate(self):
     '''Test simulation of a model.'''
     # Set model paths
     mopath = os.path.join(self.MPCPyPath, 'resources', 'model',
                           'Simple.mo')
     modelpath = 'Simple.RC'
     # Gather control inputs
     control_csv_filepath = os.path.join(self.MPCPyPath, 'resources',
                                         'model', 'SimpleRC_Input.csv')
     variable_map = {
         'q_flow_csv': ('q_flow', units.W)
     }
     controls = exodata.ControlFromCSV(control_csv_filepath, variable_map)
     controls.collect_data(self.start_time, self.final_time)
     # Instantiate model
     self.model = models.Modelica(models.JModelica, \
                                  models.RMSE, \
                                  self.measurements, \
                                  moinfo = (mopath, modelpath, {}), \
                                  control_data = controls.data)
     # Simulate model
     self.model.simulate(self.start_time, self.final_time)
     # Check references
     df_test = self.model.display_measurements('Simulated')
     self.check_df_timeseries(df_test, 'simulate_display.csv')
     df_test = self.model.get_base_measurements('Simulated')
     self.check_df_timeseries(df_test, 'simulate_base.csv')
Пример #7
0
 def setUp(self):
     csv_filepath = os.path.join(self.get_unittest_path(), 'resources', 'building', 'ControlCSV_0.csv');
     variable_map = {'conHeat_wes' : ('conHeat_wes', units.unit1), \
                     'conHeat_hal' : ('conHeat_hal', units.unit1), \
                     'conHeat_eas' : ('conHeat_eas', units.unit1)};
     # Instantiate control object
     self.control = exodata.ControlFromCSV(csv_filepath, \
                                           variable_map);
Пример #8
0
def get_controlCSV(control_file, variable_map, start_time, final_time,
                   timezone):
    # function to gather control data from csv
    print("%%%%%%%%%%%%%%%----Getting control data from CSV---%%%%%%%%%%%%%")
    control = exodata.ControlFromCSV(control_file,
                                     variable_map,
                                     tz_name=timezone)

    return control.collect_data(start_time, final_time)
Пример #9
0
    def get_DRinfo(self, start, end, **kwargs):
        self.price = exodata.PriceFromCSV(self.price_file,
                                          self.price_varmap,
                                          tz_name=self.weather.tz_name)
        self.flex_cost = exodata.PriceFromCSV(self.price_file,
                                              self.flex_cost_varmap,
                                              tz_name=self.weather.tz_name)
        self.ref_profile = exodata.ControlFromCSV(self.control_file,
                                                  self.ref_profile_varmap,
                                                  tz_name=self.weather.tz_name)
        index = pd.date_range(start, end, freq=str(self.meas_sampl) + 'S')
        # Random control signal
        price_signal = pd.Series(np.random.rand(len(index)) * 40, index=index)
        flex_signal = pd.Series(0, index=index)
        k = pd.Series(1, index=index)
        ref_signal = pd.Series(25000, index=index)
        #ref_signal = load_namespace(self.ref_profile_file)[0]
        #print(type(ref_signal))
        for i in index:
            if i.hour >= 7 and i.hour <= 11:
                price_signal[i] = np.random.uniform(0.8, 1) * 60
            if i.hour >= 17 and i.hour <= 19:
                price_signal[i] = np.random.uniform(0.8, 1) * 90
            if i.hour >= 20 and i.hour <= 22:
                price_signal[i] = np.random.uniform(0.8, 1) * 60

        self.price.data = {
            "pi_e":
            variables.Timeseries('pi_e',
                                 price_signal,
                                 units.cents_kWh,
                                 tz_name=self.weather.tz_name)
        }
        self.flex_cost.data = {
            "flex_cost":
            variables.Timeseries('flex_cost',
                                 flex_signal,
                                 units.cents_kWh,
                                 tz_name=self.weather.tz_name)
        }
        self.ref_profile.data = {
            "ref_profile":
            variables.Timeseries('ref_profile',
                                 ref_signal,
                                 units.W,
                                 tz_name=self.weather.tz_name)
        }

        #pheat_max = pd.Series(10000,index=index)
        #self.control.collect_data(self.sim_start, self.sim_end)
        #print(self.price.display_data())
        #print(self.flex_cost.display_data())
        #print(self.ref_profile.display_data())
        store_namespace('price_' + self.building, self.price)
        store_namespace('flex_cost_' + self.building, self.flex_cost)
        store_namespace('ref_profile_' + self.building, self.ref_profile)
Пример #10
0
    def get_control(self):
        self.control = 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)+'S')
        # Random control signal
        control_signal1 = pd.Series(np.random.rand(len(index))*0.1,index=index)
        # Define control data
        self.control.data = {"HPPower": variables.Timeseries('HPPower', control_signal1,units.W,tz_name=self.weather.tz_name)
        }

        store_namespace('control_'+self.building,self.control)
Пример #11
0
 def setUp(self):
     self.MPCPyPath = utility.get_MPCPy_path();
     ## Setup building fmu emulation
     self.building_source_file_path = self.MPCPyPath + os.sep + 'resources' + os.sep + 'building' + os.sep + 'LBNL71T_Emulation_JModelica_v2.fmu';
     self.zone_names = ['wes', 'hal', 'eas'];
     self.weather_path = self.MPCPyPath + os.sep + 'resources' + os.sep + 'weather' + os.sep + 'USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw';
     self.internal_path = self.MPCPyPath + os.sep + 'resources' + os.sep + 'internal' + os.sep + 'sampleCSV.csv';
     self.internal_variable_map = {'intRad_wes' : ('wes', 'intRad', units.W_m2), \
                                   'intCon_wes' : ('wes', 'intCon', units.W_m2), \
                                   'intLat_wes' : ('wes', 'intLat', units.W_m2), \
                                   'intRad_hal' : ('hal', 'intRad', units.W_m2), \
                                   'intCon_hal' : ('hal', 'intCon', units.W_m2), \
                                   'intLat_hal' : ('hal', 'intLat', units.W_m2), \
                                   'intRad_eas' : ('eas', 'intRad', units.W_m2), \
                                   'intCon_eas' : ('eas', 'intCon', units.W_m2), \
                                   'intLat_eas' : ('eas', 'intLat', units.W_m2)};        
     self.control_path = self.MPCPyPath + os.sep + 'resources' + os.sep + 'building' + os.sep + 'ControlCSV_0.csv';
     self.control_variable_map = {'conHeat_wes' : ('conHeat_wes', units.unit1), \
                                  'conHeat_hal' : ('conHeat_hal', units.unit1), \
                                  'conHeat_eas' : ('conHeat_eas', units.unit1)};        
     # Measurements
     self.measurements = {};
     self.measurements['wesTdb'] = {'Sample' : variables.Static('wesTdb_sample', 1800, units.s)};
     self.measurements['halTdb'] = {'Sample' : variables.Static('halTdb_sample', 1800, units.s)};
     self.measurements['easTdb'] = {'Sample' : variables.Static('easTdb_sample', 1800, units.s)};
     self.measurements['wesPhvac'] = {'Sample' : variables.Static('easTdb_sample', 1800, units.s)};
     self.measurements['halPhvac'] = {'Sample' : variables.Static('easTdb_sample', 1800, units.s)};     
     self.measurements['easPhvac'] = {'Sample' : variables.Static('easTdb_sample', 1800, units.s)};
     self.measurements['Ptot'] = {'Sample' : variables.Static('easTdb_sample', 1800, units.s)};
     ## Setup model
     self.mopath = self.MPCPyPath + os.sep + 'resources' + os.sep + 'model' + os.sep + 'LBNL71T_MPC.mo';
     self.modelpath = 'LBNL71T_MPC.MPC';
     self.libraries = os.environ.get('MODELICAPATH');
     self.estimate_method = models.JModelica; 
     self.validation_method = models.RMSE;
     # Instantiate exo data sources
     self.weather = exodata.WeatherFromEPW(self.weather_path);
     self.internal = exodata.InternalFromCSV(self.internal_path, self.internal_variable_map, tz_name = self.weather.tz_name);
     self.control = exodata.ControlFromCSV(self.control_path, self.control_variable_map, tz_name = self.weather.tz_name);   
     # Parameters        
     self.parameters = exodata.ParameterFromCSV(self.MPCPyPath + os.sep + 'resources' + os.sep + 'model' + os.sep + 'LBNL71T_Parameters.csv');
     self.parameters.collect_data();
     self.parameters.data['lat'] = {};
     self.parameters.data['lat']['Value'] = self.weather.lat;    
     # Instantiate building
     building_parameters_data = {};
     building_parameters_data['lat'] = {};
     building_parameters_data['lat']['Value'] = self.weather.lat;  
     self.building = systems.EmulationFromFMU(self.measurements, \
                                              fmupath = self.building_source_file_path, \
                                              zone_names = self.zone_names, \
                                              parameter_data = building_parameters_data);
Пример #12
0
 def get_other_input(self,start,end):
     
     index = pd.date_range(start, end, freq = str(self.meas_sampl)+'S')
     # Zero signal
     radgain = pd.Series(np.random.rand(len(index))*100,index=index)
     zero_signal = pd.Series(np.zeros(len(index)),index=index)
     
     self.other_input = exodata.ControlFromCSV(self.control_file,
                                     self.other_varmap,
                                     tz_name = self.weather.tz_name)
     self.other_input.data = {"ConvGain1": variables.Timeseries('ConvGain1', zero_signal,units.W,tz_name=self.weather.tz_name),
         "RadGain": variables.Timeseries('RadGain', radgain,units.W,tz_name=self.weather.tz_name)
         }
     store_namespace('other_input_'+self.building,self.other_input)
Пример #13
0
    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)
Пример #14
0
    def test_collect_measurements_continue_cs_2(self):
        start_time = '1/1/2017'
        final_time = '1/2/2017'
        # Set measurements
        measurements = {}
        measurements['T_db'] = {
            'Sample': variables.Static('T_db_sample', 1800, units.s)
        }
        # Set model paths
        mopath = os.path.join(self.get_unittest_path(), 'resources', 'model',
                              'Simple.mo')
        modelpath = 'Simple.RC_nostart'
        moinfo = (mopath, modelpath, {})
        # Gather control inputs
        control_csv_filepath = os.path.join(self.get_unittest_path(),
                                            'resources', 'model',
                                            'SimpleRC_Input.csv')
        variable_map = {
            'q_flow_csv': ('q_flow', units.W)
        }
        controls = exodata.ControlFromCSV(control_csv_filepath, variable_map)
        controls.collect_data(start_time, final_time)
        # Instantiate model
        building = systems.EmulationFromFMU(measurements, \
                                            moinfo = moinfo, \
                                            control_data = controls.data,
                                            version = '2.0',
                                            target = 'cs')
        # Simulate model
        building.collect_measurements(start_time, final_time)
        # Check references
        df_test = building.display_measurements('Simulated')
        self.check_df(df_test, 'collect_measurements_display_cs.csv')

        # Simulate model in 4-hour chunks
        sim_steps = pd.date_range(start_time, final_time, freq=str('8H'))
        for i in range(len(sim_steps) - 1):
            if i == 0:
                building.collect_measurements(sim_steps[i], sim_steps[i + 1])
            else:
                building.collect_measurements('continue', sim_steps[i + 1])
            # Check references
            df_test = building.display_measurements('Simulated')
            self.check_df(df_test,
                          'collect_measurements_step_cs{0}.csv'.format(i))
Пример #15
0
 def setUp(self):
     self.start_time = '1/1/2017';
     self.final_time = '1/2/2017';
     MPCPyPath = utility.get_MPCPy_path();
     # Set model paths
     mopath = os.path.join(MPCPyPath, 'resources', 'model', 'Simple.mo');
     modelpath = 'Simple.RC';
     # Gather control inputs
     control_csv_filepath = os.path.join(MPCPyPath, 'resources', 'model', 'SimpleRC_Input.csv');
     variable_map = {'q_flow_csv' : ('q_flow', units.W)};
     controls = exodata.ControlFromCSV(control_csv_filepath, variable_map);
     controls.collect_data(self.start_time, self.final_time);
     # Set measurements
     measurements = {};
     measurements['T_db'] = {'Sample' : variables.Static('T_db_sample', 1800, units.s)};
     # Instantiate model
     self.model = models.Modelica(models.JModelica, \
                                  models.RMSE, \
                                  measurements, \
                                  moinfo = (mopath, modelpath, {}), \
                                  control_data = controls.data);
Пример #16
0
    def test_simulate_continue(self):
        '''Test simulation of a model in steps.'''
        # Set model paths
        mopath = os.path.join(self.get_unittest_path(), 'resources', 'model',
                              'Simple.mo')
        modelpath = 'Simple.RC_nostart'
        # Gather control inputs
        control_csv_filepath = os.path.join(self.get_unittest_path(),
                                            'resources', 'model',
                                            'SimpleRC_Input.csv')
        variable_map = {
            'q_flow_csv': ('q_flow', units.W)
        }
        controls = exodata.ControlFromCSV(control_csv_filepath, variable_map)
        controls.collect_data(self.start_time, self.final_time)
        # Instantiate model
        model = models.Modelica(models.JModelica, \
                                     models.RMSE, \
                                     self.measurements, \
                                     moinfo = (mopath, modelpath, {}), \
                                     control_data = controls.data)
        # Simulate model
        model.simulate(self.start_time, self.final_time)
        # Check references
        df_test = model.display_measurements('Simulated')
        self.check_df(df_test, 'simulate_display.csv')

        # Simulate model in 4-hour chunks
        sim_steps = pd.date_range(self.start_time,
                                  self.final_time,
                                  freq=str('8H'))
        for i in range(len(sim_steps) - 1):
            if i == 0:
                model.simulate(sim_steps[i], sim_steps[i + 1])
            else:
                model.simulate('continue', sim_steps[i + 1])
            # Check references
            df_test = model.display_measurements('Simulated')
            self.check_df(df_test, 'simulate_step{0}.csv'.format(i))
Пример #17
0
 def get_control(self):
     self.control = 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) + 'S')
     # Random control signal
     control_signal1 = pd.Series(np.random.rand(len(index)) * 3000,
                                 index=index)
     # Define control data
     self.control.data = {
         "ConvGain2":
         variables.Timeseries('ConvGain2',
                              control_signal1,
                              units.W,
                              tz_name=self.weather.tz_name)
     }
     #pheat_max = pd.Series(10000,index=index)
     #self.control.collect_data(self.sim_start, self.sim_end)
     #print(self.control.display_data())
     store_namespace('control_' + self.building, self.control)
Пример #18
0
    def get_other_input(self, start, end):

        index = pd.date_range(start, end, freq=str(self.meas_sampl) + 'S')
        # Zero signal
        radgain = pd.Series(np.random.rand(len(index)) * 100, index=index)
        zero_signal = pd.Series(np.zeros(len(index)), index=index)
        #t_start = pd.Series(self.start_temp, index=index)

        mor_start = np.random.randint(5, 9)
        mor_end = np.random.randint(9, 12)
        eve_start = np.random.randint(15, 19)
        eve_end = np.random.randint(19, 24)
        dem_temp = np.random.randint(18, 23)
        ppl_nr = np.random.randint(1, 5)

        for i in index:
            if i.hour >= mor_start and i.hour <= mor_end:
                radgain[i] = np.random.uniform(0, 1) * 150 * np.random.randint(
                    0, ppl_nr)
            if i.hour >= eve_start and i.hour <= eve_end:
                radgain[i] = np.random.uniform(0, 1) * 150 * np.random.randint(
                    0, ppl_nr)

        self.other_input = exodata.ControlFromCSV(self.control_file,
                                                  self.other_varmap,
                                                  tz_name=self.weather.tz_name)
        self.other_input.data = {
            "ConvGain1":
            variables.Timeseries('ConvGain1',
                                 zero_signal,
                                 units.W,
                                 tz_name=self.weather.tz_name),
            "RadGain":
            variables.Timeseries('RadGain',
                                 radgain,
                                 units.W,
                                 tz_name=self.weather.tz_name)
        }
        store_namespace('other_input_' + self.building, self.other_input)
Пример #19
0
 def setUp(self):
     self.start_time = '1/1/2017';
     self.final_time = '1/2/2017';
     # Set .mo path
     self.mopath = os.path.join(self.get_unittest_path(), 'resources', 'model', 'Simple.mo');
     # Gather inputs
     start_time_exo = '1/1/2017';
     final_time_exo = '1/10/2017';
     control_csv_filepath = os.path.join(self.get_unittest_path(), 'resources', 'model', 'SimpleRC_Input.csv');
     control_variable_map = {'q_flow_csv' : ('q_flow', units.W)};
     self.controls = exodata.ControlFromCSV(control_csv_filepath, control_variable_map);
     self.controls.collect_data(start_time_exo, final_time_exo);
     # Set measurements
     self.measurements = {};
     self.measurements['T_db'] = {'Sample' : variables.Static('T_db_sample', 1800, units.s)};
     self.measurements['q_flow'] = {'Sample' : variables.Static('q_flow_sample', 1800, units.s)};
     # Gather constraints       
     constraint_csv_filepath = os.path.join(self.get_unittest_path(), 'resources', 'optimization', 'SimpleRC_Constraints.csv');
     constraint_variable_map = {'q_flow_min' : ('q_flow', 'GTE', units.W), \
                                'T_db_min' : ('T_db', 'GTE', units.K), \
                                'T_db_max' : ('T_db', 'LTE', units.K)};
     self.constraints = exodata.ConstraintFromCSV(constraint_csv_filepath, constraint_variable_map);
     self.constraints.collect_data(start_time_exo, final_time_exo);
Пример #20
0
 def setUp(self):
     ## Setup building fmu emulation
     self.building_source_file_path_est = os.path.join(
         self.get_unittest_path(), 'resources', 'building',
         'RealMeasurements_est.csv')
     self.building_source_file_path_val = os.path.join(
         self.get_unittest_path(), 'resources', 'building',
         'RealMeasurements_val.csv')
     self.zone_names = ['wes', 'hal', 'eas']
     self.weather_path = os.path.join(
         self.get_unittest_path(), 'resources', 'weather',
         'USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw')
     self.internal_path = os.path.join(self.get_unittest_path(),
                                       'resources', 'internal',
                                       'sampleCSV.csv')
     self.internal_variable_map = {'intRad_wes' : ('wes', 'intRad', units.W_m2), \
                                   'intCon_wes' : ('wes', 'intCon', units.W_m2), \
                                   'intLat_wes' : ('wes', 'intLat', units.W_m2), \
                                   'intRad_hal' : ('hal', 'intRad', units.W_m2), \
                                   'intCon_hal' : ('hal', 'intCon', units.W_m2), \
                                   'intLat_hal' : ('hal', 'intLat', units.W_m2), \
                                   'intRad_eas' : ('eas', 'intRad', units.W_m2), \
                                   'intCon_eas' : ('eas', 'intCon', units.W_m2), \
                                   'intLat_eas' : ('eas', 'intLat', units.W_m2)}
     self.control_path = os.path.join(self.get_unittest_path(), 'resources',
                                      'building', 'ControlCSV_0.csv')
     self.control_variable_map = {'conHeat_wes' : ('conHeat_wes', units.unit1), \
                                  'conHeat_hal' : ('conHeat_hal', units.unit1), \
                                  'conHeat_eas' : ('conHeat_eas', units.unit1)}
     # Measurements
     self.measurements = {}
     self.measurements['wesTdb'] = {
         'Sample': variables.Static('wesTdb_sample', 1800, units.s)
     }
     self.measurements['halTdb'] = {
         'Sample': variables.Static('halTdb_sample', 1800, units.s)
     }
     self.measurements['easTdb'] = {
         'Sample': variables.Static('easTdb_sample', 1800, units.s)
     }
     self.measurements['wesPhvac'] = {
         'Sample': variables.Static('easTdb_sample', 1800, units.s)
     }
     self.measurements['halPhvac'] = {
         'Sample': variables.Static('easTdb_sample', 1800, units.s)
     }
     self.measurements['easPhvac'] = {
         'Sample': variables.Static('easTdb_sample', 1800, units.s)
     }
     self.measurements['Ptot'] = {
         'Sample': variables.Static('easTdb_sample', 1800, units.s)
     }
     self.measurement_variable_map = {
         'wesTdb_mea': ('wesTdb', units.K),
         'halTdb_mea': ('halTdb', units.K),
         'easTdb_mea': ('easTdb', units.K),
         'wesPhvac_mea': ('wesPhvac', units.W),
         'halPhvac_mea': ('halPhvac', units.W),
         'easPhvac_mea': ('easPhvac', units.W),
         'Ptot_mea': ('Ptot', units.W)
     }
     ## Setup model
     self.mopath = os.path.join(self.get_unittest_path(), 'resources',
                                'model', 'LBNL71T_MPC.mo')
     self.modelpath = 'LBNL71T_MPC.MPC'
     self.libraries = os.environ.get('MODELICAPATH')
     self.estimate_method = models.JModelica
     self.validation_method = models.RMSE
     # Instantiate exo data sources
     self.weather = exodata.WeatherFromEPW(self.weather_path)
     self.internal = exodata.InternalFromCSV(self.internal_path,
                                             self.internal_variable_map,
                                             tz_name=self.weather.tz_name)
     self.control = exodata.ControlFromCSV(self.control_path,
                                           self.control_variable_map,
                                           tz_name=self.weather.tz_name)
     # Parameters
     self.parameters = exodata.ParameterFromCSV(
         os.path.join(self.get_unittest_path(), 'resources', 'model',
                      'LBNL71T_Parameters.csv'))
     self.parameters.collect_data()
     self.parameters.data['lat'] = {}
     self.parameters.data['lat']['Value'] = self.weather.lat
     # Instantiate test building
     self.building_est = systems.RealFromCSV(
         self.building_source_file_path_est,
         self.measurements,
         self.measurement_variable_map,
         tz_name=self.weather.tz_name)
     # Instantiate validate building
     self.building_val = systems.RealFromCSV(
         self.building_source_file_path_val,
         self.measurements,
         self.measurement_variable_map,
         tz_name=self.weather.tz_name)
Пример #21
0
def param_estimation(model_param, ADD_UNIT_EP_TZONE):

    # Simulation settings
    estimation_start_time = model_param['estimation_start_time']
    estimation_stop_time = model_param['estimation_stop_time']
    validation_start_time = model_param['validation_start_time']
    validation_stop_time = model_param['validation_stop_time']

    pat_wea = model_param['wea']
    variable_map = eval(model_param['var_map'])
    con_fil = model_param['con_fil']
    obs_var = model_param['obs_var']
    step_size = model_param['emulator_step_size']
    fmu_path = model_param['fmu_path']
    param_fil = model_param['param_fil']
    moinfo = model_param['rc_param']

    # Setup for running the weather FMU
    weather = exodata.WeatherFromEPW(pat_wea)

    control = exodata.ControlFromCSV(con_fil,
                                     variable_map,
                                     tz_name=weather.tz_name)

    # Running the weather data FMU
    weather.collect_data(estimation_start_time, estimation_stop_time)

    # Collecting the data from the CSV file
    control.collect_data(estimation_start_time, estimation_stop_time)

    # Setting up parameters for emulator model (EnergyPlusFMU)
    from mpcpy import systems
    measurements = {obs_var: {}}
    measurements[obs_var]['Sample'] = variables.Static('sample_rate_Tzone',
                                                       step_size, units.s)
    fmupath = fmu_path

    print("=========Run emulation model with FMU={!s}".format(fmu_path))
    emulation = systems.EmulationFromFMU(measurements,
                                         fmupath=fmu_path,
                                         control_data=control.data,
                                         tz_name=weather.tz_name)

    # Running the emulator EnergyPlus FMU
    emulation.collect_measurements(estimation_start_time, estimation_stop_time)

    # Add units to EnergyPlus output variables
    if ((ADD_UNIT_EP_TZONE == True) and obs_var == 'Tzone'):
        print(
            "==========WARNING: When using E+FMU, if the output of E+ is the "
            "zone temperature, then the next lines will add the unit degC to the "
            "output results. This is only valid for E+ and an output which is Tzone."
        )
        data = measurements[obs_var]["Measured"].display_data()
        name = measurements[obs_var]["Measured"].name

    # Set new variable with same data and name and units degC
    measurements[obs_var]["Measured"] = variables.Timeseries(
        name, data, units.degC)

    from mpcpy import models
    parameters = exodata.ParameterFromCSV(param_fil)
    parameters.collect_data()
    parameters.display_data()

    # Defning model to be use for parameter estimation
    model = models.Modelica(models.JModelica,
                            models.RMSE,
                            emulation.measurements,
                            moinfo=moinfo,
                            parameter_data=parameters.data,
                            weather_data=weather.data,
                            control_data=control.data,
                            tz_name=weather.tz_name)

    #print("=========Simulate model with default parameters={!s}".format(moinfo))
    #model.simulate('1/1/2017', '1/2/2017')
    #model.parameter_data['zone.T0']['Value'].set_data(model.get_base_measurements('Measured')['Tzone'].loc[start_time_est_utc])

    #model.display_measurements('Simulated')
    print("=========Run parameter estimation for model={!s}".format(moinfo))
    print("=========Start time={!s}, Stop time={!s}, Observed variable={!s}".
          format(estimation_start_time, estimation_stop_time, obs_var))
    model.estimate(estimation_start_time, estimation_stop_time, [obs_var])

    # Validate the estimation model by comparing measured vs. simulated data
    # IMPORTANT: The accuracy of the validation depends on the initial temperature set
    # in the Modelica models. A parameter T0 is defined to set the initial
    # temperatures of the room air or internal mass. this should be set to
    # to the initial temperatures measured from the emulator.
    model.validate(validation_start_time,
                   validation_stop_time,
                   'validate_tra',
                   plot=1)
    print("The Root Mean Square Error={!s}".format(
        model.RMSE['Tzone'].display_data()))

    # Printing simulation results
    for key in model.parameter_data.keys():
        print(key, model.parameter_data[key]['Value'].display_data())
Пример #22
0
    def setUp(self):
        ## Setup model
        self.mopath = os.path.join(self.get_unittest_path(), 'resources',
                                   'model', 'LBNL71T_MPC.mo')
        self.modelpath = 'LBNL71T_MPC.MPC'
        self.libraries = os.environ.get('MODELICAPATH')
        self.estimate_method = models.JModelica
        self.validation_method = models.RMSE
        self.zone_names = ['wes', 'hal', 'eas']
        # Measurements
        self.measurements = {}
        self.measurements['wesTdb'] = {
            'Sample': variables.Static('wesTdb_sample', 1800, units.s)
        }
        self.measurements['halTdb'] = {
            'Sample': variables.Static('halTdb_sample', 1800, units.s)
        }
        self.measurements['easTdb'] = {
            'Sample': variables.Static('easTdb_sample', 1800, units.s)
        }
        self.measurements['wesPhvac'] = {
            'Sample': variables.Static('easTdb_sample', 1800, units.s)
        }
        self.measurements['halPhvac'] = {
            'Sample': variables.Static('easTdb_sample', 1800, units.s)
        }
        self.measurements['easPhvac'] = {
            'Sample': variables.Static('easTdb_sample', 1800, units.s)
        }
        self.measurements['Ptot'] = {
            'Sample': variables.Static('easTdb_sample', 1800, units.s)
        }

        ## Exodata
        # Exogenous collection time
        self.start_time_exodata = '1/1/2015'
        self.final_time_exodata = '1/30/2015'
        # Optimization time
        self.start_time_optimization = '1/2/2015'
        self.final_time_optimization = '1/3/2015'
        # Weather
        self.weather_path = os.path.join(
            self.get_unittest_path(), 'resources', 'weather',
            'USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw')
        self.weather = exodata.WeatherFromEPW(self.weather_path)
        self.weather.collect_data(self.start_time_exodata,
                                  self.final_time_exodata)
        # Internal
        self.internal_path = os.path.join(self.get_unittest_path(),
                                          'resources', 'internal',
                                          'sampleCSV.csv')
        self.internal_variable_map = {'intRad_wes' : ('wes', 'intRad', units.W_m2), \
                                      'intCon_wes' : ('wes', 'intCon', units.W_m2), \
                                      'intLat_wes' : ('wes', 'intLat', units.W_m2), \
                                      'intRad_hal' : ('hal', 'intRad', units.W_m2), \
                                      'intCon_hal' : ('hal', 'intCon', units.W_m2), \
                                      'intLat_hal' : ('hal', 'intLat', units.W_m2), \
                                      'intRad_eas' : ('eas', 'intRad', units.W_m2), \
                                      'intCon_eas' : ('eas', 'intCon', units.W_m2), \
                                      'intLat_eas' : ('eas', 'intLat', units.W_m2)}
        self.internal = exodata.InternalFromCSV(self.internal_path,
                                                self.internal_variable_map,
                                                tz_name=self.weather.tz_name)
        self.internal.collect_data(self.start_time_exodata,
                                   self.final_time_exodata)
        # Control (as initialization)
        self.control_path = os.path.join(self.get_unittest_path(), 'resources',
                                         'optimization', 'ControlCSV.csv')
        self.control_variable_map = {'conHeat_wes' : ('conHeat_wes', units.unit1), \
                                     'conHeat_hal' : ('conHeat_hal', units.unit1), \
                                     'conHeat_eas' : ('conHeat_eas', units.unit1)}
        self.control = exodata.ControlFromCSV(self.control_path,
                                              self.control_variable_map,
                                              tz_name=self.weather.tz_name)
        self.control.collect_data(self.start_time_exodata,
                                  self.final_time_exodata)
        # Parameters
        self.parameters_path = os.path.join(self.get_unittest_path(),
                                            'outputs', 'model_parameters.txt')
        self.parameters = exodata.ParameterFromCSV(self.parameters_path)
        self.parameters.collect_data()
        # Constraints
        self.constraints_path = os.path.join(
            self.get_unittest_path(), 'resources', 'optimization',
            'sampleConstraintCSV_Constant.csv')
        self.constraints_variable_map = {'wesTdb_min' : ('wesTdb', 'GTE', units.degC), \
                                         'wesTdb_max' : ('wesTdb', 'LTE', units.degC), \
                                         'easTdb_min' : ('easTdb', 'GTE', units.degC), \
                                         'easTdb_max' : ('easTdb', 'LTE', units.degC), \
                                         'halTdb_min' : ('halTdb', 'GTE', units.degC), \
                                         'halTdb_max' : ('halTdb', 'LTE', units.degC), \
                                         'der_wesTdb_min' : ('wesTdb', 'dGTE', units.K), \
                                         'der_wesTdb_max' : ('wesTdb', 'dLTE', units.K), \
                                         'der_easTdb_min' : ('easTdb', 'dGTE', units.K), \
                                         'der_easTdb_max' : ('easTdb', 'dLTE', units.K), \
                                         'der_halTdb_min' : ('halTdb', 'dGTE', units.K), \
                                         'der_halTdb_max' : ('halTdb', 'dLTE', units.K), \
                                         'conHeat_wes_min' : ('conHeat_wes', 'GTE', units.unit1), \
                                         'conHeat_wes_max' : ('conHeat_wes', 'LTE', units.unit1), \
                                         'conHeat_hal_min' : ('conHeat_hal', 'GTE', units.unit1), \
                                         'conHeat_hal_max' : ('conHeat_hal', 'LTE', units.unit1), \
                                         'conHeat_eas_min' : ('conHeat_eas', 'GTE', units.unit1), \
                                         'conHeat_eas_max' : ('conHeat_eas', 'LTE', units.unit1)}
        self.constraints = exodata.ConstraintFromCSV(
            self.constraints_path,
            self.constraints_variable_map,
            tz_name=self.weather.tz_name)
        self.constraints.collect_data(self.start_time_exodata,
                                      self.final_time_exodata)
        self.constraints.data['wesTdb']['Cyclic'] = variables.Static(
            'wesTdb_cyclic', 1, units.boolean_integer)
        self.constraints.data['easTdb']['Cyclic'] = variables.Static(
            'easTdb_cyclic', 1, units.boolean_integer)
        self.constraints.data['halTdb']['Cyclic'] = variables.Static(
            'halTdb_cyclic', 1, units.boolean_integer)
        # Prices
        self.prices_path = os.path.join(self.get_unittest_path(), 'resources',
                                        'optimization', 'PriceCSV.csv')
        self.price_variable_map = {
            'pi_e': ('pi_e', units.unit1)
        }
        self.prices = exodata.PriceFromCSV(self.prices_path,
                                           self.price_variable_map,
                                           tz_name=self.weather.tz_name)
        self.prices.collect_data(self.start_time_exodata,
                                 self.final_time_exodata)

        ## Parameters
        self.parameters.data['lat'] = {}
        self.parameters.data['lat']['Value'] = self.weather.lat
        ## Instantiate model
        self.model = models.Modelica(self.estimate_method, \
                                     self.validation_method, \
                                     self.measurements, \
                                     moinfo = (self.mopath, self.modelpath, self.libraries), \
                                     zone_names = self.zone_names, \
                                     weather_data = self.weather.data, \
                                     internal_data = self.internal.data, \
                                     control_data = self.control.data, \
                                     parameter_data = self.parameters.data, \
                                     tz_name = self.weather.tz_name)
Пример #23
0
 def setUp(self):
     ## Setup building fmu emulation
     self.building_source_file_path_est = os.path.join(
         self.get_unittest_path(), 'resources', 'building',
         'RealMeasurements_est.csv')
     self.building_source_file_path_val = os.path.join(
         self.get_unittest_path(), 'resources', 'building',
         'RealMeasurements_val.csv')
     self.building_source_file_path_val_missing = os.path.join(
         self.get_unittest_path(), 'resources', 'building',
         'RealMeasurements_val_missing.csv')
     self.zone_names = ['wes', 'hal', 'eas']
     self.weather_path = os.path.join(
         self.get_unittest_path(), 'resources', 'weather',
         'USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw')
     self.internal_path = os.path.join(self.get_unittest_path(),
                                       'resources', 'internal',
                                       'sampleCSV.csv')
     self.internal_variable_map = {'intRad_wes' : ('wes', 'intRad', units.W_m2), \
                                   'intCon_wes' : ('wes', 'intCon', units.W_m2), \
                                   'intLat_wes' : ('wes', 'intLat', units.W_m2), \
                                   'intRad_hal' : ('hal', 'intRad', units.W_m2), \
                                   'intCon_hal' : ('hal', 'intCon', units.W_m2), \
                                   'intLat_hal' : ('hal', 'intLat', units.W_m2), \
                                   'intRad_eas' : ('eas', 'intRad', units.W_m2), \
                                   'intCon_eas' : ('eas', 'intCon', units.W_m2), \
                                   'intLat_eas' : ('eas', 'intLat', units.W_m2)}
     self.control_path = os.path.join(self.get_unittest_path(), 'resources',
                                      'building', 'ControlCSV_0.csv')
     self.control_variable_map = {'conHeat_wes' : ('conHeat_wes', units.unit1), \
                                  'conHeat_hal' : ('conHeat_hal', units.unit1), \
                                  'conHeat_eas' : ('conHeat_eas', units.unit1)}
     # Measurements
     self.measurements = {}
     self.measurements['wesTdb'] = {
         'Sample': variables.Static('wesTdb_sample', 1800, units.s)
     }
     self.measurements['halTdb'] = {
         'Sample': variables.Static('halTdb_sample', 1800, units.s)
     }
     self.measurements['easTdb'] = {
         'Sample': variables.Static('easTdb_sample', 1800, units.s)
     }
     self.measurements['wesPhvac'] = {
         'Sample': variables.Static('easTdb_sample', 1800, units.s)
     }
     self.measurements['halPhvac'] = {
         'Sample': variables.Static('easTdb_sample', 1800, units.s)
     }
     self.measurements['easPhvac'] = {
         'Sample': variables.Static('easTdb_sample', 1800, units.s)
     }
     self.measurements['Ptot'] = {
         'Sample': variables.Static('easTdb_sample', 1800, units.s)
     }
     self.measurement_variable_map = {
         'wesTdb_mea': ('wesTdb', units.K),
         'halTdb_mea': ('halTdb', units.K),
         'easTdb_mea': ('easTdb', units.K),
         'wesPhvac_mea': ('wesPhvac', units.W),
         'halPhvac_mea': ('halPhvac', units.W),
         'easPhvac_mea': ('easPhvac', units.W),
         'Ptot_mea': ('Ptot', units.W)
     }
     ## Setup model
     self.mopath = os.path.join(self.get_unittest_path(), 'resources',
                                'model', 'LBNL71T_MPC.mo')
     self.modelpath = 'LBNL71T_MPC.MPC'
     self.libraries = os.environ.get('MODELICAPATH')
     self.estimate_method = models.JModelica
     self.validation_method = models.RMSE
     # Instantiate exo data sources
     self.weather = exodata.WeatherFromEPW(self.weather_path)
     self.internal = exodata.InternalFromCSV(self.internal_path,
                                             self.internal_variable_map,
                                             tz_name=self.weather.tz_name)
     self.control = exodata.ControlFromCSV(self.control_path,
                                           self.control_variable_map,
                                           tz_name=self.weather.tz_name)
     # Parameters
     self.parameters = exodata.ParameterFromCSV(
         os.path.join(self.get_unittest_path(), 'resources', 'model',
                      'LBNL71T_Parameters.csv'))
     self.parameters.collect_data()
     self.parameters.data['lat'] = {}
     self.parameters.data['lat']['Value'] = self.weather.lat
     # Instantiate test building
     self.building_est = systems.RealFromCSV(
         self.building_source_file_path_est,
         self.measurements,
         self.measurement_variable_map,
         tz_name=self.weather.tz_name)
     # Exogenous collection time
     self.start_time_exodata = '1/1/2015'
     self.final_time_exodata = '1/30/2015'
     # Estimation time
     self.start_time_estimation = '1/1/2015'
     self.final_time_estimation = '1/4/2015'
     # Validation time
     self.start_time_validation = '1/4/2015'
     self.final_time_validation = '1/5/2015'
     # Measurement variables for estimate
     self.measurement_variable_list = ['wesTdb', 'easTdb', 'halTdb']
     # Exodata
     self.weather.collect_data(self.start_time_exodata,
                               self.final_time_exodata)
     self.internal.collect_data(self.start_time_exodata,
                                self.final_time_exodata)
     self.control.collect_data(self.start_time_exodata,
                               self.final_time_exodata)
     # Collect measurement data
     self.building_est.collect_measurements(self.start_time_estimation,
                                            self.final_time_estimation)
     # Instantiate model
     self.model = models.Modelica(self.estimate_method, \
                                  self.validation_method, \
                                  self.building_est.measurements, \
                                  moinfo = (self.mopath, self.modelpath, self.libraries), \
                                  zone_names = self.zone_names, \
                                  weather_data = self.weather.data, \
                                  internal_data = self.internal.data, \
                                  control_data = self.control.data, \
                                  parameter_data = self.parameters.data, \
                                  tz_name = self.weather.tz_name)
     # Simulate model with initial guess
     self.model.simulate(self.start_time_estimation,
                         self.final_time_estimation)