You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A little background on what I'm attempting to accomplish:
I am using XML and JSON files output from NREL's PVWatts API and other web services to get solar PV data for a given geographic location, and use it in Modelica models. I thought this would be a quicker approach than trying to re-create PVWatts in Modelica. Once I get this code working, I will be using it for wind data as well.
The Modelica code I'm using is:
model PVWatts "XML read test - PVWatts file"extends Modelica.Icons.Example;
// Read the PVWatts XML data fileExternData.XMLFile xmlfile(fileName=Modelica.Utilities.Files.loadResource("modelica://ExternData/Resources/Examples/PVWattsv5.xml"));
// Get the measurement station latitude and longitude from the file. This is just a test to make sure the file can be read.// Real stationLat = xmlfile.getReal("station-info.lat");// Real stationLon = xmlfile.getReal("station-info.lon");// Create an array to hold 12 monthly AC power valuesReal pvMonthly[12] = xmlfile.getRealArray1D("outputs.ac-monthly",12);
end PVWatts;
The two lines that read the station lat and lon work just fine. I run into trouble when attempting to read an array of 12 values from the XML file into the pvMonthly array. I've looked at the function code for getRealArray1D and I think I'm calling it correctly. Once this is working, I will be loading an array of 8760 values of hourly PV data.
The log file dump from Dymola when I run the above code is:
Log-file of program ./dymosim
(generated: Thu Jul 30 08:24:18 2015)
dymosim started
... "dsin.txt" loading (dymosim input file)
The following error was detected at time: 0
Error in line 33 when reading double value from file "C:/Users/jnangle/Desktop/Dymola/Libraries/ExternDatamaster/ExternData/Resources/Examples/PVWattsv5.xml"
The stack of functions is:
ExternData.Functions.XML.Internal.getRealArray1D
xmlfile.getRealArray1D_Unique'"xmlfile"'
xmlfile.getRealArray1D_Unique'"xmlfile"'(
"outputs.ac-monthly",
12,
xmlfile.xml)
Error: Failed to start model.
This is now fixed in v1.0.4, i.e. both xmlfile.getRealArray1D("outputs.ac-monthly",12) and xmlfile.getRealArray1D("outputs.ac-monthly.ac-monthly",12) work on your original XML file PVWattsv5.xml.
A little background on what I'm attempting to accomplish:
I am using XML and JSON files output from NREL's PVWatts API and other web services to get solar PV data for a given geographic location, and use it in Modelica models. I thought this would be a quicker approach than trying to re-create PVWatts in Modelica. Once I get this code working, I will be using it for wind data as well.
The Modelica code I'm using is:
The two lines that read the station lat and lon work just fine. I run into trouble when attempting to read an array of 12 values from the XML file into the pvMonthly array. I've looked at the function code for getRealArray1D and I think I'm calling it correctly. Once this is working, I will be loading an array of 8760 values of hourly PV data.
The log file dump from Dymola when I run the above code is:
The XML data I'm using is:
Apologies if this is a simple fix. I'm new to Modelica, but I have experience in Java and VBA.
Thank you in advance for your help.
The text was updated successfully, but these errors were encountered: