@@ -327,9 +327,9 @@ class ModelChain:
327
327
The ModelChain instance will be passed as the first argument to a
328
328
user-defined function.
329
329
330
- losses_model: str or function , default 'no_loss'
331
- Valid strings are 'pvwatts', 'no_loss'. The ModelChain instance
332
- will be passed as the first argument to a user-defined function .
330
+ losses_model: str, default 'no_loss'
331
+ Valid strings are 'pvwatts', 'no_loss'. The loss functions will
332
+ be set according to this parameter .
333
333
334
334
name: None or str, default None
335
335
Name of ModelChain instance.
@@ -935,13 +935,15 @@ def losses_model(self, model):
935
935
elif isinstance (model , str ):
936
936
model = model .lower ()
937
937
if model == 'pvwatts' :
938
- self ._losses_model = self .pvwatts_losses
938
+ self ._losses_model = model
939
+ self ._dc_losses = self .pvwatts_losses
939
940
elif model == 'no_loss' :
940
- self ._losses_model = self .no_extra_losses
941
+ self ._losses_model = model
942
+ self ._dc_losses = self .no_extra_losses
941
943
else :
942
944
raise ValueError (model + ' is not a valid losses model' )
943
945
else :
944
- self . _losses_model = partial ( model , self )
946
+ raise ValueError ( 'losses_model must be a string' )
945
947
946
948
def infer_losses_model (self ):
947
949
raise NotImplementedError
@@ -1374,7 +1376,7 @@ def _run_from_effective_irrad(self, data=None):
1374
1376
"""
1375
1377
self ._prepare_temperature (data )
1376
1378
self .dc_model ()
1377
- self .losses_model ()
1379
+ self ._dc_losses ()
1378
1380
self .ac_model ()
1379
1381
1380
1382
return self
0 commit comments