Summary
The Streamlit app (webapp/app.py) computes baseline, uncertainty, and flexibility results with standalone NumPy formulas instead of calling BaselineOptimization, UncertaintyAnalysis, and FlexibleDesign.
Location
webapp/app.py — key functions:
| Function |
What it does instead of engine |
run_analysis() |
Fake progress bar; calls build_results() only |
build_results() |
Local capacity/LCOE/NPV math |
derive_capacity() |
Hardcoded 0.38 CF and 3.2 $/MW heuristics |
allocate_capacity() |
Weighted by cf / cost |
calculate_technology_metrics() |
capacity * cf * 8760 / 1000 |
calculate_lcoe() / calculate_npv() |
Simplified annuity formulas |
scenario_samples() |
Random perturbations around local LCOE |
flexibility_plan() |
Rule-of-thumb expansion premium |
The UI labels stages "Baseline", "Uncertainty", "Flexibility" but none invoke fleximorpv2 analysis classes.
Impact
- Webapp results can diverge from notebook/API/engine outputs for the same site config.
- Hardcoded defaults (
default_capacity_factor, opex_ratio, 0.38 implied CF) are not shared with fleximorpv2/config.py.
- Users may treat Streamlit dashboards as authoritative while README examples use the real pipeline.
Suggested fix
- Replace
build_results() with calls to BaselineOptimization.optimize(), UncertaintyAnalysis.run_monte_carlo(), and FlexibleDesign.analyze_flexibility().
- Map Streamlit settings (
target_type, target_value, technologies) to engine OptimizationTarget inputs.
- Add caching/timeouts for long runs; show engine errors in UI instead of silent approximations.
- Keep lightweight preview mode optional, but label it clearly as "screening estimate".
Acceptance criteria
Summary
The Streamlit app (
webapp/app.py) computes baseline, uncertainty, and flexibility results with standalone NumPy formulas instead of callingBaselineOptimization,UncertaintyAnalysis, andFlexibleDesign.Location
webapp/app.py— key functions:run_analysis()build_results()onlybuild_results()derive_capacity()0.38CF and3.2$/MW heuristicsallocate_capacity()cf / costcalculate_technology_metrics()capacity * cf * 8760 / 1000calculate_lcoe()/calculate_npv()scenario_samples()flexibility_plan()The UI labels stages "Baseline", "Uncertainty", "Flexibility" but none invoke
fleximorpv2analysis classes.Impact
default_capacity_factor,opex_ratio,0.38implied CF) are not shared withfleximorpv2/config.py.Suggested fix
build_results()with calls toBaselineOptimization.optimize(),UncertaintyAnalysis.run_monte_carlo(), andFlexibleDesign.analyze_flexibility().target_type,target_value, technologies) to engineOptimizationTargetinputs.Acceptance criteria
tests/test_integration.py