Next Article in Journal
Design of Space Efficient Electric Vehicle Charging Infrastructure Integration Impact on Power Grid Network
Previous Article in Journal
A Combinatorial Model for Determining Information Loss in Organizational and Technical Systems
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Sampling Rate Optimization and Execution Time Analysis for Two-Degrees-of-Freedom Control Systems †

Department of Automation, Technical University of Cluj-Napoca, Str. G. Bariţiu nr. 26-28, 400027 Cluj-Napoca, Romania
*
Authors to whom correspondence should be addressed.
This paper is an extended version of our paper published in 2022 IEEE International Conference on Automation, Quality and Testing, Robotics (AQTR), Cluj-Napoca, Romania, 19–21 May 2022. https://0-doi-org.brum.beds.ac.uk/10.1109/AQTR55203.2022.9802027.
These authors contributed equally to this work.
Submission received: 25 August 2022 / Revised: 13 September 2022 / Accepted: 16 September 2022 / Published: 22 September 2022
(This article belongs to the Section Engineering Mathematics)

Abstract

:
The current journal paper proposes an end-to-end analysis for the numerical implementation of a two-degrees-of-freedom (2DOF) control structure, starting from the sampling rate selection mechanism via a quasi-optimal manner, along with the estimation of the worst-case execution time (WCET) for the specified controller. For the sampling rate selection, the classical Shannon–Nyquist sampling theorem is replaced by an optimization problem that encompasses the trade-off between the fidelity of the controllers’ representation, along with the fidelity of the resulting closed-loop systems, and the implementation difficulty of the controllers. Additionally, the WCET analysis can be seen as a verification step before automatic code generation, a computational model being provided. The proposed computational model encompasses infinite-impulse response (IIR) and finite-impulse response (FIR) filter models for the controller implementation, along with additional relevant phenomena being discussed, such as saturation, signal scaling and anti-windup techniques. All proposed results will be illustrated on a DC motor benchmark control problem.

1. Introduction

1.1. Literature Review

The problem of sampling rate choice to numerically implement a controller designed in the continuous-time domain has significant importance. A sub-optimal value of the sampling period represents a trade-off between the fidelity of the response, given by a shorter sampling rate, and implementability, obtained using a larger sampling rate. The most common manner to choose this sampling period is given by the Shannon sampling theorem [1]. However, this can only be a starting point in a control context, because, in practice, it can lead to unacceptable behavior of the discrete-time controller compared to its continuous-time equivalent, a significant justification being the presence of quantization errors unaccounted for in the signal and system models. In the available literature, the problem of choosing the sampling rate is specifically formulated for the purpose of the particular control system at hand. For example, for a structure with a P-type regulator proposed in [2], the key points used in sampling rate selection are the overshoot and the rise time. For the case of a PID-based control structure, an optimization criterion has been proposed in [3] to find the optimal and/or sub-optimal value of the sampling rate. The problem of sampling rate selection for parameter estimation of an induction machine has been solved via a metaheuristic procedure in [4]. A similar thematic is addressed in [5] in the case of permanent magnet synchronous motors using field programmable gate array devices, while the rapid control prototyping principle is illustrated for discrete-time closed-loop control of brushless DC motors in [6,7], respectively. Moreover, an important result regarding the dependence between the stability and the performance of the closed-loop system, and the choice of sampling rate is presented in [8].
After the first step of selecting the sampling period, an analysis regarding the practical implementation of the proposed control structure on a microprocessor-based system should be performed. This analysis needs to encompass several aspects which are not explicitly modeled in the control law, such as the register word lengths of the coefficients which directly influence the number of necessary assembly instructions, and saturation, overflow, underflow verifications on the computed command signals. In the specific context of rapid control prototyping (RCP), one key step before the proper code generation is to certify if its execution abides by the time span given by the sampling period. Moreover, other important verifications for phenomena such as underflow and overflow, or saturation and anti-windup techniques should be also performed before the code-generation step. As such, one important goal consists of approximating the number of software operations necessary to implement the designed control law, mandatory in the context of hard real-time systems. A survey of worst-case execution time computational methods is presented in the seminal paper [9]. A simplified study applied for control system-related interrupt service routines for state-space controller representations is presented in [10]. Another possibility for the computational error analysis is presented in [11].
In the Control Systems domain, the linear control system field plays an important role. Linear controller design techniques are available for both linear plants and nonlinear process models alike. Starting from the classical proportional–integral–derivative (PID) controller [12] towards the domain of robust controller [13,14,15], these techniques can be extended for nonlinear systems via the gain-scheduling method [16] or an additional passivity-based component [17]. Moreover, with great advantage in also coping with disturbance rejection problems, alongside reference tracking specifications are the so-called two-degrees-of-freedom (2DOF) control schemes [13]. In ref. [18], a 2DOF PID controller has been proposed, where the serial compensator is a classical PID controller, while the feedforward compensator is a PD controller, the integral effect being excluded due to the stability requirements. For the case of unstable plants with time delays, a discrete-time 2DOF control scheme has been proposed in [19]. As such, for reference tracking, the serial controller was designed using the H 2 optimal control framework, while the feedforward controller has been tuned by imposing the desired closed-loop transfer function. Additionally, in terms of software toolbox implementations, the robust advanced PID (RaPID) toolbox described in [20] presents a set of possibilities to design a 2DOF PID control structure by minimizing certain error criteria, such as the integral of absolute error or integral of time multiplied by the absolute value of error.

1.2. Contributions and Paper Structure

The current journal paper represents an extension of the conference papers [10,21], and proposes a joint analysis on sampling time selection and execution time framing of the microcontroller operations into the previously established optimum for the case of a 2DOF control structure. The main contributions of the paper are:
(i)
to extend the functionals initially proposed in [21] in order to encompass the fidelity of both controllers from the 2DOF structure and of the resulting closed-loop systems, i.e., ensuring the tracking and servo behavior of the initially designed continuous-time controllers, along with the implementation difficulty of the proposed controllers in terms of quantization and sampling rate span;
(ii)
to formulate the optimization problem for sampling rate selection of a 2DOF control structure without considering any further normalizations of the final functional’s terms and propose a metaheuristic-based solution to find an optimal or quasi-optimal value of the sampling rate which can offer a good trade-off between implementability and fidelity;
(iii)
to extend the WCET analysis, initially proposed in [10] for the case of state-space regulator implementations, for the case of controllers implemented as infinite-impulse response (IIR) or finite-impulse response (FIR) filters, offering an upper bound estimation of the time span necessary to perform all the operations involved in the numerical implementation of the proposed 2DOF controller;
(iv)
to offer an exhaustive analysis which can be further performed in an automatic manner and to be integrated in our open-source MATLAB-based CACSD toolbox [22];
(v)
to present an end-to-end design procedure for the case of a DC motor control problem, starting from the controller design, followed by choice of the quasi-optimal sampling rate and the worst-case execution time analysis, finalizing with a detailed discussion.
The rest of the paper is organized as follows: Section 2 presents the 2DOF structure which will be studied, along with a mathematical background for the sampling rate choice and worst-case execution time analysis, and a set of theoretical results and optimization problems extended and adapted for the proposed control structure; in Section 3 a case study consisting of an end-to-end design procedure of a 2DOF PID controller is illustrated, while Section 4 deals with a set of conclusions and further research directions.

1.3. Notations

We denote by C z , r the circle with the center in z C and radius r > 0 . Additionally, P ( G ) and Z ( G ) denote the pole and zero sets of an LTI system G, respectively. An arbitrary sampling period will be denoted T s T > 0 throughout the paper. Continuous-time regulators will be denoted K ( s ) K , while their discrete counterparts, as a function of the sampling period will be used as K T ( z ) K T . The set of continuous-time systems will be denoted by G , while the set of discrete-time systems will be denoted by G D . The standard growth functions and their notations according to [23]:
O ( g ( n ) ) = f ( n ) c , n 0 > 0 such that 0 f ( n ) c g ( n ) , n n 0 ; Ω ( g ( n ) ) = f ( n ) c , n 0 > 0 such that 0 c g ( n ) f ( n ) , n n 0 ; Θ ( g ( n ) ) = f ( n ) c 1 , c 2 , n 0 > 0 such that 0 c 1 g ( n ) f ( n ) c 2 g ( n ) , n n 0 .

2. Mathematical Background and Proposed Extensions

2.1. Numerical Closed-Loop Control

Modern control systems make use of numerically implemented regulators to coordinate continuous-time processes. The classical configuration of a numerical regulator is presented in Figure 1. It uses sample and hold circuits as interfaces to the continuous-time adjacent components and, as such, it imposes the zero-order hold discretization method for the plant G. As such, define the plant discretization methodology as the mapping G ( s ) , T G T ( z ) G ( z ) G D :
G T ( z ) = Z L 1 G z o h , T ( s ) · G ( s ) : G × R + G D .
with G denoting the continuous-time model set, G D being the discrete-time model set, and with the digital-to-analog converter, i.e., zero-order hold, model:
G z o h , T ( s ) = 1 e s T s .
For the purpose of this paper, we consider a two-degrees-of-freedom (2DOF) control structure as in Figure 2, which has an inner controller K in ( s ) usually designed for disturbance rejection, and a feedforward controller K ff ( s ) which provides the necessary compensation for the steady-state tracking behavior, along with the process model with disturbance, described by G ( s ) and G d ( s ) . As  K ff does not influence the signal path from the disturbance d ( t ) to the output y ( t ) , the usual design workflow is to synthesize K in and, then, to fine-tune the transient response from r ( t ) to y ( t ) through K ff . Both continuous-time controllers K in ( s ) and K ff ( s ) are assumed to have the following linear and time-invariant (LTI) state-space representations:
K x ( s ) : x ˙ c = A K , x x c + B K , x u c y c = C K , x x c + D K , x u c , x { in , ff } .
Given that the continuous-time controllers K in ( s ) and K ff ( s ) must be numerically implemented on a microcontroller, the problem of selecting an appropriate sampling period T ( 0 , ) becomes a critical step. For a fixed sampling rate T, the discrete-time form of a controller K x ( s ) can be written as:
K x ( z ) : x k + 1 = Φ x x k + Γ x u k y k = C K , x x k + D K , x u k , x { in , ff } .
To compute the transition matrix Φ x and the input matrix Γ x , a wide selection of discretization methods, denoted by D , can be considered, such as zero-order hold, trapezoidal (Tustin), forward or backward Euler, frequency-response regression and so on. Additionally, in most situations, the output matrix remains the same as in the continuous-time representation, but there exist cases when it may be different than its continuous-time counterpart. As such, from a tuple of a continuous-time transfer matrix K x ( s ) = ( A K , x , B K , x , C K , x , D K , x ) G and a sampling rate T R + results an equivalent discrete-time transfer matrix K ( s ) , T K T ( z ) K ( z ) G D , where:
K T ( z ) = D K ( s ) , T : G × R + G D .
The open-loop process model has the input-output representation:
Y ( s ) = G d ( s ) · D ( s ) + G ( s ) · U ( s ) ,
while the closed-loop system expression becomes:
Y ( s ) = G d ( s ) 1 + G ( s ) K in ( s ) · D ( s ) + G ( s ) ( K in ( s ) + K ff ( s ) ) 1 + G ( s ) K in ( s ) · R ( s ) .
The discrete-time equivalent closed-loop model will be:
Y ( z ) = G d ( z ) 1 + G ( z ) K in ( z ) · D ( z ) + G ( z ) ( K in ( z ) + K ff ( z ) ) 1 + G ( z ) K in ( z ) · R ( z ) = H c l d ( z ) D ( z ) + H c l r ( z ) R ( z ) ,
which represents the starting point for various control design methodologies.

2.2. Sampling Rate Optimization

The current subsection presents an extension of the work from the paper [21].

2.2.1. Linear System Sampling Background

The well-known Shannon theorem [1] states that the necessary sampling rate to avoid information loss must be at most twice time smaller than the inverse of the continuous-time signal’s maximum frequency component:
T s < T min 2 f s > 2 · f max , where f max = 1 T min .
Moreover, the theoretical upper bound of the frequency range after which aliasing phenomena occur is called Nyquist frequency and is given by:
ω N = ω s 2 = π · f s .
The above-mentioned version of Nyquist-Shannon theorem for signals can be extended to LTI systems by considering that the resulting discrete-time system must maintain all relevant dynamics of the continuous-time system. The dynamics of a system is given by its set of poles, one possible constraint for the sampling rate implying to be at most twice smaller than the inverse of the real part of the minimum value of poles. However, there are cases when the imaginary part of the poles is relevant, or even the values of the transmission zeros, for a good representation of the system’s frequency response.
For the remainder of the paper, the sampling rate will be denoted by T s T . The analytical relationship between the continuous-time s-plane and the discrete-time z-plane is illustrated by the equation:
z = e s · T .
Considering a point s = σ + j ω , with  σ , ω R , the resulting corresponding complex number is z = e σ T cos ( ω T ) + j sin ( ω T ) . As such, the left half of the complex s-plane can be split into an infinite number of disjoint strips of height 2 π T , due to the periodical nature of the sin ( · ) and cos ( · ) functions. The resulting primary strip contains points which correspond to ω ω N , ω N . The s-plane to z-plane mapping causes the following topologies of the primary strip of the s-plane:
  • the imaginary axis in is mapped to the unit circle C 0 , 1 ;
  • the upper and the lower edges are both mapped to the negative axis;
  • the negative real axis is mapped to the positive axis inside the unit circle;
  • the interior of the primary strip is mapped in the unit disk.
When sampling an LTI controller, several remarks can be considered then the behavior of the singularities is studied:
(i)
unstable zeros and poles tend decreasingly to the unit circle’s circumference, i.e.,  z 1 and p 1 as T 0 ; for poles, this aspect is relevant when sampling systems, as controllers generally do not employ unstable poles in their structure;
(ii)
stable zeros and poles tend increasingly to the unit circle’s circumference, i.e.,  z 1 and p 1 as T 0 , requiring additional decimal or binary digits for an accurate representation.
(iii)
poles and zeros from the imaginary axis in the s-domain are maintained on the unit circle in the z-domain irrespective of the sampling period T > 0 . Additionally, integrator and derivative terms do not matter in deciding the practical sampling time.
(iv)
the quantization error increases as T 0 in the case of stable closed-loop systems.
Remark 1.
The quantization error mentioned in (iv) increases as T 0 as proved in [24], due to the guaranteed steady-state error being proportional to 1 1 ρ Φ , while ρ ( Φ ) denotes the spectral radius of the closed-loop state matrix: Φ = A ^ B ^ D ^ C ^ , based on the series interconnection between the controller and the process model matrices.
According to the previously mentioned aspects, a sub-optimal value of the sampling rate must ensure a good trade-off between the fidelity of the representation of the continuous-time controllers and their implementability difficulty. As such, we next introduce a set of functionals to quantify these two aspects.

2.2.2. Proposed Functionals

To measure the similarity between a continuous-time LTI system H ( s ) and a discrete-time system H T ( z ) over the frequency range Ω , the following functional can be defined as S H Ω : D ( 0 , ) , with  D = G × R + :
S H Ω ( T ) = Ω σ ¯ H ( j ω ) σ ¯ H T e j ω T 2 d ω ,
where σ ¯ ( · ) is the maximum singular value. Moreover, as mentioned before, the available frequency domain is Ω = ( 0 , ω N ) , ω N being the corresponding Nyquist-Shannon frequency to the sampling rate T. Therefore, the similarity functional S H : D ( 0 , ) becomes:
S H ( T ) = 0 + ω N σ ¯ H ( j ω ) σ ¯ H T e j ω T 2 d ω .
However, to compute the similarity integral term S H , a discrete set from the frequency range ( 0 , ω N ) Ω ¯ = ω ̲ = ω 1 < ω 2 < < ω N ω ε = ω ¯ can be considered, the performance index being approximated as follows:
S H Ω ¯ ( T ) ω Ω ¯ σ ¯ H ( j ω ) σ ¯ H T e j ω T 2 Δ ω ,
where ω ε > 0 is a predefined threshold used to avoid the prewarping phenomenon which ensues in the magnitude responses when ω ω N .
Remark 2.
There are several alternatives in defining the similarity between two LTI systems, with particular interest for closed-loop connections, such as the normalized dissimilarity function metric, described in [25], the standard ν-gap metric, with its limitations exposed in [26], or the improved Vinnicombe ν-gap metric [27], described as:
δ ( G 1 , G 2 ) = max δ ¯ G 1 , G 2 , δ ¯ G 2 , G 1 ,
with:
δ ¯ ( G 1 , G 2 ) = inf Q H M 1 N 1 M 2 N 2 Q ,
where for the reference systems G 1 and G 2 , their right normalized coprime factorizations will be considered: G 1 = N 1 M 1 1 and G 2 = N 2 M 2 1 , which in context of the proposed sampling rate optimization problem, the differences should be computed with the subsystems applied in G 1 K ( s ) j ω and G 2 K T ( z ) e j ω T , respectively.
To define the fixed-point implementability functional I H ( T ) : D ( 0 , ) which measures the quantization implementation difficulty of the LTI system H T ( z ) , the following expression can be considered:
I H ( T ) = 1 min λ 1 , λ P H T Z H T ,
with P and Z denoting the pole and zero sets of H T , respectively, excluding singularities from the set C 0 , 1 .
Alongside the previous implementability functional, an execution time cost functional T H ( T ) : D ( 0 , ) becomes necessary to limit the decrease of T 0 which would ideally lead the similarity functional costs to zero:
T H ( T ) = 1 T .
A concluding functional with global effect, J stab ( H ) : D { 0 , } , will define the feasibility domain of the optimization problem, because it accepts or rejects a specific sampling period value. It induces an infinitely valued constant when the numeric system H T becomes unstable, and otherwise, defaults to no extra penalization:
J stab ( H ) ( T ) = + , if H T has unstable poles ; 0 , otherwise .
For the numerical implementation of the stability functional, a sufficiently large value α can be considered to mark the feasibility subdomain of D where the system H is stable, leading to an approximation of the original performance index:
J stab ( H ) α ( T ) = + α , if H T has unstable poles ; 0 , otherwise .

2.2.3. Optimization Problem

For the two-degrees-of-freedom control structure proposed in Figure 2 the following functionals will be considered to formulate the optimization problem to determine the sampling rate:
  • two terms S K in ( T ) and S K ff ( T ) representing the similarity between the continuous-time and the discrete-time representations of the controllers K in ( s ) and K ff ( s ) over the frequency range ( 0 , ω N ) ;
  • two terms S H c l r ( T ) and S H c l d ( T ) representing the similarity between the continuous-time and the discrete-time representations of the resulting closed-loop systems H c l r ( s ) and H c l d ( s ) over the same frequency range;
  • the quantization implementation difficulty I K in ( T ) and I K ff ( T ) of each controller along with the execution time functional T ( T ) ;
  • the stability functional J stab ( H c l r ) ( T ) of the resulting numerical closed-loop system H c l , T r ( z ) .
The first set of three terms are used to measure the fidelity between the components of the continuous-time designed system and the resulting components in the discrete-time domain, considering the transient and steady-state performance altering. The next set of three terms manages to encompass the implementation difficulty of the resulting controller, according to the already-mentioned remarks. The last term is nothing but a correction used to define the feasibility subdomain of D . As such, a trade-off between the first two sets of performance indices must be established by taking into account the last feasibility term, resulting a non-convex optimization problem. However, in order to increase the flexibility of this optimization problem, a set of weights c 1 6 can be considered as follows: the weights c 1 , c 2 , c 3 , and  c 4 are for the fidelity measurement indices, while weights c 5 , c 6 , and  c 7 are for the implementability indices, the final functional J : D R ¯ + being:
J ( T ) = c 1 S K in ( T ) + c 2 S K ff ( T ) + c 3 S H c l r ( T ) + c 4 S H c l d ( T ) c 5 I K in ( T ) + c 6 I K ff ( T ) + c 7 T ( T ) + J stab ( H 0 ) ( T ) .
Moreover, considering the numerical approximations (14) and (20), the following numerically implementable non-convex optimization problem occurs:
Problem 1.
For an LTI plant model G ( s ) included in a two-degrees-of-freedom control structure with the continuous-time inner controller K in ( s ) and with the continuous-time feedforward controller K ff ( s ) as in Figure 2, define an ordered set of pulsations, preferably in logarithmic scale:
Ω ¯ = ω ̲ = ω 1 < ω 2 < < ω N ω ε = ω ¯ .
Then, the functional J Ω ¯ : D R + :
J Ω ¯ ( T ) = c 1 S K in Ω ¯ ( T ) + c 2 S K ff Ω ¯ ( T ) c 3 S H c l r Ω ¯ ( T ) + c 4 S H c l d Ω ¯ ( T ) + c 5 I K in ( T ) + c 6 I K ff ( T ) + c 7 T ( T ) + J stab ( H 0 ) α ( T ) ,
with weighting terms c 1 7 , leads to the following quasi-optimal sampling time optimization problem:
min T D J Ω ¯ T .
Remark 3.
The resulting optimization problem (24) is non-convex by nature. As such, the line-search procedure used to solve this problem must be able to explore the whole feasible domain. One possible solution is a metaheurisitc approach, such as particle swarm optimization (PSO) [28], which will be used for the purpose of this paper.

2.3. Worst-Case Execution Time Analysis

The current subsection presents an extension of the work from the paper [10].

2.3.1. Execution Time Model

This subsection proposes the study of the implementation details for the case of linear control structures, where controllers will be modeled as infinite-impulse response (IIR) and finite-impulse response (FIR) filters. Starting from [10], a set of implementation aspects which are treated for state-space realizations will be considered in a unified manner for the case of transfer matrices in this paper. Additionally, this section also analyzes the 2DOF extension. The duration for each operation involved in the control structure can significantly impact the regulator implementability.
The necessary mathematical operations to fully implement an LTI-based control law must be formally defined. Besides the LTI-control law, the classical saturation and anti-windup nonlinearities will be considered, which are usually related to said LTI laws. The unary and binary mathematical operators defined in Table 1 and gathered in the operations alphabet O = 𝓃 , 𝒶 , 𝓂 , 𝓈 , 𝓌 , 𝓁 , are considered with real operands and must be accounted for into a microprocessor-based environment.
As such, the process of computing a command signal y [ k ] as in Figure 1 implies a finite and formal computational finite sequence S 𝒸 O N , where all terms are mathematical operations as in Table 1, i.e.,  S 𝒸 [ i ] = p i O , i = 1 , N ¯ , where N depends on the structure of the controller K ( z ) . Moreover, in order to additionally specify a set of practical hardware specifications and constraints H and to uniformly describe the problem, the finite sequence can be now extended to a full sequence S 𝒸 K , H O :
S 𝒸 K , H = p 1 , p 2 , , p N , n , n , , p i O .
Starting from an array S 𝒸 K , H of operations as (25), we follow with a general-purpose instruction set model. Assume a Random-Access Machine (RAM) computational model as in [23], with deterministic operations. RAM machines have practical counterparts, materialized through RISC machines. Reconfigurable RISC machines specialized on certain problems have been proposed in [31]. Additionally, there is the approach of multiply and accumulate (MAC) instructions supported in digital signal processors (DSP) [32]. Depending on the supported computer architectures of the RCP framework, relevant are also Single Instruction stream/Multiple instruction Pipelining (SIMP) [33] constructions with respect to single-processor architectures, or Single Instruction/Multiple Data (SIMD) features, which allow the practical parallelization of addition and multiplication operations for several sets of operands.
Definition 1.
The hardware constraints and specification set H encompasses metadata which imply extra operations or different approaches to the standard operations performed on the controller signals and implementation-specific information, with various outcomes on the total execution time, frequently found in practice being:
  • reading reference signals r [ k ] and plant measurements y [ k ] , all input signal reading steps may imply preprocessing constraints in terms of sensor delays, impulse counters or data type conversions—this equates to adding p i 𝓃 , 𝓁 steps;
  • scaling operations for the input and output signals imposed by the operating point used for plant linearization: Δ u [ k ] = u [ k ] u 0 and y [ k ] = y 0 + Δ y [ k ] , which equates to augmenting the sequence set with p i 𝒶 , 𝓈 , 𝓁 items;
  • input and output signals scaling operations, i.e.,  u s [ k ] = a u · u [ k ] + b u and y s [ k ] = a y · y [ k ] + b y , useful especially for sensor/adapter signals, and extend the operations with p i 𝒶 , 𝓂 , 𝓈 , 𝓁 ;
  • starting from the variable base word length L of the microcontroller arithmetic registers which allows operations to be executed in a single clock tick, each variable’s type and size should be adequately adapted for 2 × L , 4 × L etc., which complicates the adding and multiplication routines with additional p i 𝒶 , 𝓂 , 𝓁 steps;
  • controller gain-scheduling verifications and updates based on the value of the input signal u [ k ] , leading to extra p i 𝓁 ;
  • underflow and overflow checks for involved signals, implying saturations p i 𝓈 ;
  • availability of Direct Memory Access (DMA) modules, MAC instructions, circular buffers in opposition to linear buffering, or output bypassing, which has the advantage of discarding p i 𝓁 operations.
Such specifications will be quantified by scaling factors γ j to the base duration of the RISC machine model operations. Depending on the significance of the alternative instruction, γ j could be less than, equal to, or greater than one, respectively.
Therefore, a set of instructions S 𝒸 K , H can be manually designed or automatically deduced. For manual modeling, the control engineer needs to find this set for each control law, while for automatic mode, an RCP tool can already deduce this set. Such an RCP tool generally deals with the code generation for different environments. Now, the sequence of operations generator procedures can be seen as a functional:
Ψ : G D × H O , Ψ K , H = S 𝒸 K , H .
To implement the mathematical operations p i O from Table 1, the atomic assembly instructions a i A = NOP , MF , MS , ADD , MUL , SH , JMP , CMP from Table 2 will represent the starting point. It covers the basic arithmetical operations required in linear systems, with the additivity and homogeneity properties, conditional jumps for saturations and the anti-windup of integrator terms, forced and imposed delays through data acquisition hardware and access to memory devices. Each arbitrary atomic assembly operation will be denoted by a, as part of the formal set A all the equivalent assembly instructions supported by H for the implementation of S 𝒸 , with the RISC machine assumption that each instruction takes a fixed clock tick value T c l k > 0. The number of ways in obtaining the resulting assembly instructions is not unique and it further depends on the structure of H . A straightforward example to illustrate this phenomenon is when the regulator coefficients are stored contiguously in the memory in comparison to arbitrary and uncorrelated memory registers. The execution time implications are obtained through different pointer operations. To conclude, a new mathematical operator analogous to (26), tasked with the generation of a computer-equivalent set of instructions given by the functional S 𝓅 A is:
Ξ : G D × H A , Ξ K , H = S 𝓅 K , H ,
which results in an infinite sequence of atomic software instructions, but with a finite number of them being different to NOP, located at the start of the sequence, which implement the linear controller formula:
S 𝓅 K , H = a 1 , , a M , NOP , NOP , , a i A .
The difference between the sets S 𝒸 and S 𝓅 is that S 𝒸 contains abstract mathematical operations p i O , and each such operation p i will be practically implemented using equivalent a i , j A steps, j = 1 , N i ¯ , as in the mapping:
p i a i , 1 , a i , 2 , , a i , N i , i = 1 , N ¯ ,
the number of atomic operations different from NOP being M = N 1 + N 2 + + N N .
The importance of the previously defined sequences and functionals, i.e.,  S 𝒸 K , H , Ψ , S 𝓅 K , H and Ξ , respectively, and the implications of estimating the number of assembly operations in a tight manner was insisted upon in the base paper [10]. Figure 3 gathers them and illustrates their connections in an RCP context. The mapping from K , H to the set S 𝒸 K , H is usually performed for Model-in-the-Loop (MiL) simulations through an application Ψ , while the mapping K , H S 𝓅 K , H is made through Software-in-the-Loop (SiL) testing using an application Ξ . The master RCP program, with access to both S 𝒸 K , H and S 𝓅 K , H , can subsequently perform a worst-case execution time analysis on the implementation of the digital regulator K ( z ) in the production hardware context H .
Figure 4 presents the sequence diagram with the timing constraints of the discrete-time controller K with respect to other software threads from the microcontroller, with an illustration of the WCET of the controller interrupt service routine (ISR) thread. The main result of the section is gathered in the following theorem.
Theorem 1.
Given a numerical control law given by K G D , along with a microcontroller specification set H and a code-generation procedure given by a pair of MiL and SiL Ψ , Ξ , the worst-case execution time estimation can be computed by the following formula:
WCET Ψ , Ξ = S 𝓅 K , H + O ( 1 ) × T c l k ,
where S 𝓅 K , H represents the number of atomic assembly operations a i A as in (28), and  O ( 1 ) accounts the context switching operations for the other software threads. Additionally, the exact bounds from O ( 1 ) depend on all other software entities running on the same microprocessor and are not correlated with the input dimension m or the output dimension p of the numerical controller.
Proof. 
According to the schematic representation from Figure 3, starting from the control law K G D and the specification set H , the set S 𝒸 K , H can be obtained via the MiL operator Ψ , resulting in p 1 , p 2 , , p N O . However, in order to measure each p i , the set of atomic operations must be attached via the SiL operator Ξ : p i a i , 1 , a i , 2 , , a i , N i , each such atomic operation requiring exactly T c l k , leading to:
T 1 t K = i = 1 N l = 1 N i t ( a i , l ) = T c l k · i = 1 N l = 1 N i 1 = T c l k × S 𝓅 K , H ,
where t ( · ) is the time necessary to execute an operation or a set of operations.
Additionally, a second term T 2 = ISR λ accumulates ISR switching and stack-handling operations handled by the scheduler, bounded by a processor-dependent constant λ > 0 , which can be modeled as O ( 1 ) × T c l k . As such, the worst-case execution time can now be written as:
WCET Ψ , Ξ = T 1 + T 2 = S 𝓅 K , H + O ( 1 ) × T c l k ,
which concludes the proof.    □
Observation 1.
All possible delays caused by context switching to preemptive ISRs belonging to measurement data processing, with the cost of O ( m ) , are included in the input processing step and do not remain unaccounted for in the execution time model of Theorem (30).
Two additional performance qualifiers can be employed to globally assess the controller ISR implementation impact on the scheduling algorithm of the processor.
Definition 2.
The processor usage level qualifier relative to a fixed sampling period T > 0 of a discrete-time regulator K ( z ) G D , described in a relative manner, is defined by:
U Ψ , Ξ , T = WCET Ψ , Ξ T × 100 [ % ] .
Definition 3.
The processor idle time qualifier with respect to a fixed sampling period T > 0 of a discrete-time regulator K ( z ) G D , described in absolute units, is defined by:
I Ψ , Ξ , T = max 0 , T WCET Ψ , Ξ [ s ] .

2.3.2. Modeling Duration of Finite and Infinite-Impulse Response Topologies

Denote by H G D p × m a MIMO regulator with m inputs and p outputs, thus fully described by the expressions of m × p transfer functions H i j G D :
( H ) : Y 1 ( z ) Y 2 ( z ) Y p ( z ) = H 11 ( z ) H 12 ( z ) H 1 m ( z ) H 21 ( z ) H 22 ( z ) H 2 m ( z ) H p 1 ( z ) H p 2 ( z ) H p m ( z ) · U 1 ( z ) U 2 ( z ) U m ( z ) .
Each element of the transfer matrix H , i.e.,  H i j , can be modeled as an infinite-impulse response (IIR) filter or as a finite-impulse response (FIR) filter. The case where H is modeled as a state-space representation is treated in the base conference paper [10], namely in Algorithm 1 and Table I, respectively.
For an arbitrary discrete-time IIR transfer function H ( z ) of order n, define Ω H as the pair:
Ω H = n 2 , n 1 = n 2 , 1 , if n is odd ; n 2 , 0 , if n is even .
Using this notation, the transfer function H ( z ) can be written using a series of second-order sections and an additional first-order component, if necessary, as:
H I I R ( z ) = b 0 , 1 z + b 0 , 0 z + a 0 , 0 n 1 · i = 1 n 2 b i , 2 z 2 + b i , 1 z + b i , 0 z 2 + a i , 1 z + a i , 0 = ( H 1 ( z ) n 1 · i = 1 n 2 H 2 , i ( z ) ,
with the terms from each triplet b i , 2 , b i , 1 , b i , 0 not all null, H 1 known as a first-order section, and each H 2 , i , with  i = 1 , n 2 ¯ being denoted in the literature as a second-order section (SOS).
Remark 4.
Second-order sections are usually described with an additional gain term multiplied separately to the output of the transfer function as:
H 2 ( z ) = g · b 2 z 2 + b 1 z + b 0 z 2 + a 1 z + a 0 , g 0 .
To not further complicate the notations, we will not explicitly write this gain term for every second-order section, but it will be implicitly considered in the implementation and execution time analysis.
There are multiple approaches of implementing digital biquadratic filters, a good example being the description from the monograph [34]. Table 3 exposes the four usual topologies, which principally implement the same input-output transfer function, but with important differences regarding numerical stability when selecting fixed-point or floating-point implementations. These configurations are referred to as the canonical forms: Direct Form I, Direct Form II, Transposed Form I, Transposed Form II, which differ in the numerical properties of their implementations and in the number of necessary delay elements. As observed in the third column of the table, all biquad topologies are based on four additions, five multiplications, and a different number of load/store operations, depending on the definition of the internal state variables. Such implementation details are relevant when studying particularized structures, such as in the situations treated in [35,36].
The ISR model for IIR controller structures is based on the pseudocode exposed in Algorithm 1. hlBased on the specifications for H , each line of the pseudocode will have a set of mandatory mathematical operations, along with optional operations, which will be accounted for in the execution time analysis model through different constant weights.
Algorithm 1 Infinite-impulse response (IIR) filter interrupt service routine (ISR)
Input: 
H i j ( z ) as in (35), topology as in Table 3
Output: 
Execution time profiler for routine iirFiltIsr
1:
Construct software structures H 1 , H 2 , 1 H 2 , n 2 according to (37) and Table 3
2:
Initialize delays involved in second-order sections to zero
3:
procedureiirFiltIsr( Ω ( H ) , H 2 [ ] , H 1 )
4:
    Read and scale u [ k ] from input device
5:
     u ˜ u [ k ]
6:
    for  i 1 to n 2  do
7:
         u ˜ H 2 i . call u ˜   ▷ The output from H 2 [ i 1 ] becomes input to H 2 [ i ]
8:
    end for
9:
     u ˜ H 1 . call u ˜
10:
     y [ k ] = u ˜
11:
    Scale y [ k ] and write to output device
12:
end procedure
13:
functioncall(H, topology) ▷ First or second-order section call method for IIR filter
14:
    Read input u [ k ]
15:
    Shift input delays u [ k ] , u [ k 1 ] , u [ k 2 ]
16:
    Compute y [ k ] according to input topology as in Table 3
17:
    Shift output delays y [ k ] , y [ k 1 ] , y [ k 2 ]
18:
    Scale by second-order section gain g
19:
    return  y [ k ]
20:
end function
In ref. [10], an analysis has been performed on the simplified case of a nth order IIR SISO transfer function in a series connection, described as:
H I I R s ( z ) = Y ( z ) U ( z ) = b m z m + b m 1 z m 1 + + b 0 z n + a n 1 z n 1 + a n 2 z n 2 + + a 0 ,
which, by design, it can implicitly include a delay z n d by forcing the first n d coefficients b i to zero. Such a transfer function has its corresponding difference equation as:
y [ k ] = i = 0 n 1 a i · y [ k i ] + j = 0 m 1 b j · u [ k j ] .
A further particularization on the structure of H i j ( z ) is to consider the expression of a FIR filter topology, which, by design, discards the previous output delays. The present command signal y [ k ] will, as such, depend only on an array of delays, i.e., delay tap of inputs u [ k i ] , modeled as:
H F I R ( z ) = g · z n d · i = 0 m b i · z i g · k = 0 N 1 h k · z k , g 0 .
Four typical canonical forms are distinguished for FIR-type filters, namely the Direct Form (DF), Direct Form Transposed (DFT), Symmetric and Antisymmetric [34], respectively, with their definitions exposed in Table 4. The main difference between DF and DFT is that for the former, the delay word lengths are that of the input signals u [ k i ] , while for the latter, the delays have the word length of the accumulator variable. The Symmetric and Antisymmetric cases make use of the linear phase of the filter through the regularity of the first N 2 coefficients as the symmetrical or antisymmetrical equivalents of the latter half of the coefficients. As mentioned in the third column of the table, this has a significant impact on the necessary multiplications and load operations involved in the implementation of y [ k ] , k 0 . Algorithm 2 emphasizes the corresponding SISO FIR filter ISR routine starting from the mathematical basis of Equation (41) and information from Table 4.
Corollary 1.
Given a MIMO transfer matrix H G D p × m as in (35), where each component H i j ( z ) , i 1 , p ¯ , j 1 , m ¯ can be described as an IIR filter of form (37), with second-order sections as in Table 3 or a FIR filter of form (41), with difference equations as in Table 4, the WCET can be computed as:
WCET Ψ , Ξ = O ( 1 ) + i = 1 p j = 1 m γ i j · min S 𝓅 H i j , H × T c l k ,
with coefficients γ i j > 0 accounting for the hardware specifications set H from Definition 1, each assembly operation set S 𝓅 H i j , H determined individually by the RCP application, given the microprocessor tick T c l k > 0 , and  O ( 1 ) depends only on the other higher-priority software threads.
Algorithm 2 Finite-impulse response (FIR) filter interrupt service routine (ISR)
Input: 
H i j ( z ) as in (41), topology as in Table 4
Output: 
Execution time profiler for routine firFiltIsr
1:
Construct software structure H F I R with N coefficients h [ i ] and a Nth order delay tap
2:
Initialize Nth-order input delay tap to zero
3:
procedurefirFiltIsr(N,H)
4:
    Read and scale u [ k ] from input device
5:
     u ˜ u [ k ]
6:
    Shift input delay tap
7:
     y ˜ H . call u ˜    ▷ According to column 2 of Table 4
8:
     y [ k ] = y ˜
9:
    Scale y [ k ] and write to output device
10:
end procedure
The proof immediately follows based on Theorem 1 by replacing the general-purpose sequence S 𝓅 K , H with its corresponding sum of subsystems H i j from the full MIMO regulator K H and their definitions.

3. Case Study

The Case Study section concerns with illustrating the proposed extensions on a motor servo control example, and will encompass the following key points: process description, control performance specifications, continuous-time controller design, regulator discretization methods, sampling time optimization, selection of different controller implementation topologies along with the worst-case execution time analysis and a detailed discussion of the obtained results. The reason for selecting this example is that the proposed theory can be illustrated in the same manner for a simple process model and a modest microcontroller device setup, compared to a more complex process and an adequate microcontroller setup, leading to similar processor workloads.

3.1. Process Model and Controller Synthesis

To illustrate the proposed theoretical techniques, we consider a numerical case study based on a brushed direct-current (DC) motor position control system. Figure 5 shows the closed-loop structure, emphasizing both the process model and the 2DOF regulator structure. The motor process has a control input represented by the source voltage V a [V], along with the disturbance load torque T d [Nm], and the output is considered to be the angular position θ [rad]. As noticeable from the transfer function blocks, the DC motor model has order three, and the nominal component values are listed in Table 5.
The process model from its two inputs to the angular position output is described by:
Θ ( s ) = 1 s · H L ( s ) 1 + H r ( s ) H L ( s ) H a ( s ) · T d ( s ) + 1 s · H a ( s ) H L ( s ) 1 + H r ( s ) H L ( s ) H a ( s ) · V a ( s ) ,
with the armature transfer function H a , along with the load component H L and the reverse loop term H r which denotes the back-electromotive voltage constant K b :
H a ( s ) = K m L s + R , H L ( s ) = 1 J s + K f , H r ( s ) = K b .
The 2DOF controller components have the proportional–integral–derivative plus filter (PIDF) structure for K in , while the integral term is canceled for the feedforward controller K ff . This structure allows straightforward implementation in many industrial contexts as such PIDF regulators can be directly acquired and there are multiple validated approaches in the literature for their parameter tuning [18,20]. As such, their mathematical expressions become:
K in ( s ) = U in ( s ) R ( s ) = K P + K I 1 s + K D s T f s + 1 ,
K ff ( s ) = U ff ( s ) R ( s ) = b ˜ · K P + c ˜ · K D s T f s + 1 ,
with the feedforward parameters usually specified as b and c, with b ˜ = 1 + b and c ˜ = 1 + c . The command signal applicable to the motor input is comprised of two components derived from the 2DOF regulator as:
U ( s ) = U in ( s ) + U ff ( s ) = K in ( s ) E ( s ) + K ff ( s ) R ( s ) .
The closed-loop control specifications were selected as follows: a reference tracking settling time of t s 1.5 [s] with an overshoot M p 0.05 5 [%], with the rise time as short as possible. Additionally, regarding the disturbance rejection specifications, a load torque of 1 [Nm] must be rejected in less than t s d 1 [s], i.e., its effect on the output measurement should become less than 0.1 [rad] in the specified t s d , with a maximum allowed disturbance of y m a x d = 0.65 [rad]. The recommended approach in such designs [12] is to tune the inner PIDF controller K i n to account for the disturbance rejection coefficients, as K f f does not influence that control loop, as written in the discrete-time counterpart expressions (54). The PIDF parameter tuning has been done using global optimization methods by encompassing the desired specifications. The first iteration which covered all disturbance rejection performances was accepted and halted the optimization procedure. Additionally, a further optimization as been performed on the 2DOF parameters b and c of (46) with, again, halting the procedure after the reference tracking requirements have been fulfilled. The outcomes of the regulator tuning are illustrated in Table 6, where, alongside the PIDF and additional PD synthesis, a separate 1DOF PIDF regulator has been also added, to account for only the tracking response.
The closed-loop step responses for the reference tracking and disturbance rejection problems are portrayed in Figure 6, showing the effects of the three controller examples from Table 6, case in which the 2DOF structure is validated, as the obtained performance metrics are t s 1.5 [s], M p 0 [ % ] , rise time t r 0.75 [s] and steady-state error ε s s = 0 . As illustrated in the figure, the 2DOF structure manages to ensure both the transient response performances and the disturbance rejection behavior, being the only regulator from the proposed triplet to cover both areas.

3.2. Sampling Rate Selection

For the discretization of the PID regulators, the forward Euler method has been considered for the integrator term, with the approximation:
s z 1 T = 1 z 1 T z 1 ,
while the derivative term is discretized using the backward Euler method as:
s z 1 T z = 1 z 1 T ,
leading to the expression of K in :
K in ( z ) = K P + K I T z 1 + K D T f + T z z 1 ,
with an expression of K ff also as:
K ff ( z ) = b ˜ · K P + c ˜ · K D T f + T z z 1 ,
which will be further used in the proceeding illustration of the sampling time analysis.
Starting from the continuous-time open-loop model from (43), the discrete-time equivalent using the zero-order hold method becomes:
Θ ( z ) = Z L 1 H z o h , T ( s ) H a u x ( s ) · T d ( z ) + Z L 1 H z o h , T ( s ) H a ( s ) H a u x ( s ) · V a ( z ) ,
with the auxiliary notations:
H a u x ( s ) = 1 s · H L ( s ) 1 + H a ( s ) H L ( s ) H r ( s ) , Θ ( z ) = H dist op ( z ) · T d ( z ) + H servo op ( z ) · V a ( z ) .
The closed-loop system’s expression thus becomes:
Θ ( z ) = H dist op ( z ) 1 + H servo op ( z ) K in ( z ) · T d ( z ) + H servo op ( z ) K ff ( z ) + K in ( z ) 1 + H servo op ( z ) K in ( z ) · R ( z ) .
By imposing the functionals S K in Ω ¯ , S K ff Ω ¯ , I K in , I K ff , S H c l r Ω ¯ , S H c l d Ω ¯ , T , and J stab ( H 0 ) α from Equation (23), two weighting sets c 1 c 7 were considered as in Table 7, corresponding to two distinct experiments, the first numerical column designating emphasis on the difficulty of implementation functionals, while the second numerical column coefficients focus mainly on open-loop and closed-loop fidelity. With said coefficients, using a general-purpose PSO implementation as specified in Remark 3 [28], the optimal implementability sampling period becomes T s , 1 o p t = 2.866 × 10 3 [s], while the fidelity sampling period is obtained at T s , 2 o p t = 1.260 × 10 4 [ s ] T s , 1 o p t . To further extend the analysis, two extra sampling periods will be added in the discussion, the first representing the value obtained by applying the classical Shannon–Nyquist theorem (9), leading to a sampling period smaller than half the least time constant of the regulator, i.e., T s , 3 < T f 2 T s , 3 = 7.0081 × 10 4 [s], while the latter relevant value is considered to be T s , 4 = T s , 1 · 1 + 0.03 = 2.9520 × 10 3 , which represents a 3 [ % ] disturbance increase on the ideal implementability sampling rate, which causes instability in the closed-loop system. Figure 7 gathers all functionals and their weighted sums in its six subfigures, while also marking the positions of T s , 1 o p t , T s , 2 o p t and T s , 3 . The open and closed-loop similarity functionals J 1 , J 2 , J 5 , J 6 are non-monotonic with respect to a variable T s , while the implementability functionals J 3 , J 4 , J 7 are principally monotonically decreasing. The existing exceptions appear due to numerical errors.
There are multiple approaches for implementing the two PID regulators. Both K in ( z ) and K ff ( z ) can be fully encompassed into a biquadratic filter topology and, furthermore, a first-order structure for K ff . The two main ones, given the simplicity of their structure, would be to implement it in parallel versus in series. For the inner regulator, the parallel topology, denoted with the superscript p can be split into three subsystems:
K in p ( z ) = H i n , 1 ( z ) + H i n , 2 ( z ) + H i n , 3 ( z ) = K P + K I T z 1 + K D ( z 1 ) ( T f + T ) z T f ,
while the series topology, denoted with the superscript s, is:
K in s ( z ) = b 2 z 2 + b 1 z + b 0 z 2 + a 1 z + a 0 = g · b 2 ˜ z 2 + b ˜ 1 z + b ˜ 0 a 2 z 2 + a 1 z + a 0 , a 2 = 1 .
where the equivalent normalized coefficients are obtained:
b 2 = K P ( T f + T ) + K D T f + T ; b 1 = K P ( 2 T f + T ) + K I T ( T f + T ) 2 K D T f + T ;
b 0 = K P T f K I T T f + K D T f + T ; a 1 = 2 T f + T T f + T ; a 0 = T f T f + T .
In the same manner, the parallel form of the feedforward regulator is adapted as:
K ff p ( z ) = b ˜ H i n , 1 ( z ) + c ˜ H i n , 3 ( z ) = b ˜ · K P + c ˜ · K D ( z 1 ) ( T f + T ) z T f ,
with a first-order series form of:
K ff s ( z ) = b 1 z + b 0 z + a 0 = g · b ˜ 1 z + b ˜ 0 a 1 z + a 0 , a 1 = 1 .
and equivalent normalized coefficients:
b 1 = b ˜ K P ( T f + T ) + c ˜ K D T f + T ; b 0 = b ˜ K P T f c ˜ K D T f + T ; a 0 = T f T f + T .

3.3. Execution Time Analysis

After the discretization procedure as specified by (48) and (49), using the right-hand side notation for the coefficients in (56) and (60), the numerical values of the coefficients become as in Table 8, using the for deduced sampling rates from Section 3.2, T s , 1 o p t , T s , 2 o p t , T s , 3 , T s , 4 . As observed, the gain coefficient g b 2 for K in and g b 1 for K ff , respectively, remains invariant in this set of experiments, while the remaining non-unitary coefficients vary with respect to T s > 0 and necessitate increasingly more decimals as the sampling rate tends to zero.
To account for the necessary word length analysis, two frequently used configurations have been considered: the first case is to store the operands, i.e., coefficients and inputs, states, outputs into 16-bit registers, considered the standard length for the RISC machine hosting the 2DOF controller, followed by a set of 32-bit length registers, which will increase the working precision, but with added execution time overhead, as modeled in continuation. Given the dynamic range of the final filter gains g, this final multiplication will be considered separately. Thus, the set H for this case study will encompass the properties:
  • it has a clock tick period of T c l k = 1 1 [ MHz ] = 1 [ μ s], obtainable on standard microcontrollers by configurating the phase-locked loop circuit to a lower-power setting;
  • implements the second-order sections using the Direct Form II for K in and a series connection for the first-order term K ff , denoted y [ k ] = f y [ k i ] , u [ k i ] ;
  • two configurations for the word lengths of the operands: 16-bit and 32-bit;
  • applies saturation on output command signals y [ k ] ;
  • applies anti-windup on the integrator term of K in using the back-calculation method:
    w I ̲ , I ¯ x [ k + 1 ] = x [ k ] + K w · s Y ̲ , Y ¯ ( y [ k ] ) y [ k ] · K i T · u [ k ] ,
    with the additional parameters K w , I ̲ , I ¯ represented using a 16-bit word length;
  • the output measurement Θ is gathered as a sum of impulses, with a maximum expected frequency of f m a x = 80,000 impulses per 100 [ms] time unit, and each such impulse triggers a hardware interrupt with a 15 assembly operation stack commutation cost; the scaling is then performed using a multiplication with a 16-bit variable;
  • K ff accepts the reference signal r [ k ] as input, while K in accepts the error e [ k ] = r [ k ] Θ [ k ] .
The mathematical operations p i O , along with their assembly instruction correspondents as in (29) are detailed in Table 9, with an emphasis on each type of operation based on its physical significance, as written in the last column. The hyperparameters γ i in the case of standard 16-bit word lengths have been considered with the value 1, denoting that each base arithmetical operations costs only T c l k , while the values are scaled upwards for the case when the operands exceed the word length to 32 bits. The impulse counter assembly operation cost for Θ [ k ] has been computed as 80,000 × 0.1 × 15 × T . Additionally, Table 10 totalizes the number of assembly operations based on the previous table’s description, along with computing the worst-case execution times for the three stable sampling rate values: T s , 1 o p t T s , 3 . As seen from the table, the optimal sampling rate solution featuring implementability emphasis T s , 1 o p t occupies the microprocessor for less than 25 [ % ] of its capability in either 16 or 32-bit quantizations alike, with the Shannon theorem approach T s , 3 following with sufficient headroom in the scheduler algorithm, while the fidelity-based approach in this case occupies the scheduler with small margins in the case of 16-bit quantizations, and exceeds the allowed time frame in the case of the 32-bit configuration.
Based exclusively on the previous WCET analysis, there are several feasible solutions. In order to decide between the three sampling rate and quantization pair configurations, further analysis is performed on the frequency response of the K in and K ff controllers, along with the closed-loop responses using said controllers. As such, Figure 8 and Figure 9, respectively, gather the previously said behaviors. In addition to the three sampling rates, for completeness, the fourth, unstable sampling rate T s , 4 is shared, along with the ideal continuous-time equivalent controllers in the frequency-response plot. In both figures, columns one and two expose the 32-bit and 16-bit quantization configurations, respectively, while the lines distinguish between the K in , K ff controllers in the frequency-response figure and reference step response compared to the step disturbance responses in the time-domain simulation, respectively. The main conclusion drawn from this final pair of Figures is that the considered 2DOF control scheme is sensitive to the coefficient quantization levels, such that for T s , 2 and T s , 3 , the only acceptable solution would be to use the precise 32-bit configuration, with the exception of the implementability solution which manages to follow the imposed closed-loop transient response specifications with a reasonable degradation of the performances. The 16-bit quantization frequency responses for K in ( z ) drastically alter the integrator effect, which, in effect, disturbs the ability of the closed-loop motor system to track reference signals and to reject step-like load torque disturbances.
To conclude the case study, the acceptable solutions are to consider the implementability-based sampling rate optimum T s , 1 o p t , with practically ideal behavior if a 32-bit word length setup is acceptable, and with a small performance degradation if only the 16-bit standard word length is supported, depending also on other execution threads running in the microprocessor, not covered in this experiment.
Further extensions, as in using more complex controllers for both the tracking regulator and the feedforward component, considering cases such as fractional-order controllers or 2DOF robust control synthesis results can be treated in an analogous manner by splitting such control laws into their component second-order sections and applying the theory from Table 3 and Table 4, along with Algorithms 1 and 2, respectively.

4. Conclusions

This paper gathered a set of analysis and design tools to determine the sampling rate of one and 2DOF control structures using an optimization-based approach, along with an approach of deducing a WCET for linear and time-invariant-based regulators through a formal language model which can be implemented in an RCP software tool. The execution time model is based on a deterministic, RISC architecture, where each operation is quantified with the same base clock tick duration. The end-to-end DC motor case study emphasizes the design of the controllers for the widely used benchmark system, by also focusing on the proposed framework.
Future work will concern on an online sampling rate optimization, as it is necessary in linear-parameter varying and linear-time variant models, along with the study and analysis of the continuity property of the regulator coefficient quantization effects as a function of the sampling rate. The problem of process controllability loss is also known in the literature and will be investigated for variable sampling rates in subsequent research. The mathematical framework proposed and extended in this paper will be included in the software toolbox initially proposed by the authors in [22], with the great advantage of obtaining an end-to-end solution for RCP, starting from the continuous-time controller design up to the optimal numerical implementation of said controller on a microprocessor-based system with a given set of specifications. A separate theoretical direction would be to investigate the link between sampling rate T > 0 and quantization step Q > 0 to guarantee that the minimum imposed performances are also fulfilled in the discrete domain.

Author Contributions

Conceptualization, M.Ş. and V.M.; methodology, M.Ş.; software, M.Ş. and V.M.; validation, M.Ş., V.M. and D.M.; formal analysis, P.D.; investigation, M.Ş.; resources, M.Ş. and V.M.; data curation, D.M.; writing—original draft preparation, M.Ş. and V.M.; writing—review and editing, V.M., D.M. and P.D.; visualization, M.Ş.; supervision, P.D.; project administration, P.D.; funding acquisition, P.D. All authors have read and agreed to the published version of the manuscript.

Funding

This paper was financially supported by the Project “Entrepreneurial competences and excellence research in doctoral and postdoctoral programs—ANTREDOC”, project co-funded by the European Social Fund financing agreement no. 56437/24.07.2019.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.

Abbreviations

The following abbreviations are used in this manuscript:
2DOFTwo-Degrees-of-Freedom
ADCAnalog-to-Digital Converter
DACDigital-to-Analog Converter
DCDirect Current
DMADirect Memory Access
ISRInterrupt Service Routine
LMILinear Matrix Inequality
LTILinear and Time-Invariant
MACMultiply-Accumulate
MiLModel-in-the-Loop
MIMOMulti-Input Multi-Output
NPNon-deterministic Polynomial-time
PIDProportional–Integral–Derivative
PIDFProportional–Integral–Derivative with Lowpass Filter
RAMRandom-Access Machine
RCPRapid Control Prototyping
SiLSoftware-in-the-Loop
SOSSecond-Order Section
SIMDSingle Instruction/Multiple Data
SIMPSingle Instruction Stream/Multiple Instruction Pipelining
SISOSingle-Input Single-Output
WCETWorst-Case Execution Time

References

  1. Tan, L.; Jiang, J. Digital Signal Processing: Fundamentals and Applications, 3rd ed.; Elsevier: Amsterdam, The Netherlands, 2019. [Google Scholar]
  2. Dohnal, F.; Rerucha, V. Practical Aspects of Digital Control Systems Design—Sampling Period Choice. In Proceedings of the IFAC Programmable Devices and Systems, Ostrava, Czech Republic, 8–9 February 2000. [Google Scholar]
  3. Tomov, L.; Garipov, E. Choice of Sample Time in Digital PID Controllers. RECENT 2007, 8, 2. [Google Scholar]
  4. Bensic, T.; Varga, T.; Barukcic, M.; Stil, V.J. Optimization Procedure for Computing Sampling Time for Induction Machine Parameter Estimation. Appl. Sci. 2020, 10, 3222. [Google Scholar] [CrossRef]
  5. Mishra, I.; Tripathi, R.N.; Hanamoto, T. Synchronization and Sampling Time Analysis of Feedback Loop for FPGA-Based PMSM Drive System. Electronics 2020, 9, 1906. [Google Scholar] [CrossRef]
  6. Trusca, M.; Petreus, D.; Munteanu, R.A.; Sita, I.V.; Dobra, P. Wireless low cost embedded solution for electrical motors control. In Proceedings of the 5th European DSP Education and Research Conference (EDERC), Amsterdam, The Netherlands, 13–14 September 2012; pp. 144–148. [Google Scholar] [CrossRef]
  7. Duma, R.; Dobra, P.; Dobra, M.; Sita, I.V. Low cost embedded solution for BLDC motor control. In Proceedings of the 15th International Conference on System Theory, Control and Computing, Sinaia, Romania, 14–16 October 2011; pp. 1–6. [Google Scholar]
  8. Janus, T.; Ulanicki, B. Effects of Sampling on Stability and Performance of Electronically Controlled Pressure-Reducing Valves. J. Water Resour. Plan. Manag. 2021, 147. [Google Scholar] [CrossRef]
  9. Wilhelm, R.; Engblom, J.; Ermedahl, A.; Holsti, N.; Thesing, S.; Whalley, D.; Bernat, G.; Ferdin, C.; Heckmann, R.; Mitra, T.; et al. The Worst-Case Execution Time Problem—Overview of Methods and Survey of Tools. ACM Trans. Embed. Comput. Syst. 2008, 7, 1–47. [Google Scholar] [CrossRef]
  10. Șușcă, M.; Mihaly, V.; Morar, D.; Dobra, P. Worst-Case Execution Time Estimation for Numerical Controllers. In Proceedings of the 2022 IEEE International Conference on Automation, Quality and Testing, Robotics (AQTR), Cluj-Napoca, Romania, 19–21 May 2022; pp. 1–6. [Google Scholar] [CrossRef]
  11. Nghiem, T.X.; Pappas, G.J.; Alur, R.; Girard, A. Time-triggered Implementations of Dynamic Controllers. ACM Trans. Embed. Comput. Syst. (TECS) 2012, 11, 58. [Google Scholar] [CrossRef]
  12. Åström, K.J.; Hägglund, T. Advanced PID Control; ISA-The Instrumentation, Systems, and Automation Society: Raleigh, NC, USA, 2006. [Google Scholar]
  13. Skogestad, S.; Postlethwaite, I. Multivariable Feedback Control: Analysis and Design; John Wiley & Sons: Hoboken, NJ, USA, 2005. [Google Scholar]
  14. Mihaly, V.; Şuşcă, M.; Dulf, E.H. μ-Synthesis FO-PID for Twin Rotor Aerodynamic System. Mathematics 2021, 9, 2504. [Google Scholar] [CrossRef]
  15. Mihaly, V.; Şuşcă, M.; Morar, D.; Stănese, M.; Dobra, P. μ-Synthesis for Fractional-Order Robust Controllers. Mathematics 2021, 9, 911. [Google Scholar] [CrossRef]
  16. Gahinet, P.; Apkarian, P. Automated Tuning of Gain-Scheduled Control Systems. In Proceedings of the IEEE Conference of Decision and Control, Firenze, Italy, 10–13 December 2013. [Google Scholar]
  17. Mihaly, V.; Şuşcă, M.; Dobra, P. Krasovskii Passivity and μ-Synthesis Control Design for Quasi-Linear Affine Systems. Energies 2021, 14, 5571. [Google Scholar] [CrossRef]
  18. Taguchi, H.; Araki, M. Two-degree-of-freedom PID Controllers—Their Functions and Optimal Tuning. In Proceedings of the IFAC Digital Control: Past. Present and Future of PID Control, Terrassa, Spain, 5–7 April 2000. [Google Scholar]
  19. Wang, D.; Liu, T.; Sun, X.; Zhong, C. Discrete-time domain two-degree-of-freedom control design for integrating and unstable processes with time delay. ISA Trans. 2016, 63, 121–132. [Google Scholar] [CrossRef] [PubMed]
  20. Oviedo, J.J.E.; Boelen, T.; van Overschee, P. Robust advanced PID control (RaPID): PID tuning based on engineering specifications. IEEE Control Syst. Mag. 2006, 26, 15–19. [Google Scholar] [CrossRef]
  21. Șușcă, M.; Mihaly, V.; Morar, D.; Dobra, P. Quasi-Optimal Sampling Time Computation for LTI Controllers. In Proceedings of the 6th IFAC Conference on Intelligent Control and Automation Sciences, ICONS, Cluj-Napoca, Romania, 13–15 July 2022; Volume 55, pp. 87–92. [Google Scholar] [CrossRef]
  22. Şuşcă, M.; Mihaly, V.; Stănese, M.; Morar, D.; Dobra, P. Unified CACSD Toolbox for Hybrid Simulation and Robust Controller Synthesis with Applications in DC-to-DC Power Converter Control. Mathematics 2021, 9, 731. [Google Scholar] [CrossRef]
  23. Cormen, T.H.; Leiserson, C.E.; Rivest, R.L.; Stein, C. Introduction to Algorithms, 3rd ed.; MIT Press: Cambridge, MA, USA, 2009. [Google Scholar]
  24. Șușcă, M.; Mihaly, V.; Dobra, P. Fixed-Point Uniform Quantization Analysis for Numerical Controllers. In Proceedings of the 2022 IEEE Conference on Decision and Control (CDC), Cancún, Mexico, 6–9 December 2022. [Google Scholar]
  25. Whorton, M.; Yang, L.; Hall, R. Similarity Metrics for Closed Loop Dynamic Systems. In Proceedings of the AIAA Guidance, Navigation and Control Conference and Exhibit, Honolulu, HI, USA, 18–21 August 2008. [Google Scholar] [CrossRef]
  26. Hsieh, G.C.; Safonov, M.G. Conservatism of the gap metric. IEEE Trans. Autom. Control 1993, 38, 594–598. [Google Scholar] [CrossRef]
  27. Vinnicombe, G. Frequency domain uncertainty and the graph topology. IEEE Trans. Autom. Control 1993, 38, 1371–1383. [Google Scholar] [CrossRef]
  28. Kennedy, J.; Eberhart, R. Particle Swarm Optimization. In Proceedings of the IEEE International Conference on Neural Networks, Perth, WA, Australia, 27 November–1 December 1995; Volume 4, pp. 1942–1948. [Google Scholar]
  29. da Silva, L.R.; Flesch, R.C.C.; Normey-Rico, J.E. Analysis of Anti-windup Techniques in PID Control of Processes with Measurement Noise. In Proceedings of the 3rd IFAC Conference on Advances in Proportional-Integral-Derivative Control PID, Ghent, Belgium, 9–11 May 2018; Volume 51, pp. 948–953. [Google Scholar] [CrossRef]
  30. Tarbouriech, S.; Turner, M. Anti-windup design: An overview of some recent advances and open problems. IET Control Theory Appl. 2009, 3, 1–19. [Google Scholar] [CrossRef]
  31. Singh, R.P.; Vashishtha, A.K.; Krishna, R. 32 Bit re-configurable RISC processor design and implementation for BETA ISA with inbuilt matrix multiplier. In Proceedings of the Sixth International Symposium on Embedded Computing and System Design (ISED), Patna, India, 15–17 December 2016; pp. 112–116. [Google Scholar] [CrossRef]
  32. Salim, A.J.; Samsudin, N.R.; Salim, S.I.M.; Soo, Y. Multiply-accumulate instruction set extension in a soft-core RISC Processor. In Proceedings of the 10th IEEE International Conference on Semiconductor Electronics (ICSE), Kuala Lumpur, Malaysia, 19–21 September 2012; pp. 512–516. [Google Scholar] [CrossRef]
  33. Murakami, K.; Irie, N.; Kuga, M.; Tomita, S. SIMP (single Instruction Stream/multiple Instruction Pipelining): A Novel High-speed Single-processor Architecture. In Proceedings of the 16th Annual International Symposium on Computer Architecture, Jerusalem, Israel, 28 May–1 June 1989; pp. 78–83. [Google Scholar] [CrossRef]
  34. Proakis, J.G.; Manolakis, D.G. Digital Signal Processing: Principles, Algorithms and Applications, 5th ed.; Pearson, Prentice Hall: Upper Saddle River, NJ, USA, 2022; ISBN 9780137348657. [Google Scholar]
  35. Essl, G. Topological IIR Filters Over Simplicial Topologies via Sheaves. IEEE Signal Process. Lett. 2020, 27, 1215–1219. [Google Scholar] [CrossRef]
  36. Marjanovic, J. Deutsches Elektronen-Synchrotron (DESY), Low vs. High Level Programming for FPGA. In Proceedings of the 7th International Beam Instrumentation Conference, IBIC2018, Shanghai, China, 9–13 September 2018; JACoW Publishing: Geneva, Switzerland, 2018. ISBN 978-3-95450-201-1. [Google Scholar] [CrossRef]
Figure 1. Numeric regulator K T ( z ) with a specified sampling rate T > 0 and its corresponding interface consisting of a sample and hold with the analog-to-digital converter, along with the digital-to-analog converter followed by a sample and hold circuit.
Figure 1. Numeric regulator K T ( z ) with a specified sampling rate T > 0 and its corresponding interface consisting of a sample and hold with the analog-to-digital converter, along with the digital-to-analog converter followed by a sample and hold circuit.
Mathematics 10 03449 g001
Figure 2. Two-degrees-of-freedom (2DOF) numerical control structure with components K in ( z ) and K ff ( z ) , designed for the process models G ( s ) with disturbance dynamics G d ( s ) .
Figure 2. Two-degrees-of-freedom (2DOF) numerical control structure with components K in ( z ) and K ff ( z ) , designed for the process models G ( s ) with disturbance dynamics G d ( s ) .
Mathematics 10 03449 g002
Figure 3. Rapid control prototyping relationship between the formal sets and functionals necessary to perform a worst-case execution time analysis for a regulator K ( z ) G D in the production context H .
Figure 3. Rapid control prototyping relationship between the formal sets and functionals necessary to perform a worst-case execution time analysis for a regulator K ( z ) G D in the production context H .
Mathematics 10 03449 g003
Figure 4. Sequence diagram illustrating the regulator K ( z ) interrupt service routine execution among higher and lower priority threads for the duration of one sampling period T s [10].
Figure 4. Sequence diagram illustrating the regulator K ( z ) interrupt service routine execution among higher and lower priority threads for the duration of one sampling period T s [10].
Mathematics 10 03449 g004
Figure 5. Closed-loop two-degree-of-freedom (2DOF) position control structure for the DC motor system with a control voltage input V a and a disturbance load torque T d . The 2DOF structure has an inner-loop component K in designed for disturbance rejection and a feedforward component K ff for good servo compensation.
Figure 5. Closed-loop two-degree-of-freedom (2DOF) position control structure for the DC motor system with a control voltage input V a and a disturbance load torque T d . The 2DOF structure has an inner-loop component K in designed for disturbance rejection and a feedforward component K ff for good servo compensation.
Mathematics 10 03449 g005
Figure 6. Closed-loop continuous-time domain simulations; step reference responses along with step disturbance rejections considering 1DOF regulators designed for servo tracking, disturbance rejection, and for performance in both cases, respectively.
Figure 6. Closed-loop continuous-time domain simulations; step reference responses along with step disturbance rejections considering 1DOF regulators designed for servo tracking, disturbance rejection, and for performance in both cases, respectively.
Mathematics 10 03449 g006
Figure 7. Functionals J 1 J 8 , corresponding to S K in Ω ¯ , S K ff Ω ¯ , I K in , I K ff , S H c l r Ω ¯ , S H c l d Ω ¯ , T , J stab ( H 0 ) α , respectively, and their weighted sum as in Equation (23) for both performed experiments. Besides the implementability and fidelity cases, a classical sampling-theorem approach is illustrated.
Figure 7. Functionals J 1 J 8 , corresponding to S K in Ω ¯ , S K ff Ω ¯ , I K in , I K ff , S H c l r Ω ¯ , S H c l d Ω ¯ , T , J stab ( H 0 ) α , respectively, and their weighted sum as in Equation (23) for both performed experiments. Besides the implementability and fidelity cases, a classical sampling-theorem approach is illustrated.
Mathematics 10 03449 g007
Figure 8. DC motor example regulator frequency magnitude responses; the first line gathers the inner regulator K in ( z ) with 32-bit and 16-bit quantized regulator coefficients, respectively, while the second line gathers the feedforward controller K ff ( z ) in the same 32-bit and 16-bit configurations. For completeness, the continuous-time ideal regulators K in ( s ) and K ff ( s ) were also added alongside their discrete-time counterparts.
Figure 8. DC motor example regulator frequency magnitude responses; the first line gathers the inner regulator K in ( z ) with 32-bit and 16-bit quantized regulator coefficients, respectively, while the second line gathers the feedforward controller K ff ( z ) in the same 32-bit and 16-bit configurations. For completeness, the continuous-time ideal regulators K in ( s ) and K ff ( s ) were also added alongside their discrete-time counterparts.
Mathematics 10 03449 g008
Figure 9. DC motor example closed-loop step responses using the proposed 2DOF control structure; the first line gathers the reference tracking behavior with 32-bit and 16-bit quantized regulator coefficients, respectively, while the second line gathers the disturbance rejection behavior in the same 32-bit and 16-bit configurations.
Figure 9. DC motor example closed-loop step responses using the proposed 2DOF control structure; the first line gathers the reference tracking behavior with 32-bit and 16-bit quantized regulator coefficients, respectively, while the second line gathers the disturbance rejection behavior in the same 32-bit and 16-bit configurations.
Mathematics 10 03449 g009
Table 1. Formal operators necessary for the implementation of LTI-based control laws.
Table 1. Formal operators necessary for the implementation of LTI-based control laws.
#OperatorDomainDefinitionObservations
1Addition 𝒶 : R 2 R 𝒶 x 1 , x 2 = x 1 + x 2 bilinear
2Multiplication 𝓂 : R 2 R 𝓂 g , x = g · x homogenous
3Saturation 𝓈 x ̲ , x ¯ : R R 𝓈 x ̲ , x ¯ ( x ) = x ̲ , if x < x ̲ ; x , if x ̲ x x ¯ ; x ¯ , if x ¯ < x , nonlinear
4Anti-windup 𝓌 x ̲ , x ¯ : R R various [12,29,30]for integrators
5Load/Store 𝓁 ( x ) : R R 𝓁 ( x ) = x bilinear
6Null 𝓃 ( x ) : R R 𝓃 ( x ) = 0 for delays
Table 2. Base assembly operations a i A for a Random-Access Machine model used in an LTI-based control system context.
Table 2. Base assembly operations a i A for a Random-Access Machine model used in an LTI-based control system context.
#OperatorAbbreviationPart of OperationObservations
1No operationNOP 𝓃
2Memory fetchMF 𝓁 SIMP
3Memory storeMS 𝓁 SIMP
4AddADD 𝒶 SIMP, MAC, SIMD
5MultiplyMUL 𝓂 SIMP, MAC, SIMD
6Binary shiftSH 𝓂 SIMP, SIMD
7JumpJMP 𝓈 , 𝓌 , 𝓁
8CompareCMP 𝓈 , 𝓌 , 𝓁 SIMP
Table 3. Digital biquadratic topology implementations; all difference equations implement the same input-output second-order transfer function, but differ through the configurations of the state signals.
Table 3. Digital biquadratic topology implementations; all difference equations implement the same input-output second-order transfer function, but differ through the configurations of the state signals.
IIR SOS TopologyDifference Equation min 𝒮 𝒸 K , H
Direct Form I (DFI) y [ k ] = g · 0 2 b i u [ k i ] 1 2 a i y [ k i ] ] . 4 𝒶 , 6 𝓂 , 12 𝓁
Direct Form II (DFII) y [ k ] = g · 0 2 b i · x [ k i ] ; x [ k ] = u [ k ] 1 2 a i · x [ k i ] . 4 𝒶 , 6 𝓂 , 14 𝓁
Transposed Direct Form I ( TDFI ) y [ k ] = g · 0 2 b i · x [ k i ] ; x [ k ] = u [ k ] 1 2 a i · x [ k i ] . 4 𝒶 , 6 𝓂 , 14 𝓁
Transposed Direct Form II ( TDFII ) y [ k ] = g · b 0 u [ k ] + x 1 [ k 1 ] ; x 1 [ k ] = b 1 u [ k ] a 1 y [ k ] + x 2 [ k 1 ] ; x 2 [ k ] = b 2 u [ k ] a 2 y [ k ] . 4 𝒶 , 6 𝓂 , 16 𝓁
Table 4. Digital FIR filter topology implementations; all difference equations implement the same input-output Nth order transfer function, but vary through the configuration of the accumulator.
Table 4. Digital FIR filter topology implementations; all difference equations implement the same input-output Nth order transfer function, but vary through the configuration of the accumulator.
FIR TopologyDifference Equation min S 𝒸 K , H
Direct Form y [ k ] = g · 0 N 1 h [ i ] u [ k i ] . N 𝒶 , N + 1 𝓂 , 2 N + 2 𝓁
Direct Form Transposed y [ k ] = g · 0 N 1 h [ i ] · u [ k i ] . N 𝒶 , N + 1 𝓂 , 2 N + 2 𝓁
Symmetric y [ k ] = g · 0 N / 2 h [ i ] u [ i ] + u [ N 1 i ] ; h [ i ] = h [ N 1 i ] , i = 0 , N / 2 ¯ . N 𝒶 , N 2 + 1 𝓂 , N + N 2 + 2 𝓁
Anti-symmetric y [ k ] = g · 0 N / 2 h [ i ] u [ i ] u [ N 1 i ] ; h [ i ] = h [ N 1 i ] , i = 0 , N / 2 ¯ . N 𝒶 , N 2 + 1 𝓂 , N + N 2 + 2 𝓁
Table 5. DC motor physical parameters.
Table 5. DC motor physical parameters.
ParameterValueParameterValue
R 2 [ Ω ] L 0.5 [H]
K m 0.1 [Nm·A/V2] K f 0.2 [Nm]
J 0.02 [kg · m2/s2] K b 0.1 [V·s/rad]
Table 6. Regulator designs leading to the proposed 2DOF control and their corresponding coefficients.
Table 6. Regulator designs leading to the proposed 2DOF control and their corresponding coefficients.
Regulator K p K i K d T f bc
PID (1DOF): tracking21.06668.7577.74970.001471711
PID (1DOF): disturbance rejection52.666570.05607.74970.001471711
PID (2DOF)52.666570.05607.74970.00147170.40.2
Table 7. Functional weighting coefficients for the two considered experiments of the DC motor case study: main focus on implementability of the resulting controller versus the focus on fidelity compared to the continuous-time control counterpart.
Table 7. Functional weighting coefficients for the two considered experiments of the DC motor case study: main focus on implementability of the resulting controller versus the focus on fidelity compared to the continuous-time control counterpart.
ParameterImplementability Case ValueFidelity Case Value
c 1 0.1100
c 2 0.1100
c 3 20001
c 4 20001
c 5 0.1300
c 6 0.1100
c 7 2001
T s o p t T s , 1 o p t = 2.866 × 10 3 [s] T s , 2 o p t = 1.260 × 10 4 [s]
Table 8. DC motor case study discrete-time ideal coefficients using the deduced sampling rates.
Table 8. DC motor case study discrete-time ideal coefficients using the deduced sampling rates.
Coefficient T s , 1 opt T s , 2 opt T s , 3 T s , 4
g: K in ( z ) 5.3184815 × 10 3 5.3184815 × 10 3 5.3184815 × 10 3 5.3184815 × 10 3
b ˜ 2 : K in ( z ) 1111
b ˜ 1 : K in ( z ) 1.980677 1.999150 1.995275 1.980097
b ˜ 0 : K in ( z ) 0.980751 0.999150 0.995279 0.980175
a 1 : K in ( z ) 0.052546 1.914358 1.523809 0.005877
a 0 : K in ( z ) 0.947453 0.914358 0.523809 1.005877
g: K ff ( z ) 4.244251 × 10 3 4.244251 × 10 3 4.244251 × 10 3 4.244251 × 10 3
b ˜ 1 : K ff ( z ) 1111
b ˜ 0 : K ff ( z ) 0.985500 0.999362 0.996454 0.985065
a 0 : K ff ( z ) 0.947453 0.914358 0.523809 1.005877
Table 9. Encountered operations in the implementation of the 2DOF structure for the DC motor case study in the hypothesis of a base word length of L = 16 bits and two considered quantization levels for the controller coefficients: 16-bit and 32-bit lengths, respectively.
Table 9. Encountered operations in the implementation of the 2DOF structure for the DC motor case study in the hypothesis of a base word length of L = 16 bits and two considered quantization levels for the controller coefficients: 16-bit and 32-bit lengths, respectively.
p i = # r i p i K in s K in p K ff s K ff p γ i 16 b γ i 32 b Observations for K ( z ) , H
1 𝓁 141881312 y [ k ] = f y [ k i ] , u [ k i ]
1 𝒶 452312 y [ k ] = f y [ k i ] , u [ k i ]
1 𝓂 654416 y [ k ] = f y [ k i ] , u [ k i ]
8 𝓈 111112 𝓈 y [ k ]
20 𝓌 110016Integrator anti-windup
120 × 10 3 × T s 𝒶 110011 Θ [ k ] impulse counter
1 𝓂 110016 Θ [ k ] scaling
1 𝒶 110012 e [ k ] = r [ k ] Θ [ k ]
1 𝓁 330012 e [ k ] = r [ k ] Θ [ k ]
1 𝓁 221112 y [ k i ] y [ k i 1 ]
1 𝓁 221112 u [ k i ] u [ k i 1 ]
Table 10. DC motor case study WCET analysis in the conditions from Table 9, by emphasizing the number of assembly operations S 𝓅 K , H necessary to implement the 2DOF structure comprised of K in and K ff , along with the processor usage level for the three stable sampling rate values.
Table 10. DC motor case study WCET analysis in the conditions from Table 9, by emphasizing the number of assembly operations S 𝓅 K , H necessary to implement the 2DOF structure comprised of K in and K ff , along with the processor usage level for the three stable sampling rate values.
16 b K in s 16 b K ff s 16 b K in p 16 b K ff p 32 b K in s 32 b K ff s 32 b K in p 32 b K ff p
S 𝓅 K , H 772481302466425076
S 𝓅 K in , K ff , H 101111310326
WCET T s , 1 o p t = 2866 [ μ s]429[ μ s]439[ μ s]638[ μ s]654[ μ s]
WCET T s , 2 o p t = 126 [ μ s]101[ μ s]111[ μ s]310[ μ s]326[ μ s]
WCET T s , 3 = 700.8 [ μ s]170[ μ s]180[ μ s]379[ μ s]395[ μ s]
U Ψ , Ξ , T s , 1 o p t 14.96 [ % ] 15.31 [ % ] 22.26 [ % ] 22.81 [ % ]
U Ψ , Ξ , T s , 2 o p t 80.15 [ % ] 88.09 [ % ] 246.03 [ % ] 258.73 [ % ]
U Ψ , Ξ , T s , 3 o p t 24.25 [ % ] 25.68 [ % ] 54.08 [ % ] 56.36 [ % ]
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Şuşcă, M.; Mihaly, V.; Morar, D.; Dobra, P. Sampling Rate Optimization and Execution Time Analysis for Two-Degrees-of-Freedom Control Systems. Mathematics 2022, 10, 3449. https://0-doi-org.brum.beds.ac.uk/10.3390/math10193449

AMA Style

Şuşcă M, Mihaly V, Morar D, Dobra P. Sampling Rate Optimization and Execution Time Analysis for Two-Degrees-of-Freedom Control Systems. Mathematics. 2022; 10(19):3449. https://0-doi-org.brum.beds.ac.uk/10.3390/math10193449

Chicago/Turabian Style

Şuşcă, Mircea, Vlad Mihaly, Dora Morar, and Petru Dobra. 2022. "Sampling Rate Optimization and Execution Time Analysis for Two-Degrees-of-Freedom Control Systems" Mathematics 10, no. 19: 3449. https://0-doi-org.brum.beds.ac.uk/10.3390/math10193449

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop