solar_workflow_manager
¶
Classes:
LazyLoader
¶
LazyLoader is a utility class which postpones the "real" importing of the desired module until the time when it is actually needed
Source code in reskit/solar/workflows/solar_workflow_manager.py
SolarWorkflowManager
¶
SolarWorkflowManager(placements)
Bases: WorkflowManager
__init_(self, placements)
Initialization of an instance of the generic SolarWorkflowManager class.
Parameters:
-
(placements¶pandas Dataframe) –The locations that the simulation should be run for. Columns must include "lon", "lat"
Returns:
-
SolarWorkflorManager–
Methods:
-
adjust_variable_to_long_run_average–Adjusts the average mean of the specified variable to a known long-run-average
-
apply_DIRINT_model–apply_DIRINT_model(self, use_pressure=False, use_dew_temperature=False)
-
apply_angle_of_incidence_losses_to_poa–apply_angle_of_incidence_losses_to_poa(self)
-
apply_elevation–apply_elevation(self)
-
apply_inverter_losses–apply_inverter_losses(self, inverter, method="sandia", )
-
apply_loss_factor–Applies a loss factor onto a specified variable
-
cell_temperature_from_sapm–cell_temperature_from_sapm(self, mounting="glass_open_rack")
-
configure_cec_module–configure_cec_module(self, module="WINAICO WSx-240P6")
-
determine_air_mass–determine_air_mass(self, model='kastenyoung1989')
-
determine_angle_of_incidence–determine_angle_of_incidence(self)
-
determine_extra_terrestrial_irradiance–determine_extra_terrestrial_irradiance(self, **kwargs)
-
determine_solar_position–determine_solar_position(self, lon_rounding=1, lat_rounding=1, elev_rounding=-2)
-
diffuse_horizontal_irradiance_from_trigonometry–diffuse_horizontal_irradiance_from_trigonometry(self)
-
direct_normal_irradiance_from_trigonometry–direct_normal_irradiance_from_trigonometry(self):
-
estimate_azimuth_from_latitude–estimate_azimuth_from_latitude(self)
-
estimate_plane_of_array_irradiances–estimate_plane_of_array_irradiances(self, transposition_model="perez", albedo=0.25, **kwargs)
-
estimate_tilt_from_latitude–estimate_tilt_from_latitude(self, convention)
-
extract_raster_values_at_placements–Extracts pixel values at each of the configured placements from the specified raster file
-
filter_positive_solar_elevation–filter_positive_solar_elevation(self)
-
get_scalar_values_from_raster–Auxiliary function to extract raster values with NaN fallback options.
-
permit_single_axis_tracking–permit_single_axis_tracking(self, max_angle=90, backtrack=True, gcr=2.0 / 7.0)
-
read–Reads the specified variables from the NetCDF4-style weather dataset, and then extracts
-
register_workflow_parameter–Add a parameter to the WorkflowManager which will be included in the output XArray dataset
-
set_time_index–Sets the time index of the WorkflowManager
-
simulate_with_interpolated_single_diode_approximation–simulate_with_interpolated_single_diode_approximation(self, module="WINAICO WSx-240P6")
-
spatial_disaggregation–[summary]
-
to_netcdf–Saves an XArray dataset to netCDF4 format
-
to_xarray–Generates an XArray dataset from the data currently contained in the WorkflowManager
Source code in reskit/solar/workflows/solar_workflow_manager.py
adjust_variable_to_long_run_average
¶
adjust_variable_to_long_run_average(
variable: str,
source_long_run_average: Union[str, float, ndarray],
real_long_run_average: Union[str, float, ndarray],
real_lra_scaling: float = 1,
spatial_interpolation: str = "linear-spline",
nodata_fallback: str = "nan",
nodata_fallback_scaling: float = 1,
allow_nans: bool = True,
)
Adjusts the average mean of the specified variable to a known long-run-average
Note:
uses the equation: variable[t] = variable[t] * real_long_run_average / source_long_run_average
Parameters:
-
(variable¶str) –The variable to be adjusted
-
(source_long_run_average¶Union[str, float, ndarray]) –The variable's native long run average (the average in the weather file) - If a string is given, it is expected to be a path to a raster file which can be used to look up the average values from using the coordinates in
.placements- If a numpy ndarray (or derivative) is given, the shape must be one of (time, placements) or at least (placements) -
(real_long_run_average¶Union[str, float, ndarray]) –The variables 'true' long run average - If a string is given, it is expected to be a path to a raster file which can be used to look up the average values from using the coordinates in
.placements- If a numpy ndarray (or derivative) is given, the shape must be one of (time, placements) or at least (placements) -
(real_lra_scaling¶float, default:1) –An optional scaling factor to apply to the values derived from
real_long_run_average. - This is primarily useful whenreal_long_run_averageis a path to a raster file - By default 1 -
(spatial_interpolation¶str, default:'linear-spline') –When either
source_long_run_averageorreal_long_run_averageare a path to a raster file, this input specifies which interpolation algorithm should be used - Options are: "near", "linear-spline", "cubic-spline", "average" - By default "linear-spline" - See for more info: geokit.raster.interpolateValues -
(nodata_fallback¶str, default:'nan') –When real_long_run_average has no data, one can decide between different fallback options, by default np.nan: - np.nan or None : return np.nan for missing values in real_long_run_average - float : Apply this float value as a scaling factor for all no-data locations only: source_long_run_average * nodata_fallback. NOTE: A value of 1.0 will return the source lra value in case of missing real lra values (no additional nodata_fallback_scaling applied). - str : Will be interpreted as a filepath to a raster with alternative real_long_run_average values, scaled by nodata_fallback_scaling. - callable : any callable method taking the arguments (all iterables): 'locs' and 'source_long_run_average_value' (the locations as gk.geom.point objects and original value from source data). The output values will be considered as the new real_long_run_average for missing locations only (absolute data, no additional nodata_fallback_scaling applied).
NOTE: np.nan will also be returned in case that the nodata fallback does not yield values either.
-
(nodata_fallback_scaling¶float, default:1) –An optional scaling factor to apply to the values derived from
nodata_fallback. - This is primarily useful whennodata_fallbackis a path to a raster file - By default 1 -
(allow_nans¶boolean, default:True) –If True, NaN values may remain after scaling, else an error will raised. By default True.
Returns:
-
WorkflowManager–Returns the invoking WorkflowManager (for chaining)
Source code in reskit/workflow_manager.py
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | |
apply_DIRINT_model
¶
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:
Returns:
-
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.
Source code in reskit/solar/workflows/solar_workflow_manager.py
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¶
Returns:
-
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
Source code in reskit/solar/workflows/solar_workflow_manager.py
apply_elevation
¶
apply_elevation(elev, fallback_elev=0)
apply_elevation(self)
Adds an elevation (name: 'elev') column to the placements data frame.
Parameters:
-
–elev¶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¶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.
Returns:
-
Returns a reference to the invoking SolarWorkflowManager object–
Source code in reskit/solar/workflows/solar_workflow_manager.py
apply_inverter_losses
¶
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].
Returns:
-
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.
Source code in reskit/solar/workflows/solar_workflow_manager.py
1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 | |
apply_loss_factor
¶
apply_loss_factor(
loss: Union[float, ndarray, FunctionType],
variables: Union[str, List[str]] = ["capacity_factor"],
)
Applies a loss factor onto a specified variable
Parameters:
-
(loss¶Union[float, ndarray, FunctionType]) –The loss factor(s) to be applied - If a float or a numpy ndarray is given, then the following operation is performed:
variable = variable * (1 - loss) - If a function is given, then the following operation is performed: variable = variable * (1 - loss(variable) ) - If a numpy ndarray is given, it must be broadcastable to the variable's shape in
.sim_data -
(variables¶Union[str, List[str]], default:['capacity_factor']) –The variable or variables to apply the loss factor to - By default ["capacity_factor"]
Returns:
-
WorkflowManager–Returns the invoking WorkflowManager (for chaining)
Source code in reskit/workflow_manager.py
cell_temperature_from_sapm
¶
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¶Options: "glass_open_rack" [1] "glass_close_roof" [1] "polymer_open_rack" [1] "polymer_insulated_back" [1]
Returns:
-
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
Source code in reskit/solar/workflows/solar_workflow_manager.py
configure_cec_module
¶
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¶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, default:2050) –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.
Returns:
-
Returns a reference to the invoking SolarWorkflowManager object–
References
[1] https://pvlib-python.readthedocs.io/en/stable/generated/pvlib.pvsystem.retrieve_sam.html
Source code in reskit/solar/workflows/solar_workflow_manager.py
908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 | |
determine_air_mass
¶
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¶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]
Returns:
-
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).
Source code in reskit/solar/workflows/solar_workflow_manager.py
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¶
Returns:
-
Returns a reference to the invoking SolarWorkflowManager object.–
Notes
Required data in the sim_data dictionary are 'apparent_solar_zenith' and 'solar_azimuth'.
Source code in reskit/solar/workflows/solar_workflow_manager.py
determine_extra_terrestrial_irradiance
¶
determine_extra_terrestrial_irradiance(self, **kwargs)
Determines extra terrestrial irradiance using the pvlib.irradiance.get_extra_radiation() function [1].
Parameters:
-
–None¶
Returns:
-
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] https://web.archive.org/web/20230529210255/http://solardat.uoregon.edu/SolarRadiationBasics.html, Eqs. SR1 and SR2 (the UO SRML moved to solardata.uoregon.edu and dropped this page; the archived copy is cited because it carries the numbered equations)
[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.
Source code in reskit/solar/workflows/solar_workflow_manager.py
determine_solar_position
¶
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¶Decimal places that the longitude should be rounded to. Default is 1. -
–lat_rounding¶Decimal places that the latitude should be rounded to. Default is 1. -
–elev_rounding¶Decimal places that the elevation should be rounded to. Default is -2.
Returns:
-
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
Source code in reskit/solar/workflows/solar_workflow_manager.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | |
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¶
Returns:
-
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'.
Source code in reskit/solar/workflows/solar_workflow_manager.py
direct_normal_irradiance_from_trigonometry
¶
direct_normal_irradiance_from_trigonometry(self):
Parameters:
-
–None¶
Returns:
-
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: .. math:: 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
Source code in reskit/solar/workflows/solar_workflow_manager.py
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¶
Returns:
-
Returns a reference to the invoking SolarWorkflowManager object–
Source code in reskit/solar/workflows/solar_workflow_manager.py
estimate_plane_of_array_irradiances
¶
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:
Returns:
-
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
Source code in reskit/solar/workflows/solar_workflow_manager.py
estimate_tilt_from_latitude
¶
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) –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.
Returns:
-
Returns a reference to the invoking SolarWorkflowManager object–
Source code in reskit/solar/workflows/solar_workflow_manager.py
extract_raster_values_at_placements
¶
Extracts pixel values at each of the configured placements from the specified raster file
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¶
Returns:
-
Returns a reference to the invoking SolarWorkflowManager object–
Notes
Required data in the sim_data dictionary are 'apparent_solar_zenith'.
Source code in reskit/solar/workflows/solar_workflow_manager.py
get_scalar_values_from_raster
¶
Auxiliary function to extract raster values with NaN fallback options.
Source code in reskit/workflow_manager.py
permit_single_axis_tracking
¶
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¶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¶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¶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].
Returns:
-
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
[1] https://wholmgren-pvlib-python-new.readthedocs.io/en/doc-reorg2/generated/tracking/pvlib.tracking.singleaxis.html
[2] Lorenzo, E et al., 2011, “Tracking and back-tracking”, Prog. in Photovoltaics: Research and Applications, v. 19, pp. 747-753.
Source code in reskit/solar/workflows/solar_workflow_manager.py
578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 | |
read
¶
read(
variables: Union[str, List[str]],
source_type: str,
source: str,
set_time_index: bool = False,
spatial_interpolation_mode: str = "bilinear",
temporal_reindex_method: str = "nearest",
time_index_from=None,
**kwargs,
)
Reads the specified variables from the NetCDF4-style weather dataset, and then extracts
those variables for each of the coordinates configured in .placements. The resulting
data is then available in .sim_data.
Parameters:
-
(variables¶str or list of strings) –The variables (or variables) to be read from the specified source - If a path to a weather source is given, then only the 'standard' variables configured for that source type are available (see the doc string for the weather source you are interested in) - If either 'elevated_wind_speed' or 'surface_wind_speed' is included in the variable list, then the members
.elevated_wind_speed_heightand.surface_wind_speed_height, respectfully, are also added. These are constants which specify what the 'native' wind speed height is, which depends on the source - A pre-loaded NCSource can also be given, thus allowing for any variable in the source to be specified in thevariableslist. But the user needs to take care of initializing the NCSource and loading the data they want -
(source_type¶str) –The type of weather datasource which is to be loaded. Can be one of: "ERA5", "SARAH", "MERRA", or 'user' - If a pre-loaded NCSource is given for the
sourceobject, then thesource_typeshould be "user" -
(source¶str or NCSource) –The source to read weather variables from
-
(set_time_index¶bool, default:False) –If True, instructs the workflow manager to set the time index to that which is read from the weather source - By default False
-
(spatial_interpolation_mode¶str, default:'bilinear') –The spatial interpolation mode to use while reading data from the weather source at each of the placement coordinates - By default "bilinear"
-
(temporal_reindex_method¶str, default:'nearest') –In the event of missing data, this algorithm is used to fill in the missing data. - Can be, for example, "nearest", "ffill", "bfill", "interpolate" - By default "nearest"
Returns:
-
WorkflowManager–Returns the invoking WorkflowManager (for chaining)
Raises:
-
RuntimeError–If set_time_index is False but no
.time_indexexists -
RuntimeError–If source_type is unknown
Source code in reskit/workflow_manager.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
register_workflow_parameter
¶
Add a parameter to the WorkflowManager which will be included in the output XArray dataset
Parameters:
-
(key¶str) –The workflow parameter's access key
-
(value¶Union[str, float]) –The workflow parameter's value. Only strings and floats are allowed
Source code in reskit/workflow_manager.py
set_time_index
¶
Sets the time index of the WorkflowManager
Source code in reskit/workflow_manager.py
simulate_with_interpolated_single_diode_approximation
¶
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¶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, default:2050) –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.
Returns:
-
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
Source code in reskit/solar/workflows/solar_workflow_manager.py
1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 | |
spatial_disaggregation
¶
spatial_disaggregation(
variable: str,
source_high_resolution: Union[str, float, ndarray],
source_low_resolution: Union[str, float, ndarray],
real_lra_scaling: float = 1,
spatial_interpolation: str = "linear-spline",
)
[summary]
Parameters:
-
(variable¶str) –[description]
-
(source_long_run_average¶Union[str, float, ndarray]) –[description]
-
(real_long_run_average¶Union[str, float, ndarray]) –[description]
-
(real_lra_scaling¶float, default:1) –[description], by default 1
-
(spatial_interpolation¶str, default:'linear-spline') –[description], by default "linear-spline"
Source code in reskit/workflow_manager.py
to_netcdf
¶
to_netcdf(
xds: Dataset,
output_netcdf_path: str = None,
output_variables: List[str] = None,
custom_attributes: dict = None,
_intermediate_dict=False,
) -> str
Saves an XArray dataset to netCDF4 format
Note:
- The .placements data is automatically added to the XArray dataset along the 'locations' dimension
- The workflow_parameters data is automatically added as dimensionless variables
- The .sim_data is automatically added along the dimensions (time, locations)
- The .time_index is automatically added along the dimension 'time'
Parameters:
-
(xds¶Dataset) –The XArray dataset to save
-
(output_netcdf_path¶str, default:None) –If given, the XArray dataset will be written to disc at the specified path - By default None
-
(output_variables¶List[str], default:None) –If given, specifies the variables which should be included in the resulting dataset. Otherwise all suitable variables found in
.placements,.workflow_parameters,.sim_data, and.time_indexwill be included - Only variables of numeric or string type are suitable due to NetCDF4 limitations - By default None -
(custom_attributes¶dict, default:None) –If given, adds the key-value pairs as attributes to the XArray dataset before saving - These will be added in addition to existing attributes - By default None
Returns:
-
output_netcdf_path–The resulting output_netcdf_path
Source code in reskit/workflow_manager.py
to_xarray
¶
to_xarray(
output_netcdf_path: str = None,
output_variables: List[str] = None,
custom_attributes: dict = None,
_intermediate_dict=False,
) -> Dataset
Generates an XArray dataset from the data currently contained in the WorkflowManager
Note:
- The .placements data is automatically added to the XArray dataset along the 'locations' dimension
- The workflow_parameters data is automatically added as dimensionless variables
- The .sim_data is automatically added along the dimensions (time, locations)
- The .time_index is automatically added along the dimension 'time'
Parameters:
-
(output_netcdf_path¶str, default:None) –If given, the XArray dataset will be written to disc at the specified path - By default None
-
(output_variables¶List[str], default:None) –If given, specifies the variables which should be included in the resulting dataset. Otherwise all suitable variables found in
.placements,.workflow_parameters,.sim_data, and.time_indexwill be included - Only variables of numeric or string type are suitable due to NetCDF4 limitations - By default None -
(custom_attributes¶dict, default:None) –If given, adds the key-value pairs as attributes to the XArray dataset - These will be added in addition to the workflow_parameters - By default None
Returns:
-
Dataset–The resulting XArray dataset
Source code in reskit/workflow_manager.py
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 | |