Code documentation¶
Main¶
Main functions of pvcompare that can be used to run a full simulation.
|
Starts the energy system optimization with MVS and stores results. |
|
Runs the main functionalities of pvcompare. |
Area potential¶
Function for calculating the area potential of the rooftop and facades for a given population.
Calculates the area potential for PV installations. |
Demand¶
Functions for calculating the electrical demand profiles and heat demand profiles.
|
Calculates electricity and heat load profiles for country, storeys, and year. |
|
Calculates electricity demand profile for country, storeys, and year. |
|
Calculates heat demand profile for storeys, country, year. |
|
Adjust the hourly heat demands exceeding the heating limit temperature. |
|
Shift the demand time series ts`depending `country. |
|
Loads workalender for a given country. |
Feed-in time series of photovoltaic installations¶
Functions for calculating the feed-in time series of different PV technologies.
|
Creates feed-in time series for all surface types in pv_setup or ‘pv_setup.csv’. |
|
Calculates feed-in time series for a silicon PV module. |
|
Creates power time series of a hybrid CPV module. |
|
Creates power time series of a perovskite-silicone (PSI) module. |
|
calculates the maximum installed capacity for each pv module. |
|
This function returns the peak value for the given technology. |
|
Sets up pvlibPVSystems. |
Calculates the optimal tilt angle depending on the latitude. |
CPV time series¶
Specific functions for calculating the feed-in time series of the CPV technology.
|
Calculates time series for a CPV module. |
|
Calculates maximum power output and efficiency for the CPV and flat plate module. |
PSI time series¶
Specific functions for calculating the feed-in time series of the perovskite-silicon technology.
Creates a time series for the output power of a pero-si module. |
|
|
Calculates a timeseries for each cell type in list cell_type. |
calculates the short current density Jsc for each timestep. |
|
|
Function that runs the smartsAll function to get a standard spectrum |
|
Parameter |
Heat pumps and chillers¶
Functions for implementing a sector-coupled system (electricity, heat) and for calculating the COPs/EERs of heat pumps and chillers.
Calculates the COPs of a heat pump or EERs of a chiller depending on mode. |
|
Add heat sector if heat pump or chiller are in energyConversion.csv. |
Stratified thermal storage¶
Functions for calculating thermal losses of a stratified thermal storage and for adding it to the energy system.
This function does the precalculations of the stratified thermal storage. |
|
This function saves time dependent values to ‘data/mvs_inputs/time_series’. |
|
Adds stratified thermal storage if it exists either in ‘energyStorage.csv’. |
|
This function executes calc_strat_tes_param(input_data) with self selected input data series |
Reading and Writing input csv’s¶
Functions that match manual inputs and calculated results with data/user_inputs/mvs_inputs/csv_elements/
Overwrites a value from a file in ‘mvs_inputs/csv_elements’ with a user input. |
|
Loads a value from a file in ‘mvs_inputs/csv_elements’. |
|
Enters new parameters into ‘storage_xx.csv’. |
|
Matches user input scenario_name with scenario_name in ‘project_data.csv’. |
|
Matches user input for year, latitude, longitude and country with mvs_inputs. |
|
Adds grid parameters such as electricity price or feed-in tariff to ‘energyProviders.csv’. |
|
Checks static input files for valid countries and years. |
|
Inserts default values for PV technologies defined in ‘pv_setup.csv’. |
|
Enters new parameters into ‘energyProduction.csv’. |
|
Enters demand time series file name to ‘energyProduction.csv’. |
|
Adds number of days of the time series into ‘simulation_settings.csv’. |
Loading ERA5 weather data¶
Functions that request the weather data of one year and one location from the ERA5 weather data set
|
Loads era5 weather data and converts it into format required by pvlib. |
Send request for era5 data to the Climate Data Store (CDS) |
|
Format dataset to dataframe as required by the pvlib’s ModelChain. |
|
|
Gets ERA5 weather data from netcdf file and converts it to a pandas dataframe as required by the spcified lib. |
Sensitivity analysis¶
Functions sensivity analysis, i.e. running simulations in a loop while adjusting one parameter at each loop.
Defines the path of the loop_output_directory. |
|
|
Starts multiple pvcompare simulations with a range of values for a specific loop type. |
|
|
|
Starts multiple MVS simulations with a range of values for a specific parameter. |
Evaluation¶
Function for the post-processing of KPIs. It is recommended to post-process certain KPIs when sector-coupling electricity and heat sector with a heat pump and/or chiller.
|
Overwrites all output excel files “timeseries_all_flows.xlsx” and “scalars.xlsx” in loop output directory of a scenario with modified KPI’s. |
Visualization¶
Plotting function for visualization of simulation results.
|
Plots all flows of the energy system for a given period of time. |
|
Plots two matrix subplots (LCOE and total costs) over a number of scenarios. |
|
Plots list of key performance indicators (KPIs) of a ‘mvs_output/scalars_**.xlsx’ file. |
|
Plots barplot for KPI’s from the ‘mvs_output/scalars_**.xlsx’ files in loop_outputs for all facades. |
|
Comparison of scenarios for specific KPI’s. |
|
Comparison of different technologies at different locations for specific KPI’s. |