13
13
import pandas as pd
14
14
from dataclasses import dataclass
15
15
from abc import ABC , abstractmethod
16
+ from typing import Optional
16
17
17
18
import warnings
18
19
from pvlib ._deprecation import deprecated , pvlibDeprecationWarning
@@ -200,7 +201,7 @@ def __init__(self,
200
201
array_losses_parameters = _build_kwargs (['dc_ohmic_percent' ],
201
202
losses_parameters )
202
203
self .arrays = (Array (
203
- FixedMount (surface_tilt , surface_azimuth ),
204
+ FixedMount (surface_tilt , surface_azimuth , racking_model ),
204
205
albedo ,
205
206
surface_type ,
206
207
module ,
@@ -209,7 +210,6 @@ def __init__(self,
209
210
temperature_model_parameters ,
210
211
modules_per_string ,
211
212
strings_per_inverter ,
212
- racking_model ,
213
213
array_losses_parameters ,
214
214
),)
215
215
else :
@@ -775,15 +775,22 @@ def fuentes_celltemp(self, poa_global, temp_air, wind_speed,
775
775
poa_global = self ._validate_per_array (poa_global )
776
776
temp_air = self ._validate_per_array (temp_air , system_wide = True )
777
777
wind_speed = self ._validate_per_array (wind_speed , system_wide = True )
778
- surface_tilt = self ._validate_per_array (wind_speed , system_wide = True )
778
+ surface_tilt = self ._validate_per_array (surface_tilt , system_wide = True )
779
779
780
780
def _build_kwargs_fuentes (array , user_tilt ):
781
781
kwargs = {'surface_tilt' : user_tilt }
782
+ if array .mount .module_height is not None :
783
+ kwargs ['module_height' ] = array .mount .module_height
782
784
temp_model_kwargs = _build_kwargs ([
783
- 'noct_installed' , 'module_height' , ' wind_height' , 'emissivity' ,
785
+ 'noct_installed' , 'wind_height' , 'emissivity' ,
784
786
'absorption' , 'surface_tilt' , 'module_width' , 'module_length' ],
785
787
array .temperature_model_parameters )
786
788
kwargs .update (temp_model_kwargs )
789
+ if kwargs ['surface_tilt' ] is None :
790
+ raise ValueError (
791
+ "surface_tilt must be specified in "
792
+ "PVSystem.fuentes_celltemp if not providing a "
793
+ "default in the Array's temperature_model_parameters" )
787
794
return kwargs
788
795
return tuple (
789
796
temperature .fuentes (
@@ -1145,6 +1152,7 @@ def temperature_model_parameters(self, value):
1145
1152
1146
1153
@property
1147
1154
def surface_tilt (self ):
1155
+ # TODO: make sure this is merged correctly with #1196
1148
1156
if len (self .arrays ) == 1 :
1149
1157
msg = (
1150
1158
'PVSystem.surface_tilt attribute is deprecated. '
@@ -1159,6 +1167,7 @@ def surface_tilt(self):
1159
1167
1160
1168
@surface_tilt .setter
1161
1169
def surface_tilt (self , value ):
1170
+ # TODO: make sure this is merged correctly with #1196
1162
1171
if len (self .arrays ) == 1 :
1163
1172
msg = (
1164
1173
'PVSystem.surface_tilt attribute is deprecated. '
@@ -1173,6 +1182,7 @@ def surface_tilt(self, value):
1173
1182
1174
1183
@property
1175
1184
def surface_azimuth (self ):
1185
+ # TODO: make sure this is merged correctly with #1196
1176
1186
if len (self .arrays ) == 1 :
1177
1187
msg = (
1178
1188
'PVSystem.surface_azimuth attribute is deprecated. '
@@ -1187,6 +1197,7 @@ def surface_azimuth(self):
1187
1197
1188
1198
@surface_azimuth .setter
1189
1199
def surface_azimuth (self , value ):
1200
+ # TODO: make sure this is merged correctly with #1196
1190
1201
if len (self .arrays ) == 1 :
1191
1202
msg = (
1192
1203
'PVSystem.surface_azimuth attribute is deprecated. '
@@ -1207,12 +1218,14 @@ def albedo(self):
1207
1218
@property
1208
1219
@_unwrap_single_value
1209
1220
def racking_model (self ):
1210
- return tuple (array .racking_model for array in self .arrays )
1221
+ # TODO: make sure this is merged correctly with #1196
1222
+ return tuple (array .mount .racking_model for array in self .arrays )
1211
1223
1212
1224
@racking_model .setter
1213
1225
def racking_model (self , value ):
1226
+ # TODO: make sure this is merged correctly with #1196
1214
1227
for array in self .arrays :
1215
- array .racking_model = value
1228
+ array .mount . racking_model = value
1216
1229
1217
1230
@property
1218
1231
@_unwrap_single_value
@@ -1277,13 +1290,11 @@ class Array:
1277
1290
strings: int, default 1
1278
1291
Number of parallel strings in the array.
1279
1292
1280
- racking_model : None or string, default None
1281
- Valid strings are 'open_rack', 'close_mount', and 'insulated_back'.
1282
- Used to identify a parameter set for the SAPM cell temperature model.
1283
-
1284
1293
array_losses_parameters: None, dict or Series, default None.
1285
1294
Supported keys are 'dc_ohmic_percent'.
1286
1295
1296
+ name: None or str, default None
1297
+ Name of Array instance.
1287
1298
"""
1288
1299
1289
1300
def __init__ (self , mount ,
@@ -1292,7 +1303,7 @@ def __init__(self, mount,
1292
1303
module_parameters = None ,
1293
1304
temperature_model_parameters = None ,
1294
1305
modules_per_string = 1 , strings = 1 ,
1295
- racking_model = None , array_losses_parameters = None ,
1306
+ array_losses_parameters = None ,
1296
1307
name = None ):
1297
1308
self .mount = mount
1298
1309
@@ -1309,7 +1320,6 @@ def __init__(self, mount,
1309
1320
self .module_parameters = module_parameters
1310
1321
1311
1322
self .module_type = module_type
1312
- self .racking_model = racking_model
1313
1323
1314
1324
self .strings = strings
1315
1325
self .modules_per_string = modules_per_string
@@ -1329,7 +1339,7 @@ def __init__(self, mount,
1329
1339
1330
1340
def __repr__ (self ):
1331
1341
attrs = ['name' , 'mount' , 'module' ,
1332
- 'albedo' , 'racking_model' , ' module_type' ,
1342
+ 'albedo' , 'module_type' ,
1333
1343
'temperature_model_parameters' ,
1334
1344
'strings' , 'modules_per_string' ]
1335
1345
@@ -1340,7 +1350,7 @@ def __repr__(self):
1340
1350
def _infer_temperature_model_params (self ):
1341
1351
# try to infer temperature model parameters from from racking_model
1342
1352
# and module_type
1343
- param_set = f'{ self .racking_model } _{ self .module_type } '
1353
+ param_set = f'{ self .mount . racking_model } _{ self .module_type } '
1344
1354
if param_set in temperature .TEMPERATURE_MODEL_PARAMETERS ['sapm' ]:
1345
1355
return temperature ._temperature_model_params ('sapm' , param_set )
1346
1356
elif 'freestanding' in param_set :
@@ -1625,6 +1635,8 @@ class FixedMount(AbstractMount):
1625
1635
1626
1636
surface_tilt : float = 0.0
1627
1637
surface_azimuth : float = 180.0
1638
+ racking_model : Optional [str ] = None
1639
+ module_height : Optional [float ] = None
1628
1640
1629
1641
def get_orientation (self , solar_zenith , solar_azimuth ):
1630
1642
# note -- docstring is automatically inherited from AbstractMount
@@ -1686,6 +1698,8 @@ class SingleAxisTrackerMount(AbstractMount):
1686
1698
backtrack : bool = True
1687
1699
gcr : float = 2 / 7
1688
1700
cross_axis_tilt : float = 0.0
1701
+ racking_model : Optional [str ] = None
1702
+ module_height : Optional [float ] = None
1689
1703
1690
1704
def get_orientation (self , solar_zenith , solar_azimuth ):
1691
1705
# note -- docstring is automatically inherited from AbstractMount
0 commit comments