On the Performance Improvement of the Optimal-Sampling-inspired Self-Triggered Control at Implementation Stage

—The self-triggered control includes a sampling strategy that focuses on decreasing the use of computational resources (processor and network) while preserving the same control performance as the one obtained via a controller with periodic sampling. Within this framework it has been developed recently a self-triggered control technique inspired by a sampling pattern whose optimal density minimizes the control cost, this approach is called “optimal-sampling inspired self-triggered control”. However, the strategies used to implement it on microprocessor-controlled systems working under perturbation are still unclear; this paper addresses some techniques to organize and improve the implementation on actual controllers. The proposed solution comprises both the formulation of two algorithms to organize the implementation and the insertion of a closed-loop observer to deal with the perturbation that normally appears on real plants. Regarding the former, certain computationally expensive processes involved in the implementation of this control technique are treated through their replacement by lightweight polynomials ﬁtted at design stage. Simulations and practical experiments conﬁrm the solution is effective and there could be an open research topic concerning observation in optimal-sampling self-triggered control strategies


I. INTRODUCTION
N OWADAYS controllers are implemented on digital sys- tems consisting of microprocessors and communication networks.Among some of the alternatives that have efficient resource consumption in a nonperiodic fashion are the selftriggered control techniques (STC), initially proposed by [1]- [5].They solve the fundamental problem of determining both optimal sampling and efficient processing/communication strategies.Each time the control task is triggered, both the time the next sampling will be performed (sampling rule) and the control action which should be maintained until this event happens, are estimated.
Several approaches aimed at solving the problem of determining optimal sampling rules in STC have been addressed recently.An optimal sampling pattern proposed in [6] inspired the approach in [7], which is analyzed in the present study.This technique describes a sampling rule that generates approximated control actions by solving the continuous-time LQR problem [8] at each sample time.The performance guarantee is based on a number of samples over a time interval with a given sampling constraint.The sampling time is calculated by the derivative of a continuous-time LQR problem and the rule produces smaller sampling times while the control action has more variation.
Though the optimal-sampling in [6] and [7] has standard cost lower than the one obtained by periodic sampling techniques, and even than other optimal-sampling approaches i.e. [9], [10], it has many weaknesses.Since the research is still new there are many open topics, among which two stand out: (a) clarifying and organizing the implementation on real microprocessor systems, and (b) adapting the approach to cases with disturbances.
To solve problem (a), in [7] both a simulated and an experimental set-ups are described.However, a deeper explanation of the paradigm that a designer of control systems should use to put this approach on a microprocessor-based system is not shown.
With regard to problem (b) the approach in [6] could be restated by inserting robustness to uncertainty in the approach by developing new theory, or on the other hand by using observation techniques.A settlement applying observation in presence of unknown disturbances but on a different STC strategy to that used herein, is presented in [11], [12].
To overcome problems (a) and (b), the contribution of this paper is twofold.First, two algorithms are formulated to organize and synthesize the implementation of the approach in [7].Second, a time-varying closed-loop observer is applied on the approach in [7] in order to make it less sensitive to noise.
The rest of the paper is organized as follows.Section II summarizes the theory on optimal-sampling-inspired selftriggered control (OSISTC).Section III presents the insertion of state observation into the self-triggered control and also the strategies to describe the implementation.Section IV shows the simulations and experiments on a selected plant.At the end, Section V performs the analysis of results and Section VI concludes the article.

SELF-TRIGGERED CONTROL
This section summarizes the theory on OSISTC extracted from the original works in [6] and [7], and included for better understanding of the subject of study.

A. Continuous-time dynamics
Consider the linear time-invariant system (LTI) represented in continuous-time by where x (t) ∈ R n is the state and u (t) ∈ R m is the continuous control input signal.A c ∈ R n×n and B c ∈ R n×m describe the dynamics of the system, and C ∈ R q×n is the weight matrix used to read the state; x 0 is the initial value of the state.

B. Sampling
The control input u (t) in ( 1) is piecewise constant, meaning that it remains with the same value between two consecutive sampling instants, thus where the control input u (k) is updated at discrete times k ∈ N and the sampling instants are represented by t k ∈ R. Consecutive sampling instants are separated by sampling intervals τ k , and the relationship between instants and intervals is

C. Discrete-time dynamics
In periodic sampling, a constant sampling interval τ is considered.The continuous-time dynamics from (1) is discretized using methods taken from [8] by resulting in the discrete-time LTI system where the state x (k) is sampled at t k .The location of the system poles (or eigenvalues of the dynamics matrices A c , A d ) is fundamental to determine/change the stability of the system [8].Poles in continuous-time p c become poles in discrete-time p d through State-feedback control by means of pole placement requires to assign the desired closed-loop poles by hand.Nevertheless, the LQR technique allows to place the poles automatically and optimally.LQR is used by OSISTC at each t k considering τ k as the sampling time.

D. Linear quadratic regulator
The LQR optimal control problem allows to find an optimal input signal that minimizes the continuous-time and discretetime infinite-horizon cost functions in (7) and ( 8) respectively.
Regarding dimensionality in (7) and (8), the weight matrices R m×m are positive definite, and S c , S d ∈ R n×m .Refer to [13] to know about the transformation of the weight matrices from their continuous forms Q c , R c , S c to their discrete versions Q d , R d , S d .

E. Optimal sampling-inspired self-triggered control
The approach in [7] involves designing both a sampling rule as a piecewise control input, such that the LQR cost is minimized.Additionally, the periodicity of execution of the controller is relaxed so that the consumption of resources is diminishing.Then, the sampling rule is where an upper bound on the sampling intervals is given by τ max ; similarly η modifies the degree of density of the sampling sequence (smaller η yields denser sampling instants and vice versa).By minimizing the continuous-time cost function (7) an optimal continuous-time feedback gain K c is found once.According to [6] and [7] there exist optimal settings for the exponent α ≥ 0 which influences the density of the samples set; with α = 0 the sampling becomes regular (periodic).
Additionally, from [7] the piecewise optimal control signal expressed in linear state feedback form is where K d(τ k ) is calculated at each controller execution τ k .Its value is obtained by solving the discrete-time LQR problem (8) considering a fixed sampling period τ k .

III. ON THE IMPLEMENTATION OF OSISTC
The model of the proposed approach as well as the guidelines for its implementation are explained in this section.This corresponds to the main contribution of the work.

A. Original OSISTC architecture
Figure 1 is used to ensure better understanding of the original OSISTC scheme.In this configuration the output of the plant y (t) is sampled by the self-triggered sampler at each τ k ; the measured state y (k) is used by both the event scheduler and the controller.The event scheduler is responsible for calculating when the next sampling time t k+1 will be executed by means of (9).The controller computes the control action using both ( 2) and (10).The control input u (k) is kept constant along the entire sampling interval τ k in a zero-order hold manner.
In the same Figure 1, the bounded exogenous disturbances ω (t) are not treated in any way, causing noisy states and affecting the system performance.With respect to both the event scheduler and the controller, they base their procedures on the measured state y (k) (or on the error e (k) when there is a reference).Thus, the insertion of noise into the states leads to the emergence of uncertainty in both the linear piece-wise control u (k) and the sampling interval τ k .

B. Discrete-time observer
An observer constitutes a computer copy of the observed dynamic system (5) whose predicted states x(k) converge to the real states x (k) by reducing the observer's output error e (k) .The x(k) Next sample at discrete-time Luenberger observer proposed in [14] and shown in Fig. 2 is a state estimator which works properly in presence of unknown disturbances; see [8] for better understanding.Then, the system in ( 5) is reformulated as where x(k+1) ∈ R n is the state estimate and ŷ(k) ∈ R q is the output estimate.L d ∈ R n×q is the observer gain matrix.In (11), if the pair (A d ,C) is completely observable, the dual system (A d , B d ,C , D ) is completely reachable.Then, an observer gain matrix L d for the dual system can be designed and the eigenvalues (poles) of (A d − C L d ) can be arbitrarily placed [14].Consider that the eigenvalues of a matrix (A d − C L d ) are equal to the eigenvalues of its transpose (A d − L d C).

C. Proposed OSISTC architecture based on observer
Figure 3 shows the proposed self-triggered architecture in which the use of a discrete-time observer stands out to deal with noise ω (t) .Assuming that the pair (A d(τ k ) ,C) is observable along the set of all possible sampling intervals τ k , the eigenvalues of (A d(τ k ) − L d(τ k ) C) can be placed arbitrarily [14].Notice that the dynamics now depends on τ k because A d(τ k ) is a time varying matrix.The discrete poles in (6) are also dependent on the sampling interval τ k , as in In this context the observer needs to solve a new pole placement at each execution, since the discrete dynamics matrices and the discrete poles are dependent on the sampling interval τ k .This implies that the observer has a different gain matrix L d(τ k ) at each execution.Then, considering the changing dynamics, the system in (11) becomes where A d(τ k ) and B d(τ k ) are discretized matrices for a sampling interval τ k , u (k) is the linear piecewise control action calculated by (10), and L d(τ k ) ∈ R n×q is the gain matrix of the samplingdependent observer.

D. Problems considered
There are several drawbacks in assembling both the OSISTC controller and the time-varying observer on a real-time control system.
The first issue has to do with calculation of the controller gain matrix K d(τ k ) in ( 10) by solving the problem in (8) through recursive computation of the discrete algebraic Ricatti equation (DARE) until convergence [8].The second issue is the pole placement solved by Ackermann's formula [15] in order to obtain the observer gain matrix L d(τ k ) .
Both processes are computationally expensive and must be performed at each controller execution.If the execution time of the control task is too close to the minimum sampling interval, undesirable effects such as jitter could appear [16].Particularly in OSISTC, the worst case scenario comes out when the rate of change of the control action is maximal, causing a highest density in the emergence of samples (minimum τ k ).

E. Set of sampling intervals T
The set of sampling intervals T ∈ R 1×s within a closed interval [τ min ; τ max ] is where τ g is the sampling granularity defined as the least increase-unit for the sampling intervals.Each element of the set can be addressed in this way being s the length of T .The minimum and maximum sampling times, τ min and τ max , as well as τ g are chosen following the conditions detailed in [7]    where X is the entire state space taken from the physical constraint of the plant, and τ RT OS is the sampling granularity of the real-time operating system (RTOS) in which the technique will be implemented.

F. Strategy to calculate the controller gain matrix K d(τ k )
The gain K d(τ h ) is calculated by brute force for each h th element of the set T in ( 14) by the discrete-time LQR problem (8).Therefore, we obtain a total of s controller gain matrices K d(τ h ) ∈ R m×n that have the form Regrouping the elements of all gain matrices according to their position yields a group S K d that is m • n training sets long, where m and n are the dimensions of inputs and states respectively, then Each training set in ( 18) is defined in R 1×s and used to perform a polynomial curve fitting in order to find the coefficients θ of the d-degree polynomials K i j (τ k ).Therefore, we have a total of m • n polynomials each one following the form where superscript (i j) indicates the belonging of coefficients θ (i j) to polynomial K i j (τ k ); i-row and j-column show the position of polynomials into the gain matrix.Note the change of τ k instead of τ h since the former is the current sampling interval calculated online through equation ( 9) on a real controller.Thus, (17) to (19) become where d+1 .

G. Strategy to calculate the observer gain matrix L d(τ k )
It is a process similar to that described in subsection III-F.All possible observer gain matrices L (τ h ) are evaluated offline as functions of sampling intervals τ h .
The error dynamics of the observer is given by the poles of A d(τ h ) − L d(τ h ) C .A rule of thumb considers to place the observer poles five to ten times farther to the left of s-plane than the dominant poles of the system.
By computing A d(τ h ) through ( 4), assigning statically the continuous-time poles and discretizing them by (6) in order to have the vector P d(τ h ) , and finally considering C which remains constant, we obtain a total of s observer gain matrices L d(τ h ) ∈ R n×q by the poles placement method in [15] with the form Using the same regrouping criterion as in ( 18) a group S L d , n • q training sets long, is obtained Subsequently a total of n • q polynomials are calculated with the form d+1 , (23) such as in (19).Finally it is obtained where d+1 .Then, on each execution of the actual controller, after calculating the next sampling interval τ k via (9), each element of the observer gain matrix is computed through a different polynomial in the matrix L d(τ k ) .

H. Implementation guidelines
Through Algorithm 1 what was said in subsections III-F and III-G is summarized; this program can be performed offline by any numerical computing programming language.Algorithm 2 shows how to implement OSISTC on any processor with reduced performance features.

IV. RESULTS
An experiment on a real plant is presented in order to illustrate the theory introduced in the previous section.

A. Plant
The experimental plant with form (1) is the same electronic double integrator circuit as the one used in [7], so advise with that document for further information.The state space representation is ) by continuous LQR (7); T = f (τ min , τ max , τ g ) by ( 14) and ( 16); ; Compute P d(τ h ) by ( 6);  22); for i ≤ m and j ≤ n do ) by polynomial curve fitting; end for i ≤ n and j ≤ q do L i j (τ k ) = f S L d (i• j) by polynomial curve fitting; end Create K d(τ k ) by ordering all K i j (τ k ) as in (20); Create L d(τ k ) by ordering all L i j (τ k ) as in (24); Algorithm 1: Offline design Initialization of hardware, RTOS and variables; x (k) := read input();  13) Algorithm 2: Online implementation In Table I most important configurations used to design both controller and observer are detailed.These values have been based on recommendations from the literature in [7].Note that the poles of the observer have been chosen to be fast enough so that they do not slow down the dynamics of the plant

C. Implementation on a processor
The development platform comprises the digital signal controller (DSC) dsPIC33FJ256MC710A from Microchip which internally runs the Erika real-time kernel.To learn more about this environment, it is recommended to see the original work in [18] and its references, and the same implementation in [7].
The self-triggered controller uses rule (9) to calculate when it will activate itself next time; this value is used to set the RTOS to trigger the next sampling instant.Other functions of the controller are to read the states of the plant x (k) through the DSC analog/digital converter, to estimate the states x(k) through the observer, and to compute the control action u (k) which is applied directly to the plant via pulse width modulation (PWM).
Algorithm 2 has been used to perform the implementation that works on the microcontroller.To calculate the controller gain matrix, two first-degree polynomials that are functions of τ k are represented as K 11 (τ k ) and K 12 (τ k ), grouped into K d(τ k ) .This is done instead of minimizing DARE.Finally, the observer gain matrix is replaced by a pair of first-degree polynomials L 11 (τ k ) and L 21 (τ k ), framed within L d(τ k ) .This is done instead of using a pole placement method i.e.Ackermann.The sampling intervals in the simulation (Fig. 5) lie within the range [31; 60]ms, in the real system without observer (Fig. 6) are within [32; 59]ms, and in the real system with observer (Fig. 7) within [31; 60]ms.The red lines in the sampling sequence graphs correspond to the average sampling, explained later through equation ( 26).
The observer in Fig. 7 provides noise-free states that stabilize the triggering of sampling periods τ k at the same time.The implementation without observer in Fig. 6 tends to shake in steady state since its states have noise, which causes the oscillation of the triggering of sampling periods.
The average sampling metric τ av in [7] establishes where N is the number of samples within the experiment/simulation time; larger values of τ av indicate less resource utilization.In the simulation τ avS = 55.7ms, in the implementation without observer τ avNO = 51.3ms, and in the  implementation with observer τ avO = 54.1ms.The average sampling τ avNO is less than τ avO , which means that the implementation with observer has better performance than the implementation presented in [7] which has no observer, since it uses less processing resources.
Figure 8 shows how the sampling average periods behave when the density degree is changed as long as the guarantee in ( 16) is maintained.The behavior τ avO > τ avNO is recurrent, which allows corroborating the results obtained above.

VI. CONCLUSIONS
Some techniques applied at the implementation stage to improve the performance of the method in [7] were presented.A polynomial fitted offline to calculate the discrete-time controller gains, was used to replace the online discrete-time LQR problem.A time-varying closed-loop observer has been implemented by polynomial fitting techniques while avoiding the online use of the Ackermann pole placement method.
Simulations and experiments have been confirmed the solution is effective and there could be an open research topic regarding observation techniques in OSISTC.There are interesting performance measures in the literature which could become future work for this study; metrics from [7] and [10] would allow further evaluation on a real system.A comparison between the implementation with and without observer can be made to determine the true contribution of the latter.

Fig. 1 .
Fig. 1.Original architecture of the self-triggered feedback control.Solid lines denote continuous-time signals and dashed lines denote signals updated only at each sampling time.

Fig. 3 .
Fig. 3. Proposed architecture of the self-triggered feedback control with observation.Solid lines denote continuous-time signals and dashed lines denote signals updated only at each sampling time.