A method for controlling a modular converter, a) the modular converter comprising a plurality of M converter cells, each converter cell comprising i) an AC-to-DC converter, a primary side of which represents a primary side of said converter cell, ii) a DC-to-DC converter, a secondary side of which represents a secondary side of said converter cell; with iii) a secondary side of said AC-to-DC converter and a primary side of said DC-to-DC converter connected in parallel with a first DC-link capacitor, iv) a secondary side of said DC-to-DC converter connected to a second DC-link capacitor; wherein b) each DC-to-DC converter is adapted to be operated in at least i) a first active operation state, in which electric power may flow into the primary side and out of the secondary side of said DC-to-DC converter; and ii) a second active operation state, in which electric power may flow into the secondary side and out of the primary side of said DC-to-DC converter; c) the primary sides of the converter cells are connected in series, with a first converter cell connected to a line providing an AC line voltage U(t) having a peak value Û, and an M -th converter cell connected to a ground; the method comprising the step of: d) repeatedly determining a switch-over indicator; characterized in that the method further comprises the step of: e) switching at least one DC-to-DC converter between first active operation state and second active operation state if the switch-over indicator fulfils a switch-over condition; and in that f) the switch-over indicator is determined based on one or more of the following quantities: i) one or more voltages at one or more first DC-link capacitors, ii) one or more voltages at one or more second DC-link capacitors, iii) a DC-to-DC converter current ( I conv) at a point between the first DC-link capacitor and the second DC-link capacitor of at least one converter cell, and/or a load current ( I load) at a secondary side of the modular converter. a) the modular converter comprising a plurality of M converter cells, each converter cell comprising i) an AC-to-DC converter, a primary side of which represents a primary side of said converter cell, ii) a DC-to-DC converter, a secondary side of which represents a secondary side of said converter cell; with iii) a secondary side of said AC-to-DC converter and a primary side of said DC-to-DC converter connected in parallel with a first DC-link capacitor, iv) a secondary side of said DC-to-DC converter connected to a second DC-link capacitor; wherein i) an AC-to-DC converter, a primary side of which represents a primary side of said converter cell, ii) a DC-to-DC converter, a secondary side of which represents a secondary side of said converter cell; with iii) a secondary side of said AC-to-DC converter and a primary side of said DC-to-DC converter connected in parallel with a first DC-link capacitor, iv) a secondary side of said DC-to-DC converter connected to a second DC-link capacitor; wherein b) each DC-to-DC converter is adapted to be operated in at least i) a first active operation state, in which electric power may flow into the primary side and out of the secondary side of said DC-to-DC converter; and ii) a second active operation state, in which electric power may flow into the secondary side and out of the primary side of said DC-to-DC converter; i) a first active operation state, in which electric power may flow into the primary side and out of the secondary side of said DC-to-DC converter; and ii) a second active operation state, in which electric power may flow into the secondary side and out of the primary side of said DC-to-DC converter; c) the primary sides of the converter cells are connected in series, with a first converter cell connected to a line providing an AC line voltage U(t) having a peak value Û, and an M -th converter cell connected to a ground; e) switching at least one DC-to-DC converter between first active operation state and second active operation state if the switch-over indicator fulfils a switch-over condition; and in that f) the switch-over indicator is determined based on one or more of the following quantities: i) one or more voltages at one or more first DC-link capacitors, ii) one or more voltages at one or more second DC-link capacitors, iii) a DC-to-DC converter current ( I conv) at a point between the first DC-link capacitor and the second DC-link capacitor of at least one converter cell, and/or i) one or more voltages at one or more first DC-link capacitors, ii) one or more voltages at one or more second DC-link capacitors, iii) a DC-to-DC converter current ( I conv) at a point between the first DC-link capacitor and the second DC-link capacitor of at least one converter cell, and/or