@@ -90,6 +90,15 @@ def UserString(default: Any = Undefined, *, title: str = None, description: str
9090 )
9191
9292
93+ class PVLibBase (BaseModel ):
94+ """Provide a `pvlib_dict` method to convert parameters if needed
95+ for using in pvlib. Child classes may implement model-specific conversions
96+ as needed."""
97+
98+ def pvlib_dict (self ):
99+ return self .dict ()
100+
101+
93102class FixedTracking (BaseModel ):
94103 """Parameters for a fixed tilt array"""
95104
@@ -135,7 +144,7 @@ class SingleAxisTracking(BaseModel):
135144 )
136145
137146
138- class PVsystModuleParameters (BaseModel ):
147+ class PVsystModuleParameters (PVLibBase ):
139148 """Parameters for the modules that make up an array in a PVsyst-like model"""
140149
141150 alpha_sc : float = Field (
@@ -191,7 +200,7 @@ class PVsystModuleParameters(BaseModel):
191200 _modelchain_dc_model : str = PrivateAttr ("pvsyst" )
192201
193202
194- class PVWattsModuleParameters (BaseModel ):
203+ class PVWattsModuleParameters (PVLibBase ):
195204 """Parameters for the modules that make up an array in a PVWatts-like model"""
196205
197206 pdc0 : float = Field (
@@ -201,12 +210,17 @@ class PVWattsModuleParameters(BaseModel):
201210 gamma_pdc : float = Field (
202211 ...,
203212 description = (
204- "Temperature coefficient of power in units of 1 /C. "
205- "Typically -0.002 to -0.005 per degree C"
213+ "Temperature coefficient of power in units of % /C. "
214+ "Typically -0.2 to -0.5 % per degree C"
206215 ),
207216 )
208217 _modelchain_dc_model : str = PrivateAttr ("pvwatts" )
209218
219+ def pvlib_dict (self ):
220+ """Convert to a dict pvlib understands for `module_parameters`
221+ i.e. scale gamma_pdc to 1/C"""
222+ return {k : v / 100 if k == "gamma_pdc" else v for k , v in self .dict ().items ()}
223+
210224
211225class PVsystTemperatureParameters (BaseModel ):
212226 """Parameters for the cell temperature model of the modules in a
0 commit comments