A method of controlling a microgrid arrangement comprising a control arrangement and a microgrid comprising a plurality of switches , each having a local controller , and a plurality of Distributed Generators, DGs, arranged for being connected to the microgrid, the method comprising: obtaining (S1) information about the microgrid arrangement, wherein the obtained information comprises sensor measurements on the microgrid , power generation of one or more of the DGs , and/or varying power quality requirements within the microgrid arrangement; the method being characterised in: based on the obtained (S1) information, the control arrangement , dynamically over time, linking (S2) a first group of switches, of the plurality of switches , to each other, such that different switches of the plurality of switches are linked to each other in the first group during different time periods; instructing the local controllers of said first group of switches that the switches of the first group are linked to each other; after the linking (S2), detecting (S3) an event in the microgrid ; and in response to the detection (S3), by means of direct communication between the local controllers of said first group of switches, automatically opening (S4) closed switches in the first group, whereby a first segment of the microgrid is disconnected from a second segment of the microgrid. obtaining (S1) information about the microgrid arrangement, wherein the obtained information comprises sensor measurements on the microgrid , power generation of one or more of the DGs , and/or varying power quality requirements within the microgrid arrangement; the method being characterised in: based on the obtained (S1) information, the control arrangement , dynamically over time, linking (S2) a first group of switches, of the plurality of switches , to each other, such that different switches of the plurality of switches are linked to each other in the first group during different time periods; instructing the local controllers of said first group of switches that the switches of the first group are linked to each other; after the linking (S2), detecting (S3) an event in the microgrid ; and in response to the detection (S3), by means of direct communication between the local controllers of said first group of switches, automatically opening (S4) closed switches in the first group, whereby a first segment of the microgrid is disconnected from a second segment of the microgrid. based on the obtained (S1) information, the control arrangement , dynamically over time, linking (S2) a first group of switches, of the plurality of switches , to each other, such that different switches of the plurality of switches are linked to each other in the first group during different time periods; instructing the local controllers of said first group of switches that the switches of the first group are linked to each other; after the linking (S2), detecting (S3) an event in the microgrid ; and in response to the detection (S3), by means of direct communication between the local controllers of said first group of switches, automatically opening (S4) closed switches in the first group, whereby a first segment of the microgrid is disconnected from a second segment of the microgrid. <EOS>