documentation: use-function / batch run from command line

  • solarjoe
  • Topic Author
More
22 Mar 2013 02:37 #1457 by solarjoe
Hello,

just a litte hint that the SamUL documentation
is missing two very handy features.

Although the use-function for self-defined functions is present in
the "Basic Language Tests" I could not find anything about it
in the documentation.

The usage might be noted in a single paragraph in
"SamUL Scripting Language - Function Calls"

Expecially the possibility to incluce exported *.sul files,
which is very handy as it allows to maintain a single
functions-file across all SAM-cases.

E.g.

use "c:\SAM\MyFunctions.sul"

Another thing that should be noted in the documentation is the
syntax to run SamUL scripts from the command line.
It can be found here in the forum, but
( sam.nrel.gov/content/command-line-batch-run )

Kind regards,
Joe



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

  • pgilman
More
28 Mar 2013 15:27 #1458 by pgilman
Dear Joe,

Thank you for the suggestions. I will add the command line instructions to Help for the next version of SAM (Summer/Fall 2013).

I'm not sure I understand your first two suggestions. The Help system describes how to write your own SamUL functions in the SamUL: Function Calls topic.

It also explains how to save a script in an .sul file here in the SamUL: Writing and Running SamUL Scripts topic.

Is there a way we could make that clearer or easier to find?

Best regards,
Paul.

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

  • solarjoe
  • Topic Author
More
03 Apr 2013 01:25 #1459 by solarjoe
Hello Paul,

the sample with the basic functions introduces the
"use" command to include files, but I could not find
anything about it in the documentation.
It just mentiones

"SAM saves the SamUL script in the .zsam file where you created the script. You do not need to save the script to an .sul file unless you want to use it in a different .zsam file."

but not how to use it in different zsam-files.

And it took me a while to find out, that it is possible
to "use" external files, too. I thought they have to
be within the same zsam-file.

As far as I remember I did not read anything about that
in the documentation, just remembered that it was working
in Soltrace, its called import there, and gave it a try.

I just thought that "SamUL: Function Calls" might be a good place
to introduce this feature, and explain that it works with
exported *.sul files, too.
I did not get that in the beginning and I have quite some experience :)

The main motivation to me was that if you have lots of user functions
it is good practice to store each of them in a single file or a
topic-file (statistics, solar, numerical...).

Keep up the good work!
Kind regards,
Joe

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

  • pgilman
More
05 Apr 2013 16:10 #1460 by pgilman
Thank you Joe. I will try to improve the explanations for the Summer/Fall 2013 SAM version.

Best regards,
Paul.

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

  • pkulbeik
More
29 Jul 2014 16:27 #1461 by pkulbeik
Hello,
I've written a SamUL script that I would like to access from other SamUL scripts. I understand how function calls work within a single script but how do you call another script as a function?

I can't find any reference to doing that in the Function call section fo the manual.
Reguards,
Pam

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

  • pgilman
More
29 Jul 2014 17:43 #1462 by pgilman
Dear Pam,
Yes. As long as the scripts are in the same SAM file, you can call a function from one script in an other with the 'use' keyword.
For an example, see the sample file SamUL Script Samples (from the File menu, choose Open sample file, and then choose the file from the list). The "Basic Language Tests" script calls functions that are defined in the "My Functions" script.
Best regards,

Paul.
 
 
 

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

Moderators: pgilman
Powered by Kunena Forum