Hi Henry,
The 'system_capacity' input to the pvsamv1 module is an example of an interdependent variable.
In the pvsamv1 documentation, you can see a list of variables on which 'system_capacity' depends:
nrel-pysam.readthedocs.io/en/master/modules/Pvsamv1.html#PySAM.Pvsamv1.Pvsamv1.SystemDesign.system_capacity.
See the section on interdependent variables for more information:
nrel-pysam.readthedocs.io/en/master/interdependent-variables.html
However, I think the problem in your script is with the way you are importing modules from PySAM. For the wind model you have:
PySAM.Windpower as WindPower
And, then, later on:
gs_dat = dict_to_ssc_table(dic, "WindPower")
Windmodel = WindPower.wrap(gs_dat)
But for the PV model:
import PySAM.Pvsamv1 as pv1
And, then:
PVmodel_dat = dict_to_ssc_table(dic, "FlatPlatePVNone")
gridmodel_dat = dict_to_ssc_table(dic, "grid")
PVmodel = pv1.wrap(PVmodel_dat)
gridmodel = grid.wrap(gridmodel_dat)
It doesn't look like the pvsamv1 inputs are getting loaded properly. I think your call to dict_to_ssc_table() here should use 'pv1' instead of 'FlatPlatePVNone' as a parameter.
It might be easier to use the one of the methods described here to import your inputs from json instead of dict_to_ssc_table():
nrel-pysam.readthedocs.io/en/master/inputs-from-sam.html
If that information does not help, and you would like me to help troubleshoot, please attach minimal code along with a weather file that causes the error you are trying to fix.
Best regards,
Paul.