Combined CSP + Wind LCOE calculation

  • Mohammed Alfailakawi
  • Topic Author
More
28 Jul 2022 17:25 #11299 by Mohammed Alfailakawi
Combined CSP + Wind LCOE calculation was created by Mohammed Alfailakawi
Hello,

I am trying to automate a combined CSP + Wind model in order to get the LCOE for different models while varying SM and TES of the CSP.

I imported all the financial parameters in a LK script for each individual CSP and Wind cases separately and succeeded to reproduce the LCOE for each case.

My actual problem relies in the combined script as when I try to call the annual energy generation of the CSP case and that of the Wind case and add them up, the total energy generation gives either 2 times the energy of CSP or 2 times the energy of wind. It really depends on what model at which I place the mouse at in SAM environment ..

Is there any way that I can apply on the script to make call the parameters from one performance model (e.g. CSP) and then kind of stop and pass to the other performance model (e.g. Wind) and call the parameters and then eventually add them up ?

I attached the SAM file with both the CSP and Wind models along with a simple LK script file that I wrote to do the latter.

Thanks in advance.

Regards,
Mohammed

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

  • pgilman
More
28 Jul 2022 21:52 #11301 by pgilman
Replied by pgilman on topic Combined CSP + Wind LCOE calculation
Hi Mohammed,

There are a couple of problems with your example LK script.

To set the current case to the case named "5 WT", use:
active_case( '5 WT' );

If you want to determine the name of the current case, you can use:
current_case = active_case();
outln( current_case );

The simulate() command is after the get() commands that read the output variable values so it has no effect on the sum of the two arrays.

Here's a revised version of your script that runs a simulation for the wind case, reads the annual electricity to grid array,  runs a simulation for the CSP case and reads its electricity to grid array, and then adds the electricity to grid arrays together. The Power Tower case (TES 16) takes a while to run, so you'll need to wait a couple of minutes for the script to finish:
active_case( '5 WT' );
outln( active_case() );
simulate();
WT_AEG = get( 'cf_energy_sales' );

active_case( 'TES 16' );
outln( active_case() );
simulate();
SPT_AEG = get('cf_energy_sales'); 

outln(#SPT_AEG);

for  ( i=0; i<#SPT_AEG; i++)
{
    
    SPT_WT_AEG [i] = WT_AEG[i] + SPT_AEG[i];
}

outln(SPT_AEG);
outln(WT_AEG);
outln(SPT_WT_AEG);

Best regards,
Paul.

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

  • Mohammed Alfailakawi
  • Topic Author
More
31 Jul 2022 16:34 #11305 by Mohammed Alfailakawi
Replied by Mohammed Alfailakawi on topic Combined CSP + Wind LCOE calculation
Thanks Mr. Gilman this is very helpful I really appreciate it!

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

  • Mohammed Alfailakawi
  • Topic Author
More
07 Aug 2022 12:53 #11328 by Mohammed Alfailakawi
Replied by Mohammed Alfailakawi on topic Combined CSP + Wind LCOE calculation
Hello,

After producing a LCOE for a combined SPT-wind model in LK, I would like to automate my script in order for it to run a parametric analysis with variation of TES-SM while being combined with the wind model.

The problem is that my analysis period is 25 + initial year 0 and some financial parameters are 26 values while others are only 25. Now in order to use the array element i+1 of a parameter as the element i of another parameter I had to close the for loop each time. Now this still works for single values of TES and SM, however, I would like to vary these two parameters using a nested for loop. I tried a lot of positions and forms but at best the loop on takes the first values of TES-SM. I kindly need a recommendation for where and how to implement this for loop ..

note:
- the for loop :
 for (y=0; y<19; y++)
    {    
         for (z=0; z<16; z++)
        {    
           R = a[0];
           set ('tshours', R);
     
           R = b[0];
           set ('solarm', R);
           }
}

Thanks a lot in advance.
Regards,
Mohammed

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

  • pgilman
More
08 Aug 2022 21:56 #11329 by pgilman
Replied by pgilman on topic Combined CSP + Wind LCOE calculation
Hi Mohammed

The output variables with names that start with "cf_" are cash flow outputs of the financial model. They start in Year 0 and end in the year defined by the analysis period. For an analysis period of 25 years, the arrays will have 26 values, one for Year 0 and one for each of the 25 years in the analysis period.

You can verify this with the following:
x = get('cf_energy_sales');

outln( 'analysis period = ', get('analysis_period') );
outln( 'number of cash flow years = ', #x );

It looks like you are calculating some of the cash flow line items yourself, for example the insurance expense in Lines 63 to 70 of the script you attached. In that case, if the analysis period is 25 years, you should create an array of 26 years with the insurance cost in Year 0 set to zero. You can also get the insurance expense directly instead of calculating it:
insurance = get('cf_insurance_expense');

Click the Variables button at the top of the script editor to see a list of all available variables.

Best regards,
Paul.

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

  • Mohammed Alfailakawi
  • Topic Author
More
09 Aug 2022 16:07 #11336 by Mohammed Alfailakawi
Replied by Mohammed Alfailakawi on topic Combined CSP + Wind LCOE calculation
Dear Mr. Gilman,

Thanks for your reply.

I already succeeded to calculate the LCOE for a combined CSP-wind model which has been done only because I would like to automate this combined model in order for it to calculate the LCOE for different values of TES-SM (by a parametric analysis after being automated). 

As for the insurance, I don't really have any problems calculating it, I already set the first value to zero and figured out how to produce the values for the 25 year of analysis. Further, calling the insurance with a get function is not really helpful for my case because I need it for the combined CSP-wind model and not for one of them, that's why I am calculating it by breaking down the equations as much as possible.

My issue is really with the global for loop that I must apply on the script in order for it to be output multiple LCOE values based on the ranges of TES-SM. The loop (when placed at the beginning of the script and with a simulate function just before the local loops) works as seen in SAM interface as the TES-SM values change accordingly, however, the script only outputs the results of the last element of the TES-SM arrays.

I am having doubts of the simulate() function position and tried quite of few, non of which works..

I would really be grateful if you kindly have a quick look on this script modification that I implemented (for loop in lines 49-57 which does as underlined above).

Thanks a lot in advance.

Regards,
Mohammed

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

Moderators: pgilman
Powered by Kunena Forum