**2. Li-ion battery: model selection, accuracy, robustness, SOC estimation and terminal voltage prediction**

In this research, we try to develop new approaches for identification, modeling, state estimation, and linear and nonlinear speed control strategies for a typical choice of DC or AC electric motor powered by a Li-ion battery and suitable for possible cars' mid-size EVs applications. Nowadays, we have a great opportunity to take advantage of the significant advances in modeling, identification and control systems inspired by the latest achievements in artificial intelligence, statistics and machine learning, deep learning, signal process analysis. Therefore, our research objectives are expanded with new approaches.

### **2.1 Li-ion battery model selection**

In the case study, for "proof-of-concept" and simulation reasons, our selection strategy is to adopt a Li-ion battery model that meets the following requirements:

simple, accurate, easy to implement and suitable for online real-time simulations for a wide range of applications in the automotive industry of EVs.

The experience gained so far in process identification, modeling, design, and implementation confirms the existence of such a Li-ion battery model; depending on the complexity of the proposed research objectives, this could be an ECM, i.e., an electrical circuit consisting of a Thevenin-type voltage source OCV connected to the internal resistance Rint of the battery in series with one, two or three RC polarization cells. The number of RC cells substantially increases the accuracy of the model, which undoubtedly fulfills the above-mentioned characteristics, thus becoming valuable support for achieving research goals [3]. In our research, a second order ECM Li-ion battery model (abbreviated 2RC ECM) with a nominal voltage of 3.7 V and a rated capacity of 7.5 Ah was adopted, and the model was validated for different operating conditions in [3]. The electrical circuit diagram is shown in **Figure 1**, where the first polarization cell R1C1 captures the fast dynamics of the battery. In contrast, the second R2C2 polarization cell captures the slow dynamics of the Li-Ion battery. From the systemic perspective, it is a single-input, single-output (SISO) system with the input u = i indicating the charge (i < 0) or discharge (i > 0) current, and y = Vbat denoting the voltage at the output terminal of the battery. The voltages across the bias cells, Vc1 and Vc2, and the internal SOC state of the battery represent the internal states of the system. In addition, the proposed Li-ion battery SOC estimator based on the adopted model is expected to perform much better in terms of accuracy and robustness of battery SOC estimates for different operating conditions [3, 5, 7].

The adopted Li-ion battery (LIB) ECM model plays an important role in our research since it is valuable to support building a model-based EKF SOC and terminal voltage estimator, whose accuracy and robustness depended on the accuracy and robustness of the battery model. In addition, the ECM battery model is used for training data set generation to develop a data-driven intelligent neural network learning technique for SOC estimation and terminal voltage prediction, as a viable alternative to the traditional EKF estimator. The new modeling and estimation approach has proven its use for all battery types and different chemistries, outperforming traditional model-based state estimators. Their convergence does not depend on the complexity of model nonlinearity, unmodelled parts or model uncertainties. Also, intelligent learning techniques are much more suitable for real time online applications in the EVs industry. Model selection is also suggested due to its simplicity and ability to accurately describe the static and dynamic behavior of Li-ion battery.

The new modeling approaches use a specialized Simulink Simscape battery block to preset a specific Li-ion battery operating for different temperature ranges that

**Figure 1.** *2RC ECM wiring diagram.*

*Investigations of Different Approaches for Controlling the Speed of an Electric Motor… DOI: http://dx.doi.org/10.5772/intechopen.112383*

significantly affect battery internal resistance *R*Ð , SOC, and RC components of the

bias cells. Therefore, depending on user settings, Simscape multi-object models, built by a kind of specific object-oriented programming language, become valuable tools for generating different measurement input-output data sets for physical systems or subsystems. Then, these data sets are trained to develop and implement in MATLAB Simulink intelligent neural networks (NNs) learning techniques or to extract the model parameter values of a particular Li-ion battery, as well as to adjust and obtain the optimal values of them. For interested readers, such a Simscape block is shown in **Figure 2**.

**Figure 3a** and **b** show the discharge characteristics curves of rated current at 0.9, 5.4, 10.8, and 27 A versus battery capacity (Ah) as in **Figure 3a**, and time (h) in **Figure 3b**. The parameter values of a generic preset Li-ion battery model are also disclosed.

### **2.2 Li-ion 2RC ECM analytical model state space representation and continuous time domain**

The analytical model of the Li-Ion battery is described in the continuous time domain by three first-order linear differential state equations and a highly nonlinear static output-state-input equation:

$$\frac{d\mathbf{x}\_1}{dt} = \frac{-\eta}{Q\_{nom}}\mu(t) \tag{1}$$

$$\frac{d\mathbf{x}\_2}{dt} = \frac{-\mathbf{1}}{R\_1 \mathbf{C}\_1} \mathbf{x}\_2 + \frac{\mathbf{1}}{\mathbf{C}\_1} = \frac{-\mathbf{1}}{T\_1} \mathbf{x}\_2 + \frac{\mathbf{1}}{\mathbf{C}\_1}, T\_1 = R\_1 \mathbf{C}\_1[\mathbf{s}] \tag{2}$$

$$\frac{d\mathbf{x}\_3}{dt} = \frac{-\mathbf{1}}{R\_2\mathbf{C}\_2}\mathbf{x}\_3 + \frac{\mathbf{1}}{\mathbf{C}\_2} = \frac{-\mathbf{1}}{T\_2}\mathbf{x}\_3 + \frac{\mathbf{1}}{\mathbf{C}\_2}, T\_2 = R\_2\mathbf{C}\_2[s] \tag{3}$$

**Figure 2.** *Simulink Simscape block configured for Li-ion battery and NEDC driving cycle current profile test.*

**Figure 3.**

*Li-ion battery-rated current discharge characteristics and battery terminal voltage curves: (a) battery voltagerated capacity curve (V-Ah); (b) battery voltage-time curve (V-h).*

$$y = h(\mathbf{x}\_1) - \mathbf{x}\_2 - \mathbf{x}\_3 - R \int u(t) \tag{4}$$

where,

$$h(\mathbf{x}\_1) = \text{OCV}(\mathbf{x}\_1) = k\_0 - k\_1 \frac{1}{\mathbf{x}\_1} - k\_2 \mathbf{x}\_1 + k\_3 \ln\left(\mathbf{x}\_1\right) + k\_4 \ln\left(1 - \mathbf{x}\_1\right) \tag{5}$$

is a nonlinear static function that represents the dependence of OCV on SOC, that is, OCV(SOC), and SOC = *x*1, the first component of the state vector *x*, given by

$$\mathbf{x} = \begin{bmatrix} \mathbf{x}\_1 \\ \mathbf{x}\_2 \\ \mathbf{x}\_3 \end{bmatrix} \begin{bmatrix} \\ \end{bmatrix} \tag{6}$$

Both, *T*<sup>1</sup> and *T*2, denote the time constant of the first and second polarization cells, respectively. Also, the constants η, and *Qnom* designate the coulombic efficiency (η) for both, charging and discharging cycles, and the nominal capacity of the battery (*Qnom*) respectively.

It is worth noting that, Eqs. (5) and (6) represent a combination of three separate models, namely Shepherd, Unnewehr and Nernst, reported in [3, 5] to predict terminal voltage based on SOC measurements. The combined model performs better than using either model separately. The constants *k*0, *k*1, *k*2, *k*3,, *k*<sup>4</sup> can be estimated using a least square estimation (LSE) procedure provided in the MATLAB System Identification Toolbox. To understand how LSE technique works, a simple offline (batch) processing method that calculates all these unknown parameters is well described in [3, 5]. For tuning these parameters and finding their optimal values, a Global Pattern Search (GPS) genetic algorithm from MATLAB Optimization Toolbox is a valuable tool to use [3].

*Investigations of Different Approaches for Controlling the Speed of an Electric Motor… DOI: http://dx.doi.org/10.5772/intechopen.112383*

### **2.3 Analytical model of Li-ion 2RC ECM in state space and discrete time domain representation**

The Li-ion battery model described in the continuous-time state space representation can be discretized using a Taylor series expansion and then keeping only the first linear term, obtained by using the following approximation

$$\frac{dx\_i}{dt} = x\_i \tag{7}$$

where,

*Ts* is the sampling time, *tk* ¼ *k* � *Ts*, *k Z*<sup>þ</sup> denotes the time instance, and *k* is a sample index

A matrix representation describes a compact Li-ion battery model of the following form:

$$\mathbf{x}(k+1) = A\mathbf{x}(k) + Bu(k), \\ \mathbf{y}(k) = \mathbf{C}\mathbf{x}(k) + Du(k) + h\_1(\mathbf{x}(k)) \tag{8}$$

where

$$A = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 - \frac{T\_s}{T\_1} & 0 \\ 0 & 0 & 1 - \frac{T\_s}{T\_2} \end{bmatrix}, B = \begin{bmatrix} -\eta T\_s \\ \overline{Q\_{nom}} \\ \overline{T\_s} \\ \overline{C\_1} \\ \overline{T\_s} \\ \overline{C\_2} \end{bmatrix}, C = \begin{bmatrix} -k\_2 & -1 & -1 \end{bmatrix}, D = \tag{9}$$

and,

$$h\_1(\varkappa(k)) = k\_0 - k\_1 \frac{1}{\varkappa\_1} + k\_3 \ln\left(\varkappa\_1\right) + k\_4 \ln\left(1 - \varkappa\_1\right) \tag{10}$$

The MATLAB simulation results obtained by iteratively solving the discrete-time Eqs. (8)–(10) describing the dynamics of the battery model over a finite time horizon defined by the number of samples are shown in **Figure 4a**–**c**. **Figure 4a** shows the SOC evolution of the battery over a full one-hour discharge cycle for a discharge current of 1C (7.5A), decreasing from 100% (fully charged battery) to 0% (fully discharged battery). **Figure 4b** reveals one of the main characteristics of the proposed Li-ion battery, which can be found in any catalog specifications of battery manufacturers. This well-known non-linear OCV-SOC curve differs from battery to battery. The time evolution of the battery terminal voltage and its OCV are illustrated in **Figure 4c** (Vbat) and 4d (OCV), respectively. The development of OCV and the terminal voltage of the Li-Ion battery is studied over the same full discharge cycle of 1h @7.5A (1C rate) discharge current.

### **3. SOC estimation and terminal voltage prediction of Li-ion battery**

Section 1 details the vital role of the SOC battery in energy efficiency, safe operation and life extension. Also, information on the best-known state estimators and

### **Figure 4.**

*MATLAB simulation results @ constant current = 7.5 A: (a) discharged battery SOC during one-hour discharge cycle; (b) OCV characteristics of the Li-ion battery; (c) Li-ion battery terminal voltage during one-hour discharge cycle; (d) OCV battery during a one-hour discharge cycle.*

parameters reported in the literature is provided to interested readers and implementers. Among these estimators, the most popular is the Kalman filter estimator in various versions, such as KF, EKF, UKF, and EnKF, as mentioned in the Introduction section. This section briefly introduces the EKF state estimator, which is easily adapted to estimate the SOC of the Li-ion battery proposed in the case study.

### **3.1 EKF state estimator design and MATLAB implementation**

The Kalman Filter is reported in the literature field since 1960. It is "an optimal recursive model-based data processing algorithm for linear filtering purposes" [3].

A new modified form of KF, abbreviated EKF, was adopted for nonlinear process dynamics, a non-optimal filter estimator based on the linearization of process dynamics. Only KF is the optimal filter that addresses Gaussian linear processes whose measurement and process noises are zero-mean and uncorrelated of covariance matrices, e.g., Q for process noise and R for measurement noise, respectively. The state estimation of a process minimizes the minimum mean squared error, abbreviated MMSE, between state estimate values and true state

*Investigations of Different Approaches for Controlling the Speed of an Electric Motor… DOI: http://dx.doi.org/10.5772/intechopen.112383*

model values given the measured input data set and the observed output data set [3, 5].

The EKF is a discrete-time recursive algorithm based on the LIB model whose states need to be estimated. For simplicity, the steps of the general iterative KF procedure when applied to linear systems are shown; it consists of the following two update phases [3–6, 15, 16]:

1.Prediction (forecasting) phase (time update) steps

1.1 Predict the LIB state given in Eq. (8) one step ahead

$$
\hat{\mathfrak{x}}\_{k+1,k} = A\hat{\mathfrak{x}}\_{k,k} + Bu(k) \tag{11}
$$

1.2 Predict one step ahead the error state covariance

$$
\hat{P}\_{k+1,k} = A\hat{P}\_{k,k}A^T + Q\_k \tag{12}
$$

2.Correction phase (measurement update)

2.1 Kalman gain computation

$$K\_{k+1} = \hat{P}\_{k+1,k} \mathbf{C}^T \left( \mathbf{C} \hat{P}\_{k+1,k} \mathbf{C}^T + R\_{k+1} \right)^{-1} \tag{13}$$

2.2 Update the state estimate with a new available measurement

$$
\hat{\boldsymbol{\omega}}\_{k+1,k+1} = \hat{\boldsymbol{\omega}}\_{k+1,k} + \boldsymbol{K}\_{k+1} \left( \boldsymbol{y}\_{k+1} - \mathbf{C} \hat{\boldsymbol{\omega}}\_{k+1,k} \right) \tag{14}
$$

2.3 Update error state covariance

$$
\hat{P}\_{k+1,k+1} = (I - K\_{k+1}C)\hat{P}\_{k+1,k} \tag{15}
$$

Summarizing, in the prediction/forecast phase are predicted the LIB states *x*^*<sup>k</sup>*þ1,*<sup>k</sup>* and the covariance of the states *<sup>P</sup>*^*<sup>k</sup>*þ1,*<sup>k</sup>*. The second is a correction phase that occurs only if a new output measurement *yk*þ<sup>1</sup> (terminal voltage) is available, as it must calculate the Kalman gain *Kk*þ<sup>1</sup> and, based on it, are updated the estimated state *<sup>x</sup>*^*<sup>k</sup>*þ1,*k*þ<sup>1</sup> and its estimated covariance *<sup>P</sup>*^*<sup>k</sup>*þ1,*k*þ<sup>1</sup> [3, 5, 15, 16].

For general recursive EKF procedure, the matrices *A*, *B*,*C*∧*D* are obtained by linearizing the following nonlinear functions around the last predicted estimate in each iteration:

$$\mathbf{x}\_{k+1} = f(\mathbf{x}\_k, \mathbf{u}\_k) + w\_k \tag{16}$$

$$\mathcal{Y}\_k = \mathbf{g}(\mathbf{x}\_k, \boldsymbol{\mu}\_k) + \boldsymbol{\nu}\_k \tag{17}$$

where

*f*, *g* are nonlinear time-varying functions, *wk* and are both zero-mean and uncorrelated Gaussian process and measurement noises, respectively, with the statistics represented by the covariance matrices *Qk*∧*Rk* given or calculated at iteratively at the time instance zero mean and uncorrelated, of covariance matrix The

matrices represent the so-called Jacobian matrices required in the Eqs. (11)–(15), defined as

$$A\_k = \left(\frac{\partial f}{\partial \mathbf{x}}\right) \hat{\mathbf{x}}\_{k,k}, \mathbf{C}\_k = \left(\frac{\partial f}{\partial \mathbf{x}}\right) \hat{\mathbf{x}}\_{k,k} \tag{18}$$

This is just the unique difference between KF and EKF steps; the latter requires the calculation of the Jacobian matrices *Ak*, ∧*Ck* first and then the steps remain the same. It is worth noting that the matrices *Ak*∧*Ck* are time-varying, compared to matrices ð Þ *A*,*C* which have constant elements.

For a rigorous SOC performance analysis of the EKF algorithm in terms of accuracy and robustness, some of the MATLAB simulation results for the adopted 2RC ECM Li-Ion model, are shown below in **Figures 5**–**7** some of the MATLAB simulation results for the adopted 2RC ECM Li-Ion model. In **Figure 5**, the adopted Li-Ion model is tested with a New European Driving Cycle (NEDC) input current profile test, and the SOC of the battery is estimated following the steps of the EKF state estimation algorithm. For more details on the EKF state estimator, the reader can refer to [3–6, 29, 30]. **Figure 5a** shows the NEDC driving cycle current profile test, and **Figure 5b** show the SOC values generated by the 2RC ECM model versus the SOC EKF estimated values. **Figure 5b** reveals excellent SOC steady-state accuracy and robustness to changes in SOC initial value from 80% (in the model) to 30% in the initial SOC estimate value. Therefore, the EKF estimator performs very well with high SOC accuracy and robustness.

Instead, in **Figure 6a**–**d**, the EKF SOC estimator starts from the same initial SOC value that initializes the Li-Ion battery model; the MATLAB simulation results show now the battery model SOC versus its predicted EKF value, such as in **Figure 6a**, the model terminal voltage versus its predicted EKF value in **Figure 6b**, and, newly, both SOC and terminal voltage error residuals in **Figure 6c** and **d**, which provide valuable information on SOC accuracy and terminal voltage prediction. The lower values of both residuals (close to zero) indicate an excellent performance of the EKF SOC estimator and prove that the assumption regarding the accuracy of the proposed Li-ion battery model is correct; thus there is an accuracy transfer from the model to the EKF estimator.

**Figure 5.**

*MATLAB simulation results: (a) NEDC driving cycle current profile test; (b) Li-ion battery SOC ECM model versus EKF SOC estimator.*

*Investigations of Different Approaches for Controlling the Speed of an Electric Motor… DOI: http://dx.doi.org/10.5772/intechopen.112383*

**Figure 6.**

*MATLAB Simulation results: (a) Battery SOC ECM model vs. EKF SOC estimate (same initial conditions); (b) ECM terminal voltage vs. EKF predicted terminal voltage; (c) Battery SOC residual; (d) Battery terminal voltage residual.*

Similarly, the MATLAB simulation results depicted in **Figure 7a**–**e** by changing the driving style, switching from a European NEDC cycle drive current profile test to an American Federative Transport Procedure FTP-75, shown in **Figure 7a**, and the response of the EV car is reflected in the high accuracy of the battery SOC shown in **Figure 7b**, an excellent prediction of the terminal voltage, as in **Figure 7c**. Again, the driving style is changed by moving from the American FTP-75 cycle drive current profile test to the latest European World Harmonized Light Transport Procedure (WLTP) with a more aggressive behavior, very close to the operating conditions of an environment realistic, shown in **Figure 7d**, and the impact reflected in **Figure 7e** by high SOC accuracy and excellent terminal voltage prediction is revealed in **Figure 7e**.

Summarizing this subsection, the EKF SOC estimator performs excellently in high SOC accuracy and terminal voltage prediction and with excellent robustness revealed by the MATLAB simulation results depicted in **Figures 5**–**7**. All these results are obtained for different operating conditions, mainly some changes in the initial battery SOC values and driving style by switching three driving cycles current profile tests, NEDC, FTP-75, and WLTP. In any of these scenarios the EKF SOC estimator performs excellently, with no significant impact from one driving scenario to another.

**Figure 7.**

*MATLAB simulation results – Robustness of EKF estimator to change the driving style and initial SOC value from 80 to 30%. (a) FTP-75 driving cycle current profile test; (b) ECM SOC vs. ECM EKF SOC estimate for FTP-75; (c) ECM terminal voltage vs. ECM EKF prediction terminal voltage; (d) WLTP driving cycle current profile test; (e) ECM SOC vs. ECM EKF SOC estimate for WLTP; (f) ECM terminal voltage vs. ECM EKF prediction terminal voltage.*

### **3.2 Li-ion battery neural network learning techniques for nonlinear OCV characteristic estimation, SOC and terminal voltage estimation**

This subsection explores a new approach to designing and implementing datadriven intelligent learning structures using neural networks (NNs). The intention is to *Investigations of Different Approaches for Controlling the Speed of an Electric Motor… DOI: http://dx.doi.org/10.5772/intechopen.112383*

use these smart structures for possible applications as state estimators. All these investigations aim to find a viable alternative to traditional model-based state estimators, such as the EKF used in the case study. This is why it is necessary to evaluate the capability and accuracy of their performance in a state estimation to see if they are suitable for mapping the non-linear characteristic OCV = f(SOC) characteristic of the battery and for estimating the battery SOC and terminal voltage. Therefore, three intelligent structures of nonlinear autoregressive neural networks with external input (NARX) are investigated. They are easily accessible from MATLAB Simulink Deep Learning Toolbox. Since they are data-driven structures, performance accuracy does not depend on battery model accuracy, modeling uncertainties, and the unmodeled part. In addition, they are suitable for real-time online applications and can be easily updated for all types of batteries and chemistries. NARX is a learning regression shallow neural network (SNN) estimator that consists of a single hidden layer with a certain number of hidden neurons, having a significant impact on the performance of neural structure. The input-output measurement data set is collected under the signals from the battery sensors using appropriate instruments provided by a specialized data acquisition (DAQ) system. Then the data set is processed for denoising, outliers removal, and data sharpness that significantly affect the performance accuracy. Essentially, these intelligent regressive neural network structures solve nonlinear time series problems using dynamic neural networks, including feedback networks [27–30]. They can be applied in open-loop, closed-loop, and open/closed-loop multistep prediction [27, 28]. Dynamic feedback networks can switch from open-loop to closed-loop to make multistep predictions, i.e. continue to predict when external feedback is missing using internal feedback [27, 30].

The design and implementation in MATLAB Simulink follow the steps inspired by [27–30] and are summarized in this subsection as follows:


$$\mathbf{net} = \mathbf{naxxtet } (\mathbf{1}:\mathbf{5,1}:\mathbf{5,65})$$

i.e., 0.5 samples delay for input and output, and 65 hidden neurons.

Prepare the time series data using a MATLAB-specific function 'preparets' and the MATLAB code line (the interpretation of the arguments Xs, Xi, Ai is given in step 6):

```
½Xs, Xi, Ai, Ts� ¼ preparets net, XTrain, ð Þ fg, TTrain
```
4.Train the NARX network, using the MATLAB-specific functions 'net' and 'train', writing the following code line (in open-loop)

$$\text{net} = \text{train}\left(\text{net}, \text{Xs}, \text{Ts}, \text{Xi}, \text{Ai}\right)$$

5.Display the trained network diagram, using the MATLAB code line

```
view net ð Þ
```
6.Calculate the network output Y, final input states Xf and final layer states Af of the open-loop network from the network input Xs, initial input states Xi, and initial layer states Ai.

$$[\mathbf{Y}, \mathbf{X}\mathbf{f}, \mathbf{A}\mathbf{f}] = \text{net } (\mathbf{X}\mathbf{s}, \mathbf{X}\mathbf{i}, \mathbf{A}\mathbf{i})$$

7.Calculate the network performance using the specific MATLAB function 'perform' and the MATLAB code line:

perf ¼ perform net, Ts, Y ð Þ

8. Setup the closed-loop form of the NN architecture using the following MATLAB code line

½netc, Xic, Aic� ¼ closeloop net, Xf, Af ð Þ

**Remark 1.** The final input states Xf and layer states Af of the open-loop network net become the initial information states Xic and layer states Aic of the closed-loop network netc.

9.Display the closed-loop network diagram, using following MATLAB code line

½netc, Xic, Aic� ¼ closeloop net, Xf, Af ð Þ

10.Run the prediction for Ts-time steps ahead desired in closed-loop mode, using MATLAB code line

Yc ¼ netc XPredict, Xic, Aic ð Þ

Ycmatrix ¼ cell2mat Yc ð Þ

11.Plot Yc to visualize the simulation results

Following these steps, the MATLAB simulation results are presented below, followed by a performance analysis for all three NARX Shallow NN learning estimators.

*3.2.1 The innovative NARX shallow neural network learning SOC estimator*

The input-output data set is given by following sequence of cells, converted from a row vector format to a sequence of cells using the MATLAB line of code:

*Investigations of Different Approaches for Controlling the Speed of an Electric Motor… DOI: http://dx.doi.org/10.5772/intechopen.112383*

X = num2cell (u), u is the battery input sequence of current profile as Predictor. T = num2cell (y), y is the battery terminal voltage output sequence as target. XP = num2cell ([(u\*]), u\* is the Predicted input sequence proposed for test.

The MATLAB simulation results are depicted in **Figure 8a**–**d** with following interpretations:

a. Training phase progress;

b. NARX NN structure;

c. Battery SOC estimate versus the SOC ECM 2RC model (Target);

d. The best performance validation reached at epoch 242;

Performance analysis: The NN structure consists of a hidden layer with 60 hidden neurons and a 'sigmoid' activation function, an input layer with two input sequences, an output layer with one output sequence, and a linear 'pureline' activation function. The best validation performance is obtained at epoch 242. The learning rate is lr = 0.01, and a mean square error (MSE) accuracy performance of <sup>2</sup>*:*<sup>79</sup> <sup>10</sup><sup>11</sup>*is*revealed in the **Figure 8a**,**<sup>c</sup>** and **<sup>d</sup>**.

In conclusion, with an MSE accuracy performance of 2*:*<sup>79</sup> <sup>10</sup><sup>11</sup> the NARX SOC estimator undoubtedly outperforms the EKF SOC estimator.

*3.2.2 The innovative NARX shallow neural network learning OCV = f(SOC) estimation*

X = num2cell (SOC), u is the input battery SOC as Predictor T = num2cell (OCV), OCV is the battery OCV as Target

XP = num2cell ([(SOC\*]), SOC\* is the SOC Predicted input sequence for test purpose

The MATLAB simulation results are shown in **Figure 9a**–**c**, with the following interpretation for each subfigure

a. Li-Ion battery OCV estimate versus the OCV ECM 2RC model;

b. The best validation performance reached at epoch 45;

c. Training phase progress;

Performance analysis: The structure of the NN is identical to the first NN NARX. The best validation performance is achieved much faster than the first NARX estimator, i.e., at epoch 45. The learning rate is lr = 0.01, and a better mean square error (MSE) accuracy performance than the first NARX SOC estimator of 1*:*<sup>14</sup> <sup>10</sup><sup>11</sup> revealed in the **Figure 9a**–**c**.

In conclusion, with an MSE accuracy performance of 1*:*<sup>14</sup> <sup>10</sup>12, the NARX OCV estimator also outperforms the EKF OCV estimator.

### **Figure 8.**

*NN NARX SOC estimator of Li-ion battery: (a) training phase progress; (b) NARX NN structure; (c) battery SOC estimate versus ECM 2RC SOC model (Target); (d) best performance validation achieved in epoch 242.*

*Investigations of Different Approaches for Controlling the Speed of an Electric Motor… DOI: http://dx.doi.org/10.5772/intechopen.112383*

### **Figure 9.**

*NN NARX estimator of Li-ion battery OCV as a function of SOC: (a) Li-ion battery OCV estimate versus the ECM 2RC OCV model; (b) best validation performance achieved in epoch 45; (c) training phase progress.*

### *3.2.3 NN NARX Li-ion battery terminal voltage predictor*

The input-output data set is given by following sequence of cells, converted from a row vector format to a sequence of cells using the MATLAB line of code:

X = num2cell ([SOC; u]), u denotes the input current profile and SOC the input battery (Predictors)

T = num2cell (y), y signifies the output terminal voltage (Target)

XP = num2cell ([SOC\*; u]), is the Predicted input sequence proposed for the test

The MATLAB simulation results are revealed in **Figure 10a**–**d**, each capture of the figure with following interpretations:

a. Li-Ion battery terminal voltage predicted versus ECM 2RC terminal voltage model;

### **Figure 10.**

*NN NARX terminal voltage predictor: (a) Li-ion battery terminal voltage predicted versus ECM 2RC terminal voltage model; (b) training phase progress; (d) histogram error; (c) best validation performance achieved after 19 epochs.*

*Investigations of Different Approaches for Controlling the Speed of an Electric Motor… DOI: http://dx.doi.org/10.5772/intechopen.112383*


Performance analysis: The NN structure consists of one hidden layer with 60 hidden neurons and a 'sigmoid' activation function, an input layer with two input sequences, an output layer with one output sequence, and a 'pureline' linear activation function. The best validation performance is achieved at epoch 19. The learning rate is lr = 0.01, and a mean square error (MSE) accuracy performance of 1*:*03 4 shown in **Figure 8a**–**c**.

In conclusion, for an MSE accuracy performance of 1*:*<sup>03</sup> <sup>10</sup>4, it can say that the NARX SOC estimator outperforms the EKF SOC estimator.

Summarizing all the investigations made in subsection 3.2, the valuable information provided by MATLAB simulation results depicted in **Figures 8**–**10** demonstrate that all three NN NARX estimators perform better than the traditional model-based EKF, and are indeed a viable alternative to conventional estimators using an EKF algorithm.

## **4. Electrical drives: nonlinear DC model with singularities, feedback linearization and closed-loop speed control strategies**

Electric propulsion is a central system integrated into the architectural structure of an EV. It consists of three main subsystems: an AC or DC electric motor, power converters, and electronic controllers. A Li-ion battery powers the electric motor, like the one proposed in the case study. It converts the electric energy received from the battery into mechanical energy to propel the vehicle or to generate electricity during regenerative braking periods for recharging the same battery [33].

The power converter is controlled by an electronic controller to supply a regulated voltage and current to the electric motor. The main task of the controller is to generate a suitable control law (PID, fuzzy, neuro, sliding mode, state feedback linearization, etc.) such that the electric motor can produce the appropriate torque and speed converted by sensors (transducers) into electric signals through an interface circuitry [33]. These signals are then conditioned to the appropriate level and fed to be processed by a processor. For a good insight into the electric propulsion system the reader can find details in [33]. Choosing an electric drive system for a particular EV depends on the driver's expectations, the vehicle's constraints, and the power source. About driver's expectations (driving style) were mentioned in the previous section, three driving cycles, FTP-75, NEDC and WLTP, for analyzing robustness performance analysis of the EKF SOC estimator. Vehicle constraints, including "volume and weight, depend on vehicle type, weight, and payload" [33]. In the case study, the power source refers to the selection of a Li-ion battery such that its terminal voltage, rated capacity, and rated power are adapted to the electric motor of certain EVs. A traditional DC motor drive typically needs a commutator and brushes to "feed current into the armature, making it less reliable and unsuitable for maintenance-free operation and high speed" [33]. Also, the "wound-excited DC motors have a low specific power density"; however, "because of their mature technology and simple control, DC motor drives have been prominent in electric propulsion systems" [33]. Five constructive configurations of DC motors are manufactured: series excited, shunt excited, and compound excited, separately excited

and permanent magnet (PM) excited motors, as mentioned in [33]. For "proof of concept" and simulation purposes, this section is limited to a specific nonlinear DC motor drive model, focusing on the main aspects, such as nonlinearities, feedback linearization, challenges/issues when faced with the presence of singularities, the design and implementation in MATLAB Simulink of suitable nonlinear control strategies to be applied in realistic environments for a large range of EVs. If the results obtained will satisfy the expectations, an extension of them to AC motor drives will be a big challenge. A nonlinear third-order separately excited DC motor drive model (i.e., three internal states: armature current, field current and rotor speed) is adopted for the case study.

### **4.1 Field controlled DC motor drive-nonlinear model**

### *4.1.1 DC motor drive – physical model*

Applying Kirchhoff's voltage law (KVL) for both armature circuit and the field circuit, the DC motor drive model is described in continuous time by the following equations [35]:

For the field circuit: *if* is the field current, *vf* is the field voltage:

$$L\_f \frac{d\dot{q}\_f}{dt} = \upsilon\_f - R\_f \dot{\imath}\_f \tag{19}$$

For the armature circuit: *ia* is the armature current, *va* means the armature voltage, and *ef* ¼ *c*1*ωif* represents the back electromotive force (emf) induced in the armature circuit:

$$L\_a \frac{di\_a}{dt} = \upsilon\_a - R\_a i\_a - c\_1 o i\_f \tag{20}$$

For shaft motion: *T* ¼ *c*2*iaif* is the torque due to the interaction of armature current with the field circuit flux:

$$J\frac{d\alpha}{dt} = c\_2 i\_d i\_f \tag{21}$$

State-output equation:

$$
\mathcal{Y} = \mathcal{O} \tag{22}
$$

### *4.1.2 DC motor drive: State space representation*

After some mathematical manipulations the DC motor drive is described in a simple form of state space representation [32, 33]:

$$\frac{d\mathbf{x}\_1}{dt} = -a\mathbf{x}\_1 + \mathbf{u} \tag{23}$$

$$\frac{d\mathbf{x}\_2}{dt} = -b\mathbf{x}\_2 - c\mathbf{x}\_1\mathbf{x}\_3 + q\tag{24}$$

*Investigations of Different Approaches for Controlling the Speed of an Electric Motor… DOI: http://dx.doi.org/10.5772/intechopen.112383*

$$\frac{d\mathbf{x}\_3}{dt} = \theta \mathbf{x}\_1 \mathbf{x}\_2,\tag{25}$$

$$y = \mathbf{x}\_3 \tag{26}$$

where

$$\mathbf{x}\_1 = i\_f, \mathbf{x}\_2 = i\_a, \mathbf{x}\_3 = a \tag{27}$$

and, the numerical values are set to the same values as in [35]:

$$a = \frac{R\_f}{L\_f} = 103.995, b = \frac{R\_d}{L\_d} = 35.4034, c = \frac{c\_1}{L\_a} = 1.45, q = \frac{v\_d}{L\_a} = 52.7588\tag{28}$$

$$\theta = \frac{c\_2}{J} = 230.769,\\ w\_0 = 10 \left[ \frac{rad}{s} \right] \tag{29}$$

The DC motor drive model given by Eqs. (23)–(26) is nonlinear since the product *x*1*x*<sup>3</sup> appears in the second equation, and the product *x*1*x*<sup>2</sup> appears in the third equation.

### *4.1.3 DC motor drive: State feedback linearization*

The DC motor drive model can be writing in a general vectorial field form:

$$\frac{d\mathbf{x}}{dt} = f(\mathbf{x}) + \mathbf{g}(\mathbf{x})u \tag{30}$$

$$y = h(\mathfrak{x})\tag{31}$$

where the field vectors f(x), g(x) and h(x) have the vectorial form:

$$f(\mathbf{x}) = \begin{bmatrix} f\_1(\mathbf{x}) \\ f\_2(\mathbf{x}) \\ f\_3(\mathbf{x}) \end{bmatrix} = \begin{bmatrix} -a\mathbf{x}\_1 \\ -b\mathbf{x}\_2 - c\mathbf{x}\_1\mathbf{x}\_3 + q \\ \theta\mathbf{x}\_1\mathbf{x}\_2 \end{bmatrix}, \mathbf{g}(\mathbf{x}) = \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix}, h(\mathbf{x}) = \begin{bmatrix} \mathbf{0} & \mathbf{0} & \mathbf{1} \end{bmatrix} \tag{32}$$

Preliminaries: Feedback Linearization, Lie derivative definition, Diffeomorphism – Definitions.

**Definition 1.** A nonlinear system described in a state space representation (30) and (31), where the nonlinear functions f: *D*0↦*R<sup>n</sup>*, *g* : *D*0↦*R<sup>n</sup>* are sufficiently smooth on a domain *D*<sup>0</sup> ⊂*R<sup>n</sup>* is said to be feedback linearizable (or input-state linearizable) if there exists a diffeomorphism, *<sup>T</sup>* : *<sup>D</sup>*0↦*R<sup>n</sup>* such that *Dz* <sup>¼</sup> *T D*ð Þ<sup>0</sup> contains the origine and the change of variable *z* ¼ *T x*ð Þ transforms the system given by Eqs. (30) and (31) into a linear system of the form

$$\frac{dz}{dt} = Az + B\gamma(\mathbf{x})[u - a(\mathbf{x})] \tag{33}$$

that has the pair of the matrices (A, B) controllable and *γ*ð Þ *x* inversible (or nonsingular) for all *x*∈ *D*0,as is also mentioned in [34].

**Remark 2**. If linearizing the state equation does mean that at a same time is also linearized the output equation [34].

**Remark 3.** The state feedback control or partially feedback linearizable systems is an excellent control tool that can solve both system stabilization and reference tracking control [34].

**Definition 2.** If the DC motor drive described by Eqs. (30) and (31) can be put in the form given by Eq. (33) then it can be linearized via the state feedback, choosing for the input u the following control law [34]

$$u = a(\mathfrak{x}) + \beta(\mathfrak{x})v \tag{34}$$

and

$$\beta(\mathfrak{x}) = \mathfrak{y}(\mathfrak{x})^{-1} \tag{35}$$

To stabilize the DC motor drive model, the new control law *v* introduced in Eq. (34) is designed as

$$v = -Kx \tag{36}$$

such that the matrix (*A* – *BK*) is Hurwitz, equivalent to say that the pair (A, B) is controllable (stabilizable).

The original nonlinear stabilizing state feedback control in closed-loop is given by

$$u = a(\mathbf{x}) - \beta(\mathbf{x})\mathbf{K}\mathbf{x} \tag{37}$$

**Remark 4**. The DC motor drive state feedback linearized (FL) model is not unique and depends on the choice of the state variables.

**Definition 3.** (Lie derivative operator). Assuming that the vector field functions f(x), g(x) and h(x) are sufficiently smooth in a domain *D*<sup>0</sup> ⊂ *R<sup>n</sup>*, then the mapping functions f and g on *D*<sup>0</sup> ⊂*R<sup>n</sup>* and the first derivative of the output variable *dy dt* can be put in the following form [34–36]

$$\frac{dy}{dt} = \frac{dy}{d\mathfrak{x}} \frac{d\mathfrak{x}}{dt} = \frac{\partial h}{\partial \mathfrak{x}} [f(\mathfrak{x}) + \mathfrak{g}(\mathfrak{x})u] \frac{\Delta}{=} L\_f h(\mathfrak{x}) + L\_\mathfrak{g} h(\mathfrak{x}) u \tag{38}$$

were the Lie derivative operators *Lf h* and *Lgh* defined as

$$L\_f h(\mathbf{x}) = \frac{\partial h}{\partial \mathbf{x}} f(\mathbf{x}),\\ L\_\mathbf{g} h(\mathbf{x}) = \frac{\partial h}{\partial \mathbf{x}} \mathbf{g}(\mathbf{x}) \tag{39}$$

are called the Lie derivatives of h to respect to f (or equivalent, along f), and of h to respect to g (along g), respectively.

In fact, the notation *Lf h x*ð Þ¼ *<sup>∂</sup><sup>h</sup> <sup>∂</sup><sup>x</sup> f x*ð Þ is an adapted concept of the derivative of h along the trajectories of the system *dx dt* ¼ *f x*ð Þ. It is an appropriate formal procedure for repeating the calculation of the derivative with respect to the same vector field or a new one [34], such as

$$L\_{\sharp}L\_{f}h(\infty) = \frac{\partial (L\_{f}h)}{\partial \mathbf{x}} \mathbf{g}(\infty), L\_{f}^{0}h(\infty) = h(\infty), L\_{f}^{2}h(\infty) = L\_{f}L\_{f}h(\infty) \tag{40}$$

Or, in a general repetitive form given by

*Investigations of Different Approaches for Controlling the Speed of an Electric Motor… DOI: http://dx.doi.org/10.5772/intechopen.112383*

$$L\_f^k h(\infty) = L\_f L\_f^{k-1} h(\infty) = \frac{\partial \left( L\_f^{k-1} h \right)}{\partial \mathfrak{x}} f(\infty) \tag{41}$$

**Remark 5.** The repetitive notation (41) applied on DC motor drive output y, leads to the following main result of using the full state feedback linearization (FSFL):

If *Lgh x*ð Þ¼ 0, it means that

$$\frac{dy}{dt} = L\_f h(\mathbf{x}),\tag{42}$$

and can be interpreted as independence of function *dy dt* with respect to the input u. If *LgLf h x*ð Þ=0, then

$$y^{(2)} = \frac{d}{dt} \left(\frac{dy}{dt}\right) = \frac{d}{dt} \left(L\_f h(\mathbf{x})\right) = \frac{\partial (L\_f h)}{\partial \mathbf{x}} \frac{d\mathbf{x}}{d\mathbf{x}} = \partial \frac{(L || \mathbf{f} h)}{\partial \mathbf{x}} [f(\mathbf{x}) + \mathbf{g}(\mathbf{x}) u] \tag{43}$$

Then, the final result is

$$y^{(2)} = L\_f^2 h(\varkappa) + L\_\sharp L\_f h(\varkappa) u = L\_f^2 h(\varkappa) \tag{44}$$

and it means that the second derivative of the output*y*ð Þ<sup>2</sup> , is also independent of input u.

Iteratively, by repeating the procedure, and

If *LgLk*�<sup>1</sup> *<sup>f</sup> h x*ð Þ= 0, for *<sup>k</sup>* <sup>¼</sup> 1, *<sup>ρ</sup>* � 1, and *LgL<sup>ρ</sup>*�<sup>1</sup> *<sup>f</sup> h x*ð Þ 6¼ 0, therefore in the first ð Þ *ρ* � 1 derivatives of the output y the input u does not appear, it only occurs in the last derivative *y*ð Þ*<sup>ρ</sup>* [34]

$$y^{(\rho)} = L\_f^{\rho} h(\mathbf{x}) + L\_{\mathfrak{g}} L\_f^{\rho - 1} h(\mathbf{x}) u \tag{45}$$

The last equation (45) is showing without doubt that the model is input-output linearizable, of *ρ* the relative degree, and is in the required form given in Eqs. (30) and (31). The control law u, can be written in the following form

$$u = \frac{L\_f^\rho h(\mathbf{x})}{L\_\mathbf{g} L\_f^{\rho - 1} h(\mathbf{x})} \left[ -L\_f^\rho h(\mathbf{x}) + v \right] \tag{46}$$

that leads to a following form for the input-output map [34]

$$\mathcal{Y}^{(\rho)} = \mathcal{v} \tag{47}$$

as the result of a chain of *ρ* integrators applied to the output y. For the normal canonical form, the new control law *v* from Eq. (46) is chosen as

$$v = -\mathbf{K}\mathbf{x} \tag{48}$$

where, the feedback gain *K* is calculated using a pole placement procedure, using the following MATLAB code line:

$$K = \text{place}\left(A, B, \left[p\_1, p\_2, \dots, p\_{\rho}\right]\right) \tag{49}$$

where *p*1, *p*2, … , *p<sup>ρ</sup>* represent the poles' locations in the left-half plane of the complex domain, such as the matrix ð Þ *A* � *BK* is Hurwitz (the system in closed-loop and canonical form is stable).

If the relative degree *<sup>ρ</sup>* <sup>¼</sup> *<sup>n</sup>* <sup>¼</sup> *dim x* <sup>∈</sup>*R<sup>x</sup>* ð Þ, the state-space dimension, then the system is full-state linearizable (FSL) and stabilizable. Also, the transformation *T* : *D*0↦*R<sup>n</sup>* with *z* ¼ *T x*ð Þ that convert the system given by Eqs. (30)–(31) into the form defined in Eq. (33) is a diffeomorphism. The new variables *z* are defined as follows [34]:

$$z = T(\mathbf{x}) = \begin{bmatrix} h(\mathbf{x}) \\ L\_f h(\mathbf{x}) \\ \vdots \\ \vdots \\ L\_f^{n-1} h(\mathbf{x}) \end{bmatrix} \tag{50}$$

that converts the system into normal minimal form defined by [34]

$$\frac{dz}{dt} = A\_c z + B\_c \gamma(\mathbf{x}) [u - a(\mathbf{x})] \tag{51}$$

$$\mathbf{y} = \mathbf{C}\_{\mathbf{c}} \mathbf{z} \tag{52}$$

The following choice of the input u [21, 22]

$$u = a(\mathbf{x}) + \gamma(\mathbf{x})^{-1}v \tag{53}$$

brings the system in a canonical form [34–36]

$$\frac{dz}{dt} = A\_c z + B\_c v,\\ y = C\_c z \tag{54}$$

Therefore, the state transformation defined in Eq. (50) is a full-state linearization, and in the same time also, is an input-output linearization [34].

In the case when the relative degree *ρ*<*n* then the state feedback linearization problem is brining some complications (issues) such singularities and instability. In this case the transformation *z* ¼ *T x*ð Þ converts the original system into following form [34]

$$\mathbf{z} = T(\mathbf{x}) = \begin{bmatrix} \eta \\ \vdots \\ \cdots \\ \xi \end{bmatrix} = \begin{bmatrix} \Phi\_1(\mathbf{x}) \\ \vdots \\ \mathbf{0} \\ \vdots \\ \mathbf{0} \\ \mathbf{0} \\ L\_f h(\mathbf{x}) \\ \vdots \\ \mathbf{0} \\ L\_f^{\rho - 1} h(\mathbf{x}) \end{bmatrix} = \begin{bmatrix} \Phi(\mathbf{x}) \\ \vdots \\ \cdots \\ \Psi(\mathbf{x}) \end{bmatrix} \tag{55}$$

where the functions *ϕ*1ð Þ *x* , *ϕ*2ð Þ *x* , … … , *ϕ<sup>n</sup>*�*<sup>ρ</sup>*ð Þ *x* are selected such that the transformation *T x*ð Þ still to remains a diffeomorphism. Additionally, in [34] is stated that *Investigations of Different Approaches for Controlling the Speed of an Electric Motor… DOI: http://dx.doi.org/10.5772/intechopen.112383*

such of functions *<sup>ϕ</sup>i*ð Þ *<sup>x</sup>* , *<sup>i</sup>* <sup>¼</sup> 1, *<sup>n</sup>* � *ρ*, do exist at least locally, satisfying the following conditions:

$$\frac{\partial \phi\_i(\mathbf{x})}{\partial \mathbf{x}} \mathbf{g}(\mathbf{x}) = \mathbf{0}, \forall i = \mathbf{1}, n \mathbf{\bar{-}} \rho \tag{56}$$

The transformation given by Eq. (55) converts the system into the following canonical form

$$\frac{d\eta}{dt} = f\_0(\eta, \xi) \tag{57}$$

$$\frac{d\xi}{dt} = A\_c \xi + B\_c \chi(\mathfrak{x})[u - a(\mathfrak{x})] \tag{58}$$

$$\mathcal{Y} = \mathsf{C}\_{\mathsf{c}} \mathsf{f} \tag{59}$$

$$u = a(\mathbf{x}) + \boldsymbol{\chi}(\mathbf{x})^{-1}\boldsymbol{v} \tag{60}$$

and,

$$\,\_{0}f\_{0}(\eta,\xi) = \frac{d\Phi(\mathbf{x})}{d\mathbf{x}} = \frac{\partial\Phi(\mathbf{x})}{d\mathbf{x}}f(\mathbf{x})\_{\mathbf{x}=T(\mathbf{x})^{-1}},\\\eta(\mathbf{x}) = L\_{\mathbf{g}}L\_{f}h(\mathbf{x}),\\a(\mathbf{x}) = \frac{-L\_{f}^{\rho}h(\mathbf{x})}{L\_{\mathbf{g}}L\_{f}^{\rho-1}h(\mathbf{x})} \tag{61}$$

The following main valuable results can be extracted from this general modeling approach:

1. Internal dynamics of the system, described by the Eq. (57)

$$\frac{d\eta}{dt} = f\_0(\eta, \xi)$$

It is noticeable that this dynamic is unobservable for the system output y, therefore it does not directly affect the other states ξ or the system output y since it does not appear in Eq. (58) or Eq. (59).

For the internal dynamics of the system is required to solve the **stabilization problem** around the origin of its zero dynamics

2.Zero dynamics of the internal dynamics of the system

It is obtained for *ξ* ¼ 0, and first equation of the system dynamics in normal form becomes

$$f\_0(\eta, \mathbf{0}) = \mathbf{0}$$

3. Input-output linearization of the system

The system defined by Eqs. (58) and (59) is a linear system for which two critical closed-loop problems can be solved:

a. Stabilization problem

b. Tracking problem to an input reference, constant or time varying, with zero steady-state error.

Interestingly, by solving the tracking problem for the linear part of the system dynamics described by Eqs. (58) and (59), the general tracking problem for the nonlinear system is also solved, but only if the internal dynamics of the same system is stable at the origin of zero dynamics of the internal dynamics of the system given by *f* <sup>0</sup>ð Þ¼ *η*, 0 0*:*

Repeating the Lie derivative operator in the Eq. (45) three times on DC motor drive output y, the following results are obtained

$$\frac{dy}{dt} = \frac{d\mathbf{x}\_3}{dt} = \theta \mathbf{x}\_1 \mathbf{x}\_2,\\ \frac{d^2y}{dt^2} = \theta \frac{d\mathbf{x}\_1}{dt} \mathbf{x}\_2 + \theta \mathbf{x}\_1 \frac{d\mathbf{x}\_2}{dt} = M(\mathbf{x}\_1, \mathbf{x}\_2, u) + N(\mathbf{x}\_1, \mathbf{x}\_2, \mathbf{x}\_3) \tag{62}$$

where

*M x*ð Þ¼ 1, *u θ*ð Þ �*ax*<sup>1</sup> þ *u x*2, depends on u, instead. *N x*ð Þ¼ 1, *x*2, *x*<sup>3</sup> *θx*1ð Þ �*bx*<sup>2</sup> þ *q* � *cx*1*x*<sup>3</sup> it is not dependent on u. therefore,

if *<sup>x</sup>*<sup>2</sup> 6¼ 0, then *<sup>d</sup>*<sup>2</sup> *y dt*<sup>2</sup> 6¼ 0, and since u appears in the second derivative the relative degree of the DC motor drive model is *ρ* ¼ 2. In conclusion, the DC motor drive model has *<sup>ρ</sup>* <sup>¼</sup> 2 on the set *<sup>D</sup>* <sup>¼</sup> *<sup>x</sup>*∈*R*<sup>3</sup> <sup>j</sup>*x*<sup>2</sup> 6¼ <sup>0</sup> � �, so it is worth to notice a singularity of the DC motor drive model when the state *x*<sup>2</sup> ¼ 0.

A transformation of state variables *z* ¼ *T x*ð Þ such is defined in Eq. (55) has the form

$$z = T(\boldsymbol{\pi}) = \begin{bmatrix} \phi\_1(\boldsymbol{\pi}) \\ h(\boldsymbol{\pi}) \\ L\_f h(\boldsymbol{\pi}) \end{bmatrix} \tag{63}$$

By calculation,

$$L\_f h(\mathbf{x}) = \frac{\partial h}{\partial \mathbf{x}'} f(\mathbf{x}) = [001] \begin{bmatrix} -a\mathbf{x}\_1 \\ -b\mathbf{x}\_2 - c\mathbf{x}\_1 \mathbf{x}\_3 + q \\ \theta \mathbf{x}\_1 \mathbf{x}\_2 \end{bmatrix} = \theta \mathbf{x}\_1 \mathbf{x}\_2$$

*∂ϕ*<sup>1</sup> *<sup>∂</sup><sup>x</sup> g x*ð Þ¼ *<sup>∂</sup>ϕ*<sup>1</sup> *∂x*<sup>1</sup> *∂ϕ*<sup>1</sup> *∂x*<sup>2</sup> *∂ϕ*<sup>1</sup> *∂x*<sup>3</sup> h i 1 0 0 2 6 4 3 7 <sup>5</sup> <sup>¼</sup> *<sup>∂</sup>ϕ*<sup>1</sup> *<sup>∂</sup>x*<sup>1</sup> ¼ 0, according to the constraint given in Eq. (56)

to exist the function *ϕ*1ð Þ *x* and the transformation *z* ¼ *T x*ð Þ to be diffeomorphism on the set *<sup>D</sup>* <sup>¼</sup> *<sup>x</sup>*<sup>∈</sup> *<sup>R</sup>*<sup>3</sup> <sup>j</sup>*x*<sup>2</sup> 6¼ <sup>0</sup> � �.

The equation *<sup>∂</sup>ϕ*<sup>1</sup> *<sup>∂</sup>x*<sup>1</sup> ¼ 0 shows an independence of function *ϕ*1ð Þ *x* on *x*1*:* A simpler solution for this equation is only *ϕ*1ð Þ¼ *x x*2, ∨*ϕ*1ð Þ¼ *x x*3, but the second solution is not good since the transformation *z* ¼ *T x*ð Þ is not more a diffeomorphism.

One of the possible solutions can be chosen *ϕ*1ð Þ¼ *x x*2, even if exist other choices, but not simple than this last selection [34].

So, we can write that *z* ¼ *T x*ð Þ¼ *x*2 *x*3 *θx*1*x*<sup>2</sup> 2 6 4 3 7 5 ¼ *η ξ*1 *ξ*2 2 6 4 3 7 <sup>5</sup> and after some math manipu-

lations the dynamics in the new variables can be written as

*Investigations of Different Approaches for Controlling the Speed of an Electric Motor… DOI: http://dx.doi.org/10.5772/intechopen.112383*

a. The internal dynamics is given by:

$$c\frac{d\eta}{dt} = -b\eta + q - c\frac{\xi\_1\xi\_2}{\theta\eta} = f\_0(\eta, \xi), \xi = (\xi\_1, \xi\_2) \tag{64}$$

b. The normal form of the DC motor drive dynamics is given by:

$$\frac{d\xi\_1}{dt} = \xi\_2 \tag{65}$$

$$\frac{d\xi\_2}{dt} = \theta \mathbf{x}\_2 \left( u - (a+b)\mathbf{x}\_1 + q \frac{\boldsymbol{\varkappa}\_1}{\boldsymbol{\varkappa}\_2} - c \frac{\boldsymbol{\varkappa}\_1^2 \boldsymbol{\varkappa}\_3}{\boldsymbol{\varkappa}\_2} \right) \tag{66}$$

$$\mathcal{Y} = \xi\_1 \tag{67}$$

For a simple choice of the input u to cancel all the nonlinearities in Eq. (66) such as

$$u = (a+b)\mathbb{x}\_1 - q\frac{\mathbb{x}\_1}{\mathbb{x}\_2} + c\frac{\mathbb{x}\_1^2 \mathbb{x}\_3}{\mathbb{x}\_2} + \frac{\mathbf{1}}{\theta \mathbb{x}\_2}v \tag{68}$$

For this selection of the input u, the normal form of the DC motor drive dynamics is linear and described by two linear first order differential equations and a linear state output equation

$$\frac{d\xi\_1}{dt} = \xi\_2, \frac{d\xi\_2}{dt} = v, \mathcal{y} = \xi\_1 \tag{69}$$

Since the DC motor drive model is linearized, both stabilization and tracking problems will be easily solved, but only if the stability of internal dynamics must be ensured, required to ensure the existence of the function *ϕ*1ð Þ¼ *x x*2, and the transformation *z* ¼ *T x*ð Þ to be diffeomorphism [34]. The analysis of the internal stabilization of the DC motor drive model dynamics is performed by checking if the equation

$$\frac{d\eta}{dt} = -b\eta + q - c\frac{\xi\_1 \xi\_2}{\theta \eta} = f\_0(\eta, \xi) \tag{70}$$

is asymptotic stable around the origin *ξ* ¼ *ξ*1, *ξ*<sup>2</sup> ð Þ¼ ð Þ 0, 0 , known also as zero dynamics, given by the following equation.

*f* <sup>0</sup>ð Þ¼ *η*, 0 0, so equivalent for asking that the equation given below is stable around an equilibrium point ð Þ¼ *<sup>η</sup>*, *<sup>ξ</sup> <sup>η</sup>ss* <sup>¼</sup> *<sup>q</sup> <sup>b</sup>* , *<sup>ξ</sup>* <sup>¼</sup> <sup>0</sup> .

$$\frac{d\eta}{dt} = -b\eta + q\tag{71}$$

**Lemma 1.** "The origin of the closed loop system is asymptotic stable if the origin of zero dynamics is asymptotic stable", as is stated in [34].

According to this Lemma, the DC motor drive connected in closed-loop is asymptotic stable only if the origin of its zero dynamics model is asymptotic stable. In other words, the asymptotic stability of zero dynamics guarantees the asymptotic stability of closed loop linearized system.

### **4.2 Zero dynamics interpretation**

As long as *b*> 0, the origin of zero dynamics (71) of the DC motor drive model is exponentially asymptotic stable since the solution of the homogeneous equation (71) is given by:

$$
\eta\_0(t) = e^{-bt} \eta(\mathbf{0})\tag{72}
$$

since *η*0ðÞ!*t* 0, *whent* ! ∞, then the origin of zero dynamics is exponentially asymptotic stable, and according to Lemma 1, the origin of the closed-loop system is also asymptotic stable.

Conclusion: If zero dynamics of the system is not asymptotically stable then the linearization of the nonlinear system is not possible to be realized.

In closed loop, the input u (DC motor armature voltage) is defined in the original state variables *x*1, *x*2, *x*<sup>3</sup> as

$$u = (a+b)\mathbb{x}\_1 - q\frac{\mathbb{x}\_1}{\mathbb{x}\_2} + c\frac{\mathbb{x}\_1^2 \mathbb{x}\_3}{\mathbb{x}\_2} - \frac{1}{\theta \mathbb{x}\_2}v, \land v = -(k\_1\mathbb{x}\_1 + k\_2\mathbb{x}\_2) \tag{73}$$

and replacing *ξ*1, *ξ*<sup>2</sup> by *ξ*<sup>1</sup> ¼ *x*3, *ξ*<sup>2</sup> ¼ *θx*1*x*2, u becomes:

$$u = (a+b)\mathbb{x}\_1 - q\frac{\mathbb{x}\_1}{\mathbb{x}\_2} + c\frac{\mathbb{x}\_1^2 \mathbb{x}\_3}{\mathbb{x}\_2} - \frac{1}{\theta \mathbb{x}\_2}(k\_1 \mathbb{x}\_3 + k\_2 \theta \mathbb{x}\_1 \mathbb{x}\_2) \tag{74}$$

The Simulink model of the open loop and closed loop of the DC motor drive is shown in **Figure 11**.

The MATLAB Simulink simulations results for the nonlinear DC motor drive (DCMD) connected in open loop are shown in **Figure 12a** and **b** for field current *if* ¼ *x*1, armature current *ia* ¼ *x*2, and DCMD speed ω=*x*<sup>3</sup> [rad/s] for a step input voltage test, u = 12 [V].

**Figure 11.** *DCM drive – Simulink nonlinear model, closed-loop control loop and PID control law for reference tracking.*

*Investigations of Different Approaches for Controlling the Speed of an Electric Motor… DOI: http://dx.doi.org/10.5772/intechopen.112383*

In **Figure 12a** are presented the DCMD field and armature currents and in **Figure 12b** is depictured the DCM speed in rad/s. It is noticeable that the current field remains constant when the DCMD is running and the armature current increases from initial condition value at approximative 1.5 A and then during the steady-state decreases to zero when RPM speed of DCMD is stabilized in steady state to approximate 314 rad/s.

In closed loop for DCMD state feedback linearized whose dynamics is described in Eq. (69) and the new input *v* is given by

$$
v = -K\xi = -k\_1\xi\_1 - k\_2\xi\_2\tag{75}$$

and the values of the coefficients *k*1, *k*2are obtained through a pole placement technique that stabilizes the linearized system (69)

$$
\begin{bmatrix} k\_1 \\ k\_2 \end{bmatrix} = \text{place}(A\_c, B\_c, [-2; -5]), \\
 A\_c = \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix}, B\_c = \begin{bmatrix} 0 \\ 1 \end{bmatrix}, k\_1 = 10, k\_2 = 7 \tag{76}
$$

The MATLAB simulation results of the DCMD in closed loop canonical form (69) in the new state variables *η*, *ξ*1, *ξ*<sup>2</sup> ð Þ are shown for the evolution of each variable and for actuator effort (*v* to stabilize these state variables are shown in the **Figure 13a** and **b**.

**Figure 13a** reveals the evolution of the states during the transient and in steady state, where zeta1 and zeta2 are stabilized to zero, and eta is stabilized to the equilibrium point (close to 1.49, that is *<sup>η</sup>ss* <sup>¼</sup> *<sup>q</sup> <sup>b</sup>*, thus it validates the zero dynamics result). In **Figure 13b** is presented the actuator effort to stabilize all three variables around the equilibrium point of zero dynamics (*ηss* <sup>¼</sup> *<sup>q</sup> <sup>b</sup>* ¼ 1*:*49, *ξ*<sup>1</sup> ¼ 0, *ξ*<sup>2</sup> ¼ 0Þ*:*

The MATLAB simulation results for closed loop partial state feedback linearization and state feedback input u given by Eq. (74) are shown in **Figure 14a**–**c**.

In **Figure 14a** is depicted the DCMD speed stabilized in steady state at equilibrium point of the closed system, similar as for zero dynamics. **Figure 14b** reveals the field and armature currents stabilized at same equilibrium point as for zero dynamics. In **Figure 14c** is visualized the effort of the actuator to keep stabilized the nonlinear

#### **Figure 13.**

*MATLAB closed-loop simulations for DCMD model in canonical form: (a) the evolution of the new states (eta, zeta1, zeta2); (b) the actuator effort for stabilization.*

### **Figure 14.**

*MATLAB simulation results in closed-loop by feedback linearization; (a) the DCMD speed stabilization; (b) field and armature currents stabilization at equilibrium point; (c) the actuator effort to stabilize the DCMD in steadystate at equilibrium point.*

*Investigations of Different Approaches for Controlling the Speed of an Electric Motor… DOI: http://dx.doi.org/10.5772/intechopen.112383*

system at an equilibrium point, same as for zero dynamics, therefore the result of Lemma 1 is now validated.

Tracking problem can be solved similar as stabilization but we need to substract from the output the reference input *r*, such that the error:

$$e(t) = \mathcal{y}(t) - r(t) \to 0,\text{ when } t \to \infty \tag{77}$$

In **Figure 11** it can be seen both options for reference tracking of the DCM drive speed r = 100 rad/s. First option is an integration of the DCM nonlinear model in a unit output feedback closed loop that compares the output measured value to the desired track reference value r = 100 rad/s. The MATLAB Simulink simulations results are depictured in **Figure 15a** and **c**, as follows, field and armature currents in **Figure 15a**, the DCM Driver speed in rad/s revealed in **Figure 15b**, and the actuator effort is visualized in **Figure 15c**.

The second control law is a PID traditional law for which the MATLAB Simulink simulation results are presented in **Figure 16a** and **d**, with same significance as in

#### **Figure 15.**

*DCM driver closed-loop control speed – MATLAB Simulink simulation results: (a) field and armature currents; (b) DCM driver tracking speed in rad/s; (c) actuator control effort.*

**Figures 15a** and **c**, and the tuning settings values of PID controller parameters KP, KI and KD are shown in **Figure 16d**. Comparing the results obtained by using both closed-loop controls it is worth to notice that for first option the DCM speed is an aperiodic fast response (sharply) but with a big actuator effort, instead the PID controller response is slightly slower and smooth with a smaller actuator effort.

The feedback linearization can be performed also by taking advantage of deep training learning techniques to build intelligent neuro controllers. In MATLAB Simulink the Deep Learning Toolbox includes three interesting block sets to develop intelligent neuro controllers, namely NARMA-L2, Model Predictive and Reference Model. The end of this section is an introduction to nonlinear autoregressive moving average (ARMA), similar to SOC and battery terminal voltage, for which an intelligent NARX neural network estimator was developed in the Section 3. The NARMA-L2 smart controller is a brilliant tool for feedback linearization of nonlinear systems, such as the DCM drive described in this section, designed for use in possible EV applications. This intelligent neuro controller is data-driven, so does not require an accurate

**Figure 16.**

*MATLAB Simulink simulation results for DCM driver tracking problem using a PID control law: (a) field and armature currents; (b) DCM driver speed (rad/s); (c) PID actuator control law effort; (d) PID parameters tuning values settings.*

*Investigations of Different Approaches for Controlling the Speed of an Electric Motor… DOI: http://dx.doi.org/10.5772/intechopen.112383*

**Figure 17.**

*MATLAB Simulink simulation results during learning step of DCM drive nonlinear model (feedback linearization): (a) process training results; (b) the best validation performance reached at epoch 5; (c) training phase process; (d) regression performance; (e) validation phase process; (f) testing phase process.*

**Figure 18.** *MATLAB Simulink model of the DCM drive speed control in closed-loop using a NARMA-L2 controller.*

model to perform well, and therefore the impact of some modeling imperfections will be significantly attenuated. To design such a controller, two steps must be followed. In the first step, the Deep learning Simulink block is trained separately to learn the nonlinear model, which is to be feedback linearized. In the second step, the trained neural network will be connected to the NARMA-L2 neuro controller to perform a reference tracking problem, similar to nonlinear feedback linearization. So, all the nonlinearities will be canceled in the first step, and in the second step, the controller solve a reference tracking problem. The main reason for finishing this research is to open some exciting research directions in developing intelligent neuro controllers that deal with all types of nonlinearities. Only the first step is solved in this research, i.e., the Simulink neuro controller block learns the nonlinear model of the DCM drive to be connected to the neuro controller for performing the reference tracking problem. The MATLAB Simulink simulation results are presented in **Figure 17a**–**f**, with the following meaning, training process results in **Figure 17a**, the best validation performance during the training process in **Figure 17b**, training data phase in **Figure 17c**, regression performance in all the stages (training, validation and test), is shown the in **Figure 17d**, validation data phase in **Figure 17e**, and test data phase in **Figure 17f**.

The Simulink model block of NARMA-L2 controller is illustrated in **Figure 18**.

### **5. Conclusion**

The following results are worth highlighting among the authors' main contributions to this book chapter.

• 2RC ECM Li-ion battery model selection, design and implementation, a rigorous performance analysis.

*Investigations of Different Approaches for Controlling the Speed of an Electric Motor… DOI: http://dx.doi.org/10.5772/intechopen.112383*


All the algorithms' implementation and extensive simulations were conducted on MATLAB Simulink R2023b software platform, a valuable and the strongest implementation tool from the software engineering market, in a beautiful and user-friendly environment. The MATLAB Simulink simulation results proved that the advanced intelligent estimators outperform the traditional ones. For future work, the research continues in the direction of design and implementation of new advanced intelligent learning techniques and neuro controllers such as NARMA-L2, Model Predictive and Model Reference neuro controllers. The energy management performance of the Liion battery connection to the DCM drives will be further investigated.

### **Conflict of interest**

The authors declare no conflict of interest.
