Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # in ModelChain
- def __init__(..., singlediode_calcparams_model=None)
- # calls setters
- self.singlediode_calcparams_model = singlediode_calcparams_model
- @property
- def singlediode_calcparams_model(self):
- return self._singlediode_calcparams_model
- @singlediode_calcparams_model.setter
- def singlediode_calcparams_model(self, model):
- if model is None:
- self._singlediode_calcparams_model = self.infer_singlediode_calcparams_model()
- elif isinstance(model, str):
- model = model.lower()
- if model == 'desoto':
- self._singlediode_calcparams_model = self.calcparams_desoto
- elif model == 'pvsyst':
- self._singlediode_calcparams_model = self.calcparams_pvsyst
- else:
- raise ValueError(model + ' is not a valid calcparams power model')
- else:
- self._singlediode_calcparams_model = partial(model, self)
- def infer_singlediode_calcparams_model(self):
- params = set(self.system.module_parameters.keys())
- if set([desoto_params_list]) <= params:
- return self.calcparams_desoto
- elif set([pvsyst_params_list]) <= params:
- return self.calcparams_pvsyst
- else:
- raise ValueError('could not infer calcparams model from '
- 'system.module_parameters')
- def calcparams_desoto(self):
- self.singlediode_params = self.system.calcparams_desoto(self.effective_irradiance,
- self.temps['temp_cell']))
- return self
- def calcparams_pvsyst(self):
- self.singlediode_params = self.system.calcparams_pvsyst(self.effective_irradiance,
- self.temps['temp_cell']))
- return self
- def singlediode(self):
- # removed call to self.system.calcparams_desoto
- # removed assignment to self.desoto
- self.dc = self.system.singlediode(*self.singlediode_params)
- self.dc = self.system.scale_voltage_current_power(self.dc).fillna(0)
- return self
Add Comment
Please, Sign In to add comment