A computer-implemented method for decentralized control of an electricity network, comprising the steps of: - Receiving energy flow data with a controller (3, 3a, 3b) from at least two computing units via a communication network, wherein a plurality of devices are connected to each of the computing units, wherein the devices detect and/or influence energy flows and the energy flow data comprise the current consumption, the current power generation and the currently stored energy of the devices, and wherein the computing units each have a control unit, and wherein at least some of the devices send energy flow data to the computing unit; - Modeling the computing units with the connected devices with a first grid block each, wherein the grid block has a data structure with an energy consumption, an energy production, a physical energy storage, and at least one external energy flow, - Where consumption represents the sum of all energy consumed in the first grid block, production represents the sum of all energy produced in the first grid block, storage represents the sum of all energy stored in physical storage in the first grid block, and external energy flow represents energy flowing into or out of the grid block; - modeling the first grid blocks with a second grid block with the controller, wherein the second grid block comprises a plurality of first grid blocks, and wherein the second grid block has the same data structure as the first grid block; - Assigning a control mechanism to every other grid block; - Control of one or more first grid blocks by the control mechanism, wherein the control mechanism of the second grid block) sends instructions to the first grid blocks, wherein the instructions only contain signals for controlling the first grid blocks as a whole without directly controlling individual devices of the first grid block; - calculation of control commands for the individual devices by the control unit of the computing unit of the first grid block based on the instructions; and - Sending the control commands to the devices. - Receiving energy flow data with a controller (3, 3a, 3b) from at least two computing units via a communication network, wherein a plurality of devices are connected to each of the computing units, wherein the devices detect and/or influence energy flows and the energy flow data comprise the current consumption, the current power generation and the currently stored energy of the devices, and wherein the computing units each have a control unit, and wherein at least some of the devices send energy flow data to the computing unit; - Modeling the computing units with the connected devices with a first grid block each, wherein the grid block has a data structure with an energy consumption, an energy production, a physical energy storage, and at least one external energy flow, - Where consumption represents the sum of all energy consumed in the first grid block, production represents the sum of all energy produced in the first grid block, storage represents the sum of all energy stored in physical storage in the first grid block, and external energy flow represents energy flowing into or out of the grid block; - modeling the first grid blocks with a second grid block with the controller, wherein the second grid block comprises a plurality of first grid blocks, and wherein the second grid block has the same data structure as the first grid block; - Assigning a control mechanism to every other grid block; - Control of one or more first grid blocks by the control mechanism, wherein the control mechanism of the second grid block) sends instructions to the first grid blocks, wherein the instructions only contain signals for controlling the first grid blocks as a whole without directly controlling individual devices of the first grid block; - calculation of control commands for the individual devices by the control unit of the computing unit of the first grid block based on the instructions; and - Sending the control commands to the devices.