Optimization
This page covers the end-to-end optimization flow and the engines behind it.
Process at a Glance
- Config enrichment
production_modeling.modelSetup(c)loads tariffs/prices/ESG/inverters/CT limits, resolves coordinates, sets SELCO export.
- Typical consumption
optimiser.main(c)usesutilities.technical.solve_pre_surcharge_billandutilities.profile_estimation.estimate_load_profileto generate a 24h profile.
- Production and bills
production_modeling.power_and_energy(c, daily_consumption)computes hourly/net power, optional BESS sizing and SOC, and monthly aggregates (grid draw, export credits, bills).
- Financing optimization
optimiser.optimise(c, typical_consumption)dynamically dispatches tooptimizers/{Tokenization|TermLoan}/{PPA|DirectPurchase}to determine system size and financials.
- Enrichment
- Adds panel count, tariff escalation, and ESG metrics (CO2 reduction, trees/year).
Decision Variables (typical)
- System size (kWp)
- Optional battery capacity (kWh), if enabled
- Inverter configuration (derived by
size_inverters)
Constraints (examples)
- Roof space / CT rating (via CT limits in config)
- Budget bounds (per prices)
- Scheme-specific constraints (e.g., SELCO export = 0)
Objective Balancing
- Customer savings (bill without solar vs with solar + export)
- Investor returns (NPV/IRR per financing model)
- Cost (CapEx + installation, optional BESS costs)
Implementation of individual objective/constraint terms may vary by financing module. Engines typically rely on SciPy optimizers where continuous optimization is applicable and discrete selections are handled heuristically (e.g., inverters).
Optimizer Modules
- Tokenization:
{PPA, DirectPurchase} - TermLoan:
{PPA, DirectPurchase}
Each module implements a callable (c, typical_consumption) -> (results, updated_c) and returns:
results: at minimumsystem_size,monthly_energy_production,customer_savings,customer_roi, optionalbattery_size, and any model-specific outputsupdated_c: configuration with any calculated fields persisted
Key Supporting Functions
- Consumption estimation:
utilities.profile_estimation.estimate_load_profile - Billing:
utilities.technical.calculate_bill,solve_pre_surcharge_bill - Inverters:
utilities.technical.size_inverters - Production aggregation:
production_modeling.historical_*,power_and_energy - Finance:
utilities.finance.* - ESG: derived in
optimiser.optimise