Skip to content

Commit d76e645

Browse files
committed
call prepare_inputs from run_model
1 parent 16e69d4 commit d76e645

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
@@ -280,7 +280,8 @@ def orientation_strategy(self, strategy):
280280

281281
def prepare_inputs(self, times, irradiance=None, weather=None):
282282
"""
283-
Run the model.
283+
Prepare the solar position, irradiance, and weather inputs to
284+
the model.
284285
285286
Parameters
286287
----------
@@ -339,6 +340,7 @@ def run_model(self):
339340
"""
340341
A stub function meant to be subclassed.
341342
"""
343+
342344
raise NotImplementedError(
343345
'you must subclass ModelChain and implement this method')
344346

@@ -347,20 +349,31 @@ class SAPM(ModelChain):
347349
"""
348350
Uses the SAPM to calculate cell temperature, DC power and AC power.
349351
"""
350-
def run_model(self):
352+
def run_model(self, times, irradiance=None, weather=None):
351353
"""
352354
Run the model.
353355
354356
Parameters
355357
----------
358+
times : DatetimeIndex
359+
Times at which to evaluate the model.
360+
361+
irradiance : None or DataFrame
362+
If None, calculates clear sky data.
363+
Columns must be 'dni', 'ghi', 'dhi'.
364+
365+
weather : None or DataFrame
366+
If None, assumes air temperature is 20 C and
367+
wind speed is 0 m/s.
368+
Columns must be 'wind_speed', 'temp_air'.
356369
357370
Returns
358371
-------
359372
self
360373
361374
Assigns attributes: temps, dc, ac
362375
"""
363-
376+
self.prepare_inputs(times, irradiance, weather)
364377

365378
self.temps = self.system.sapm_celltemp(self.total_irrad['poa_global'],
366379
self.weather['wind_speed'],
@@ -383,12 +396,23 @@ class SingleDiode(ModelChain):
383396
and the SAPM models to calculate cell temperature and AC power.
384397
"""
385398

386-
def run_model(self):
399+
def run_model(self, times, irradiance=None, weather=None):
387400
"""
388401
Run the model.
389402
390403
Parameters
391404
----------
405+
times : DatetimeIndex
406+
Times at which to evaluate the model.
407+
408+
irradiance : None or DataFrame
409+
If None, calculates clear sky data.
410+
Columns must be 'dni', 'ghi', 'dhi'.
411+
412+
weather : None or DataFrame
413+
If None, assumes air temperature is 20 C and
414+
wind speed is 0 m/s.
415+
Columns must be 'wind_speed', 'temp_air'.
392416
393417
Returns
394418
-------
@@ -397,6 +421,7 @@ def run_model(self):
397421
Assigns attributes: temps, dc, ac
398422
"""
399423

424+
self.prepare_inputs(times, irradiance, weather)
400425

401426
self.temps = self.system.sapm_celltemp(self.total_irrad['poa_global'],
402427
self.weather['wind_speed'],

0 commit comments

Comments
 (0)