Skip to content
Snippets Groups Projects
Select Git revision
  • 50a7abd19e1a3ff86307c333be5e7a8ef346e949
  • main default protected
  • vac_in_initial_conditions
3 results

gen_data.py

Blame
  • runme.py 4.74 KiB
    import pandas as pd
    import Tooling.input_profile_processor.input_profile_processor
    import Model_Library.Prosumer.main as main
    import Model_Library.District.main_district as main_district
    from enum import Enum
    
    class SimulationScope(Enum):
        PROSUMER = 1
        COMMUNITY = 2
    
    simulation_scope = SimulationScope.COMMUNITY
    t_start = pd.Timestamp("2019-05-10 00:00:00") # start time of simulation
    t_horizon = 240 # number of time steps to be simulated
    t_step = 1 # length of a time step in hours
    
    input_profile_dict = {'irradiance_1': ['irradiance', 'input_files/data/irradiance/Lindenberg2006BSRN_Irradiance_60sec.csv'],
                          'temperature_1': ['air_temperature', 'input_files/data/temperature/temperature.csv'],
                          'demand_electric_1': ['elec_demand', 'generate', 3000],
                          'demand_heat_1': ['therm_demand', 'generate', 6000, 'temperature_1'],
                          'demand_hot_water_1': ['hot_water_demand', 'generate', 1500, 'temperature_1'],
                          'irradiance_2': ['irradiance', 'input_files/data/irradiance/Lindenberg2006BSRN_Irradiance_60sec.csv'],
                          'temperature_2': ['air_temperature', 'input_files/data/temperature/temperature.csv'],
                          'demand_electric_2': ['elec_demand', 'generate', 3000],
                          'demand_heat_2': ['therm_demand', 'generate', 6000, 'temperature_2'],
                          'demand_hot_water_2': ['hot_water_demand', 'generate', 1500, 'temperature_2'],
                          'irradiance_3': ['irradiance', 'input_files/data/irradiance/Lindenberg2006BSRN_Irradiance_60sec.csv'],
                          'temperature_3': ['air_temperature', 'input_files/data/temperature/temperature.csv'],
                          'demand_electric_3': ['elec_demand', 'generate', 0],
                          'demand_heat_3': ['therm_demand', 'generate', 0, 'temperature_3'],
                          'demand_hot_water_3': ['hot_water_demand', 'generate', 0, 'temperature_3'],
                          'elec_price_1': ['elec_price', 'input_files/data/prices/day-ahead/hourly_price.csv']}
    
    input_profiles = Tooling.input_profile_processor.input_profile_processor.process_input_profiles(input_profile_dict, t_start, t_horizon, t_step)
    
    # 'config_path': path to global configurations like prices, injection prices, emission costs, etc.
    # 'topology_path': path to directory that contains the matrices that define the prosumer topology
    prosumer_dict = {'SCN2_CAT1_PV11_3000_6000':{'config_path': 'input_files/models/prosumer_models/SCN2_CAT1_PV11/config.csv',
                                                 'topology_path': 'input_files/models/prosumer_models/SCN2_CAT1_PV11',
                                                 'profiles': {'pv_roof': ['irradiance_1', 'temperature_1'],
                                                              'elec_cns': 'demand_electric_1',
                                                              'therm_cns': 'demand_heat_1',
                                                              'dhw_dmd': 'demand_hot_water_1'}},
                     'SCN0_CAT1_3000_6000': {'config_path': 'input_files/models/prosumer_models/SCN0_CAT1/config.csv',
                                             'topology_path': 'input_files/models/prosumer_models/SCN0_CAT1',
                                             'profiles': {'elec_cns': 'demand_electric_2',
                                                          'therm_cns': 'demand_heat_2',
                                                          'dhw_dmd': 'demand_hot_water_2'}}}
    
    prosumer_main = main.Main(prosumer_dict, input_profiles, t_horizon, t_step)
    
    prosumer_sizing_strategy = 'annuity'
    prosumer_main.optimize_sizing(prosumer_sizing_strategy)
    
    prosumer_main.save_results()
    
    prosumers = prosumer_main.prosumers
    
    if simulation_scope == SimulationScope.PROSUMER:
        exit()
    
    community_assets_dict = {'ca_bat': {'config_path': 'input_files/models/district_models/example_CA/config.csv',
                                        'topology_path': 'input_files/models/district_models/example_CA',
                                        'profiles': {'elec_cns_ca_bat': 'demand_electric_3'}}}
    
    community_assets = main.Main_CA(community_assets_dict, input_profiles, t_horizon, t_step).community_assets
    
    community_dict = {'community': {'config_path': 'input_files/models/district_models/example_community/config.csv',
                                    'profiles': {'elec_price': 'elec_price_1'}}}
    
    community_main = main_district.MainDistrict(community_dict, prosumers, community_assets, input_profiles, t_horizon, t_step)
    
    community_sizing_strategy = 'sizing_max_operational_profit'
    community_main.optimize_sizing(community_sizing_strategy)
    
    community_operation_strategy = 'max_operational_profit'
    community_main.optimize_operation(t_horizon, community_operation_strategy)
    
    community_main.save_results()