Trouble with running SAM from a command batch line

  • lucas.spangher
  • Topic Author
More
17 Jul 2012 15:05 #706 by lucas.spangher
Hello!

Is the question regarding batch line runs ( sam.nrel.gov/content/command-line-batch-run ) outdated and not applicable to the 5.11.2012 version of NREL SAM? Following the exact format of the answer given to that question yields a run of the "Test Script" that produces all lines of code until the "Simulate" function (i.e. the most important one!) and then exits out of the program and makes as if it's done.

Any advice?

Thanks!

Please Log in or Create an account to join the conversation.

  • pgilman
More
17 Jul 2012 17:01 #707 by pgilman
You should still be able to run SAM from the command line with SAM 2012.5.11.

Please reply with a copy of your SAM file attached if you would like me to review your file.

Best regards,
Paul.

Please Log in or Create an account to join the conversation.

  • lucas.spangher
  • Topic Author
More
18 Jul 2012 13:31 #708 by lucas.spangher
Replied by lucas.spangher on topic Trouble with running SAM from a command batch line
Hi Paul,

I have identified almost the exact problem that is occurring. I'm running a modified version of the test case that is presented in the advanced PDF tutorial. The function getWeather makes it almost all the way through, but is unable to complete httpdownload(url,local). However, it is able to complete it when I run it directly from SAM.

I'm attaching my file, and I've commented it in way that I hope is helpful to you.

My guess was that it was a problem with directories. For memory purposes, I have the sam.exe in c:\Sam\2012.5.11\sam.exe, and I store weather data and outputs in c:\Users\Jon\SAM\Output\ and the simulation data in c:\Users\Jon\SAM\Output\\. Does this prevent cmd from calling Sam.exe? Is that necessary for httpdownload()? I'm a little bit flummoxed on why httpdownload isn't working. I hope that I've provided enough info for you. Let me know if you need more.

Also, I don't know if this is important or not, but I seem to be missing the samsim.dll that is mentioned earlier on. Was that removed during an upgrade?

Please Log in or Create an account to join the conversation.

  • lucas.spangher
  • Topic Author
More
18 Jul 2012 18:41 #709 by lucas.spangher
Replied by lucas.spangher on topic Trouble with running SAM from a command batch line
Update -- I have not solved the httpdownload problem, but I have wrapped this in a visual basic shell that can enable it to do the httpdownloading for it... thereby circumventing the problem.

I can provide that to anyone who wants it.

Please Log in or Create an account to join the conversation.

  • pgilman
More
19 Jul 2012 16:22 #710 by pgilman
The SamUL function httpdownload seems to work correctly in SAM 2012.5.11.

For example, the following script downloads a TMY3 file from the NSRDB website and saves it to a file named test-tmy3-download.csv in the directory that contains the SAM file (save the SAM file before running the script):

Code:
dir = cwd() ' current working directory url = "http://rredc.nrel.gov/solar/old_data/nsrdb/1991-2005/data/tmy3/722287TY.csv" localfile = "test-tmy3-download.csv" if ( not httpdownload(url, dir + "/" + localfile) ) outln("Did not download file.") else outln("Download complete.") end


Attached is a version of your script modified to help you test the httpdownload function. You provide a zip code, and it translates it to a Solar Prospector grid cell number using the addr2latlon, getweather, and translate functions. (To use the script, after downloading the attached .sul file, create a new SAM file with a PVWatts case named "test" and save it, and then use the Developer menu to create a new script, and click the Load Script from File button the Developer toolbar to open the .sul file.)

Is the problem in your version of the script with how you defined workdir? It's hard for me to test your script verbatim because of the references to specific file path names on your computer.

I hope that helps.

Best regards,
Paul.

Please Log in or Create an account to join the conversation.

  • lucas.spangher
  • Topic Author
More
20 Jul 2012 12:30 #711 by lucas.spangher
Replied by lucas.spangher on topic Trouble with running SAM from a command batch line
Thanks Paul.

I understand. I think it was a problem with directories. Sorry for making you go through that trouble. Your help was very appreciated. Thanks!

Please Log in or Create an account to join the conversation.

Moderators: pgilman
Powered by Kunena Forum