NREL / GEOPHIRES-X

MIT License
26 stars 21 forks source link

MC ignoring first input variable? #192

Open softwareengineerprogrammer opened 2 months ago

softwareengineerprogrammer commented 2 months ago

Per user:

I found a bug though (it took me a while to figure this out b/c it looks like it’s working fine with multiple INPUT lines). The program does not use the first row with an INPUT in the MC_GEOPHIRES_Settings_file.txt.

For example (below): it will read the INPUT row, it will sample the Gradient 1 distribution properly, but it will not use this Gradient 1 distribution for the 10 iterations. Because it thinks they are no inputs, it will use the same value included in the GEOPHIRES-x input file for the 10 iterations (so min=mean=max etc.).

INPUT, Gradient 1, triangular, 36, 41, 44

OUTPUT, Average Net Electricity Production

OUTPUT, Electricity breakeven price

ITERATIONS, 10

If I copy the input line twice (below): it will read both INPUT rows, it will sample the Gradient 1 distribution twice (distinct distributions), but it will only use the second Gradient 1 distribution for the 10 iterations.

INPUT, Gradient 1, triangular, 36, 41, 44

INPUT, Gradient 1, triangular, 36, 41, 44

OUTPUT, Average Net Electricity Production

OUTPUT, Electricity breakeven price

ITERATIONS, 10

It looks to me like an indexation issue in the MC INPUT[ ] variable.

softwareengineerprogrammer commented 2 months ago

I wasn't able to repro this, but added a unit test to ensure there's not a regression: https://github.com/NREL/GEOPHIRES-X/pull/193/commits/a8dfbffe9663d20170c519eca5b339a63ff29eff

softwareengineerprogrammer commented 2 months ago

Seeing intermittent failure in unit test, possible repro depends on race condition or specific random values: https://github.com/NREL/GEOPHIRES-X/actions/runs/8898562672/job/24435967890?pr=193