> For the complete documentation index, see [llms.txt](https://docs.unwaste.energy/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.unwaste.energy/en/unwaste-robot-operation/energy-flow-calculation-and-balancing.md).

# Energy flow calculation and balancing

Learn how Unwaste calculates and balances energy flows in an installation.

### Why balancing is needed

Real installations are rarely fully metered at every point.\nUnwaste models energy flow as a graph of connected elements (connection → circuits → devices), but:

* some devices may not have meters,
* some circuits may have meters while sub-devices also have meters,
* production and storage can be bidirectional relative to circuits.

To keep the model understandable, Unwaste applies balancing rules that prioritize:

* measured values where available,
* and residual handling where measurement is incomplete.

### Net flow principle

For any connection between two nodes, Unwaste can compute net flow for the chosen period:

* if energy can flow in both directions, net flow is the difference between the two directions.

This is why you see one arrow per connection, not two arrows.

### Unmetered usage as residual

When a circuit meter exists, Unwaste can compare:

* total energy reported by the circuit meter, vs
* sum of energy attributed to metered sub-elements.

If the circuit meter is higher, the difference is shown as **unmetered usage**.

Unmetered usage therefore means:

* "energy that passed through this circuit, but is not explained by known metered elements below it."

### Why negative residual is hidden

A negative residual can occur if production exists "below" a circuit but is not separately metered in the expected way.\nDisplaying "unmetered usage producing energy" is misleading for most users, so negative residual is suppressed.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.unwaste.energy/en/unwaste-robot-operation/energy-flow-calculation-and-balancing.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
