Skip to content

Usability improvements for power bonds and ECCO - #805

Open
restenb wants to merge 13 commits into
masterfrom
fix/power-bonds-infer-causality
Open

Usability improvements for power bonds and ECCO#805
restenb wants to merge 13 commits into
masterfrom
fix/power-bonds-infer-causality

Conversation

@restenb

@restenb restenb commented Aug 18, 2026

Copy link
Copy Markdown
Member

I wanted to improve the usability of the current implementation a bit, as it had some notable warts. This PR therefore makes the following changes:

  1. Removed the causality attribute from the <Variable> element in the XML. This was always unnecessary as the causality can be read directly from the model description which has already been parsed.
  2. Made it so that the individual power bonds in an ecco_algorithm are addressable by the configured name of the bond to avoid having to deal with opaque indices.
  3. Added convenience structs power_bond_info and power_bond_state for collecting the information (the configured bond name and it's associated variable_ids), and the runtime state associated with each power bond. There is also more state now added to these structs, in particular accumulated energy residual pr. bond, and the per-bond error contribution to the error estimate used to adjust the time steps. This provides necessary visibility into which bond(s) are contributing the most to the overall error. More state from the algorithm can easily be exposed via the same mechanism.
  4. Added API functions that interact with these state objects, rather than indices or vectors of energies directly.
  5. Avoided accumulating the energies inside of the algorithm, which would have grown unbounded with the simulation time.
  6. Added a new ecco_observer instead for observing power bonds and their states, and associated test. The observer also supports a ring buffer with configurable size (like the time_series_observer), and simple energy statistics (max/min/mean/RMS), useful for tracking how well the algorithm performs over an entire run.

Note: As there are some minor breaking changes with new tests added in #803, I suggest merging that first and I will update the tests.

Comment thread data/xsd/OspSystemStructure.xsd
Comment thread tests/ecco_observer_test.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants