Beispiel #1
0
def modify_monthly_multiplier(locator, config, measured_building_names):
    ##create building input schedules to set monthly multiplier
    archetypes_mapper.archetypes_mapper(
        locator,
        update_architecture_dbf=False,
        update_air_conditioning_systems_dbf=False,
        update_indoor_comfort_dbf=False,
        update_internal_loads_dbf=False,
        update_supply_systems_dbf=False,
        update_schedule_operation_cea=True,
        buildings=[])

    ##calculate monthly multiplier based on buildings real consumption
    for building_name in measured_building_names:
        monthly_measured_data = pd.read_csv(locator.get_monthly_measurements())
        fields_to_extract = ['Name'] + MONTHS_IN_YEAR_NAMES
        monthly_measured_demand = monthly_measured_data[
            fields_to_extract].set_index('Name')
        monthly_measured_demand = monthly_measured_demand.loc[building_name]
        monthly_measured_demand = pd.DataFrame({
            'Month':
            monthly_measured_demand.index.values,
            'measurements':
            monthly_measured_demand.values
        })
        monthly_measured_load = monthly_measured_demand.measurements / max(
            monthly_measured_demand.measurements)

        path_to_schedule = locator.get_building_weekly_schedules(building_name)
        data_schedule, data_metadata = read_cea_schedule(path_to_schedule)
        data_metadata["MONTHLY_MULTIPLIER"] = list(
            monthly_measured_load.round(2))

        # save cea schedule format
        save_cea_schedule(data_schedule, data_metadata, path_to_schedule)
Beispiel #2
0
def schedule_to_dict(schedule_path):
    schedule_data, schedule_complementary_data = read_cea_schedule(
        schedule_path)
    df = pandas.DataFrame(schedule_data).set_index(['DAY', 'HOUR'])
    out = {
        'SCHEDULES': {
            schedule_type: {
                day: df.loc[day][schedule_type].values.tolist()
                for day in df.index.levels[0]
            }
            for schedule_type in df.columns
        }
    }
    out.update(schedule_complementary_data)
    return out
Beispiel #3
0
 def get(self, building):
     config = current_app.cea_config
     locator = cea.inputlocator.InputLocator(config.scenario)
     try:
         schedule_path = locator.get_building_weekly_schedules(building)
         schedule_data, schedule_complementary_data = read_cea_schedule(schedule_path)
         df = pandas.DataFrame(schedule_data).set_index(['DAY', 'HOUR'])
         out = {'SCHEDULES': {
             schedule_type: {day: df.loc[day][schedule_type].values.tolist() for day in df.index.levels[0]}
             for schedule_type in df.columns}}
         out.update(schedule_complementary_data)
         return out
     except IOError as e:
         print(e)
         abort(500, 'File not found')
Beispiel #4
0
    def fill_in_data(self):
        get_list_uses_in_database = []
        for file in os.listdir(self.path_database):
            if file.endswith(".csv"):
                get_list_uses_in_database.append(file.split('.')[0])

        data_schedules = []
        data_schedules_complimentary = []
        for use in get_list_uses_in_database:
            path_to_schedule = self.locator.get_database_standard_schedules_use(self.path_database, use)
            data_schedule, data_metadata = read_cea_schedule(path_to_schedule)
            data_schedules.append(data_schedule)
            data_schedules_complimentary.append(data_metadata)
        return dict(zip(get_list_uses_in_database, data_schedules)), \
               dict(zip(get_list_uses_in_database, data_schedules_complimentary))
    def fill_in_data(self):
        occupancy_types = []
        for file_name in os.listdir(self.locator.get_database_use_types_folder()):
            if file_name.endswith(".csv"):
                use, _ = os.path.splitext(file_name)
                occupancy_types.append(use)

        data_schedules = []
        data_schedules_complimentary = []
        for use in occupancy_types:
            path_to_schedule = self.locator.get_database_standard_schedules_use(use)
            data_schedule, data_metadata = read_cea_schedule(path_to_schedule)
            data_schedules.append(data_schedule)
            data_schedules_complimentary.append(data_metadata)
        schedule_data = dict(zip(occupancy_types, data_schedules))
        complementary_data = dict(zip(occupancy_types, data_schedules_complimentary))
        return schedule_data, complementary_data