scieee AI-readable full text Open interactive document viewer

Optimal Sampling Pattern for the Free Final Time Linear Quadratic Regulator

Balaguer, Pedro; Ariño, Carlos

Abstract

The optimal sampling problem is the selection of the optimal sampling instants together with the optimal control actions such that a given cost function is minimized. In this article, we solve the optimal sampling problem for the free final time linear quadratic regulator. Each optimal sampling instant is computed as the minimization of a maximum eigenvalue problem that is formulated at each stage by previously applying dynamic programming. The solution provides the optimal sampling instants, control actions, and the optimal final time in a recursive and constructive way. Furthermore, the solution is optimal for any arbitrary number of control moves N≥1 , as it is not based on asymptotic arguments. Two application examples show the feasibility of the approach.

Full text

1 Optimal Sampling Pattern for the Free Final Time Linear Quadratic Regulator Pedro Balaguer and Carlos Ari˜ no Abstract—The optimal sampling problem is the selection of the optimal sampling instants together with the optimal control actions such that a given cost function is minimized. In this article we solve the optimal sampling problem for the free final time linear quadratic regulator. Each optimal sampling instant is computed as the minimization of a maximum eigenvalue problem that is formulated at each stage by previously applying dynamic programming. The solution provides the optimal sampling instants, control actions, and the optimal final time in a recursive and constructive way. Furthermore, the solution is optimal for any arbitrary number of control moves N≥1, as it is not based on asymptotic arguments. Two application examples show the feasibility of the approach. Index Terms—Optimal sampling, linear quadratic regulator, control design, dynamic programming, optimal control, networked control, real-time systems. I. INTRODUCTION THE technological developments of sensor networks (SN), the Internet of Things (IoT), and networked control systems (NCS) result in a multitude of nodes sending information for supervision [1], estimation [2], and control [3]. The reduction of the number of sampling instants Nsaves energy consumption, computing power, and communication bandwidth, which may be scarce resources. Digital control systems were initially developed on the basis of periodic sampling [4]. However, for a given number of sampling instants N, non-periodic sampling may lead to a better performance than a periodic one. The optimal sampling problem, as defined in [5], is the selection of the Ninterarrival times τk:= tk+1 −tkfor k∈ {0,1, . . . , N −1}and control inputs ukfor k∈ {0,1, . . . , N −1}, such that a given cost function Jis minimized. The analytical solution of the sampling problem by deriving necessary conditions for the optimum is not feasible. Instead, numerical gradient based optimization algorithms are derived from necessary conditions, which are of high complexity. In [5] a numerical optimization algorithm is proposed that, for systems of order nand Nsampling instants, only the computation of the gradient has complexity of O(N2n3). The optimal sampling problem has similarities with the control of switched systems [6], [7]. The optimal control of switched systems is the selection of optimal continuous inputs and optimal switching sequences among a family of dynamical systems so as to minimize a given cost function. The proposed solutions are also based on numerical optimization methods. P. Balaguer and C. Ari˜ no are with the Department of Industrial Systems Engineering and Design, University Jaume I of Castell´ on, Castell´ on, 12071 Spain e-mail: [email protected] Expressions for the gradient of the cost function with respect to switching times are derived, and gradient descent optimization algorithms are employed for numerical minimization. The derived numerical algorihtms are computationally costly, not scalable with the number of sampling instants N, and, being a nonconvex problem, they lack any guarantee to find the global minimum [6], [7]. To overcome these problems, a new approach to solve the optimal sampling problem is proposed in [5], called the quantization-based sampling. The basic idea of quantizationbased sampling is to approximate the optimal continuoustime control input u(t)∗by a piecewise constant function that provides the optimal interarrival times. Once the optimal interarrival times are calculated the optimal control inputs are computed by standard linear quadratic regulator (LQR). The approach is computationally tractable because for LQR the optimal control action u(t)∗is readily calculated. Furthermore, it is shown in [5] that quantization based sampling is optimal for first-order systems for a large number of samples N. In this article we solve the optimal sampling problem for general order multiple-input multiple-output (MIMO) systems with quadratic cost function and free final time TN. This is in contrast with the problem proposed in [5] where the final time Tis fixed beforehand. As a result, we not only provide the optimal interarrival times τ∗ kand optimal control inputs u∗ kbut also the optimal final time T∗ N. It is the free final time condition TNthat allows the scalability and constructibility properties of the optimization algorithm derived in this article. The solution of the optimal sampling problem is a complex problem. In a first step we keep the complexity of the problem bounded by applying dynamic programming, which is well suited for optimal control with quadratic cost function [8]. The application of dynamic programming does not solve the optimal sampling pattern per se. Instead, dynamic programming yields a family similar interrelated optimization problems for which the optimal interarrival time can be computed as the minimization of a maximum eigenvalue problem that must be performed at each stage. The resulting algorithm is •optimal for arbitrary N≥1because it is not based on asymptotic arguments. •scalable because the optimal interarrival times are obtained by solving None-dimensional optimization problems. •recursive because the optimal interarrival times are computed backwards from the last stage in a sequential manner. •constructive because given the Noptimal interarrival times, the solution for the new problem with N+ 1 2 interarrival times just requires to solve one more onedimensional optimization problem to calculate the new optimal interarrival time. II. PROBLEM STATEMENT Consider the free final time TNlinear quadratic regulator problem PTN: min u∈UNZTN 0 (xTQx +uTRu)dt +x(TN)TSx(TN) (1) s.t. ˙x=Ax +Bu x(0) = x0 where x(t)∈Rnis the state, u(t)∈Rmthe input signal, A∈ Rn×n, and B∈Rn×mare the dynamical system matrices, Q∈Rn×n,R∈Rm×m, and S∈Rn×nare the cost function weights, with Qand Spositive semi-definite, and Rpositive definite. The control input signal u(t)is constrained to be in the set UNof N-complexity piecewise constant signals, where by piecewise constant N-complexity we mean that u(t)is a linear combination of Nindicator functions of intervals u(t) = uk∀t∈[tk, tk+1), k = 0,1, . . . , N −1 with 0 = t0< t1< . . . < tN=TN, where ukis given as an state feedback uk:= Fkxkwithout loss of generality. The sequence {t0, t1, . . . , tN−1, tN}is the sampling pattern T, while tkfor k∈ {0,1, . . . , N}are called sampling instants. For t0= 0, the sampling pattern information is also given by the sequence {τ0, τ1, . . . , τN−1}of interarrivals τk:= tk+1 − tkfor k∈ {0,1, . . . , N −1}, defined as the time between two consecutive sampling instants. Consequently, in what follows the sampling pattern Tis defined by the interarrival sequence. The previous problem is solved by providing the optimal sampling pattern T∗:= {τ∗ 0, τ∗ 1, . . . , τ∗ N−1}and the optimal control action gain sequence F∗:= {F∗ 0, F∗ 1, . . . , F∗ N−1}. III. PROBLEM DISCRETIZATION For an arbitrary sampling pattern T={τ0, τ1, . . . , τN−1}, with PN−1 k=0 τk=TN, the exact discretization of the LQR problem PTNis min uk,τk N−1 X k=0 (xT kQkxk+uT kRkuk+ 2xT kPkuk) + xT NSxN (2) s.t. xk+1 =Akxk+Bkuk(3) xk=0 =x0(4) with Ak:= eAτ (5) Bk:= Zτ 0 eA(τ−µ)dµB (6) Qk:= Zτ 0 AT kQAkdµ (7) Rk:= Zτ 0 BT kQBkdµ +Rτ (8) Pk:= Zτ 0 AT kQBkdµ (9) This result follows by direct integration of the cost function and exact discretization of the dynamical system with the arbitrary sampling pattern T={τ0, τ1, . . . , τN−1}. The details can be found in the Appendix A. Remark 1: Note that cost function parameters Qk,Pk, and Rk, except S, become a function of the interarrivals τkof the sampling pattern T. The same happens to the discrete-time system parameters Akand Bk. On the contrary xkand ukare the state and control action values at sampling instant tk, that is xk:= x(tk)and uk:= u(tk). Remark 2: The cost function of the discretized problem depends on the product xkukby means of cost weight Pk despite the continuous cost function lacks it. However, this is not a problem for optimization by dynamic programming. If the continuous time dynamic matrix Ais invertible (i.e. Ais either stable or unstable but has no poles at origin), and there exists a matrix Mthat solves the following equation ATM+MA =Q(10) equations (5)-(9) can be analytically computed yielding the following expressions for a given τk: Ak=eAτk(11) Bk= (eAτk−I)A−1B(12) Qk=AT kMAk−M(13) Rk=BTA−T(τkQ+ (I−AT k)A−TQ+ +QA−1(I−Ak))A−1B+Rτk(14) Pk= (AT kMAk−M+A−1(I−AT k)Q)A−1B(15) Problem PTNand its discrete-time counterpart are finite time problems. An infinite time cost is more desirable in order to take into account the future behaviour of the cost function once the Ncontrol actions have been applied. This can be accomplished by proper selection of the final stage cost S. For stable systems the cost of the free response (i.e.u(t)=0) is equal to −M, with Mgiven by equation (10). In fact, in the free response case Rkand Pkare equal to zero, and Qk, as given by equation (13), tends to −Mas τk→ ∞, that is limτk→∞ Qk=−Mbecause limτk→∞ Ak= 0n×ndue to stability of A. As a result setting the final cost S=−Mwe are considering an infinite time optimization problem. For unstable systems an appropriate feedback control action is required for stability. In this case we can consider a discretetime periodic LQR with sampling time τ∞with τ∞≥τN−1 3 and cost Md. Setting the final cost S=Mdwe are also considering an infinite time cost. IV. DYNAMIC PROGRAMMING The objective is to find the optimal sampling pattern T∗:= {τ∗ 0, τ∗ 1, . . . , τ∗ N−1}and the optimal control gain sequence F∗:= {F∗ 0, F∗ 1, . . . , F∗ N−1}, with uk=F∗ kxk, that solve the problem given by equations (2)-(4). In this section we make use of dynamic programming to divide the original optimal sampling problem into Nnested subproblems from which we can compute the optimal interarrival time. As shown in Fig. 1, at each stage we have to decide not only the optimal control gain F∗ kbut also the optimal interarrival time τ∗ k. The use of dynamic programming is an intermediate step to keep the complexity of the optimization problem bounded but it cannot solve the optimal sampling problem by itself. We begin by considering an arbitrary sampling pattern T={τ0, τ1, . . . , τN−1}, with PN−1 k=0 τk=TN. x0x1xkxN F0 τ0 F1 τ1 Fk−1 τk−1 Fk τk FN−1 τN−1 Fig. 1. Dynamic programming problem. At each stage k∈ {0,1,...,N−1} a control action uk=Fkxkis applied during the interarrival time τk. For an arbitrary intermediate stage k, the cost-to-go is given by Jk=xT kQkxk+uT kRkuk+ 2xT kPkuk+J∗ k+1(xk+1) (16) with J∗ k+1(xk+1)the optimal cost-to-go from stage k+ 1, calculated in the previous iteration of the dynamic program, and given by J∗ k+1 =xT k+1K∗ k+1xk+1 (17) Substituting the discrete dynamic system xk+1 =Akxk+ Bkukin equations (16)-(17) we obtain Jk=xT k(Qk+AT kK∗ k+1Ak)xk+uT k(Rk+BT kK∗ k+1Bk)uk +2uT k(Pk+BT kK∗ k+1Ak)xk The optimal control action is obtained by minimization of Jk with respect to ukresulting in u◦ k=−Rk+BT kK∗ k+1Bk−1Pk+BT kK∗ k+1Ak | {z } Fk xk (18) Note that we have written the optimized control action as u◦ k instead of u∗ k. This is to stress the fact that u◦ kdepends on the interarrival time τktrough Ak,Bk,Rk, and Pk. We reserve the optimal control action u∗ kas the control action u◦ kfor the optimal sampling interarrival τ∗ k, that is u∗ k:= u◦ k(τ∗ k). Coming back to u◦ kin equation (18), for an arbitrary interarrival τkit follows that the control action is proportional to the current state through Fklike in the classical LQR. Substitution of the optimal control action u◦ kon the cost-to-go function yields the following cost-to-go at stage k Jk=xT kKkxk(19) with Kk:= (Qk+AT kK∗ k+1Ak)−(Pk+BT kK∗ k+1Ak)T (Rk+BT kK∗ k+1Bk)−T(Pk+BT kK∗ k+1Ak)(20) The cost-to-go function is proportional to the squared state through Kk, again like in the classical LQR. However, in contrast to periodic LQR [8], the proportional factors Fkand Kkare not constant but dependent on the interarrival τk. The optimal interarrival time τkcan be obtained by minimizing the cost function (20) with respect to τk. In this article we consider the minimization of equation (20) for any direction xkleading to a guaranteed cost minimization, as discussed in Section V. Assume we have computed the optimal interarrival τ∗ kby any means, thus the optimal control action u∗ kand optimal cost-to-go function J∗ kare given, for k={N−1, N − 2,...,1,0}, by u∗ k:= Fk(τ∗ k) | {z } F∗ k xk(21) J∗ k:= xT kKk(τ∗ k) | {z } K∗ k xk(22) Note that for k=N−1we have that K∗ N=S, so the cost-to-go function from stage N−1is JN−1=xT N−1QN−1xN−1+uT N−1RN−1uN−1 + 2xT N−1PN−1uN−1+xT NSxN (23) A. Dynamic Programming Approach Given the optimal cost-to-go gain at stage k+ 1, that is K∗ k+1, it is possible to derive the cost-to-go function gain at stage k,Kk, as shown by equations (16)-(17). By computing the LQR optimal control action u◦ kgiven by equation (18) we are able to obtain the optimal cost-to-go Kkas a function of the interarrival time τk. Note that dynamic programming itself does not solve the optimal sampling pattern problem. Instead dynamic programming defines, for each cost-to-go function k, an optimization problem which solution provides the optimal sampling pattern τ∗ k. Furthermore, the optimization of interarrival times can be embedded into a family of similar problems such that each member of the family is easily related with the solution of the previous problem. By the minimization of cost-to-go kdefined by equations (19)-(20) we obtain at stage kthe optimal interarrival τ∗ kand the optimal cost-to-go gain K∗ k. In this way, 4 starting from the last stage N−1, with cost-to-go gain defined by equation (23), we are able to compute backwards the optimal sampling pattern {τ∗ N−1, τ∗ N−2, . . . , τ∗ 0}by solving None-dimensional optimization problems. Finally, we compute the optimal control action gain sequence F∗:= {F∗ 0, F∗ 1, . . . , F∗ N−1}as defined by equation (18). V. SAMPLING PATTERN COST FUNCTION The cost-to-go function is a quadratic form of the gain Kk, that is Jk:= xT k(Qk+AT kK∗ k+1Ak)−(Pk+BT kK∗ k+1Ak)T (Rk+BT kK∗ k+1Bk)−T(Pk+BT kK∗ k+1Ak)xk(24) with Qk,Pk,Rk,Ak, and Bkfunctions of τkand given by equations (11)-(15). In this article we consider the minimization of the interarrival time τkfor any state xk, leading to a guaranteed cost minimization. This problem is equivalent to the minimization of the maximum eigenvalue of matrix Kkwith respect to the interarrival τk. Hence the optimal interarrival time τkat each stage is obtained by solving the following optimization problem min τk∈(0,∞)λmax(Kk(τk)) (25) In the next section we show the existence of solution of this optimization problem. A. Well-Posedness Optimization Problem A necessary condition for the maximum singular value of problem (25) to be depend on τkis that the rank of A−1B is equal to the rank of Q, that is, the input is able to change the cost induced by the state x(t). Otherwise the maximum eigenvalue might be insensitive to the control u(t)an hence to the value of τk. In this case, one possible solution is to minimize the trace instead of the maximum eigenvalue, that is min τk∈(0,∞)trace(Kk(τk)) (26) because now the effects of the control action are captured in the cost function value. A similar discussion can be performed with the cost function dependent on the dynamical system output min u∈UNZTN 0 (yTQy +uTRu)dt +y(TN)TSy(TN) (27) s.t. y=Cx ˙x=Ax +Bu x(0) = x0 where y(t)∈Rpis the output of the dynamical system with Q∈Rp×p,S∈Rp×p, and C∈Rp×n, in such a way that CA−1Bhas rank p. In this case both optimization problems (25) and (26) are well-posed. B. Boundedness of τk At each stage we have to compute the optimal interarrival time τk. In this section we show that the range of τkis a bounded interval and that there exists a value τ∗ kinside this interval that provides a minimum. Consider the standard discrete LQR with constant sampling time. The cost-to-go gain Kkis obtained in this case as an iteration of the Riccati Difference Equation (RDE) taken τk=τ∗ k+1 and, as initial matrix, K∗ k+1. By the convergence and monotonicity properties of the RDE [9], the cost-to- go gain Kkis monotonically decreasing, then we have that Kk(τ∗ k+1)< Kk+1(τ∗ k+1). In case that τk= 0 there is no cost reduction 1, that is Kk+1 =Kk. As a result τk= 0 is not optimal, thus it must be the case that τ∗ k>0. Now we show that the value τkis upper bounded. For stable systems if τk=∞the cost-to-go gain is equal to the free response Kk=−M, hence the optimum τkmust be finite for effective cost reduction. For unstable systems τkmust be finite otherwise Kk=∞. As a result τk<∞. For practical purposes τkmay be bounded by the system settling time. VI. PROPOSED OPTIMIZATION ALGORITHM In this section we design the optimization algorithm to solve the optimal sampling control problem. The algorithm computes the optimal sampling pattern T∗:= {τ∗ 0, τ∗ 1, . . . , τ∗ N−1}and the optimal control action gain sequence F∗:= {F∗ 0, F∗ 1, . . . , F∗ N−1}in a reverse order, as can be seen in the pseudocode of Fig. 2. The amplitude of the optimal control action ukis computed in closed-loop as uk=F∗ kxxfor k∈0,1, . . . , N −1. The optimal sampling pattern at stage kis computed by minimizing the maximum eigenvalue of Kk, as show in the minimization problem (25). For the optimization algorithm it is important to stress that Kkis a function of the decision variable τkand the optimal cost-to-go of stage k+ 1, that is Kk(τk, K∗ k+1). Note that the initialization is to set K∗ N=S. In this way the optimal sampling pattern is computed backward from stage N−1to stage 0. Being the optimization problem univariate and with decision variable domain convex and bounded (i.e. 0< τ∗ k< τmax), we propose its minimization by a gradient-descent algorithm. Recall that τmax is the settling time of the dynamical system free response. The proposed optimization approach is able to provide a certificate of global optimality by solving the optimization problem twice at each stage. One optimization with starting point at τk= 0, and the other optimization with starting point at τk=τmax. If the optimal decision variables of both problems are equal, then the optimum is global. At the same time that the optimal sampling pattern is computed, the optimal control action gain Fk(τ∗ k), as given by equation (18), is also computed. Finally, we obtain the optimal control action amplitude in closed loop as uk=F∗ kxx. 1We assume that the LQR formulation provides a solution that is different to the free response, otherwise uk= 0 is optimal. 5 Fig. 2. Optimal Sampling Pattern algorithm 1: procedure OPTIMALSAMPLING(N,Q,R,S,A,B) K∗ N←S 2: for k←(N−1),0do .Compute T∗and F∗ 3: τ∗ k←minτkKk(τk, K∗ k+1).Defined by eq. (25) 4: K∗ k←Kk(τ∗ k, K∗ k+1).Defined by eq. (20) 5: F∗ k←Fk(τ∗ k).Defined by eq. (18) 6: end for 7: end procedure VII. APPLICATION EXAMPLES A. Example 1: Second Order SISO System Let us define a SISO continuous system as: ˙x=Ax +Bu y=Cx (28) A=−10 −5 5−10 , B =1 0, C =1 0  Where the cost function weights are: Q= 100 1 0 0 0 , R = 1 The optimal interarrival times and control gains are obtained by the algorithm in Fig. 2 with N= 4. Figure 3 shows the maximal eigenvalue of the quadratic k-step cost Kkas a function of τk. As can be seen, all functions fit to the same curve as τis increased. This curve corresponds to the standard discrete LQR optimal cost for constant sample time τ. The optimal sampling pattern is T∗:= {τ∗ 0= 0.0242, τ∗ 1= 0.0317, τ∗ 2= 0.0464, τ∗ 3= 0.0876}. Note that all interarrival times are decreasing. The figure also shows that all the cost functions are quasiconvex and therefore there is an unique minimum value. The computation time for the complete algorithm was 62ms in an Intel i7-8565U 1.8GHz. Figure 4 compares the continuous time LQR optimal control action u∗(t)with the optimal sampling pattern control action u∗ k. The piecewise control action u∗ kapproximates the continuous time control action u∗(t)for the first time instants, however beyond 0.2sec there is no similarity between both control actions. Finally, Figure 5 compares the optimal continuous time LQR output y∗(t)with the output y∗ kobtained with optimal state feedback controller with optimal sampling pattern previously computed in Fig 3. The numerical difference between the cost of the continuous time LQR cost and the cost achieved with the optimal sampling pattern with N= 4 is only of 0.32%. In order to compare our proposed algorithm with the one proposed in [5], the quantization-based sampling has been implemented for this example. In the cited work, the final time has to be set before the optimization. A first final time guess could be the optimal continuous state feedback controller settling time of Tf= 0.5s. With N= 4, the quantization-based sampling cost is 2.31% greater than the optimal continuous controller. If the algorithm is set with the 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 (sec) 4 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 max(Kk( )) Optimal Samplign Instant k K3 K3 * K2 K2 * K1 K1 * K0 K0 * Fig. 3. Evolution of the maximum eigenvalue of the cost-to-go gain Kk(τ) as a function of the interarrival time τ. The filled dots mark the optimal interarrival time τ∗ kfor k= 0,1,2,3that minimizes the maximum eigenvalue of Kk(τk). 0 0.2 0.4 0.6 0.8 1 1.2 time (sec) -12 -10 -8 -6 -4 -2 0 2 4 6Optimal Control Action uk * u(t)* Fig. 4. Optimal control action u∗ k(blue) for the optimal sampling pattern with N= 4 compared to the continuous-time optimal LQR control action u∗(t)(red). optimal final time T∗ f= 0.2sthe cost is only 0.82% greater than the continuous one and closer to the optimal of 0.32% obtained with our algorithm. Therefore, it can be stated that the knowledge of optimal final time is a decisive parameter for [5]. It has been also tested that both algorithms tend to the continuous cost as Nis increased. For our presented algorithm, the error is 8.6·10−4%with N= 100 and the computation time is 0.54s, thus showing convergence. B. Example 2: IoT Heating System In this example we consider the control of a home heating system. The house is divided into 5 rooms as presented in Fig. 6. Each room is equipped with a water radiator. Each radiator in rooms 1, 2, and 3 are equipped with a wireless 6 0 0.2 0.4 0.6 0.8 1 1.2 time (sec) -1 0 1 2 3 4 5Optimal Output Evolution yk * y(t)* Fig. 5. Output of the system y∗ k(blue) obtained with the optimal sampling pattern with N= 4 compared to the continuous-time optimal LQR output y∗(t)(red) 0123456789 0 1 2 3 4 5 6 7 8 9 Room 1 Room 2 Room 3 Room 4 Room 5 Fig. 6. House rooms distribution for the home heating system. battery powered solenoid valve actuators. Radiators in rooms 4 and 5 share a unique wireless battery powered solenoid valve actuator. In this case limiting the movements in the solenoid valve is decisive in order to preserve the battery life. The system has been modelled by considering that the temperatures of the five rooms are known together with the outside temperature. The control actions are measured in Watts. The thermal conductivity of the interior walls is Ki= 0.887 W m2oK, and that of the exterior walls is Ki= 0.298 W m2oK. We have also considered the conductivity of the doors Kd= 2.32 W m2oK. The ceiling height is 2.5m, the specific heat capacity is C= 1005.3J KgK and its density ρ= 1.22Kg m3. Taking into account this parameters, the next model is obtained: ˙x=Ax +Bu +Ev (29) where x= [T1, T2, T3, T4, T5]Tare the room temperatures in Celsius, u= [Q1Q2, Q3, Q45]Tare the water radiators power 0 2000 4000 6000 8000 10000 time (sec) 50 100 150 200 250 300 350 Power (Watts) Solenoid Valve Actuator Q1 Q2 Q3 Q45 Fig. 7. Optimal sampling pattern control actions for each solenoid valve. in Watts and vis the outside temperature. The dynamical system matrices are: A= 10−4      −5.17 1.79 1.34 0.81 0 1.79 −5.46 0 2.61 0 1.43 0 −5.35 0.86 1.91 1.85 5.97 1.85 −19.23 6.99 0 0 1.19 2.04 −4.24       B= 10−5      2.02 0 0 0 0 2.02 0 0 0 0 2.16 0 0 0 0 1.39 0 0 0 0.94       E= 10−41.21 1.06 1.13 2.55 1.01 T The optimization problem allows only 4 solenoid valve movements, that is N= 4, and the cost function weights are: Q= 100       10000 01000 00100 00000 00001       R=    1000 0100 0010 0001     The optimal sampling pattern control is solved with a computing time is of 0.313s. The optimal control actions for the actuators are shown in Fig. 7. As in the previous example the interarrival time of the optimal sampling pattern increases with time. The controlled system response is presented in Figure 8. It can be seen that temperature of room 4 is not controlled as it has weight 0 in the cost function. The final cost of the trajectory for the optimal sampling strategy is J= 172.517. The optimal cost of the continuous LQR controller is Jc= 170.572. The relative error is J−Jc Jc= 1.1%. As a result with the optimal sampling pattern the cost with respect to the optimal continuous solution is increased 7 0 2000 4000 6000 8000 10000 time (sec) 15 16 17 18 19 20 21 22 23 Temperature (Celsius) Evolution of Rooms Temperature T1 T2 T3 T4 T5 Fig. 8. Evolution of temperatures in each room. Note that temperature of room 4 is not taken into account in the cost function. only in 1.1%. If the number of movements are increase to N= 9 the relative error is decreased to 0.25%. VIII. CONCLUSION AND FUTURE WORK In this article we have solved the optimal sampling problem for free final time LQR of arbitrary order and with multiple inputs and outputs. We have shown how the optimal sampling pattern problem, that is to decide the optimal sampling instants, can be embedded into a family of similar problems yielding an algorithm that is optimal for any value of N≥1, scalable with respect to N, recursive, and constructive. The proposed strategy is natural for many potential real-world applications of chemical, biological or medical processes, where the treatment application times is also a variable of interest. A current area of research is the extension of the presented results to include robustness properties on the sampling pattern and its extension to problems that are non-linear. APPENDIX A EXACT PROBLEM DISCRETIZATION Consider the linear quadratic regulator problem PTN: min u∈UNZTN 0 (xTQx +uTRu)dt +x(TN)TSx(TN) (30) s.t. ˙x=Ax +Bu x(0) = x0 The exact discretization of the dynamic equation with t>tk, is x(t) = eA(t−tk) | {z } Ak xk+ (eA(t−tk)−I)A−1B | {z } Bk uk(31) Given a sampling pattern T={τ0, τ1, . . . , τN−1}, cost function (30) can be rewritten as the sum of Nintegrals ZTN 0 (xTQx +uTRu)dt +x(TN)TSx(TN) = N−1 X k=0 Ztk+1 tk (xTQx +uTRu)dt +x(TN)TSx(TN) (32) For each integral term in (32) let us substitute the state x(t) by (31) Ztk+1 tk (xTQx +uTRu)dt = Ztk+1 tk (Akxk+Bkuk)TQ(Akxk+Bkuk) + uT kRukdt =xT kZtk+1 tk AT kQAkdt | {z } Qk xk+ +2xT kZtk+1 tk AT kQBkdt | {z } Pk uk+ +ukZtk+1 tk (BT kQBk+R)dt | {z } Rk uk Computing the integrals Qk,Pk, and Rkresults in Qk=AT kMAk−M Rk=BTA−T(τkQ+ (I−AT k)A−TQ+ +QA−1(I−Ak))A−1B+Rτk Pk= (AT kMAk−M+A−1(I−AT k)Q)A−1B REFERENCES [1] J. Zheng and A. Jamalipour, Wireless sensor networks : a networking perspective. Wiley-IEEE Press, 2009. [2] X. Ge, F. Yang, and Q.-L. Han, “Distributed networked control systems: A brief overview,” Information Sciences, vol. 380, pp. 117–131, feb 2017. [3] T. Tran and Q. Ha, “Dependable control systems with Internet of Things,” ISA Transactions, vol. 59, pp. 303–313, nov 2015. [4] K. J. K. J. Astrom and B. Wittenmark, Computer-controlled systems : theory and design. Prentice Hall, 1997. [5] E. Bini and G. M. Buttazzo, “The optimal sampling pattern for linear control systems,” IEEE Transactions on Automatic Control, vol. 59, no. 1, pp. 78–90, 2014. [6] X. Xu and P. Antsaklis, “Optimal Control of Switched Systems Based on Parameterization of the Switching Instants,” IEEE Transactions on Automatic Control, vol. 49, no. 1, pp. 2–16, jan 2004. [Online]. Available: http://ieeexplore.ieee.org/document/1259455/ [7] M. Egerstedt, Y. Wardi, and H. Axelsson, “Transition-Time Optimization for Switched-Mode Dynamical Systems,” IEEE Transactions on Automatic Control, vol. 51, no. 1, pp. 110–115, jan 2006. [Online]. Available: http://ieeexplore.ieee.org/document/1576861/ [8] B. Anderson and J. Moore, Optimal Filtering. Englewood Cliffs, NJ: Prentice-Hall, 1979. [9] R. R. Bitmead and M. Gevers, “Riccati Difference and Differential Equations: Convergence, Monotonicity and Stability,” in The Riccati Equation. Berlin, Heidelberg: Springer Berlin Heidelberg, 1991, pp. 263–291. [Online]. Available: http://link.springer.com/10.1007/978-3- 642-58223-3 10