fluxopt.contributions
¶
Per-contributor effect breakdown, read off the program.
Every contribution the ledger sums is a named expression in
math/program/, declared with the entity it came from and reduced only
where effect_accounting adds it up. So the breakdown is not a second
implementation of the effect math that has to be checked against the first —
it is the same declaration, read one step before the sum.
Two views:
- direct: each contributor shows only what it directly emits. This is what the expressions give: the coefficients are bound as declared, and the ledger adds the cross-effects on top of what each effect is charged.
- with cross-effects (default): each contributor is charged the full
priced-in cost, CO2 through to cost.
reporting.yamlstates each contribution once more with the ledger's own chainedshareapplied, aspriced_*, so the breakdown and the ledger read one table.
The contributor axis is a presentation choice rather than model math: flows and storages share one dimension, and a component-level cost is attributed to the first flow its status governs, having no single natural flow of its own.
Functions:
| Name | Description |
|---|---|
priced |
The reported expression that is name with its cross-effects charged too. |
contributions_from |
The breakdown, assembled from the program's own contribution expressions. |
validate_against_solver |
The breakdown must add up to the totals the solver reported. |
priced
¶
contributions_from
¶
The breakdown, assembled from the program's own contribution expressions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Any
|
Reads one named expression as a labelled array, or None where the program declares it but this system has no rows for it. |
required |
|
ModelData
|
The model data that was bound. |
required |
|
bool
|
Charge each contributor the full priced-in cost (default), or show only what it directly emits. |
True
|
Returns:
| Type | Description |
|---|---|
Dataset
|
Dataset with |
Dataset
|
(contributor, effect) and |
Source code in src/fluxopt/contributions.py
validate_against_solver
¶
The breakdown must add up to the totals the solver reported.
Kept although the breakdown and the ledger are now one declaration: what it guards is no longer a second implementation of the math, but the assembly above it — the contributor mapping, the reindexing, and the coordinate order the comparison is positional in.