A method for controlling a battery having electrochemical cells, the method allowing average currents passing through the cells to be balanced, the battery comprising at least one current line formed by a plurality n of basic cell modules connected in series, capable of delivering a voltage waveform, each basic module comprising two connection terminals, at least one cell delivering a basic voltage Vcell, and switching means capable of controlling the basic module in the current line as a function of three different control states allowing said basic voltage Vcell, a zero voltage and said inverted voltage Vcell to be delivered to said terminals so as to produce a voltage waveform, the method comprising a step of controlling control signals of the basic modules so as to supply the voltage waveform on the basis of a selection of a group of q basic modules as a function of a reference voltage setpoint Vref, where Vref=qVcell, the method further comprising:
- determining a classification of the n basic modules;
- processing the classification of the plurality n of basic modules according to a circular permutation of the positions of the basic modules such that each basic module of the plurality n of basic modules is involved in producing the voltage waveform.