Pre-analysis of a dataset

A solver answering infeasible names no cause, and an Irreducible Inconsistent Subsystem, when the solver offers one, speaks of rows and columns rather than of areas, resources and years. pommes.pre_analysis() computes, from the parameters alone and without building the model, the necessary conditions of feasibility below and the statistics they rest on (issue #1).

from pommes import check_inputs, pre_analysis

model_parameters = check_inputs(model_parameters)
result = pre_analysis(model_parameters)  # logs every finding
print(result.report())
result.summary()   # per area, resource and year: demand vs. maximum supply
result.emissions   # per year: emissions no dispatch avoids vs. carbon_goal

Run it before a solve, or after an infeasible one.

What is checked

Capacities. A vintage invested in year_inv is alive in year_op when year_inv <= year_op < end_of_life. The installed capacity of a year lies between the minimum investments of the vintages surely alive (with early decommissioning, only the one invested that very year) and the maximum investments of all the vintages alive, further bounded by conversion_power_capacity_min and conversion_power_capacity_max. Imposed investments above the allowed total, or a required total the allowed investments cannot reach, are infeasible. A vintage counts only if it has a planning variable: without early decommissioning, its end of life must be a year_dec label, and an investment imposed on a vintage that has none is reported as a warning, since the model drops it silently. A retrofit converts source vintages that retire in the retrofit year, so a target holds at most its ratio times every source investment made before the year; the source keeps its vintages until that year, and its minimum capacity with them.

Power. Hour by hour, per area and resource, the demand – with the floor of the flexible demand – against the largest supply the data allow: every conversion capacity at its upper bound and availability, times its positive factors; every combined unit in the mode giving the most of the resource; storage discharging at full power; every transport link flowing in; imports at their annual ceiling. The same over all areas, where transport cancels out (except on links leaving from outside the areas) – the only bound left when the transport capacities are unbounded.

Energy. The same per year, where the annual ceilings bind (*_max_yearly_production, net_import_max_yearly_energy_import) and storage gives back at most what it took, its cycle closing within the year.

Emissions. Two lower bounds on the emissions of a year, the larger of which holds: the emitting units with a must-run, at their minimum capacity; and the emitting supply needed where the sources emitting nothing fall short, hour by hour, at the lowest emission per unit of the resource. Net of the largest negative emissions, against carbon_goal.

Fossil exit. From fossil_exit_year (2050 by default) on, the power and energy balances again without any fossil source. By default a source is fossil when it emits: imports with a positive net_import_total_emission_factor – at the hours and conditions it is positive only –, conversion technologies and combined modes with a positive emission factor. fossil_resources and fossil_technologies name them instead; a name that is not a label of the dataset raises a ValueError. The check also names the fossil units forced to run (a must-run on an imposed capacity) or imposed and still installed, and says when the data do not impose the exit at all.

The exit is imposed in a year and operating condition when the carbon goal there is zero, nothing can remove carbon, and fossil means emitting: a shortfall is then an infeasibility. Otherwise it is a warning – the exit set as an objective cannot be met with the data given. fossil_exit_year=None disables the check.

Reading the findings

Every bound is a relaxation of the model: a conversion is counted with its output and never with the input it needs, so a resource is never short of what produces it; ramps, production groups and the energy capacity that limits how long storage can discharge are left out. Hence:

  • infeasible: the model cannot be solved, whatever the solver.

  • warning: it can, but not as one may expect. For the adequacy_* checks, only by shedding load (at least the amount given); for the fossil_exit_* checks, the exit cannot happen although the data do not impose it, which says nothing of load shedding; for capacity, an investment bound the model drops.

  • info: worth reading, not a fault – an imposed fossil capacity, an exit the data do not impose.

A dataset without any finding can still be infeasible. The solver’s own diagnostic (Gurobi’s IIS, linopy’s print_infeasibilities) or a run with load shedding and spillage allowed takes over from there.

All quantities are in the units of the adequacy row: demand per time step for power, the units of the annual ceilings for energy and emissions.