Proposed simulation of self-consumption can be ambiguous
In the tutorial notebook To_Modify__PV_self_consumption_eng which presents the modelling and optimization of an energetic system of an individual house, maximizing the self-consumption is proposed by minimizing the imports from the grid ( imports.minimize_production ). This is proposed without further explanations. This issue is about underlining the fact that this restrictions (imports.minimize_production) isn't sufficient to really achieve an optimization of self-consumption with respect to the grid. Although this is going to give a great approximation of self-consomption/self-production ratio on the period, this method doesn't give restrictions on the exports behavior. Therefore, this method lead to an anormal use of exports and is not modelling a correct storage when looking at the step to step behavior. Optimizing the self-consumption should be constructed by two restrictions : one on the imports ( imports.minimize_production ) and one on the exports ( exports.minimize_consumption ).
To illustrate this difference, here is two cases of a self-consumption optimization for a building with a load, a production and a battery. The first case doesn't include the exports restriction, while the next one includes both restrictions.
In green, it is the battery behavior (positive value is charging, negative value is discharging. It is possible to notice that without the restrictions on the exports, the battery is charging and exporting (which is not the optimal behavior) rather than storing the energy to use it when the production is low (which is optimizing the self-consumption).