reskit.solar.workflows.solar_workflow_manager#
Attributes#
Classes#
LazyLoader is a utility class which postpones the "real" importing of the desired module until the time when it is actually needed |
|
The WorkflowManager class assists with the construction of more specialized WorkflowManagers, |
Module Contents#
- class reskit.solar.workflows.solar_workflow_manager.LazyLoader(lib_name)#
LazyLoader is a utility class which postpones the “real” importing of the desired module until the time when it is actually needed
- lib_name#
- _mod = None#
- __getattr__(name)#
- reskit.solar.workflows.solar_workflow_manager.pvlib#
- class reskit.solar.workflows.solar_workflow_manager.SolarWorkflowManager(placements)#
Bases:
reskit.workflow_manager.WorkflowManagerThe WorkflowManager class assists with the construction of more specialized WorkflowManagers, such as the WindWorkflowManager or the SolarWorkflowManager. In addition to providing the general structure for simulation workflow management, the WorkflowManager also defines functionalities which should be common across all WorkflowManagers.
- This includes:
Basic initialization
Time domain management
Reading weather data
Adjusting variables by a long-run-average value
Applying simple loss factors
Saving the state of WorkflowManagers to XArray datasets, either in memory or on disc
Initialization:#
WorkflowManager( placements )
__init_(self, placements)
Initialization of an instance of the generic SolarWorkflowManager class.
- param placements:
The locations that the simulation should be run for. Columns must include “lon”, “lat”
- type placements:
pandas Dataframe
- rtype:
SolarWorkflorManager
- _time_sel_ = None#
- _time_index_ = None#
- module = None#
- estimate_tilt_from_latitude(convention)#
estimate_tilt_from_latitude(self, convention)
Estimates the tilt of the solar panels based on the latitude of the placements of the instance.
- Parameters:
convention (str, optional) – The calculation method used to suggest system tilts. Option 1 of convention is “Ryberg2020”. Option 2 of convention is a string consumable by ‘eval’. This string can use the variable latitude. For example “latitude*0.76”. Option 3 of convention is a path to a rasterfile. To get more information check out reskit.solar.location_to_tilt for more information.
- Return type:
Returns a reference to the invoking SolarWorkflowManager object
- estimate_azimuth_from_latitude()#
estimate_azimuth_from_latitude(self)
Estimates the azimuth of the placements of the instance. For a positive latitude the azimuth is set to 180. For a negative latitude the azimuth is set to 0.
- Parameters:
None
- Return type:
Returns a reference to the invoking SolarWorkflowManager object
- apply_elevation(elev, fallback_elev=0)#
apply_elevation(self)
Adds an elevation (name: ‘elev’) column to the placements data frame.
- Parameters:
elev (str, int, iterable) – If a string is given it must be a path to a rasterfile including the elevations. If an iterable is given it has to include the elevations at each location and be of equal length to self.placements dataframe. If an integer is given, it will be applied to all locations equally.
fallback_elev (int, optional) – The fallback value that will be used in case that elev is a raster path and the extraction of the elevation from raster fails (applied only to no-data locations). By default 0.
- Return type:
Returns a reference to the invoking SolarWorkflowManager object
- determine_solar_position(lon_rounding=1, lat_rounding=1, elev_rounding=-2)#
determine_solar_position(self, lon_rounding=1, lat_rounding=1, elev_rounding=-2)
Calculates azimuth and apparent zenith for each location using the pvlib function pvlib.solarposition.spa_python() [1]. Adds azimuth and apparent zenit to the sim_data dictionary.
- Parameters:
lon_rounding (int, optional) – Decimal places that the longitude should be rounded to. Default is 1.
lat_rounding (int, optional) – Decimal places that the latitude should be rounded to. Default is 1.
elev_rounding (int, optional) – Decimal places that the elevation should be rounded to. Default is -2.
- Return type:
Returns a reference to the invoking SolarWorkflowManager object
Notes
Required columns in the placements dataframe to use this functions are ‘lon’, ‘lat’ and ‘elev’. Required data in the sim_data dictionary are ‘surface_pressure’ and ‘surface_air_temperature’.
References
[1] https://pvlib-python.readthedocs.io/en/stable/generated/pvlib.solarposition.spa_python.html
- [2] I. Reda and A. Andreas, Solar position algorithm for solar
radiation applications. Solar Energy, vol. 76, no. 5, pp. 577-589, 2004.
- [3] I. Reda and A. Andreas, Corrigendum to Solar position algorithm for
solar radiation applications. Solar Energy, vol. 81, no. 6, p. 838, 2007.
- [4] USNO delta T:
http://www.usno.navy.mil/USNO/earth-orientation/eo-products/long-term
- filter_positive_solar_elevation()#
filter_positive_solar_elevation(self)
Filters positive solar elevations so that future operations are only executed for time steps when the sun is above (or at least near-to) the horizon
- Parameters:
None
- Return type:
Returns a reference to the invoking SolarWorkflowManager object
Notes
Required data in the sim_data dictionary are ‘apparent_solar_zenith’.
- determine_extra_terrestrial_irradiance(**kwargs)#
determine_extra_terrestrial_irradiance(self, **kwargs)
Determines extra terrestrial irradiance using the pvlib.irradiance.get_extra_radiation() function [1].
- Parameters:
None
- Return type:
Returns a reference to the invoking SolarWorkflowManager object.
References
[1] https://pvlib-python.readthedocs.io/en/stable/generated/pvlib.irradiance.get_extra_radiation.html
[2] M. Reno, C. Hansen, and J. Stein, “Global Horizontal Irradiance Clear Sky Models: Implementation and Analysis”, Sandia National Laboratories, SAND2012-2389, 2012.
[3] <http://solardat.uoregon.edu/SolarRadiationBasics.html>, Eqs. SR1 and SR2
[4] Partridge, G. W. and Platt, C. M. R. 1976. Radiative Processes in Meteorology and Climatology.
[5] Duffie, J. A. and Beckman, W. A. 1991. Solar Engineering of Thermal Processes, 2nd edn. J. Wiley and Sons, New York.
[6] ASCE, 2005. The ASCE Standardized Reference Evapotranspiration Equation, Environmental and Water Resources Institute of the American Civil Engineers, Ed. R. G. Allen et al.
- determine_air_mass(model='kastenyoung1989')#
determine_air_mass(self, model=’kastenyoung1989’)
Determines air mass using the pvlib function pvlib.atmosphere.get_relative_airmass() [1].
- Parameters:
model (str, optional) –
default ‘kastenyoung1989’ [1]
’simple’ - secant(apparent zenith angle) - Note that this gives -inf at zenith=90 [2] ‘kasten1966’ - See reference [2] - requires apparent sun zenith [2] ‘youngirvine1967’ - See reference [3] - requires true sun zenith [2] ‘kastenyoung1989’ - See reference [4] - requires apparent sun zenith [2] ‘gueymard1993’ - See reference [5] - requires apparent sun zenith [2] ‘young1994’ - See reference [6] - requires true sun zenith [2] ‘pickering2002’ - See reference [7] - requires apparent sun zenith [2]
- Return type:
Nothing is returned.
Notes
Required data in the sim_data dictionary are ‘apparent_solar_zenith’.
References
[1] https://pvlib-python.readthedocs.io/en/stable/generated/pvlib.atmosphere.get_relative_airmass.html
[2] Fritz Kasten. “A New Table and Approximation Formula for the Relative Optical Air Mass”. Technical Report 136, Hanover, N.H.: U.S. Army Material Command, CRREL.
[3] A. T. Young and W. M. Irvine, “Multicolor Photoelectric Photometry of the Brighter Planets,” The Astronomical Journal, vol. 72, pp. 945-950, 1967.
[4] Fritz Kasten and Andrew Young. “Revised optical air mass tables and approximation formula”. Applied Optics 28:4735-4738
[5] C. Gueymard, “Critical analysis and performance assessment of clear sky solar irradiance models using theoretical and measured data,” Solar Energy, vol. 51, pp. 121-138, 1993.
[6] A. T. Young, “AIR-MASS AND REFRACTION,” Applied Optics, vol. 33, pp. 1108-1110, Feb 1994.
[7] Keith A. Pickering. “The Ancient Star Catalog”. DIO 12:1, 20,
[8] Matthew J. Reno, Clifford W. Hansen and Joshua S. Stein, “Global Horizontal Irradiance Clear Sky Models: Implementation and Analysis” Sandia Report, (2012).
- apply_DIRINT_model(use_pressure=False, use_dew_temperature=False)#
apply_DIRINT_model(self, use_pressure=False, use_dew_temperature=False)
Determines direct normal irradiance (DNI) using the pvlib.irradiance.dirint() function [1].
- Parameters:
use_pressure (boolian, optional) – Default: False
use_dew_temperature (boolian, optional) – Default: False
- Return type:
Returns a reference to the invoking SolarWorkflowManager object.
Notes
Required data in the sim_data dictionary are ‘global_horizontal_irradiance’, ‘surface_pressure’, ‘surface_dew_temperature’, ‘apparent_solar_zenith’, ‘air_mass’ and ‘extra_terrestrial_irradiance’.
References
[1] https://pvlib-python.readthedocs.io/en/stable/generated/pvlib.irradiance.dirint.html
[2] Perez, R., P. Ineichen, E. Maxwell, R. Seals and A. Zelenka, (1992). “Dynamic Global-to-Direct Irradiance Conversion Models”. ASHRAE Transactions-Research Series, pp. 354-369
[3] Maxwell, E. L., “A Quasi-Physical Model for Converting Hourly Global Horizontal to Direct Normal Insolation”, Technical Report No. SERI/TR-215-3087, Golden, CO: Solar Energy Research Institute, 1987.
- diffuse_horizontal_irradiance_from_trigonometry()#
diffuse_horizontal_irradiance_from_trigonometry(self)
Calculates the diffuse horizontal irradiance from global horizontal irradiance, direct normal irradiance and apparent zenith.
[TODO: Add a simple equation such as the one given in ‘direct_normal_irradiance_from_trigonometry’]
- Parameters:
None
- Return type:
Returns a reference to the invoking SolarWorkflowManager object.
Notes
Required data in the sim_data dictionary are ‘global_horizontal_irradiance’, ‘direct_normal_irradiance’ and ‘apparent_solar_zenith’.
- direct_normal_irradiance_from_trigonometry()#
direct_normal_irradiance_from_trigonometry(self):
- Parameters:
None
- Return type:
Returns a reference to the invoking SolarWorkflowManager object.
Notes
Required columns in the placements dataframe to use this functions are ‘lon’, ‘lat’ and ‘elev’. Required data in the sim_data dictionary are ‘direct_horizontal_irradiance’ and ‘apparent_solar_zenith’.
- Calculates the direct normal irradiance from the following equation:
- \[dir_nor_irr = dir_hor_irr / cos( solar_zenith )\]
Where: dir_nor_irr -> The direct irradiance on the normal plane dir_hor_irr -> The direct irradiance on the horizontal plane solar_zenith -> The solar zenith angle in radians
- permit_single_axis_tracking(max_angle=90, backtrack=True, gcr=2.0 / 7.0)#
permit_single_axis_tracking(self, max_angle=90, backtrack=True, gcr=2.0 / 7.0)
Permits single axis tracking in the simulation using the pvlib.tracking.singleaxis() function [1].
- Parameters:
max_angle (float, optional) – default 90 A value denoting the maximum rotation angle, in decimal degrees, of the one-axis tracker from its horizontal position (horizontal if axis_tilt = 0). A max_angle of 90 degrees allows the tracker to rotate to a vertical position to point the panel towards a horizon. max_angle of 180 degrees allows for full rotation [1].
backtrack (bool, optional) – default True Controls whether the tracker has the capability to “backtrack” to avoid row-to-row shading. False denotes no backtrack capability. True denotes backtrack capability [1].
gcr (float, optional) – default 2.0/7.0 A value denoting the ground coverage ratio of a tracker system which utilizes backtracking; i.e. the ratio between the PV array surface area to total ground area. A tracker system with modules 2 meters wide, centered on the tracking axis, with 6 meters between the tracking axes has a gcr of 2/6=0.333. If gcr is not provided, a gcr of 2/7 is default. gcr must be <=1 [1].
- Return type:
Returns a reference to the invoking SolarWorkflowManager object.
Notes
Required columns in the placements dataframe to use this functions are ‘lon’, ‘lat’, ‘elev’, ‘tilt’ and ‘azimuth’. Required data in the sim_data dictionary are ‘apparent_solar_zenith’ and ‘solar_azimuth’.
References
[2] Lorenzo, E et al., 2011, “Tracking and back-tracking”, Prog. in Photovoltaics: Research and Applications, v. 19, pp. 747-753.
- determine_angle_of_incidence()#
determine_angle_of_incidence(self)
Determines the angle of incidence [TODO: credit the PVLib function as you’ve done in previous examples].
- Parameters:
None
- Return type:
Returns a reference to the invoking SolarWorkflowManager object.
Notes
Required data in the sim_data dictionary are ‘apparent_solar_zenith’ and ‘solar_azimuth’.
- estimate_plane_of_array_irradiances(transposition_model='perez', albedo=0.25, **kwargs)#
estimate_plane_of_array_irradiances(self, transposition_model=”perez”, albedo=0.25, **kwargs)
Estimates the plane of array irradiance using the pvlib.irradiance.get_total_irradiance() function [1].
- Parameters:
transportion_model (str, optional) – default “perez”
albedo (numeric, optional) – default 0.25 Surface albedo [1].
- Return type:
Returns a reference to the invoking SolarWorkflowManager object.
Notes
Required data in the sim_data dictionary are ‘apparent_solar_zenith’, ‘solar_azimuth’, ‘direct_normal_irradiance’, ‘global_horizontal_irradiance’, ‘diffuse_horizontal_irradiance’, ‘extra_terrestrial_irradiance’ and ‘air_mass’.
References
[1] https://pvlib-python.readthedocs.io/en/stable/generated/pvlib.irradiance.get_total_irradiance.html
- _fix_bad_plane_of_array_values()#
- cell_temperature_from_sapm(mounting='glass_open_rack')#
cell_temperature_from_sapm(self, mounting=”glass_open_rack”)
Calculates the cell temperature based on the pvlib.temperature.sapm_cell() function [1].
- Parameters:
mounting (str) – Options: “glass_open_rack” [1] “glass_close_roof” [1] “polymer_open_rack” [1] “polymer_insulated_back” [1]
- Return type:
Returns a reference to the invoking SolarWorkflowManager object.
Notes
Required data in the sim_data dictionary are ‘surface_wind_speed’, ‘surface_air_temperature’ and ‘poa_global’.
References
[1] https://pvlib-python.readthedocs.io/en/stable/generated/pvlib.temperature.sapm_cell.html
- apply_angle_of_incidence_losses_to_poa()#
apply_angle_of_incidence_losses_to_poa(self)
Applies the angle of incidence losses to the plane-of-array irradiance using the pvlib.pvsystem.iam.physical() function [1].
- Parameters:
None
- Return type:
Returns a reference to the invoking SolarWorkflowManager object.
Notes
Required data in the sim_data dictionary are ‘poa_direct’, ‘poa_ground_diffuse’ and ‘poa_sky_diffuse’.
References
[1] https://pvlib-python.readthedocs.io/en/stable/generated/pvlib.iam.physical.html
- configure_cec_module(module='WINAICO WSx-240P6', tech_year=2050)#
configure_cec_module(self, module=”WINAICO WSx-240P6”)
Configures CEC of a module based on the outputs of the pvlib.pvsystem.retrieve_sam() function [1].
- Parameters:
module (str or dict) –
- Must be one of:
A module found in the pvlib.pvsystem.retrieve_sam(“CECMod”) database
”WINAICO WSx-240P6” -> Good for open-field applications
”LG Electronics LG370Q1C-A5” -> Good for rooftop applications
- A dict containing a set of module parameters, including:
T_NOCT, A_c, N_s, I_sc_ref, V_oc_ref, I_mp_ref, V_mp_ref, alpha_sc, beta_oc, a_ref, I_L_ref, I_o_ref, R_s, R_sh_ref, Adjust, gamma_r, PTC
tech_year (int, optional) – If given in combination with the projected module str names “WINAICO WSx-240P6” or “LG Electronics LG370Q1C-A5”, the effifiency will be scaled linearly to the given year. Must then be between year of market comparison in analysis (2019) and 2050. Will be ignored when non-projected existing module names or specific parameters are given, can then be None. By default 2050.
- Return type:
Returns a reference to the invoking SolarWorkflowManager object
References
[1] https://pvlib-python.readthedocs.io/en/stable/generated/pvlib.pvsystem.retrieve_sam.html
- simulate_with_interpolated_single_diode_approximation(module='WINAICO WSx-240P6', tech_year=2050)#
simulate_with_interpolated_single_diode_approximation(self, module=”WINAICO WSx-240P6”)
Does the simulation with an interpolated single diode approximation using the pvlib.pvsystem.calcparams_desoto() [1] function and the pvlib.pvsystem.singlediode() [2] function.
- Parameters:
module (str) –
- Must be one of:
A module found in the pvlib.pvsystem.retrieve_sam(“CECMod”) database
”WINAICO WSx-240P6” -> Good for open-field applications
”LG Electronics LG370Q1C-A5” -> Good for rooftop applications
tech_year (int, optional) – If given in combination with the projected module str names “WINAICO WSx-240P6” or “LG Electronics LG370Q1C-A5”, the effifiency will be scaled linearly to the given year. Must then be between year of market comparison in analysis (2019) and 2050. Will be ignored when non-projected existing module names or specific parameters are given, can then be None. By default 2050.
- Return type:
Returns a reference to the invoking SolarWorkflowManager object.
Notes
Required columns in the placements dataframe to use this functions are ‘lon’, ‘lat’, ‘elev’, ‘tilt’ and ‘azimuth’. Required data in the sim_data dictionary are ‘poa_global’ and ‘cell_temperature’.
References
[1] https://pvlib-python.readthedocs.io/en/stable/generated/pvlib.pvsystem.calcparams_desoto.html
[2] https://pvlib-python.readthedocs.io/en/stable/generated/pvlib.pvsystem.singlediode.html
[3] (1, 2) W. De Soto et al., “Improvement and validation of a model for photovoltaic array performance”, Solar Energy, vol 80, pp. 78-88, 2006.
[4] System Advisor Model web page. https://sam.nrel.gov.
[5] A. Dobos, “An Improved Coefficient Calculator for the California Energy Commission 6 Parameter Photovoltaic Module Model”, Journal of Solar Energy Engineering, vol 134, 2012.
[6] O. Madelung, “Semiconductors: Data Handbook, 3rd ed.” ISBN 3-540-40488-0
[7] S.R. Wenham, M.A. Green, M.E. Watt, “Applied Photovoltaics” ISBN 0 86758 909 4
[8] A. Jain, A. Kapoor, “Exact analytical solutions of the parameters of real solar cells using Lambert W-function”, Solar Energy Materials and Solar Cells, 81 (2004) 269-277.
[9] D. King et al, “Sandia Photovoltaic Array Performance Model”, SAND2004-3535, Sandia National Laboratories, Albuquerque, NM
[10] “Computer simulation of the effects of electrical mismatches in photovoltaic cell interconnection circuits” JW Bishop, Solar Cell (1988) https://doi.org/10.1016/0379-6787(88)90059-2
- apply_inverter_losses(inverter, method='sandia')#
apply_inverter_losses(self, inverter, method=”sandia”, )
Applies inverter losses using the pvlib.pvsystem.snlinverter() function [1], the pvlib.pvsystem.retrieve_sam() function [2] and the pvlib.pvsystem.adrinverter() function [3].
- Parameters:
inverter (str) – Describes the inverter. [TODO: Add a more detailed description following the example of ‘configure_cec_module’]
method (str) – Options: “scandia” “driesse” Describes the used method to apply the inverter losses.
- Return type:
Returns a reference to the invoking SolarWorkflowManager object.
Notes
Required data in the sim_data dictionary are ‘module_dc_power_at_mpp’ and ‘module_dc_voltage_at_mpp’. Required data in the placements dataframe are ‘modules_per_string’ and ‘strings_per_inverter’. Cannot simultaneously provide ‘capacity’ and inverter-string parameters.
References
[1] https://pvlib-python.readthedocs.io/en/stable/generated/pvlib.pvsystem.snlinverter.html
[2] https://pvlib-python.readthedocs.io/en/stable/generated/pvlib.pvsystem.retrieve_sam.html
[3] https://pvlib-python.readthedocs.io/en/stable/generated/pvlib.pvsystem.adrinverter.html
[4] SAND2007-5036, “Performance Model for Grid-Connected Photovoltaic Inverters by D. King, S. Gonzalez, G. Galbraith, W. Boyson
[5] System Advisor Model web page. https://sam.nrel.gov.
[6] Beyond the Curves: Modeling the Electrical Efficiency of Photovoltaic Inverters, PVSC 2008, Anton Driesse et. al.
- estimate_missing_params(elev, convention='Ryberg2020')#