SAM freezes during PTgen refining

3 posts / 0 new
Last post
SAM freezes during PTgen refining


recently I asked about a possibility to refine the PTgen optimization.
As this was not possible I coded it myself and in general it works fine.

As we are evaluating the LCOE in the range of the first decimal place
is it likely that the default coarse optimizer does not find the global minimum.

So far the results show that if a finer discretization is used
the LCOE converges to a value that is about 0.2 - 0.3 $cents below
the default PTgen results.

Well, there is only one problem:
To find the minimum LCOE hundreds or thousands of SAM calculations are run.
And usually SAM freezes after a few hundred runs. I coded the refiner to
resume previous runs, so this is not big problem.

I have to kill SAM.exe using the task manager and on the next start
it asks to recover from a crash.

The calculations are run within three for-loops with

ClearSimResults("My project")

before each run.

There is sufficient free space on the hard drive as well as sufficient RAM.
And I tried on two completly different machines, both show the same behaviour.

Do you have an idea what might cause the problem?

Kind regards,

Paul Gilman

Hi Joe,

You might try using the False parameter with the Simulate() function:


That can save significant computer resources by not updating all of the results in the user interface after each simulation.

You should also avoid having more than one case in a file that you use for multiple simulations. SAM's user interface requires a lot of memory, and minimizing the number of cases minimizes the number of user interface objects.

We are aware of these memory management issues and are working to resolve them in a future version of SAM.

Best regards,


Hello Paul,

thanks for your response, I will give that a try.

Kind regards,

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer