A method for the automatic management of a flow of electrical energy produced by at least one first group of prosumers and consumed by said first group of prosumers and at least one second group of consumers, wherein each entity of each group determines, at a beginning of a predetermined period, a production forecast and/or a consumption forecast of electrical energy for the predetermined period, the method comprising:
- a) determining, for each group, an order for consulting the entities of the group,
- b) consulting the prosumers according to the order determined in step a), each prosumer calculating a residual production forecast taking account of its own production forecasts, a residual production forecast transmitted by a preceding entity and a portion of a consumption forecast that can be supplied by the residual production forecast, and transmitting said residual production forecast to the prosumer according to the determined order,
- c) reiterating step b) as long as all the prosumers have not been consulted,
- d) when the residual production forecasts are in surplus, transmitting said residual production forecasts to the group of consumers,
- e) consulting the consumers according to the order determined in step a), each consumer calculating and transmitting, to the consumer according to the determined order, the residual production forecast taking account of the residual production forecast transmitted by the preceding entity and of its portion of consumption forecast that can be supplied,
- f) reiterating step e) as long as all the consumers have not been consulted,
- g) reiterating steps b) to f) as long as a predetermined convergence criterion has not been reached.