Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fixed_sys = {'surface_tilt': 20,
'surface_azimuth': 180,
'albedo': 0.2}
tracker_sys1 = {'axis_tilt': 0, 'axis_azimuth': 0,
'max_angle': 90, 'backtrack': True,
'gcr': 0.2, 'albedo': 0.2}
tracker_sys2 = {'max_angle': 52, 'gcr': 0.3}
fx_sys = pvc.pvlib_system(fixed_sys)
trck_sys1 = pvc.pvlib_system(tracker_sys1)
trck_sys2 = pvc.pvlib_system(tracker_sys1)
self.assertIsInstance(fx_sys,
pvlib.pvsystem.PVSystem,
'Did not return instance of\
pvlib PVSystem')
self.assertIsInstance(trck_sys1,
pvlib.tracking.SingleAxisTracker,
'Did not return instance of\
pvlib SingleAxisTracker')
self.assertIsInstance(trck_sys2,
pvlib.tracking.SingleAxisTracker,
'Did not return instance of\
pvlib SingleAxisTracker')
def cell_temperature(poa, windspeed, ambient_temperature,
temperature_model):
kwargs = dict(
poa_global=poa,
wind_speed=windspeed,
temp_air=ambient_temperature
)
if temperature_model is not None:
kwargs['model'] = temperature_model
tcell = pvlib.pvsystem.sapm_celltemp(**kwargs)
return tcell['temp_cell']
# preparing the weather data to suit pvlib's needs
# different name for the wind speed
my_weather.data.rename(columns={'v_wind': 'wind_speed'}, inplace=True)
# temperature in degree Celsius instead of Kelvin
my_weather.data['temp_air'] = my_weather.data.temp_air - 273.15
# calculate ghi
my_weather.data['ghi'] = my_weather.data.dirhi + my_weather.data.dhi
w = my_weather.data
# time index from weather data set
times = my_weather.data.index
# get module and inverter parameter from sandia database
sandia_modules = pvlib.pvsystem.retrieve_sam('SandiaMod')
sapm_inverters = pvlib.pvsystem.retrieve_sam('sandiainverter')
# own module parameters
invertername = 'ABB__MICRO_0_25_I_OUTD_US_208_208V__CEC_2014_'
yingli210 = {
'module_parameters': sandia_modules['Yingli_YL210__2008__E__'],
'inverter_parameters': sapm_inverters[invertername],
'surface_azimuth': 180,
'surface_tilt': 60,
'albedo': 0.2,
}
# own location parameter
wittenberg = {
'altitude': 34,
'name': 'Wittenberg',
'latitude': my_weather.latitude,
ac_loss_factor : float
poa_effective : pd.Series
temp_air : pd.Series, default 20
wind_speed : pd.Series, default 1
Returns
-------
ac_power : pd.Series
"""
pvtemps = pvlib.temperature.pvsyst_cell(poa_effective, temp_air,
wind_speed=wind_speed)
dc = pvlib.pvsystem.pvwatts_dc(poa_effective, pvtemps, dc_capacity,
temperature_coefficient / 100)
dc *= (1 - dc_loss_factor / 100)
# set eta values to turn off clipping in pvwatts_ac
ac = pvlib.pvsystem.pvwatts_ac(dc, dc_capacity, eta_inv_nom=1,
eta_inv_ref=1)
ac = ac.clip(upper=ac_capacity)
ac *= (1 - ac_loss_factor / 100)
return ac
model=transposition_model,
dni_extra=dni_extra)
if weather is None:
weather = {'wind_speed': 0, 'temp_air': 20}
cell_temperature = temperature.sapm_cell(
total_irrad['poa_global'], weather['temp_air'], weather['wind_speed'],
temperature_model_parameters['a'], temperature_model_parameters['b'],
temperature_model_parameters['deltaT'])
effective_irradiance = pvsystem.sapm_effective_irradiance(
total_irrad['poa_direct'], total_irrad['poa_diffuse'], airmass, aoi,
module_parameters)
dc = pvsystem.sapm(effective_irradiance, cell_temperature,
module_parameters)
ac = inverter.sandia(dc['v_mp'], dc['p_mp'], inverter_parameters)
return dc, ac