CSP and Wind models combination

  • Mohammed Alfailakawi
  • Topic Author
More
31 Mar 2022 11:54 #10784 by Mohammed Alfailakawi
Replied by Mohammed Alfailakawi on topic CSP and Wind models combination
Dear Mr. Gilman,
Thanks a lot for your reply, I really appreciate it.

Since your reply, I have been trying to do what you told me to, however it goes wrong while indexing the total_output and I
don't understand why exactly..

In your last reply, when you mentioned that I have to set each individual case inputs, did you mean all the inputs (from the LK
for SDK) ? or just the for loop with the variables of interest ?

Please kindly have a look on the code I wrote:
a = csvread('C:/Users/Mohammed/Desktop/SAM trials/SPT + WT/Design TES range.csv',{'skip'=1, 'numeric'=true});
b = csvread('C:/Users/Mohammed/Desktop/SAMtrials/SPT + WT/Design SM range.csv', {'skip'=1, 'numeric'=true});
c = csvread('C:/Users/Mohammed/Desktop/SAMtrials/SPT + WT/cut in speed.csv', {'skip'=1, 'numeric'=true});
d = csvread('C:/Users/Mohammed/Desktop/SAMtrials/SPT + WT/cut out speed.csv', {'skip'=1, 'numeric'=true});

active_case = ('SPT');

for (w=0; w<2; w++)

{   for (x=0;x<2; x++)
 
{ R = a[w][0];
set ('tshours', R);
 
S = b[x][0];
set ('solarm', S);
 
simulate ();
  
SPT_output_array = get('system_pre_curtailment_kwac'); 
outln (SPT_output_array);
                                           } 
                                                 } 
active_case = ('WT');

for (y=0; y<2; y++)

{   for (z=0;z<2; z++)
 
  { T = c[y][0];
set ('wind_turbine_cutin', T);
 
U = d[z][0];
set ('wind_turbine_cutout', U); 

simulate ();
  
WT_output_array = get ('system_pre_curtailment_kwac'); 
outln (WT_output_array);
                                                                     }  
                                                                                              }   
for ( i=0; i<8; i++ ) 
  {  
 {total_output = SPT_output_array + WT_output_array; } 

 active_case('WT + SPT'); 
 
 set( 'spec_mode', 1 ); // sets mode to import hourly or subhourly profile from file

 set('energy_output_array', total_output);

 simulate();  
 
 energy_output_array = get ('total_output');

 outln (energy_output_array);

                                                            }

If I am at the combined case page (WT + SPT), it gives some results for the WT case and other results for the SPT case and 'null' for the combined case. 

Same happens when I am placed in the WT or the SPT pages, however always with different results for the individual WT, SPT cases and null for the combined..

Thanks a lot in advance, I really appreciate your time and effort.

Regards,
Mohammed
 

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

  • pgilman
More
31 Mar 2022 15:07 #10788 by pgilman
Replied by pgilman on topic CSP and Wind models combination
Hi Mohammed,

You need to assign all of the inputs for each compute module once. After the inputs are set, you can change only the inputs you need to change in the loop.

The instructions I provided assume you are using LK script in a SAM file, not in the SDKtool. The active_case() function only works in the context of the SAM user interface.

If you would like me to help troubleshoot, please attach the files you are using for this.

Best regards,
Paul.

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

  • Mohammed Alfailakawi
  • Topic Author
More
01 Apr 2022 10:16 #10794 by Mohammed Alfailakawi
Replied by Mohammed Alfailakawi on topic CSP and Wind models combination
Dear Mr. Gilman,

Oh I just knew that I have to set all the inputs in the LK script in SAM.. Thanks a lot for letting me know!

My question now is whether it is doable to take the inputs of a model from the model's LK for SDK code and use it in the LK script window in SAM ?

Please find attached the following:
- SAM file containing (WT, SPT and SPT + WT cases).  
- WordPad LK script file.
- TMY CSV file for the SPT. 
- notepad SRW file for the WT.
- 4 CSV files for the variables in the loop.

Thanks a lot for helping in troubleshooting I will be never able to thank you enough Mr. Gilman! I really appreciate it!

Regards,
Mohammed

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

  • pgilman
More
01 Apr 2022 10:49 #10799 by pgilman
Replied by pgilman on topic CSP and Wind models combination
Hi Mohammed,

LK for SAM and LK for SDKtool are very similar, but have a few different functions. For example, get() and set() in SAM is replaced by var() in SDKtool, so you have to make a few changes in your code to switch between SAM and SDKtool.

I will look at your files when I have a moment.

Thanks,
Paul.

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

  • Mohammed Alfailakawi
  • Topic Author
More
03 Apr 2022 21:33 #10800 by Mohammed Alfailakawi
Replied by Mohammed Alfailakawi on topic CSP and Wind models combination
Hello Mr. Gilman,

Thanks a lot for your time. I am already trying to perform what you recommended, I will let you know what happens with me.

Thanks again for everything.

Regards,
Mohammed

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

  • Mohammed Alfailakawi
  • Topic Author
More
08 Apr 2022 08:38 #10820 by Mohammed Alfailakawi
Replied by Mohammed Alfailakawi on topic CSP and Wind models combination
Dear Mr. Gilman,

I hope you are well. 

I have doing what you recommended and have been able to get both individual generated codes (from LK for SDK code generator) for the WT case and the SPT case. Then I adapted and combined both in one script and got a total of power output which is exactly just the numbers in SAM. Everything is fine now with the code, however, I believe I have difficulties with the for loop I implemented in the code. The for loop is looping the script, however, I am not sure why I am getting the exact similar results each time.

I attached the script I just combined in order for you to kindly have a look at it when is appropriate.

Thanks a lot for your great assistance and follow up, I really appreciate it.

Note:
SAM, weather and other necessary files for this script are located in this conversation (1st of April reply).

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

Moderators: pgilman
Powered by Kunena Forum