Twofold quantization in digital control: deadzone crisis and switching line collision

Quantization, sampling and delay may cause undesired oscillations in digitally controlled systems. These vibrations are often neglected or replaced by random noise (Widrow and Kollár in Quantization noise: roundoff error in digital computation, signal processing, control, and communications, Cambridge University Press, Cambridge, 2008); however, we have shown that digital effects may lead to small amplitude deterministic chaotic solutions—the so-called micro-chaos (Csernák and Stépán in Int J Bifurc Chaos 5(20):1365–1378, 2010). Although the amplitude of the micro-chaotic oscillations is small, multiple chaotic attractors can appear in the state space of the digitally controlled system—situated far away from the desired state—causing significant control error (Csernák and Stépán in Proceedings of the 19th mediterranean conference on control and automation, 2011). In this paper, we are interested in the analysis of a digitally controlled inverted pendulum with both input and output quantizers along with sampling. We show that this twofold quantization creates patterns in the state space corresponding to different control effort (force or torque) values for a simple PD control. We also highlight how these patterns lead to chaotic attractors or periodic cycles with superimposed chaotic oscillations.


Introduction
Nowadays, digitally controlled devices are becoming more and more popular, as the field of automation, smart devices, and the Internet of Things continuously grows.
The three main digital effects: sampling, quantization and processing delay are usually present in all kinds of digitally controlled devices [13,18]. Because of high-performance applications are featuring fast CPUs, high resolution analog-to-digital (adc) and digital-to-analog converters (dac), these effects were often negligible-in the last years-thanks to the small sampling time, fast computation and high resolution of quantizers.
Currently, however, low-and medium-cost controllers (from Atmel © AVRs in Arduinos to ARM Cortex © ST microcontrollers) are becoming widespread in several applications, which usually use 8-12 bit adcs/dacs and communicate in larger and wider networks which often introduce noticeable lags. That is, the corresponding digital effects: sampling, quantization and delay are becoming more significant.
We have shown in our previous works [2,4] that in case of rounding and sampling, digitally controlled systems can exhibit small amplitude chaotic oscillationsthe so-called micro-chaos. Rounding partitions the state space into bands corresponding to different control effort values, and sampling adds irregularity to switching events. Trajectories are allowed to cross switching lines unnoticed for a random amount of time-until the next sampling occurs. It can happen that multiple chaotic attractors appear in the state space of these systems and-depending on the initial conditions-the system may arrive to an attractor far away from the desired state. Thus, the control errors becomes large. Usually, the size of the chaotic attractor is so small that the solution is practically stable [14]. Depending on the nature of the instability of the uncontrolled system, periodic orbits with superimposed chaotic oscillations can also appear [6,7,12].
Note that the explicit control of chaos itself is not our goal with the PD-control. However, an elegant feedback control approach was introduced in [17] and applied to a simple system in [1].
The single quantization cases-where either only the measured state or only the outgoing control effort is quantized-are well known [3,5]. In some cases, when both quantizations are present, the less significant can be neglected, and one can return to a single quantization case.
Our current aim is to create a model for twofold quantization from which the single quantization cases can be inherited, and to discover the range of quantization resolutions for which the effect of the less important quantizer is negligible.
In this paper, the effects of twofold quantization are presented on an inverted pendulum with a simple PD-control. Two new types of bifurcations are also introduced: deadzone crisis (Sect. 3.3) and collision of switching lines (Sect. 4.1).

Digitally controlled inverted pendulum
Consider a single degree-of-freedom (DoF) inverted pendulum with digital control, i.e. the measured states and the output control torque are sampled and quantized. The processing delay is neglected and the controller realizes zero-order-hold, see Fig. 1. The measured angle ϕ and angular velocityφ are quantized according to input resolution r I , and the calculated control effort M is quantized with output resolution r O . After linearization, the equation of motion of the inverted pendulum assumes the following form: where α is the reciprocal of the time constant characterizing the instability of the upper equilibrium position, δ is the relative damping, P and D are control gains, τ is the sampling period and Eq. (1) is valid between subsequent sampling instants. Introducing the dimensionless time T = t/τ and using the notation = d /dT , Eq. (1) can be rewritten as wherê Taking input and output quantization into account, and temporarily returning to the original control parameters (P and D) introduced in Eq. (1), we arrive at the following: In this paper, we use a mid-tread quantizer with double deadzone, that is Int(x) yields the integer part of x (see Fig. 2). Note, that the resolution of the angular velocityφ i is r I /τ . Thus, according to the definition of the dimensionless time T , one can writeφ i τ/r I = ϕ i /r I . This results in the same dimension in displacement and velocity with the same quantization resolutions, r I at the input and r O at the output.
In some cases, one of the quantizations is dominant over the other, and therefore, the quantization with higher resolution can be neglected, and one of the single quantization models can be used (where either the input or the output is quantized) [3]. However, our goal is to analyse the joint effect of twofold quantization and examine the transition between the twofold and single quantization cases. Doing so, we can also highlight those ranges, where neglecting the less influential quantizer is valid. Fig. 1 The digitally controlled inverted pendulum with the schematic representation of the zero-order-hold and quantization at the input (measured angle, angular velocity) and output (control torque) In order to reduce the number of resolution parameters, we re-scale the space coordinate with a properly chosen (see Sects. 2.1, 2.2) characteristic displacement X . Introducing the notations x = ϕ/ X , x = ϕ / X and x = ϕ / X , the equation of motion can be rewritten as If we want to transform the output quantizer to a unit resolution one, X O = r O τ 2 characteristic displacement should be used. Similarly, using X I = r I results in unit resolution input quantization.

Characteristic displacement for unit resolution output quantization
Using X O , the equation of motion assumes the following form: Introducing ρ I = r I /(r O τ 2 ) = r I / X O one can write: whereP andD can be recognized [see Eq. (3)] and it can be seen that ρ I acts as a resolution for the input quantization and the output quantizer has unit resolution:

Characteristic displacement for unit resolution input quantization
Using X I and ρ O = r O τ 2 /r I = 1/ρ I , a similar derivation leads to: Exploiting the definition ofP,D and ρ O we arrive at the following equation: where the input quantizer has unit resolution and ρ O acts as a resolution for the output quantization.
In Equations (4 I -4 O ), a single quantization ratio (ρ) characterizes the ratio of input and output quantization resolutions. For large ρ I or small ρ O values, the input quantization dominates, and the outer quantization can be practically neglected. Similarly, for large ρ O or small ρ I values, the output quantization is more significant. Lastly, when the characteristic displacements X I and X O are equal, ρ O = ρ I = 1, therefore both quantizations have the same unit resolution.
It may seem that one could continue by choosing one of the characteristic displacements X I (and the corresponding resolution ρ = ρ O ) or X O (with ρ = ρ I ) and examine the ρ → 0 and ρ → ∞ limits to express the single quantization cases. However, neither of the two choices are perfect, as the upper limit of quantization is consequently the control effort turns to zero in Equations (4 I -4 O ); thus, this model does not reflect the physical properties of the single quantization controller. Taking the lower limit, we obtain which means that the twofold quantization turns to single quantization because the infinitely fine resolution quantizer yields the original signal itself (see Fig. 3). Consequently, it can be firmly stated that none of the single-parameter twofold quantization equations (4 I ) or (4 O ) can be solely used to analyse the transition to both single quantization cases. Therefore, we use Eq. (4 I ) to examine the transition from twofold quantization to single quantization at the output (ρ I → 0), and similarly Eq. (4 O ) to inspect the transition to the single quantization at the input (as ρ O → 0): It is worth noting that one can trivially switch between (4 I ) and (4 O ) at ρ I = ρ O = 1 or also can use one of the representations to examine the effect of rather large values of ρ, without switching to the other representation.

Micro-chaos map
Equations (4 I -4 O ) characterize the behaviour of the inverted pendulum with sampling, PD-control and quantization at both input and output. Rewriting it as a system of first-order differential equations, one can formulate its solution as: where Substituting T = 1, the so-called micro-chaos map [10] is obtained, which is valid at sampling instants: Here F i is the control effort between the dimensionless sampling instants T = i and T = i + 1. Note, that the Lyapunov exponents of the microchaos map are known analytically, as they are the eigenvalues of U(1): As Γ > δ, the Lyapunov exponents are always real numbers with opposite signs.
It is clear that the quantization causes the control effort F i to be a piecewise constant function over the state space, which consists of domains, each corresponding to a specific F i value. When the output quantization is dominant, F i = Int P x i +D x i . Thus, the aforementioned domains are parallel bands separated by parallel switching lines that can be given as (see Figs. 4 and 6).
For the input quantization case, however, these domains are rectangular areas since Consequently, the quantization results in a grid of horizontal and vertical switching lines (see Figs. 5 and 6).
Based on former research [3,8], in the case of single quantization at the output, multiple chaotic attractors can be found in the state space, at the intersections of switching lines and the x-axis, as it is illustrated in Fig.  4. Depending on system and control parameters, attractors may appear or disappear due to border collision bifurcation, or some of them may become repellers, and form one or more bigger attractors, by pushing the trajectory towards each other [2].
In case of input quantization, our general observation is that a periodic orbit (with superimposed chaotic oscillations) appears around the internal structure of repellers. Depending on the parameters, one or more chaotic attractors spanning over multiple control effort bands can be found, see Fig. 5.

Cell mapping results
In order to explore the effect of varying the quantization ratio and examine the transitions from twofold to single quantization cases, Cell Mapping Methods [11] were utilized. Simple Cell Mapping (SCM) is suitable to obtain a global picture of a certain state space region, i.e. to find periodic orbits, fixed points and their domains of attraction. Chaotic attractors are usually covered by one or more high-period cell groups [11].
Utilizing Clustered Simple Cell Mapping [9], it is possible to automatically extend the analysed state space region and also execute cell mapping in a parallel computing environment.
Our primary goal is to express the control error; therefore, we extract the location (centre of mass; x attr , y attr ) and size (S x , S y ) of chaotic attractors (see Fig. 7). In the output quantization case, the attractors reside on the x-axis (y attr = 0). Since the desired control state is the origin, any solution arriving to a specific attractor will yield a mean control error of x attr .
We have generated a series of SCM solutions by sweeping the parameter ρ I for some fixed α, β,P and D values. Figure 8 shows the transition from ρ I = 0 to ρ I = 16 atP = 0.007,D = 0.02, α = 0.074 and δ = 0, which correspond to the parameters of a realistic experimental device. Here the output quantization case has eight separated chaotic attractors (four-four on both sides, see Fig. 9 top) and as the quantization ratio increases, these attractors eventually become repellers. At ρ I = 1.28 (see Fig. 9 bottom), the outermost attractors disappear resulting in a more favourable state space configuration in terms of control error.
We trace back the aforementioned results to two phenomena: as it can be seen in Fig. 7, the switching lines become jagged, and consequently regions appear in the state space corresponding to only-P and only-D control (so-called input deadzones, see Fig. 6), due to the quantization of measured values. In the next section, we examine the effect of these new deadzones. For output quantization, the deadzone of the output quantizer creates an unstable band between switching lines sw −1 and sw 1 (see Figs. 4 and 6). On the other hand, in case of input quantization the two deadzones (corresponding to the measured values' quantizers) around the x and x axes will cause the PD-control to work as only-P control for small velocities and only-D control for small displacements (see Fig. 6). In the case of twofold quantization, during the variation of the quantization ratio, the borders of the output deadzone (uncontrolled region between the sw ±1 switching lines, where the control effort is F = 0) and input deadzones (deadzones around x and x axes, where either part of the PD-control is offline) move, thus state space objects (e.g. attractors or periodic orbits) can disappear or qualitatively change. This is called deadzone crisis.
To illustrate a possible scenario, consider Fig. 10. As the quantization ratio ρ I increases, the steps on During the transition from the output quantization to twofold quantization, a series of deadzone crises occur and eventually all chaotic attractors turn to repellers. The interactions of the repellers lead to a newly formed recurring orbit with superimposed chaotic oscillations (see Sect. 3.2 and Fig.  8).
Based on these results, it is obvious that the nonsmooth, stair-like shape of the switching lines play an important role in manipulating state space objects by opening up escape possibilities from the previously closed domains of chaotic attractors.
To gain a deeper insight in this phenomenon, the following section examines the topology of switching lines.

Switching line collision
For the single quantization cases, the switching lines corresponding to different efforts of the PD-control are simple to express: parallel lines (P x +D x = m, m ∈ Z) for the output quantization, and a grid of lines (x = i ρ I , x = j ρ I , i, j ∈ Z) for the input quantization. In the twofold quantization case, however, their explicit expression is not straightforward.
For this section of the paper, we use Eq. (4 I ) and ρ I . Starting with the implicit equation of the control effort: The domain of control effort band F i = m is bounded by two switching lines: sw m and sw m+1 , see Fig. 4. The equation of the lower bounding switching line is while the upper bounding switching line can be expressed implicitly as Expressing the quantized velocity (ρ I Int(x /ρ I )) from Eq. (11): and applying the con jugated version (Int * ) of the rounding function used in quantizers, i.e. rounding towards infinity without deadzone (see Fig. 11), yields the explicit formula of the switching lines: One can similarly derive the inverse expression: As the quantization ratio increases further, the stairs on the switching lines become larger, and at some point, the jagged switching lines will touch each other (see Fig. 12). This event-which will be referred to as Switching Line Collision (slc)-changes the topology of control effort bands in the state space, regardless of the dynamics of the system under control as the switching lines depend only on the control strategy.
When switching line collision occurs, trajectories gain the ability to bypass certain control bands by passing through a switching line intersection point. In the case of PD-control-if there is no switching line collision-bands corresponding to the same control effort are connected domains. However, if the switching lines sw m and sw m+1 collide, the band F i = m becomes disconnected (see Fig. 12). Observing the collision of sw m and sw m+1 at x = i ρ I , x = j ρ I , one can write the following condition: Here the left and right hand sides correspond to switching lines sw m and sw m+1 , respectively (see Eq. (11)(12)), both sides equal to x = j ρ I and {i, j, m} ∈ Z.
Since the quantization Int(i) has a discontinuity (see Fig. 14), we analyse a small neighbourhood ε around x = i ρ I and express the collision between the upper corner of the lower switching line (sw m ) and the lower corner of the upper switching line (sw m+1 ).
Expressing the limits, we can substitute lim ε→0 Int(i− ε) = i − 1 for sw m and use lim ε→0 Int(i + ε) = i for sw m+1 , resulting in the following equation: Resolving the quantization to infinity (Int * ) in Eq. (15), the following inequalities can be written: The inequalities in Eq. (16) can be reformulated as 1 For a given m and i, Eq. (17-18) can be solved for j ∈ Z to find switching line collisions between sw m and sw m+1 at These kind of slcs will be referred to as first-order switching line collisions (while in general, the kth order slc means the collision of sw m and sw m+k ).
It can be observed that there is a lowest quantization ratio for first-order switching line collisions to appear at a certain value of i in the state space: When ρ I ≥ ρ L ,i I , first-order slcs are present in the state space and by increasing ρ I , they become more and more frequent (see Fig. 13). Equation (17) reveals the value of the critical quantization ratio for which there is a solution for every i: When ρ I = ρ 1,i I , every switching line collides with its neighbour at coordinates x = i ρ I , for all i. To prove this statement, one can substitute ρ 1,i I into Eq. (17), and the four inequalities are reduced to two relations: This result shows that there is a solution j ∈ Z for every {i, m} ∈ Z: Note, that it does not imply that collision occurs for every x = j ρ I , too (see Fig. 13 centre panel). It follows from (18) that one can introduce the highest quantization ratio corresponding to the disappearance of first-order switching line collisions: ρ H,i When ρ I > ρ H,i I , first-order switching line collisions no longer present, because higher-order collisions take their place. Expressing the condition for the collision of sw m and sw m+1 for i (instead of j, similarly to Eq. (15)), one can write: which yields the following inequalities: Here another critical quantization ratio is revealed for which Eqs. (25-26) have a solution for every j (but not necessarily for every x = i ρ I ): Combining Eqs. (20) and (27), one can express a combined critical quantization ratio: If ρ I ≥ ρ 1 I , switching line collisions occur for all i and j.
Expressing higher-order switching line collisions in a similar fashion, one can arrive at the formulae of k-th order critical quantization ratios for the collision of sw m and sw m+k at ∀ i ∈ Z and ∀ j ∈ Z, respectively: It is important to note that due to the double deadzone of the mid-tread quantizer (see Fig. 2), switching line collisions of sw −1 and sw +1 are 2nd order ones.
Here we considered only the case of positiveP and D, but a similar analysis can be carried out for negative control parameters, as well.
In the following sections, we show how the transition between the twofold and single quantization cases affects the switching lines.

Transition from twofold quantization to output quantization
It is clear-based on Sect. 4, and Eq. (13)-that refining the input quantizer (ρ I → 0) means smaller steps on the jagged switching lines, and eventually the transition to output quantization leads to a set of parallel lines.
One can imagine this kind of transition by looking at Fig. 12. The transition from twofold quantization to input quantization, however, is not this trivial.

Transition from twofold quantization to input quantization
Switching lines corresponding to input quantizations form a regular grid of horizontal (Int(y)) and vertical (Int(x)) lines (see Fig. 6 right). The square shaped domains (or rectangle shaped domains around the axes) between switching lines correspond to integer value linear combination of the control parameters, e.g. F = iP + jD control effort at Int(x) = i, Int(x ) = j. If we would like to achieve the same structure of switching lines in the twofold quantization case, the following conditions must be satisfied: -Condition 1 switching lines must partition the state space into square shaped domains, i.e. for every x value, crossing x = i, (i ∈ Z) values must result in a switch in the control effort value. Similarly, for every x value, crossing x = j, ( j ∈ Z) must also result in a switch. -Condition 2 for each domain between the switching lines, the control effort value should be the same as in the case of input quantization. D)), which corresponds to ρ I ≥ max(1/P, 1/D) (see Eq. (28)), because in this case, for all i, j ∈ Z-at least first order-switching line collision takes place.

Condition 1 can be satisfied by using
It can be seen, that once Condition 1 is satisfied (and the structure of the state space matches the input quantization case), the control effort value of twofold quantization will be within an error of ρ O to the control effort value of the input quantization case [see Eq. (8)]. It follows therefore, that ρ O → 0 will satisfy Condition 2.

Conclusion
We have shown that twofold quantization in digital control can be characterized by the quantization ratio, corresponding to the ratio of input and output quantizers' resolution. We have presented that twofold quantization can be reduced to a single quantization case (input or output quantization) if an appropriate quantization ratio ρ is used and its limit ρ → 0 is analysed.
The micro-chaos map corresponding to a digitally controlled inverted pendulum was presented and the Clustered Simple Cell Mapping method was used to analyse the effect of varying the quantization ratio. Numerical results revealed, that the chaotic attractors disappear or merge due to the change of the switching lines and deadzones corresponding to input quantization.
We have presented, that deadzone crisis occurs, when the innermost stair on the switching linegoverned by the input quantization deadzone-grows large enough to collide with other state space objects.
Analysing an example transition from output to twofold and finally input quantization, we have highlighted that a series of deadzone crises happen and separated chaotic attractors merge into a single recurring orbit.
Another interesting effect, the switching line collision was also introduced, which can induce qualitative changes in the state space of continuous flows. Since the solutions of maps are allowed to "jump" in the phasespace, the effects of slc are less pronounced in the case of maps. This is the reason why no slc-related sudden bifurcations were detected during the analysis of the micro-chaos map.
From practical point of view, it is possible to improve the properties of the control for a given application, by carrying out an analysis of the quantization ratio and selecting a favourable range as illustrated in Sect. 3.2. Doing so, one can also find out how to improve a certain controlled system, i.e. which quantizer should be replaced by a higher-resolution one. In some cases one can even arrive to an unnatural conclusion, that using lower-resolution output quantizer or larger sampling time will actually result in lower control error. Similar results were found in [15,16], where the quantization improved the stability properties of the controlled system.