Hi Paul,
I believe I am having the same "Attribute Error" issue when using the PySAM JSON Generate code option. I am following the Export SAM from GUI example (
To import a case from the SAM GUI — NREL-PySAM 3.0.0 documentation
), adapting for a PV-Battery, Single owner case. The code I am running is:
import json
import PySAM.Pvsamv1 as Pvsamv1
import PySAM.Grid as Grid
import PySAM.Utilityrate5 as UtilityRate
import PySAM.Singleowner as Singleowner
pv = Pvsamv1.new()
grid = Grid.from_existing(pv)
ur = UtilityRate.from_existing(pv)
so = Singleowner.from_existing(pv)
dir = "dummydir"
file_names = ["Phoenix_PV_plus_Storage_v1_pvsamv1",
"Phoenix_PV_plus_Storage_v1_grid",
"Phoenix_PV_plus_Storage_v1_utilityrate5",
"Phoenix_PV_plus_Storage_v1_singleowner"]
modules = [pv, grid, ur, so]
for f, m in zip(file_names, modules):
with open(dir + f + ".json", 'r') as file:
data = json.load(file)
for k, v in data.items():
if k != "number_inputs":
m.value(k, v)
Thanks in advance if you have time to look into this issue.
John