LK Script - Yes/No questions / Run multiple cases at the same time

  • Diego
  • Topic Author
More
21 Apr 2021 13:24 #9486 by Diego
Dear Paul and SAM users,

I would like to ask you if is possible to answer yes or no questions using the LK script.

I'm using a script for a Generic Battery Case to change the Battery type and after I changed it, I got a window asking me if I want to replace inputs with the default values for the battery type. I need to answer this for my script to finish its job.

One more question not related to the doubt above. Is it possible to run multiple different opened cases at the same time using SAM?

For example, a WInd Case and a PVWatts Case, run these two cases from the same Project at the same time once.

Kind regards,

Diego

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

  • Paul Gilman
More
22 Apr 2021 18:23 - 22 Apr 2021 18:23 #9494 by Paul Gilman
Hi Diego,

When an LK script changes the value of the 'batt_type' variable, it triggers a user interface event that displays the prompt asking about  updating defaults. Unfortunately, it is not possible to prevent the prompt from appearing. In this case, the prompt sets the value of 'update_default', which you could set with the LK script (0=no, 1=yes), but that does not prevent the event from being triggered, so the prompt still appears.

I'm not sure I understand your second question, but here are two answers:

1. From the SAM user interface, you can press the F-11 key to run all of the cases in a file so you don't have to go to each case and click the Simulate button.

2. From an LK script, you can use the list_case() and active_case() functions to list the cases in a file and switch between them. For example:
cases = list_cases();

for ( i=0; i<#cases; i++ )
{
    active_case( cases[i] );
    simulate();
}

Best regards,
Paul.
Last edit: 22 Apr 2021 18:23 by Paul Gilman.

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

  • Diego
  • Topic Author
More
22 Apr 2021 19:00 #9498 by Diego
Hi Paul,

Thanks for clarifying my doubts.

About the second question, I was trying to figure out if it's possible to simulate all the project cases in parallel. I'm asking this because I saw the parsim() function, but it was not clear to me if this works to process many simulations only for a single case.

Could you please explain it to me?

Thanks,
Diego

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

  • Paul Gilman
More
22 Apr 2021 21:05 #9501 by Paul Gilman
Hi Diego,

The LK script interacts with a single case in the .sam file at a time, so it is not possible to run simulations for more than one case simultaneously. The parsim() function is intended to use multiple threads to run parametric simulations for a single case. You can see an example of how to use it here in the lhs-parsim-test.lk script available in the LK samples at github.com/NREL/SAM/tree/develop/samples/LK%20Scripts%20for%20SAM.

Best regards,
Paul.

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

  • Diego
  • Topic Author
More
22 Apr 2021 22:06 #9506 by Diego
Hi Paul,

Thank you so much.

Best regards,
Diego

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

Moderators: Paul Gilman
Powered by Kunena Forum