In the case of an energy contract where the totality of the PV produced energy is injected into the grid, the grid offtake volume equals = P_load + P_deferrable_sum
Else (only the excess of PV produced energy is injected), the grid offtake equals = P_grid_pos
While looking at the code in order to understand the functioning of EMHASS, I noticed an inconsistency in the objective formulas. The profit cost function shows this: https://github.com/davidusb-geek/emhass/blob/bec6f76f1d7795a1ab8730fb0a61f883e75caf0c/src/emhass/optimization.py#L196-L204 which looks correct, and is consistent with the EMHASS documentation:
However, the "grid cost" cost function seems to have the formulas inverted, which is unexpected: https://github.com/davidusb-geek/emhass/blob/bec6f76f1d7795a1ab8730fb0a61f883e75caf0c/src/emhass/optimization.py#L205-L211
Therefore, I wonder if the objective formulas in "Grid cost" cost function shouldn't be inverted. I'll propose a pull request for this.