8000 call prepare_inputs from run_model · benbenboben/pvlib-python@e173d8b · GitHub
[go: up one dir, main page]

Skip to content

Commit e173d8b

Browse files
committed
call prepare_inputs from run_model
1 parent 6bee9fe commit e173d8b

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

pvlib/modelchain.py

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,8 @@ def orientation_strategy(self, strategy):
286286

287287
def prepare_inputs(self, times, irradiance=None, weather=None):
288288
"""
289-
Run the model.
289+
Prepare the solar position, irradiance, and weather inputs to
290+
the model.
290291
291292
Parameters
292293
----------
@@ -368,6 +369,7 @@ def run_model(self):
368369
"""
369370
A stub function meant to be subclassed.
370371
"""
372+
371373
raise NotImplementedError(
372374
'you must subclass ModelChain and implement this method')
373375

@@ -376,20 +378,31 @@ class SAPM(ModelChain):
376378
"""
377379
Uses the SAPM to calculate cell temperature, DC power and AC power.
378380
"""
379-
def run_model(self):
381+
def run_model(self, times, irradiance=None, weather=None):
380382
"""
381383
Run the model.
382384
383385
Parameters
384386
----------
387+
times : DatetimeIndex
388+
Times at which to evaluate the model.
389+
390+
irradiance : None or DataFrame
391+
If None, calculates clear sky data.
392+
Columns must be 'dni', 'ghi', 'dhi'.
393+
394+
weather : None or DataFrame
395+
If None, assumes air temperature is 20 C and
396+
wind speed is 0 m/s.
397+
Columns must be 'wind_speed', 'temp_air'.
385398
386399
Returns
387400
-------
388401
self
389402
390403
Assigns attributes: temps, dc, ac
391404
"""
392-
405+
self.prepare_inputs(times, irradiance, weather)
393406

394407
self.temps = self.system.sapm_celltemp(self.total_irrad['poa_global'],
395408
self.weather['wind_speed'],
@@ -414,12 +427,23 @@ class SingleDiode(ModelChain):
414427
and the SAPM models to calculate cell temperature and AC power.
415428
"""
416429

417-
def run_model(self):
430+
def run_model(self, times, irradiance=None, weather=None):
418431
"""
419432
Run the model.
420433
421434
Parameters
422435
----------
436+
times : DatetimeIndex
437+
Times at which to evaluate the model.
438+
439+
irradiance : None or DataFrame
440+
If None, calculates clear sky data.
441+
Columns must be 'dni', 'ghi', 'dhi'.
442+
443+
weather : None or DataFrame
444+
If None, assumes air temperature is 20 C and
445+
wind speed is 0 m/s.
446+
Columns must be 'wind_speed', 'temp_air'.
423447
424448
Returns
425449
-------
@@ -428,6 +452,7 @@ def run_model(self):
428452
Assigns attributes: temps, dc, ac
429453
"""
430454

455+
self.prepare_inputs(times, irradiance, weather)
431456

432457
self.temps = self.system.sapm_celltemp(self.total_irrad['poa_global'],
433458
self.weather['wind_speed'],

0 commit comments

Comments
 (0)
0