A multi-state dynamic process confers mechano-adaptation to the bacterial flagellar motor

Adaptation is a defining feature of living systems. The bacterial flagellar motor adapts to changes in the external mechanical environment by adding or removing torque-generating stator units. However, the molecular mechanism for mechanosensitive motor remodeling remains unclear. Here, we induced stator disassembly using electrorotation, followed by the time-dependent assembly of the individual stator units into the motor after electrorotation was terminated. From these experiments, we extracted detailed statistics of the dwell times that comprise the stochastic dynamics of the binding and unbinding of stator units. Dwell times reveal multiple timescales, indicating the existence of multiple binding states of the stator units. Based on these results, we propose a minimal model in which the stator unit can occupy four different states – two bound states with very different rates of unbinding, a diffusive unbound state, and a transiently detached state. Our minimal model quantitatively explains multiple features of the experimental data and allows us to determine the transition rates among all four states. Our experiments and modeling suggest a mechanism of mechano-adaptive remodeling of the bacterial flagellar motor in which torque generated by bound stator units controls their effective unbinding rate by modulating the transition between the two bound states. Furthermore, the binding rate of stator units with the motor has a non-monotonic dependence on the number of bound units, likely because of two counteracting effects of motor rotation on the binding process.

transiently disengages from the rotor while remaining assembled in the motor 25 . This added complexity suggests that, to gain a deeper understanding of the mechanisms that enable adaptive stator remodeling, we must go beyond population-averaged data and analyze the statistics of single binding and unbinding events in individual flagellar motors. The motor behavior must be described not just in steady state but also during the adaptation process.
Here, we present a detailed analysis of remodeling events in single flagellar motors as they adapt to a sudden increase in load. From the distribution of dwell times of these events, we find signatures of additional states beyond the three (bound, unbound, hidden) that have been previously described. Motivated by these observations, we propose a new model with four states (unbound, loosely bound, tightly bound, and hidden). This treatment provides a coarse-grained approximation for a more complete model in which a bound stator unit can occupy a continuum of states with different dissociation rates. We present a theoretical treatment of the coarse-grained model using first-passage-time analysis, which allows us to calculate key statistics for the dwell time analytically. Our coarse-grained model demonstrates excellent quantitative agreement with the dwell-time statistics extracted from experimental data. Finally, we discover new features of the on-process, whereby the on-rate of an incoming stator unit is a non-monotonic function of the number of previously bound units. Put together, this work reveals that the mechanosensitive remodeling of the flagellar motor is powered by molecular interactions that are more nuanced and complex than previously thought.

Single-motor electrorotation experiments
To measure the dynamics of flagellar motors during the adaptation process accurately, we conducted a large number of single-cell experiments with the bacterium Escherichia coli. We tethered individual E. coli cells to a surface via a short flagellar stub, causing the motor to rotate the cell body instead of the flagellar filament and thus operate under a very high load (Fig. 1a).
In the initial phase of the experiment, we observed the cell rotation for 30 s. We then applied a high frequency rotating electric field to the cell, which exerted a large external torque on it in the same direction as the motor torque. This greatly reduced the load acting on the motor and stimulated mechano-adaptation in the motor via the release of bound stator units. We kept electrorotation ON for a total of 6 minutes. At the end of 6 minutes, we turned electrorotation OFF, which suddenly increased motor load. Once again, the motor adapted, this time by the sequential addition of stator units, with the motor speed increasing in a stepwise fashion over time (Fig. 1b). This phase of the experiment also lasted for 6 minutes, during which we made continuous measurements of the motor speed at a high temporal resolution.
The time trace of the motor output (i.e., rotation speed) consists of discrete levels that correspond to a given number of stator units driving the motor (Fig. 1b). We used a step-fitting algorithm (see Methods and Materials) to determine these discrete levels from the noisy speed data at each time instant (black line in Fig. 1b). Once the levels were identified, we associated them with a corresponding number of stator units, assuming that when the speed is close to 0 Hz no units are bound to the rotor.
Each new higher level is then due to the addition of a single unit. To validate our analysis pipeline, we plotted the entire set of extracted speed levels against the number of stator units associated with those levels (Fig. S1a). The approximately linear dependence of rotation speed on the number of bound stator units is consistent with the generally accepted view that, under  The simplest possible model for the molecular interactions underlying stator remodeling is one in which a stator unit can exist in one of only two states -an unbound state, in which the stator unit diffuses freely in the inner membrane, and a bound state, in which it interacts with the rotor to generate torque. Indeed, this simple model has successfully described the population-averaged kinetics of stator remodeling and its dependence on experimental parameters, such as load [20][21][22] . This two-state model makes a specific prediction for the dynamics of stator binding and unbinding events that, to our knowledge, has not been tested. It predicts that the dwell time of the stator complex at any given level will be exponentially distributed (see SI). To test this prediction, we plotted the distribution of dwell times at all stator unit numbers (Fig. 1c). Evidently, a single exponential function (and therefore a two-state model) is incompatible with the experimental data. The distribution contains at least three exponentially decaying functions. Therefore, a complete model of stator dynamics must contain additional states.  Figure 2. Illustration of the model. a. An unbound stator unit is in a closed state (D) in which it freely diffuses within the inner membrane and does not translocate protons. Upon interacting with a rotor of radius R, the stator unit transitions into a loosely bound state (L). In this state, the protons start flowing through the stator unit, resulting in the production of a torque Γ on the rotor. As a reaction, a force F = Γ/R acts on the stator unit, which displaces it in the direction of the force. This displacement away from the point of tether lowers the off rate and results in a tightly bound state (T). A bound stator unit can occasionally detach from the rotor, resulting in a transient 'hidden' state (H). b. A simplified 4-state model of stator dynamics. A stator unit can go between the diffusive state (D) and the loosely bound state (L) with an on rate, k on and an off rate k off,l . From the L state, it can go to the tightly bound state (T) with a rate k t and back with a rate k l , both of which depend on the torque (Γ). From the T state, it can transition to the D state at a much lower off rate k off,t . This model also includes the transiently detached hidden state (H). The H state couples with either the T or the L state with rates k h and k −h .

A mechanistic model for stator dynamics
Motivated by the multiple timescales observed in the distribution of dwell times, we propose a minimal model for stator binding that provides a mechanistic understanding of stator dynamics. Our model is based on the assumption that the affinity between the rotor and a single stator unit is not constant. As a simple approximation of this assumption, we define two separate states for each bound stator unit, characterized by different rates of unbinding. Addition of these internal states explains the emergence of 4/14 additional time scales in the distribution of dwell times, in line with the experimental evidence. Fig. 2a illustrates the key elements of our model. Away from the motor, a stator unit is in the diffusive state (D) in which it floats freely in the inner membrane and the proton channels inside it are closed. When a diffusing stator unit collides with a rotor, it may transition to a bound state (Fig. 2a), in which it is tethered to the peptidoglycan (PG) layer of the cell wall and the proton channels open. Subsequently, protons flow through the stator unit and generate torque (Γ) that drives the rotation of the rotor, which has a radius R. Newton's third law dictates that a counter force F = Γ/R acts on the stator unit in the opposite direction (Fig. 2a). This counter force moves the tethered stator unit away from its landing point by a displacement that depends on the force F, and thus on the torque Γ. We hypothesize that the rate at which the stator unit unbinds from the rotor decreases with increasing displacement from the landing point (see SI for details). To simplify the problem, instead of modeling a continuous displacement that depends on the torque, we use a coarse-grained approximation (Fig. 2b) to describe the internal state of a bound stator unit as being in one of two possible states: a loosely bound (L) state with a higher unbinding (off) rate k off,l , and a tightly bound (T) state with a lower off rate k off,t k off,l . The loose state (L) corresponds to a stator unit with a small displacement; the tight state (T) represents a stator unit with a large displacement.
This coarse-grained model has two important features that dictate its behavior. The first is that, when a freely diffusing stator unit in the D-state binds the motor, it enters the loose state (L) by definition, at a rate k on . The on rate for the entire complex, k + , depends upon the number of available sites (N tot − N), where N tot is the total number of sites and N is the number of occupied sites. It can additionally depend on other parameters, such as the motor speed ω, which is linearly proportional to the number of attached stator units N (Fig. S1a). The second important feature of this model is that the transition rates (k l and k t ) between the loose state (L) and the tight state (T) depend on the torque (Γ). In particular, k t k l increases with torque so that the equilibrium probability of a bound stator unit to be in the tight state P t = k t /(k t + k l ) increases with torque. Consequently, the effective (observed) off ratek off = P t k off,t + (1 − P t )k off,l , which is averaged over the two bound states (T and L), is smaller at higher torque because the tight state has a much smaller off rate k off,t ( k off,l ), which is set to zero (k off,t = 0) hereafter for simplicity. Thus, torque controls the effective off rate by controlling the internal dynamics of the bound stator units.
While the above described states (D, L, and T) may be sufficient to describe the on process from freely diffusion unbound stator units and the torque dependence of the off process, our data as well as previous study 25 suggest that there is an additional "hidden" unbound state different from D. Specifically, a bound stator unit can occasionally become detached from the rotor at a rate k h . The detached unit quickly attaches again to the rotor with a much higher rate k −h k h , resulting in this hidden state being very short lived. To account for this finding, we introduce this hidden state (H) into our model (Fig. 2b). The H-state is an unbound state (it does not exert force on the rotor). However, it is also not the same as the diffusive state (D) because the stator unit stays in the vicinity of the rotor and quickly rebinds with the rotor and becomes attached again. The short-lived H states are evidenced by the fastest decay time scale in the distribution of dwell times (the first dotted red line in Fig. 1c).
Altogether, we have the minimal 4-state (D-L-T-H) model that describes the dynamics of stator assembly (Fig. 2b). Aside from the rates (k ±h ) related to the fast transient state (H), the model is defined by four rate parameters: k on , k off,l , k t , and k l . The on rate k on can additionally depend on N because of its dependence on the rotation speed ω, which is linearly proportional to N (Fig. S1a). These important biophysical parameters are hard to measure directly. In the following, we determine their values from a statistical analysis of the remodeling data obtained from single flagellar motors during their adaptation to a sudden increase in load.

The statistics of dwell times and first-passage-time analysis
Due to a separation of timescales, i.e., the transition rate k −h from the H state to the bound state being faster than the other rates, we simplify our analysis by first identifying the H states in the time series using a short time-scale threshold for the duration of the H states (see Fig. S2 in SI for details). From the H states identified in the experimental data, the kinetic rates (k ±h ) to and from the H state can be determined.
Once the short-lived H states are identified, we can separate them from the rest of the time series and focus on analysing the transitions between the other three states (L, T, and D), which enable mechano-adaptation in the flagellar motor. An N-stator

5/14
state ends with either an increase or decrease in N (N → N ± 1). The stochastic dynamics of N are controlled by both the on ('+') and off ('-') processes, and whether the '+' or the '-' transition is observed depends on which of the two happens first.
Thus, the statistics of dwell times can be understood as a first-passage-time (FPT) problem 28 with two independent stochastic processes ('+' and '-'). Mathematically, when the number of stator units reaches N at time t = 0, we can compute the survival probability S(t), i.e., the probability the motor stays in state-N at a later time t ≥ 0. The distribution P(τ) for dwell time τ can then be determined from S(t): P(τ) = − dS dt | t=τ In our model, the on process has a time-independent rate k + = (N tot − N)k on (N), where k on (N) is the on rate for a single stator unit. However, the off process has a rate k − (t|N) that is time-dependent because of the existence of the two bound states and their different off rates. This can be understood by considering a unit-i (i = 1, 2, .., N) that binds to the rotor at time t i (≤ 0) in the L state. The survival probability S i (t) can be determined analytically: where are the two eigenvalues of the transition rate matrix for the two bound states (T and L), and c = σ + −k l −k t σ + −σ − is a constant (see SI for detailed derivation). The off rate for the unit-i can then be determined from S i for t ≥ t i : where ∆σ = σ + − σ − . Equation 2 shows that k −,i starts with the "bare" off rate k −,i (t i ) = cσ + + (1 − c)σ − = k off,l when the stator unit first becomes bound at t = t i and decreases to its equilibrium value k −,i (∞) = σ − at t − t i τ e with τ e = ∆σ −1 is the timescale to reach equilibrium between the two bound states (T and L).
The overall off rate (summed over all the bound stators), , thus also depends on time, which indicates a non-Markovian (memory) effect due to the existence of the hidden bound states 1 . Given the rates k + (N) and k − (t|N), the survival probability satisfies: which can be solved with the initial condition S(0|N) = 1 to obtain a closed-form expression for the survival probability: . Details of the FPT analysis and derivation of the solution for S(t|N) are given in the SI. The observed histograms for these dwell times (Fig. S3) show the occurrence of long dwell times far outside of the exponential distribution with a shorter mean dwell time, which indicates the existence of multiple timescales even for a given N. In

Quantitative comparison between experiments and theory
where f ± is the fraction of '+' (on) or '-' (off) transitions ( f + + f − = 1); τ (N) is the mean dwell time for the N-stator state; V is the variance of dwell time σ 2 τ ≡ ∞ 0 [τ − τ (N)] 2 P(τ|N)dτ normalized by the square of its mean, which measures the magnitude of the variation in dwell times. We can also define τ ± (N) = P ± (τ|N)dτ as the average '+' or '-' dwell time, and we have: In Fig. 3, we show the comparison between experimental data and our model results for the average dwell time τ , the fraction of the '+' events f + , and the normalized variance V for different numbers of stator units N. The agreement between the experimental data and our model results supports our theory, which incorporates multiple hidden bound states. This is seen most clearly in the normalized variance V (Fig. 3c). If there were only one bound state, the dwell time distribution would be a single exponential distribution, which would lead to V = 1 (see SI). From the experimental measurements, we found V = 2.0 ± 0.4. The large normalized variance can only be explained by a model with multiple bound states like the one we proposed in Fig. 2, which leads to a theoretical value V = 1.75 ± 0.4, which is consistent with experiments 2 .  The quantitative agreement between our model and the experimental data confirms the existence of multiple bound states.
Furthermore, it allows us to determine the dominant off rate k off,l from the L-state and the transition rates (k t , k l ) between the two bound states (T and L), which are not possible to measure directly. In particular, from the fitting of our model to the experimental data (Fig. 3), we determined the values of key model parameters: c = 0.30 ± 0.11, σ + = 0.19 ± 0.1s −1 , and an upper bound for the much lower rate σ − ≤ 0.0005s −1 (see SI for details). In the regime σ + σ − , which is valid at high load, these model parameters are related to k t , k l , and k off,1 : σ + ≈ k t + k l + k off,l , σ − = k l k off,l σ + , and c ≈ k off,l σ + , from which we obtain: k off,l ≈ cσ + = 0.057 ± 0.023s −1 , k t ≈ (1 − c)σ + = 0.13 ± 0.07s −1 , and k l ≈ σ − /c ≤ 0.0017s −1 . Thus, the results of our fit show that, in our experiments at a high load, k t k l , which leads to a much decreased effective off rate σ − ≈ (1 + k t /k l + k off,l /k l ) −1 k off,l k off,l . The reason for this significant decrease in the off rate at high load is that, once bound in the L-state, a stator unit quickly transitions to the more stable T-state. The range of equilibrium off rate σ − at high load inferred from our experiments is consistent with those measured in previous experiments 25 . At low load, the equilibrium is shifted towards the L-state, i.e., k t k l , and our model predicts a much larger effective off rate σ − ≈ k off,l = 0.057s −1 , which is in excellent agreement with previous measurements at low load 20 . Our analysis also provides new information about the on process. Based on the FPT analysis, we have P + (τ|N) = k + (N)S(t|N), which leads to f + (N) = ∞ 0 P + (τ)dτ = k + (N) ∞ 0 S(τ|N)dτ = k + (N) τ . Therefore, we can obtain the on rates for different stator number N, k + (N) = f + (N)/ τ (N), from the observed f + (N) and τ (N). Furthermore, we can obtain k on = k + /(N tot − N) as the on rate for each empty binding site. In Fig. 4, we plot k on (N) for different values of N = 0, 1, ..., 8.

Number of stator units
This plot reveals several interesting features about the on process. First, the nucleation rate, or the initial on rate for N = 0: k on (0) ≈ 0.0037 s −1 is much smaller than the on rates for N ≥ 1. Second, the on rates for N ≥ 3 are roughly the same, with k on (N ≥ 3) ≈ 0.0067 s −1 . Third, the on rates for N = 1, 2 are higher than the rates for N ≥ 3. The first two features were also reported in a recent study by Ito et al 29 . At high load, the motor speed is linearly proportional to N and the low initial on rate has been attributed to a possible dependence of k on on the rotational speed ω in a nonlinear, sigmoid-like fashion 29 . However, as far as we know, the enhanced on rates for N = 1 and N = 2 have not been reported before. These high rates are related to the short average dwell times for N = 1 and N = 2 (Fig. 3a).
We do not understand the molecular details of how a freely diffusing (unbound) stator is incorporated into a rotating motor.
The dependence of k on (N) on N is likely caused by effect(s) of the motor speed on the on rate. The non-monotonic dependence we found further suggests that there may be multiple counteracting effects. On the one hand, a higher motor speed may enhance both the probability of collision between a diffusive unbound stator unit and the rotor and the collision strength, effects that could contribute to a higher on rate 29 . On the other hand, a higher speed would also mean a shorter contact time, which could lead to a lower on rate, as previously suggested by Wadhwa et al 21 . By combining these two possible counteracting effects, we propose a minimal phenomenological model to fit the data: where f 1 (N) ( f 2 (N)) is a monotonically increasing (or decreasing) function of N that describes the speed-dependent enhancing (reducing) effect of the on rate with f 1 (0) = f 2 (0) = 1. Here, we chose the simplest forms with the smallest number of parameters for these two functions that are consistent with previous studies 21,29 . As shown in Fig. 4, this simple model yields reasonable agreement with the experimental results, which support the hypothesis that the motor speed may affect the on process through two opposing mechanisms.

Summary and Discussion
In this study, we combined quantitative measurements of the remodeling dynamics of single motors and first-passage-time analysis of the statistics of dwell times. We also developed and tested a minimal four-state model that quantitatively captures multiple experimental observations of the remodeling dynamics of the motor. A short-lived unbound state (H), proposed in a previous study 25 of the steady-state motor dynamics, is confirmed in our analysis of the transient dynamics of motor remodeling. We include this H-state in our analysis for the sake of completeness, but it is not essential for mechano-adaptation.
More importantly, our study reveals the existence of multiple states for a stator unit bound to the motor, each with a different unbinding rate. This multiplicity of bound states is what confers mechano-adaptation to the motor.
In all sensory adaptation systems, a key common feature is the existence of multiple internal states that can be modulated in response to changes in external stimuli 30  Another recent study proposed a model in which the bound state is split into two states with different unbinding rates 33 .
Based on population-averaged kinetics of stator remodeling, those authors showed that a three-state model (also termed a 'two-state catch-bond model' 34 ) can explain the asymmetry observed in the timescales of relaxation to steady state from either a large or small number of stator units. However, the authors were unable to distinguish clearly between a three-state (loosely bound, tightly bound, unbound) model and a two-state model (bound, unbound) with a speed-dependent on rate, as previously proposed by Wadhwa et al 21 .
Here, by analyzing the statistics of the dwell times of single motors, we conclusively show that a two-state model is incompatible with the experimental observations. We go a step further by including the short-lived hidden state in our model and confirming its presence in our experimental data. These advances are primarily enabled by the detailed analysis of single binding and unbinding events using first-passage-time methods, rather than by looking at population averages. The convergence between our study and that of Perez-Carrasco et al. 33 , which investigated different aspects of mechanosensitive stator remodeling (dwell-time statistics vs. relaxation-time asymmetry), makes the model with multiple bound states a strong candidate for future theoretical and experimental work in this field.
The emerging picture for mechano-adaptive remodeling of the bacterial flagellar motor is that the torque generated by bound stator units controls their off rate by modulating the transition rates between the T-state (with a low or zero off rate) and the L-state (with a high off rate k off,l ), and thus the equilibrium between the two bound states. The ratio k l k t therefore depends on the torque Γ and determines the observed off rate. Quantitatively, we find that the motor can tune its effective off rate over a wide range (> 100 fold) from a very low rate (≤ 0.0005s −1 ) at high torque (near stall) to a much higher rate (∼ 0.057s −1 ) at low torque. Thus, the motor can adapt to changes in the mechanical environment by adjusting the number of stator units over a range of N tot from 0 to 11. In our experiments, the motor drove the rotation of tethered cells and therefore operated close 9/14 to stall. As a result, our data can only be used to determine the values of k t and k l at high torque (near stall). In the future, it will be interesting to use the same modeling and analysis framework developed here to analyze the data from experiments performed at different loads -for example, by using flagella labeled with beads of different sizes -to dissect the dependence of k l and k t on torque.
As first pointed out by Nord et al. 22 , the large reduction in the unbinding (off) rate of stator units as torque increases is reminiscent of the general catch-bond phenomenon, in which the lifetime of a receptor-ligand bond increases with tensile force applied to the bond 35 . In the case of stator units, however, the molecular mechanism causing the differences in off rates for different bound states remains unclear. In Fig. 2, we suggest a scenario in which the off rate may depend on the physical location (relative to its tethering position) of a bound stator unit, which is affected by the torque it generates. Another possibility is that the binding strength is increased by the torque through mechanically induced allostery in which torque production (and the resultant force) may propagate through the stator unit and cause conformational changes in the peptidoglycan binding domain of the stator unit. Indeed, these are only two of the several possible scenarios that can lead to the catch-bond phenomenon 35 .
Currently, there is no evidence to rule out either of these scenarios, both of which can be described by our model with two bound states (T and L). However, the presence of two bound states makes the binding of the stator unit to peptidoglycan analogous to the catch-bond behavior of FimH-mannose 36,37 , kinetochore-microtubule 38  binding effect) as well as on the motor speed ω. However, in our current experiments at high load, ω is linearly proportional to N, which makes it impossible to separate the dependence on N and ω. Future experiments that systematically measure the on rate under different loads are needed to understand the on process and its dependence on N and ω.
A model with multiple bound states with mechanically regulated transition rates, such as the one proposed here for the bacterial stator units, also provides a possible mechanism for downstream signaling of mechanical signals. It is conceivable that, apart from regulating the binding strength of proteins, force could also alter their biochemical interactions with downstream signaling molecules. This could explain the putative role of the bacterial flagellar motor, and stator units in particular, in surface sensing during biofilm formation and differentiation of swarmer cells 42-45 . Overall, this work demonstrates the power of combining quantitative data from single molecule experiments with detailed stochastic analysis (e.g. first-passage-time analysis) to decipher the underlying mechanisms in biological systems without requiring that all the molecular details be known. Similar approaches should be applicable to studying other stochastic dynamic processes in biology, especially those that have to do with self-assembly of multi-protein complexes and their regulation by intrinsic or extrinsic signals.

Methods and materials Bacterial strains and cultures
We used Escherichia coli strain KAF95 (alias HCB986; a derivative of AW405) for all experiments. This strain is deleted for the chemotaxis response regulator CheY. Consequently, the cells of this strain rotate their flagellar motors exclusively 10/14 counterclockwise. Additionally, this strain is deleted for the WT flagellin gene FliC and transformed with the plasmid pFD313, which expresses sticky FliC, resulting in filaments that readily attach to a variety of surfaces. Cells grown at 33 • C to OD 600 = 0.5 -0.6 were washed and resuspended in TES buffer (20 mM TES, 0.1 mM EDTA, pH = 7.5). The cells were then sheared by passing through a 20 cm long piece of polyethylene tubing (inner diameter 0.50 mm) 60 times. The cells were then washed again to remove the sheared filaments and re-suspended in TES buffer.

Electrorotation experiments
The electrorotation apparatus has been described before 21,46 . Cells were introduced into a custom-built flow cell that consisted of a circular sapphire window on one side and a circular glass cover slip on the other side. Cells readily tethered to sapphire via a short flagellar stub, which resulted in rotation of the cell body around the point of tether. The flow cell also contained four tungsten micro-electrodes whose tips were located at a short distance from the sapphire surface. The electrodes were driven in quadrature at 2.25 MHz to apply a rotating electric field on the tethered cells. This field caused an external torque on the cell body in the same direction as the torque applied by the flagellar motor. The strength of the external torque could be tuned by changing the amplitude of the rotating electric field. The temperature of the sapphire window was held constant at 20 • C by a circular Peltier element driven by a proportional controller. The flow cell and electrode assembly was fixed on the 20X objective of a phase contrast microscope. Rotating cells were imaged at 50 or 100 frames per second using a high-speed sCMOS camera (Edge 5.5; PCO-Tech).

Data analysis and step fitting
We measured the angular displacement of the cell body between consecutive frames and multiplied it with the imaging frame rate, followed by filtering with a median filter of order 15. This provided the rotation speed of the motor as a function of time (gray line in Fig. 1). We then proceeded to fit steps to the rotation speed to extract the number of active stator units as a function of time. Of all the traces, we selected only those for further analysis in which the rotation speed was below 1 Hz at the end of the electrorotation phase, so that at most a single stator unit was bound to the motor at the beginning of the high load phase.
Our approach to step-fitting consists of partitioning the total time in smaller time intervals in such a way that we minimize the point-by-point distance between the fitted step and the original trace. We call ω(t i ) the value of the rotation speed at time instant t i from the original data and, given that the time increment δt is constant for every step, we have t i = i * δt. We will call t n the total time of a given experiment, where n is the total number of measurements per trace.
We need to find an instant t l at which a step occurs. The point of the partition (the index l) is chosen in such a way that the updated step function will be as close as possible to the original data. More formally, we define the averages and ω l,n = 1 n − l n ∑ k=l ω(t k ) , where ω 0,l is the average of the original data in the time interval between t 0 = 0 and t l and ω l,n is the average of the data in the interval between t l and the final instant t n . Then, l is chosen in such a way that the residual ∆, defined as sum of the squares of the difference between the fitted step and the original data at each time instant:

11/14
is minimal. The partition is then iterated several times. The formula for ∆ after K iterations is where l i is the index for the instant of at which the i-th step in the fitted function occurs and the indices are defined so that l i < l i+1 for all values of i (i = 0, 1, ..., K − 1).
The choice of the total number of iterations K is important in order to avoid over-fitting. To determine when to interrupt the loop, at each iteration we calculate the average∆ = ∆ α that is obtained by partitioning at randomly generated instants t α rather than the specific instants that minimize ∆ to ∆ min . Iteration is stopped as soon as ∆ min /∆ > 0.995, i.e., when compared to an equal number of randomly placed steps, an additional computed step would not improve the fit by more than 0.5%.
The process described above results in a fitted step function g for a given time t u , where l i < u < l i+1 : At this stage, we must associate the discrete values of g to a specific number of stator units. To do so, we determine whether slightly different values of g during different time intervals correspond to the same number of stator units. This is done with a sorting method. First, we sort all the values of g in ascending order. Then, if two consecutive values of g (levels) differ by less than 0.75 Hz, we assign to them a new level given by the weighted average of their current levels. Then, we associate a number of stator units N to each level starting with N = 0 for the level with a value close to 0 Hz and we add a stator unit for each subsequent level.