*Article* **Linear Golden Section Speed Adaptive Control of Permanent Magnet Synchronous Motor Based on Model Design**

**Wenping Jiang 1, \*, Wenchao Han 1 , Lingyang Wang 1 , Zhouyang Liu <sup>2</sup> and Weidong Du 1**


**Abstract:** Permanent magnet synchronous motor (PMSM) is a multi-variable, strongly coupled, nonlinear complex system. It is usually difficult to establish an accurate mathematical model, and the introduction of new complex algorithms will increase the difficulty of embedded code development. In order to solve this problem, we establish the characteristic model of permanent magnet synchronous motor in this paper, and the speed control scheme of the linear golden-section adaptive control and integral compensation, which is adopted. Finally, using the model-based design (MBD) method, how to build the simulink embedded code automatic generation model is introduced in detail, and then we complete the PMSM speed control physical verification experiment. Simulation and experimental results show that compared with traditional proportional-integral-derivative (PID) control, the speed control accuracy of PMSM is improved about 3.8 times. Meanwhile, the development method based on the model design can increase the PMSM control system physical verification, and then improve the development efficiency.

**Keywords:** permanent magnet synchronous motor; characteristic model; linear golden-section adaptive control; model-based design

#### **1. Introduction**

Permanent magnet synchronous motor (PMSM) has been widely used in automotive, aerospace, and other fields in recent years due to its small size, light weight, and high power density [1]. Because PMSM is a nonlinear, multi-variable, strongly coupled system, coupled with factors such as the parameter changes during operation, it is difficult to establish an accurate mathematical model. Therefore, in recent years the control of PMSM has also become a hot research topic.

Direct torque control (DTC) and field-oriented control (FOC) are the most common basic methods at present for PMSM. The vector control system adopts traditional proportionalintegral (PI) control, which has a simple model and is easy to implement. Currently, it is widely used in PMSM. However, traditional PI control cannot solve the contradiction between overshoot and rapidity, and it is easily affected by parameter changes [2,3]. In response to this problem, based on the vector control, there are a series of modern control methods of PMSM. For example, the sliding-model variable structure control using the sliding mode control is insensitive to parameters and has a fast response speed. These two advantages improve the dynamic characteristics of the PMSM [4,5] but the control accuracy is not too high due to the existence of chattering interval. Compared with the traditional PI control, the proportional resonance control eliminates the coupling between the *d* and *q* axis components, and the system implementation is more simple [6], but it still cannot solve the contradiction between overshoot and rapidity. Fuzzy control does not require an accurate mathematical model and has strong robustness [7,8], but it relies more on control experience and expert knowledge. Although model predictive control and active

**Citation:** Jiang, W.; Han, W.; Wang, L.; Liu, Z.; Du, W. Linear Golden Section Speed Adaptive Control of Permanent Magnet Synchronous Motor Based on Model Design. *Processes* **2022**, *10*, 1010. https:// doi.org/10.3390/pr10051010

Academic Editor: Jose Carlos Pinto

Received: 10 April 2022 Accepted: 15 May 2022 Published: 19 May 2022

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

disturbance rejection control can improve the speed control accuracy and dynamic performance of the system [9–12], the algorithms are complex and not easy to implement quickly. In [13], a backstepping sliding mode control based on a recurrent radial basis function network (RBFN) for a PMSM is presented, with a novel combination of the backstepping method and sliding mode control, eliminating the chattering effectively without losing the precision. In [14], an online PID parameter adjustment control, combining model predictive control and on-line fuzzy rule adjustment, is proposed. DTC is another common control method for PMSM, but it has its drawbacks with the problem of large torque pulsation particularly evident. In [15], a new DB-DTFC algorithm to solve the stator reference voltage in a stator-flux-oriented coordinate system is proposed. In [16], an analytical motor model taking the spatial harmonics and magnetic saturation characteristics of PMSM into account by reconstructing the numerical solution of magnetic co-energy (MCE) from finite element analysis (FEA) is proposed. In [17], a hybrid decision control strategy based on DNN and DTC (direct torque control) is proposed. In [18], an Ant Colony Optimization (ACO) algorithm was proposed to adjust the PID controller gains of the DTC control.

In the application of the characteristic model for PMSM, Literature [19] used the golden-section of permanent magnet synchronous motor and maintained tracking control of the integrated control method, but this paper did not consider the characteristic model and the sensitivity of the golden-section control of the step signal problems, in the initial stage. The result is that the initial stage has a larger amount of overshoot, and it is not conducive to the stability of the system. Literature [20] used the nonlinear golden-section method, and the introduction of the initial phase transition process gives the system obvious improvement, but it does not spell out the coefficient values of the transition process and the specific influence on the system, and using the nonlinear golden control method also increases the complexity of the system. It is not conducive to the realization of the ascension of the response speed and the actual system.

Based on these studies, this paper starts from the perspective of control accuracy and engineering application. Firstly, characteristic modeling of the PMSM speed control system is carried out, and then the parameters of the characteristic model are identified online by the gradient method. Only linear golden-section controller and integral controller are used to achieve stable tracking. The first-order inertial filter is introduced in the linear golden-section controller as the starting method, and the influence of the filter coefficient on the system is discussed. Finally, the paper introduces the model-based design method in the controller, gives a detailed modeling method, and uses the DSP controller and servo driver to carry out a physical verification test. Experimental results show that the method used in this paper has a high control accuracy, and based on the model design method, can greatly shorten the system verification development cycle, and can be applied to industrial control.


This paper is organized as follows. In Section 1, the introduction of the control method of PMSM is given. In Section 2, the establishment process of the mathematical model and characteristic model of the PMSM is described. In Section 3, the design of the speed adaptive controller is described. In Section 4, the method of model-based design is described. In Section 5, the simulation and experimental results are given. In Section 6, the detailed conclusions and suggestions for further work are given.

#### **2. Modeling of PMSM**

#### *2.1. Mathematical Model of PMSM*

Considering the complex relationship between different variables and the complex motion law of permanent magnet synchronous motor, its dynamic mathematical model is nonlinear and multivariate. Therefore, when considering the mathematical model of the three-phase permanent magnet synchronous motor, the following conditions are assumed.


Based on the above conditions, the stator flux Equation of permanent magnet synchronous motor in the two-phase rotating coordinate system is molded as:

$$\begin{cases} \; \psi\_{\rm d} = L\_{d} \dot{i}\_{d} + \psi\_{f} \\ \; \psi\_{q} = L\_{q} \dot{i}\_{q} \end{cases} \tag{1}$$

The voltage Equation is molded as:

$$\begin{cases} \boldsymbol{\mu\_{d}} = \mathcal{R}\_{\text{s}} \dot{\mathbf{i\_{d}}} + \mathcal{L}\_{\text{d}} \frac{d\dot{i\_{d}}}{dt} - \omega \boldsymbol{\psi\_{q}} \\\ \boldsymbol{\mu\_{q}} = \mathcal{R}\_{\text{s}} \dot{\boldsymbol{i\_{q}}} + \mathcal{L}\_{q} \frac{d\dot{i\_{q}}}{dt} + \omega \boldsymbol{\psi\_{d}} \end{cases} \tag{2}$$

where, *ψ*, *i* and *u* represent flux linkage, current, and voltage respectively, *ψ*<sup>f</sup> is permanent magnet flux, *R<sup>s</sup>* is stator phase resistance, *L*<sup>d</sup> and *L*<sup>q</sup> are synchronous inductors of axis *d* and *q* respectively, and *ω* is angular velocity.

When the motor is running stably, assuming that the steady-state voltage and current of *d*-axis and *q*-axis are respectively, and ignore the resistance voltage's drop, the torque Equation in the *dq*-reference frame is:

$$\tau\_{\rm em} = 1.5 p\_n \left[ \psi\_f i\_q + (L\_d - L\_q) i\_d i\_q \right] \tag{3}$$

The Equation of motion is:

$$
\tau\_{\rm em} = \tau\_L + \frac{1}{p\_n} B\omega + \frac{1}{p\_n} f \frac{d\omega}{dt} \tag{4}
$$

where, *J* is the moment of inertia, *ω* is the angular velocity, *τ*em is the electromagnetic torque, *τ*<sup>L</sup> is the load torque, *p<sup>n</sup>* is the polar logarithm, *B* and is the viscous friction coefficient.

In the vector control system, the more application is *i<sup>d</sup>* = 0, at this point, the stator current vector on direct axis component to 0, all the current is used for torque control. The rotor magnetic field space vector is perpendicular to the magnetomotive stator force space vector, the electromagnetic torque and the current stator form a first-order linear function relationship, the counter electromotive force, and the same direction, the motor is to achieve the highest efficiency. The size of torque can be controlled through control. In this paper, surface mount PMSM is taken as the control object. For surface mount PMSM, define *L<sup>q</sup>* = *L<sup>d</sup>* = *L* the mathematical model under *i<sup>d</sup>* = 0 control mode is approximately as follows:

$$\begin{cases} \frac{d\dot{q}\_q}{dt} = -\frac{R\_8}{L}\dot{i}\_q - p\_n\omega\dot{u}\_d - \frac{p\_n\psi\_f}{\int}\omega - \frac{1}{L}u\_q\\ \frac{d\omega}{dt} = \frac{3p\_n\psi\_f}{2f}\dot{i}\_q - \frac{B\omega}{f} - \frac{\tau\_L}{f} \end{cases} \tag{5}$$

According to Equation (5), the speed loop of the surface mount PMSM vector control system has a linear relationship between the output speed and the *q*-axis current, the motor speed can be controlled by control *iq*. Figure 1 shows a schematic diagram of the FOC vector control system.

= = =

**Figure 1.** Diagram of FOC vector control system.

#### *2.2. Characteristic Model of PMSM*

According to Equation (5), PMSM can be seen as a time-varying linear time-invariant system, let

$$\frac{d\omega}{dt} \approx \frac{\omega(k+1) - \omega(k)}{T}\frac{\omega(k)}{\approx}\alpha \quad + \quad -\alpha \tag{6}$$

This is,

$$
\omega(k+1) + (\frac{B}{I} - 1)\omega(k) = \frac{\mathfrak{T}Tp\_n \psi\_f}{2I} i\_q(k) - \frac{T\tau\_\mathcal{L}}{I} + \Delta k \tag{7}
$$

 ω ω + − = − +∆ *T* ∆*k* In Equation (7), *T* is the sampling period, ∆*k* is the discretization error. According to the characteristic model theory, for a linear time-invariant system, under a certain sampling period, the characteristic model can be described by a second-order time-varying difference Equation for position holding or tracking control [21] as Equation (8):

$$y(k+1) = f\_1(k)y(k) + f\_2(k)y(k-1) + g\_0(k)u(k) + g\_1(k)u(k-1)\tag{8}$$

+= + −+ + −1) *f k*( ) *f k*( ) g( ) *k* g( ) *k* ( ) + *n* ( ) + *n* where, *f*1(*k*), *f*2(*k*), *g*0(*k*) and *g*1(*k*) are the system parameters to be identified, *y*(*k* + *n*) is the output of the system, and *u*(*k* + *n*) is the input of the system. For the convenience of control, the *g*1(*k*)*u*(*k* − 1) term is discarded within the allowable error range, we can get the characteristic model of PMSM by Equation (8) as Equation (9):

$$
\omega(k) = f\_1(k)\omega(k-1) + f\_2(k)\omega(k-2) + g\_0(k)i\_q(k-1) \tag{9}
$$

In Equation (9), *f*1(*k*), *f*2(*k*) and *g*0(*k*) are the system parameters to be identified, *ω*(*k*) is the speed output value of the system at the moment of *k*, *ω*(*k* − *n*) are the speed output value of the system at the moment of *k* − *n* and *iq*(*k* − *n*) are the shaft current feedback value of the system at the moment of *k* − *n*.

When the sampling time is small enough, the range of characteristic parameters is *f*1(*k*) ∈ (1, 2], *f*2(*k*) ∈ [−1, 0)*g*0(*k*) ≪ 1 for Equation (9), online identification of characteristic parameters can be carried out according to the input and output values. In this paper, the gradient method is adopted for identification.

$$\begin{aligned} \boldsymbol{\phi}(k) &= \left[\boldsymbol{\omega}(k)\boldsymbol{\omega}(k-1)\boldsymbol{\omega}(k-2)\right]^\mathrm{T} \\ \boldsymbol{\theta}(k) &= \left[f\_1(k)f\_2(k)\boldsymbol{g}\_0(k)\right]^\mathrm{T} \end{aligned} \tag{10}$$

−

 ω= −+ − + −

− −

ω−

Then the identification Equation is [22]:

$$\theta(k) = \theta(k-1) + \frac{\theta}{\underset{\mathcal{A}}{\underset{\mathcal{A}}{\rightleftharpoons}} \frac{\theta}{\underset{\mathcal{A}}{\rightleftharpoons}} \frac{-}{\theta} \begin{array}{c} \lambda \phi \\ \lambda\_1 \phi(k) \\ \lambda \end{array} \times \begin{bmatrix} \alpha & -\phi & \theta & - \end{bmatrix} \tag{11}$$

where, *λ*<sup>1</sup> and *λ*<sup>2</sup> is determined by the amount of interference and the speed of convergence. In general, 0 < *λ*<sup>1</sup> < 1 0 < *λ*<sup>2</sup> < 4. < < λ < < λ

ωω

∈ ∈ −

#### **3. Speed Adaptive Control Scheme**

ω

Based on the characteristic model, the first by the gradient method parameter online identification characteristics, and then on the basis of the theory of the all-coefficient adaptive into linear golden-section controller, to guarantee the stability of the output can track the reference signal, the integral compensation controller, among them, the reference signal using first-order low-pass filter processing. Meanwhile, the total output is limited to prevent output saturation [23]. Figure 2 shows the overall speed adaptive control system structure [24].

**Figure 2.** Golden-section speed adaptive system structure diagram.

#### *3.1. Input Signal Processing*

For step-type speed signal, due to the large initial error, the output adjustment will be too large, which will cause system oscillation and overshoot, and will also lead to motor torque oscillation, which is not conducive to the stable operation of the motor and will cause adverse effects on the life of the motor. In order to reduce overshoot and oscillation, a first-order low-pass filter is introduced to smooth the step signal of the reference input. The discretized first-order low-pass filtering Equation is:

$$
\omega\_{\rm ro}(k) = \mathfrak{a}\omega\_{\rm ri}(k) + (1-\mathfrak{a})\omega\_{\rm ro}(k-1) \tag{12}
$$

where, *α* is the filtering coefficient, *ω*ro(*k*) is the filtered output value at the moment of *k*, *ω*ro(*k* − 1) is the filtered output value at the moment of *k*−1, and *ω*ri(*k*) is the input sampling value at the moment of *k*.

The first-order low-pass filtering method uses this sampling value and the last filtering output value to be weighted to obtain an effective filtering value so that the output has a feedback effect on the input. Among them, the smaller the filtering coefficient, the smoother the filtering result, but the sensitivity will be reduced; the larger the filtering coefficient, the higher the sensitivity, but the filtering result will be unstable.

#### *3.2. Linear Golden-Section Speed Adaptive Controller*

Introducing the golden-section ratio into the control system constitutes the goldensection control. In the characteristic model adaptive control theory, the identification parameters are combined with the golden ratio, and the model parameters of the system are identified online by observing the input and output data. According to Formula (9), a linear

golden-section adaptive controller of the PMSM speed control system can be designed, and the formula is:

$$\mathcal{U}\_{\rm L}(k) = \frac{-l\_1 \hat{f}\_1(k)e(k) - l\_2 \hat{f}\_2(k)e(k-1)}{\mathfrak{g}\_0(k) + k\_L} \tag{13}$$

In Equation (13), *l*<sup>1</sup> = 0.382, *l*<sup>2</sup> = 0.618 is the golden-section coefficient, and ˆ *f*1(*k*), ˆ *f*2(*k*), *g*ˆ0(*k*) are the characteristic model coefficients identified online, *e*(*k*) is the speed error at time *k*, *e*(*k* − 1) is the speed error at time *k*−1, *k<sup>L</sup>* is the adjustable parameter, which determines the stability and immunity of the system, and 0 <sup>≤</sup> *<sup>k</sup><sup>L</sup>* <sup>&</sup>lt; 1.

Based on Equation (13), the voltage control quantity of an axis *q* can be obtained, and a relatively stable speed control system can be achieved through adjustment *kL*. However, the system cannot reach the expected tracking value at this time. There is a certain steady-state error, therefore, a compensator needs to be introduced.

#### *3.3. Integral Compensator*

The characteristic model and golden-section adaptive control system have a simple structure and are easy to realize. Integral compensation also has the same characteristics and is widely used. Therefore, this paper uses integral compensator as the voltage control quantity of the second *q*-axis [25,26], denoted as the compensation Equation:

$$\mathcal{U}\_{\rm I}(k) = \mathcal{U}\_{\rm I}(k-1) + k\_{\rm I}e(k) \tag{14}$$

In Equation (14), *U*I(*k*) is integral compensation output value the time of *k*, *U*I(*k* − 1) is integral compensation output value the time of *k*−1, *k*<sup>I</sup> is the integral coefficient, and, the total axis voltage control quantity is:

$$\mathcal{U}\_q(k) = \mathcal{U}\_L(k) + \mathcal{U}\_I(k) \tag{15}$$

The whole control system has only two adjustable parameters, and the adjustment range is determined, the overall structure is simple, and easy to achieve engineering.

#### **4. PMSM Control System Based on Model Design**

#### *4.1. General Process of Model-Based Design*

The traditional design is divided into four stages: requirement, design, implementation, and testing [27,28]. It has the disadvantages of low efficiency, high difficulty, and high requirements, which is not conducive to verifying new algorithms. Therefore, model-based design is introduced in this paper.

Compared with traditional design, model-based design connects the four stages and synchronously promotes modeling and verification testing on a unified test platform, which can reduce the migration process and enable engineers to focus on the research of algorithms, greatly shorten the development cycle and reduce the development cost. The general flow of model-based design is shown in Figure 3:

**Figure 3.** The general process of model-based design.

#### *4.2. DSP Peripheral Configuration Based on Model Design*

MATLAB provides many hardware support packages, including TI C2000 processor series, for the basic FOC system, which generally need ePWM module, ADC module, eQEP module and interrupt system [29].

The ePWM module is used to generate three complementary PWM waves. The configurable parameters include period, duty cycle, dead time, input polarity and external trigger events, etc. Set the duty cycle as an external input, and calculate the duty cycle, and then it can be linked to the ePWM input pin of the hardware. The external trigger event sets to start ADC conversion, which means that when the bridge arm turns on, the current value at this moment is collected.

The ADC module is used to configure the ADC value represented by the acquisition current, select the corresponding channel, and set it to ePWMxA to trigger the conversion. The data output type is set to uint16. Finally, the conversion completion interrupt needs to be enabled, and the core program of the algorithm needs to be executed in the interrupt.

The eQEP module is used to configure and collect the encoder signal, and then obtain the rotor position, direction, and speed information. For the quadrature photoelectric encoder, the counting mode can be directly set to quadrature counting, which is equivalent to 4 times the counting frequency of QEP, and then improves speed calculation accuracy. In addition, the module also provides a flag pulse QEP\_index, the flag bit will generate a pulse for speed calculation every time the motor rotates one revolution.

#### *4.3. Build PMSM Golden-Section Adaptive Code Generation Model*

In this paper, the model-based design method is used to model and verify the goldensection speed adaptive system. First, the characteristic model algorithm is simulated and analyzed in simulink, and then the model is discretized and converted into an embedded code model for modular testing. Finally, the system integration is carried out, and the generated board file is directly downloaded to the corresponding DSP hardware to verify the correctness and efficiency of the model algorithm.

In order to increase the program processing speed, it is necessary to perform fixedpoint processing on the core model, mainly processing the data collected by the ADC and eQEP modules and some mathematical calculation modules. In order to accelerate the processing speed of the program, fixed-point processing is needed for the core model, mainly for the data collected by ADC, eQEP module, and part of the mathematical calculation module.

For the acquisition of phase current, it is only necessary to collect AB two-phase current. Since the ADC of C2000 series is unipolar, it cannot collect negative voltage signals. Bipolar signals need to be biased, and the bias voltage is set to 1.65 V. The current signal can be converted into a 0~3.3 V voltage signal that can be processed by the embedded hardware, and then the collected data is shifted to the left by 6 bits to form a normalized Q17 format, and the output data is set to fixdt (1,32,17). The current acquisition and data conversion model is shown in Figure 4:

**Figure 4.** Current acquisition model.

Encoder

−

−

offset

2 QEP\_index

1 QEP

negative

For obtaining rotor position and speed, it is divided into electrical Angle calculation and speed calculation modules. The calculation formula of electrical Angle is:

$$\begin{cases} \begin{array}{l} \mathrm{N\_{PU}} = \mathrm{N\_{QEP}} - \left( f \dot{x} (\frac{N\_{QEP}}{\mathrm{N\_{PU}} \times \mathbb{R}}) \times p\_n \times \mathbb{R} \right) \\\ ETheta \mathrm{t}a = \frac{\mathrm{N\_{PU}} \times p\_n}{\mathbb{R}} \end{array} \end{cases} \tag{16}$$

1 Theta

IQmath

*p R Thet*

 × =

−

In Equation (16), *NPU* is the number of counting pulses, *NQEP* is the number of encoder pulses, *p<sup>n</sup>* is the number of motor poles, *R* is the number of encoder lines, *ETheta* is the electrical Angle. Since the encoder has a correction angle when the motor is delivered, which is the deviation between the center line of the rotor magnetic field and the zero point of the encoder, the software correction is also required. The electrical Angle model after adding correction and processing Q17 data format is shown in Figure 5:

= − ××

multiply by −1

×

 × =

−

**Figure 5.** Electrical Angle calculation model.

The rotor speed is calculated by M-method, and the expression is: ω = × ω − − = × θ

−

$$
\omega\_{\mathbf{e}}(k) = \frac{\theta\_{\mathbf{e}}(k) - \theta\_{\mathbf{e}}(k-1)}{f\_{\mathbf{b}} \times T} \tag{17}
$$

 θ

− −

− −

Ta

1 Ia

4 Speed

> 2 Ib

3 Theta

4 Speed

θ

 θ

 θ

×

θ

=

θ

In Equation (17), *θ<sup>e</sup>* is the electrical Angle of the rotor position, *f<sup>b</sup>* is the reference frequency, and *T* is the sampling period. The speed calculation model is shown in Figure 6:

ω

**Figure 6.** Rotational speed calculation model.

4 iQ\_desired

Combining the phase current acquisition and rotor information acquisition models, the FOC model of embedded automatic code generation is built as shown in Figure 7. On this basis, the PI controller of the *q*-axis is replaced by the discrete model of the golden-section adaptive method described in the paper, which constitutes the automatic code generation model of the golden-section-based rotational speed adaptive control system as shown in Figure 8.

saturation desired\_gain **Figure 7.** DSP automatic code generation model for FOC system.

Golden Control And Interg Contorl **Figure 8.** Golden-section speed adaptive code generation model.

#### **5. Simulation and Experimental Research**

The control chip used in this paper is TMS320F28335, with a floating point processing unit, and the motor is a surface mount low-voltage permanent magnet synchronous motor, whose specific parameters are shown in Table 1. The actual hardware of the overall system is shown in Figure 9. the speed sensor is an incremental photoelectric encoder, its model is H40-6-0500VL, 500 pulses per circle, and maximum support speed is 8000 rpm. This platform is used as the verification system to verify the PMSM's linear golden-section rotational speed adaptive control system.

#### **Table 1.** PMSM parameters.


**Figure 9.** PMSM hardware diagram.

#### *5.1. Simulation Analysis*

5.1.1. Influence of Filter Coefficient on the System

The golden-section speed adaptive control scheme is sensitive to step signals, so first-order low-pass filtering is used to process the input reference signals. The filtering coefficient has different influences on the system results. The reference speed is set at 1000 RPM and the simulation time is 0.1 s and Figures 10–13 show the speed response curves under different values.

As can be seen from Figures 10–13, the larger *α* is, the shorter its adjustment time. Meanwhile, the initial error is large, and the system oscillates. The smaller *α* is, the more stable its speed tracking, and the smaller the error, but it will increase the system adjustment time and reduce the adjustment sensitivity. Considering the stability and rapidity of the system comprehensively, filter coefficient *α* = 0.002 is selected, and the speed error curve is shown in Figure 14.

α

Phase resistance (Ω)

2

α**Figure 10.** Speed response curve when *α* = 0.01.

α**Figure 11.** Speed response curve when *α* = 0.005.

α**Figure 12.** Speed response curve when *α* = 0.002.

α **Figure 13.** Speed response curve when *α* = 0.001.

α α 202

α

α

α**Figure 14.** Speed error curve when *α* = 0.002.

5.1.2. Parameter Identification Results and Analysis

∈(1, 2] ∈ −1, 0) 1 )=2 )= 1− 0.001 α 0.002 When the sampling time is small enough, the range of characteristic parameters *f*1(*k*) ∈ (1, 2] *f*2(*k*) ∈ [−1, 0)*g*0(*k*) ≪ 1, generally, takes the initial value of parameter identification *f*1(*k*) = 2 *f*2(*k*) = −1*g*0(*k*) = 0.001. Set the simulation time to 0.1 s, the reference speed to 1000 rpm, and the filter coefficient *α* = 0.002. Figures 15–17 show the online parameter identification results of the second-order characteristic model. It can be seen from the figure that the identification parameters have little change after steady-state operation, which further indicates that the speed adaptive system has strong stability.

*f k*( ) **Figure 15.** Characteristic parameter identification curve of *f*1(*k*).

*f k*( )

*f k*( ) **Figure 16.** Characteristic parameter identification curve of *f*2(*k*).

*g k*( ) **Figure 17.** Characteristic parameter identification curve of *<sup>g</sup>*0(*k*).

#### 5.1.3. Load Performance Analysis

In order to verify the anti-disturbance of the proposed method, a loading simulation experiment was carried out on the system. The rated torque of the motor used was 0.318 N·m, the sudden load was set at 0.1 s, and the loading value was 0.1 N·m. Figure 18 shows the speed response curve, and Figure 19 shows the curve of torque. It can be seen from the figure that in the process of steady-state operation, the impact of sudden load on the system speed can be ignored, indicating that the proposed method has a high anti-disturbance ability.

**Figure 18.** Curve of speed after sudden loading.

**Figure 19.** Curve of torque for sudden loading.

#### *5.2. Actual Product to Verify*

Physical verification is the key link of model-based design, which determines the feasibility of the proposed method. After the correct simulation verification, the core algorithm needs to be discretized, and then the system motor in the simulation is replaced by the actual motor feedback value which is combined with the hardware.

In this paper, the recursive parameter identification model, the golden-section model, and the integral model are firstly discretized, and then the data is converted into per-unit values. The reference value selects the rated value of the motor. The generated FOC framework interface is connected, and finally, the model is compiled and downloaded to the hardware core unit and optimized to complete the physical verification process. In order to illustrate the performance superiority of the method proposed in this paper, the golden-section controller with integral compensation based on the characteristic model is

compared with the traditional PID, and the PMSM in Table 1 and the hardware system in Figure 9 are used for verification, and the speed reference value is set to 1000 rpm. Figure 20 is the actual operation effect of the traditional PID and the method proposed in this paper.

**Figure 20.** Actual operation effect of traditional PID and proposed method.

Figure 20 shows that the performance of the proposed method is significantly better than that of traditional PID control. However, it is limited by hardware, such as encoder accuracy, current sampling accuracy, etc. The error of actual operation is larger than that of simulation, which can be improved by improving hardware performance.

In order to highlight the actual performance of the proposed method, settling time and average volatility are introduced, where, average volatility is defined as the ratio of the absolute value of the steady-state error to the reference value. Table 2 shows the running results of the proposed method about linear golden-section control (LGSC), nonlinear golden-section control (NGSC), and PID control. They were all carried out on the same experimental platform with reference speed set to 1000 rpm and the frequency of the control system was set to 20 KHz.


**Table 2.** Performance analysis of different control methods.

As can be seen from Table 2, our method has better performance than the results of nonlinear golden-section control and traditional PID control. The proposed method does not contain high-order terms, so it has fast regulation speed, which makes it superior to NGSC and PID in rapidity. In terms of average volatility, for the same experimental platform, after the motor enters steady-state operation, the average speed error of the proposed method is 2.3 rpm, the average speed error of NGSC is 4.3 rpm, while the traditional PID is as high as 11 rpm, which shows that the characteristic model and goldensection control have advantages in control accuracy. In conclusion, the proposed method has advantages in rapidity and accuracy.

#### **6. Conclusions**

In view of the difficulty of establishing an accurate mathematical model for PMSM, and the introduction of new algorithms increasing the difficulty of embedded code development, this paper adopts the model-based design method on the basis of the characteristic model, and introduces the linear golden-section and integral compensation controller. The speed adaptive control of PMSM is carried out, and the simulation and physical verification tests are carried out. In addition, the first-order low-pass filter is used to process the reference signal, and the influence of different filter coefficients on the result is discussed. Finally, a more suitable coefficient value is selected, which gives the system rapidity but also solves the overshoot problem. Meanwhile, the model-based design method is used to verify the proposed control scheme, and the performance comparison with traditional PID control and nonlinear golden-section control is given. The experiment shows that compared with traditional PID control, the speed control accuracy of PMSM is improved about 3.8 times. In the future, we plan to reduce the order of the characteristic model and use the first-order characteristic model to reduce the identification parameters and further improve the system response speed under the premise of ensuring accuracy.

**Author Contributions:** Conceptualization and methodology, W.J. and W.H.; software, validation, investigation and writing—original draft preparation, W.H.; formal analysis, L.W.; resources, Z.L.; project administration, W.D. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research was funded by Shanghai Institute of Technology, grant number XTCX2021-10.

**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.

#### **References**


**Ibrahem E. Atawi 1 , Essam Hendawi <sup>2</sup> and Sherif A. Zaid 3,4, \***


**Abstract:** Nowadays, there is a great development in electric vehicle production and utilization. It has no pollution, high efficiency, low noise, and low maintenance. However, the charging stations, required to charge the electric vehicle batteries, impose high energy demand on the utility grid. One way to overcome the stress on the grid is the utilization of renewable energy sources such as photovoltaic energy. The utilization of standalone charging stations represents good support to the utility grid. Nevertheless, the electrical design of these systems has different techniques and is sometimes complex. This paper introduces a new simple analysis and design of a standalone charging station powered by photovoltaic energy. Simple closed-form design equations are derived, for all the system components. Case-study design calculations are presented for the proposed charging station. Then, the system is modeled and simulated using Matlab/Simulink platform. Furthermore, an experimental setup is built to verify the system physically. The experimental and simulation results of the proposed system are matched with the design calculations. The results show that the charging process of the electric vehicle battery is precisely steady for all the PV insolation disturbances. In addition, the charging/discharging of the energy storage battery responds perfectly to store and compensate for PV energy variations.

**Keywords:** electric vehicle; charging station; photovoltaic; maximum power point tracking

#### **1. Introduction**

Nowadays, classical internal combustion engine (ICE) vehicles are being replaced by electric vehicles (EVs) [1,2]. In fact, the ICEs have many drawbacks that can be mitigated by EVs. The EVs have negligible pollution, higher energy efficiency, lower noise, and lower maintenance compared to the ICE. However, the charging process of the EV battery still has many obstacles such as the charging time, the charging station's infrastructure, and the effect of these stations on the present electrical power system. The charging time can be greatly reduced to minutes by utilizing fast charging techniques [3–5]. These techniques represent large electrical loads on the utility grid and affect it adversely. Especially, when there is a high number of charging stations connected simultaneously to the utility grid, many problems would be generated such as excessive overload, voltage instability, and voltage variation [6–8]. One of the solutions to these problems is the upgrading of the power system but this will lead to high costs. Another better solution is the use of an energy storage system (ESS) that can act as a buffer between the EV charging station (EVCS) and the utility [9–12]. Nevertheless, the use of ESS will reduce slightly the stress on the utility grid but the expected large number of EVCSs in the future is still a challenge.

The idea that the EV is an environmentally friendly vehicle could not be accepted if the charging stations rely mainly on the grid power that is usually generated from fossil fuels.

**Citation:** Atawi, I.E.; Hendawi, E.; Zaid, S.A. Analysis and Design of a Standalone Electric Vehicle Charging Station Supplied by Photovoltaic Energy. *Processes* **2021**, *9*, 1246. https://doi.org/10.3390/pr9071246

Academic Editor: Zhiwei Gao

Received: 4 July 2021 Accepted: 16 July 2021 Published: 19 July 2021

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

Hence, renewable energy sources must be utilized in EV charging stations to emphasize the environmental impacts of the EV. Usually, renewable energy sources are not continuous, it is intermittent. Hence, there is another use for the ESSs in resolving the discontinuity in these sources.

The common renewable energy sources used for the EV charging stations are photovoltaic (PV), biogas, and wind systems [13,14]. The PV energy systems are simple and have higher efficiency than the wind energy systems. Hence, PV energy is more attractive for EV charging stations. Several research papers have been introduced for the PV-based charging stations [15,16]. Ref. [17] has been proposed a high-power EV charging station utilizing PV powered bidirectional charger. Nevertheless, the proposed system could not permit AC charging. Ref. [18], has suggested an integrated PV panel using a multiport converter for the EV charging station. However, the grid current is greatly distorted. Ref. [19] has introduced a PV-powered grid-tied EV charger via a z-source converter. Though the charger gave better performance, it is not suitable for standalone operation. Therefore, it cannot provide EV charging in absence of a grid. A hybrid optimized management for the ESS of a PV-powered EV station is discussed in [20]. Ref. [21] provides an optimization study on the physical scheduling of the EV charging stations. Ref. [22] has presented a PV-based charging station with an ESS to support the system during peak load. In Ref. [23], a new energy management procedure was introduced for use with small EVs in urban environments. Another strategy, in [24], for the EV charging station power management was proposed to reduce the power consumption from utility grid. Furthermore, the strategy serves to store PV energy when the EV is not online with the utility grid. In Ref. [25], a 20 kW charging station for the EVs was designed and introduced using biogas.

In this paper, a new simple analysis and design of a standalone charging station powered by photovoltaic energy. Based on the assumptions, new closed-form equations are derived for the design purpose. The idea of the analysis and the assumptions are new. Modeling, simulation, and experimental verification are carried out to justify the analysis and the design procedure. Simple energy management is tested practically and simulated. The proposed system includes PV panels, a lithium-ion battery representing the electric vehicle EV, and a lead-acid battery representing the energy storage system. A bidirectional converter is employed for charging/discharging the lead-acid battery and a unidirectional converter is utilized for charging the electric vehicle. A new and simple analysis technique is proposed. In addition, simple design equations are generated from the analysis. The proposed system has been implemented physically and simulated using Matlab/Simulink platform. A single-chip PIC18F4550 microcontroller is utilized to realize the operation of the system. The system is tested successfully for 120 W level and it can be extended for a higher power. Besides, it can be applied in urban and remote areas as well. The objectives of this research are:


The paper structure is as follows: Section 2 presents the proposed system architecture. Analysis and design of the charging station have been described in Section 3. Section 4 presents the charging converters modelling and design. The proposed control system is shown in Section 5. Section 6 presents the proposed system design. The simulation

and experimental results have been discussed in Section 7. Finally, Section 8 comes with the conclusions.

#### **2. The Proposed Charging Station Description**

The architecture of the proposed EVCS system is shown in Figure 1. The EVCS system is an off-grid type that is powered by solar energy. It is collected by a PV array that generates electrical energy to the EVCS. The PV panel represents the main source of energy for the charging station. However, the generated energy is not steady. It varies according to the solar insolation level and other environmental issues. Hence, ESS batteries are usually used to compensate for the problem of energy intermittence. The output terminals of the PV are connected to a boost converter. Its function is to match the PV voltage level to that of the DC bus and helps in utilizing the maximum power point tracking (MPPT) condition of the PV panel. Two charging converters are connected to the DC bus namely the EV charger and the energy storage converter. These converters are generally DC/DC converters. However, the EV charger is a one quadrant buck converter that is used to charge the EV battery (lithium-ion). It serves in regulating the charging process of the EV battery. However, the energy storage converter is a two-quadrant DC/DC converter. It is used to control the charge/discharge process of the storage battery (lead-acid). In addition, it participates in regulating the DC bus voltage against the variations of the EV load and insolation level. The modelling and theory of operation of these converters will be explained in the next paragraphs.

**Figure 1.** The proposed PV-powered EVCS with the battery storage system.

#### **3. Analysis and Design of the Charging Station**

The electrical design of the EVSC means designing all electrical parts of the station such as the PV array, the system converters, the DC bus voltage level, all passive components, and the storage battery. Many aspects must be considered in designing the EVSC:

• The available solar energy on the site and the maximum permissible area for the PV panels.


As a first step for the design process, the relation among the input solar energy, the output charging power to the EV, and the stored energy in the ESS must be studied. The system power and energy relations will be studied in the next subsection.

#### *3.1. Power and Energy Analysis of the System*

In this section, the energy and power relations of the system are derived to help in the design process. The assumptions used in this regard are:


$$P\_{pv} = \frac{P\_{\max}}{36} \left(36 - t^2\right) \tag{1}$$

where; "*Pmax*" is the PV maximum power and "*t*" is the time in hours. The relation is sketched in Figure 2. The time axis origin is set at noon where the insolation level is maximum. The period of solar energy is assumed to be 12 H starting at 6:00 a.m. ௩ = 36 (36 − <sup>ଶ</sup> )

From the power balance principle and refer to the system power flow diagram shown in Figure 3.

$$P\_{EV} = P\_{pv} - P\_{bat} \tag{2}$$

**Figure 3.** The system power flow diagram.

Hence,

$$P\_{bat} = \begin{cases} \frac{P\_{\text{max}}}{36} \left( 36 - t^2 \right) - P\_{EV} - 6 \le t \le 6\\ -P\_{EV} \ 6 \le t \le 18 \end{cases} \tag{3}$$

where; "*Pbat*" is the instantaneous storage battery power. The average power of the storage battery is assumed to be zero along one day period (*T* = 24 h).

> Z *T*

0

Hence,

$$P\_{bat}dt = 0\tag{4}$$

Hence,

$$\int\_{-6}^{6} [\frac{P\_{\text{max}}}{36} \left( 36 - t^2 \right) - P\_{EV}] dt - \int\_{6}^{18} P\_{EV} dt = 0\tag{5}$$

*Pmax* = 3*PEV* (6)

Battery state of charge and maximum stored energy

The battery energy-stored can be calculated through:

$$E\_{bat} = \mathbb{C} + \int P\_{bat} dt\tag{7}$$

where; "*C*" is a constant.

*The region* (−6 ≤ *t* ≤ 6)

Substitute Equation (3) into Equation (7) and integrate:

$$E\_{bat} = \mathbb{C} + P\_{EV} \left( 2t - \frac{t^3}{36} \right) \tag{8}$$

To get the constant "*C*", we have that at *t* = −6 → *Ebat* = *E<sup>i</sup>* . Using Equation (8):

$$\mathbf{C} = \mathbf{E}\_{\mathrm{i}} + \mathbf{6}P\_{\mathrm{EV}} \tag{9}$$

The instantaneous battery energy is given by:

$$E\_{\rm bat} = E\_i + P\_{EV} \left[ 6 + 2t - \frac{t^3}{36} \right] \tag{10}$$

The final value of the energy at this region (*t = 6*):

*Ebat*| *<sup>t</sup>*=<sup>6</sup> = *E<sup>i</sup>* + 12*PEV* (11)

This value is the initial value for the next region. *The region* (6 ≤ *t* ≤ 18) From Equations (7) and (3):

*Ebat* = *C*<sup>1</sup> − *PEVt* (12)

where; "*C*1" is constant. From Equations (11) and (12):

$$C\_1 = E\_i + 18P\_{EV} \tag{13}$$

Hence,

$$E\_{bat} = E\_i + 18P\_{EV} - P\_{EV}t \tag{14}$$

The maximum stored energy occurs at *t = x* as shown in Figure 3. It can be shown that the maximum stored energy is given by: ௧|௫ = + 2ா[3 + ଶ√ଶସ ]

$$E\_{\rm bat}|\_{\rm max} = E\_i + 2P\_{EV}[3 + \frac{2\sqrt{24}}{3}] \tag{15}$$

ଷ

From this analysis, if the EV power *PEV* is known, then using Equations (1), (6) and (15) the PV power rating and the ESS size can be determined. Hence, the PV array area can be calculated.

#### **4. Charging Converters Modelling and Design**

The proposed system has two charging converters. The EV charging converter is a simple buck converter (first-quadrant converter). However, the energy storage battery is a buck-boost converter (two-quadrant converter). The circuit diagrams of the converters are shown in Figure 4. The operation, modeling, and analysis of the two-quadrant converter include that of the first-quadrant converter. The continuous mode is assumed for the converter operation. The converter comprised two IGBT's (S1, S2), two antiparallel diodes, and an LC filter. The converter terminals are connected to the DC bus and the storage battery. The battery's internal voltage and resistance are represented by (Eb, rb). The filter inductance is assumed to be large enough to preserve sufficient energy to charge or discharge the battery. Hence, the discontinuous conduction operation mode is neglected. The converter has two modes namely the buck mode and boost mode. The bidirectional converter serves in the boost mode, when the switch S<sup>2</sup> is active and the switch S<sup>1</sup> acts as a diode, for discharging the battery. However, it serves in the buck mode, when switch S<sup>1</sup> is active and the switch S<sup>2</sup> acts as a diode, resulting in the battery charge mode. The converter dynamic model in the state-space form is described as: = ൨

During buck operation:

$$\mathbf{x} = \begin{bmatrix} \ i\_I \\ v\_c \end{bmatrix} \tag{16}$$

$$
\begin{bmatrix}
\dot{\mathbf{x}}\_1 \\
\dot{\mathbf{x}}\_2
\end{bmatrix} = \begin{bmatrix}
0 \\
\frac{1}{C} \begin{bmatrix}
\frac{-1}{L} \\
\frac{-1}{Cr\_b}
\end{bmatrix}
\end{bmatrix} \begin{bmatrix}
\mathbf{x}\_1 \\
\mathbf{x}\_2
\end{bmatrix} + \begin{bmatrix}
\frac{V\_{dc}}{L} \\
\mathbf{0}
\end{bmatrix} u\_1 + \begin{bmatrix}
0 \\
\frac{E\_b}{Cr\_b}
\end{bmatrix} \tag{17}
$$

where; (*i<sup>l</sup>* , *vc*) are the inductor current and the capacitor voltage, *u*<sup>1</sup> represents the switch S<sup>1</sup> action with PWM taking values from the set of {0:1}, (*L*, *C*) are inductance and the capacitance of the filter, *Vdc* is the DC bus voltage.

**Figure 4.** The system converters circuit diagram: (**a**) bidirectional converter, (**b**) buck converter.

During boost operation:

$$
\begin{bmatrix}
\dot{\boldsymbol{x}}\_1 \\
\dot{\boldsymbol{x}}\_2
\end{bmatrix} = \begin{bmatrix}
0 & \frac{-1}{L} \\
\frac{1}{C} & \frac{-1}{C r\_b}
\end{bmatrix} \begin{bmatrix}
\boldsymbol{x}\_1 \\
\boldsymbol{x}\_2
\end{bmatrix} + \begin{bmatrix}
\frac{-V\_{dc}}{L} \\
\mathbf{0}
\end{bmatrix} \boldsymbol{u}\_2 + \begin{bmatrix}
\frac{V\_{dc}}{L} \\
\frac{E\_b}{C r\_b}
\end{bmatrix} \tag{18}
$$

where; *u*<sup>2</sup> represents the switch S<sup>2</sup> action with PWM taking values from the set of {0:1}. The filter inductor and capacitor design equations are [27]: (1−) 

−1 

−1 ⎦ ⎥ ⎥ ⎤ ቂ ଵ ଶ

⎣ ⎢ ⎢ ⎡0

1 

 ሶଵ ሶଶ ൨ =

$$\frac{1}{2f} \frac{\stackrel{\smile}{f}}{\text{2}f} \stackrel{\smile}{\geq} \text{L} \leq \frac{\stackrel{\smile}{f}}{f \Delta I\_{\text{min}}} \times d\_{\text{max}}\tag{19}$$

ቃ+−ௗ 0

൩ <sup>ଶ</sup> +

⎣ ⎢ ⎢ ⎡ ௗ ⎦ ⎥ ⎥ ⎤

$$I\_{rms} = \sqrt{I\_{b}|\_{max} + \frac{\left(\Delta I\_{\text{max}}\right)^2}{3}}\tag{20}$$

$$C \ge \frac{(1 - d\_{\rm min})}{8 \, r\_{\rm min} \, \mathrm{L} \, f^2} \qquad f \tag{21}$$

where; (*dmin*, *dmax*) is the minimum and maximum duty cycle, *Rli* is the approximate equivalent resistance of Li-ion battery, *f* is the switching frequency, (∆*Imin*, ∆*Imax*) is the minimum and maximum ripple currents, *r* is the minimum voltage ripple factor, and *I<sup>b</sup>* |*max* is the maximum battery current. ∆ ∆௫ |௫

The DC bus voltage level is selected according to the charging state of the system as the system converters operate in the buck mode. In this case, the DC bus voltage must be greater than the converter output average voltage. On the other hand, the minimum duty cycle and battery voltage variations affect the value of *Vdc*. These constraints can be written as:

$$\frac{V\_{b-\max}}{d\_{\min}} \ge V\_{dc} \ge \frac{V\_{b-\min}}{d\_{\text{n}}} \tag{22}$$

where; (*Vb*−*min*, *Vb*−*max*) is the battery minimum and maximum terminal voltage, and *<sup>d</sup><sup>n</sup>* is the nominal modulation index. The value of the DC capacitance affects greatly the DC bus stability. Basically, the DC bus capacitor must support a certain voltage and power ripple factor. The DC bus capacitance *Cdc* can be calculated from [28]: ି, ି௫

$$\mathbf{C}\_{d\mathbf{c}} = \frac{2\mathbf{P}\_{rated} \cdot \Delta \mathbf{x}}{\Delta r \cdot V\_{d\mathbf{c}}^2 \cdot f} \qquad \qquad f \tag{23}$$

where; (∆*x*, ∆*r*) is the percentage ripple power and voltage; and P*rated* is the rated power. ∆, ∆

#### **5. Control System**

The controllers of the proposed system, shown in Figure 5, are the MPPT, the EV charger, and the storage converter controller. The function of the MPPT controller is to keep absorbing the peak power from the PV panel. It outputs the suitable duty ratio to the boost converter that maintains the MPPT. However, the EV converter controller regulates the charging of the EV. Finally, the battery storage converter controller is used to control the DC bus voltage and ESS charge/discharge process.

**Figure 5.** *Cont.*

**Figure 5.** The proposed system controllers: (**a**) MPPT controller, (**b**) EV charge controller, and (**c**) storage battery converter controller.

#### *5.1. MPPT Controller*

The MPPT controller is necessary to improve the PV system utilization. The algorithm of the MPPT has been implemented using many approaches [29–32]. For simplicity, the common technique called "perturb and observe" is utilized here. In this technique, a perturb of the boost converter duty ratio is made and the PV voltage and current are measured. After then, the power change is calculated then checked according to the flow chart of Figure 6 [33]. The controller is adapted to generate the necessary duty ratio for the boost converter switch to achieve MPPT conditions.

**Figure 6.** Perturb and Observe MPPT algorithm flowchart.

#### *5.2. EV Converter Controller*

The target of this controller is to regulate the charging process of the EV. There are various control techniques such as pulse, constant voltage (CV), constant current (CC), and constant current/constant voltage (CC/CV) techniques. Commonly, the (CC and CC/CV) techniques are preferred for their low charging time. In our system, the (CC/CV) technique

is utilized. A simple PI controller is adapted for this technique. The proportion and integral gains of the PI controller are tuned using the Ziegler–Nichols method.

The experimental Ziegler–Nichols tuning algorithm can simply be summarized as the following. First, the PI controller is reduced to only the proportional part with very low proportional gain. Hence, remove the integral actions from the controller by setting it to zero. The proportional gain is then increased until continuous oscillations in the output signal are observed. Note that, when the oscillations occur, the controller should not be hitting limits. After each gain increase, you may need to make a disturbance b changing the setpoint to see if the loop oscillates. The oscillations occur at a critical proportional gain (*Kpc*) with an oscillation period (*Tosc*). By measuring the parameters *Kpc* and *Tosc*, the proportional and integral gains (*Kp*, *K*<sup>i</sup> ) for the PI controller are adjusted as:

$$K\_p = 0.35 \, K\_{pc} \tag{24}$$

$$K\_{\rm i} = 0.8 \, K\_p / T\_{\rm osc} \tag{25}$$

#### *5.3. Battery Storage Converter Controller*

The objective of this controller is to regulate the DC bus voltage at a constant reference value. Consequently, charging and discharging the storage battery are adapted to serve this function. In addition, the PI controller is adapted for this converter. In case that the batteries are fully charged, the converter stops charging except for a small trickle current.

#### **6. The Proposed System Design Calculations**

According to the previous analysis, the system parameters can be calculated. Assume that the proposed system data and parameters are listed in Table 1. The design calculations are carried out as follows:

• Design calculations for ESS

As the available PV panel is 120 W, the EV power can be determined from Equation (6). Hence, using Equation (15) the ESS energy can be calculated. The charge capacity of the ESS is 39 Ah. However, the nearest available standard is 65 Ah. Normally, the range of the SOC of the ESS is from 20% to 95% [34].

• Design calculations for EV converter filter

Let that ∆*Imin* = 0.3 A, *Vdc* = 25 *V*, and *r*min = 0.02. Hence, substituting in Equation (19), gives the range of inductance as 325 µH and 9375 µH. The standard inductance value of 560 µH is chosen. Then, substituting in Equation (21), gives C ≥ 363 µF. The standard inductance value of 1000 µF is chosen.

• Design calculations for Storage battery converter filter

Let that ∆*Imin* = 1.3 A and applying the same procedure to the converter of storage battery giving the range of inductance as 74 µH and 1329 µH. The standard inductance value of 560 µH is chosen. Then, substituting in Equation (21), gives C ≥ 446 µF. The standard inductance value of 1000 µF is chosen.

**Table 1.** System Parameters.


**Table 1.** *Cont.*


#### **7. Simulation and Experimental Results**

The proposed system, shown in Figure 1, is simulated and implemented physically to verify the paper idea. The parameters in Table 1 are used for both the simulation and the experimental setup. The PV panel is the Copex module of model P120. It is a polycrystalline type and has the specifications listed below. The EV battery is formed by four Li-ion batteries connected in series. Its nominal voltage is 14.8 V, the fully charged voltage is 17 V and its cut-off voltage is 12 V. The results are discussed in the following paragraphs.

#### *7.1. Simulation Results*

The proposed system is simulated using Matlab/Simulink platform. The system performances according to step changes in the solar irradiation of the PV panel are shown in Figures 7 and 8. Figure 7a shows the irradiation level of solar energy. The DC bus voltage tracks well the reference voltage (25 V), as shown in Figure 7b. The state of charge of the lead-acid battery bank B<sup>2</sup> is shown in Figure 7c. At the first four seconds, the insolation is ≥60%. Therefore, the generated PV power is enough to charge the EV battery and store the reserve in the B2. However, the insolation at the remaining period is ≤60% which is not enough to supply the energy to the EV. Hence, the storage battery discharges to compensate for the drop in solar energy. The current of the battery tracks its reference value generated by the DC bus voltage controller, as shown in Figure 7d. In addition, the charging and discharging processes track and compensate for the irradiation level. Figure 7e shows the voltage of the B<sup>2</sup> battery. Its voltage increases with charging and decreases with discharging. The PV current is shown in Figure 7f. The current level is the same as the MPPT conditions.

Figure 8a shows the irradiation level of solar energy. The EV current tracks well the reference current generated by the charge controller, as shown in Figure 8b. Figure 8c shows the voltage of the B<sup>1</sup> battery. It is continuously charging. The state of charge of the EV battery is shown in Figure 8d. Figure 8e,f show the PV power, the power of the B<sup>2</sup> battery, and the EV battery power. At the first four seconds, the irradiation is ≥60%. Therefore, the generated PV power is enough to charge the EV battery and store the reserve in the B2. However, the insolation at the remaining period is ≤60% which is not enough to supply the energy to the EV. Hence, the storage battery discharges to compensate for the drop in solar energy. In addition, the charging and discharging processes track and compensate for the irradiation level. Its voltage increases with charging and decreases with discharging. The EV power is constant at all conditions, shown in Figure 8f.

≥

≤

**Figure 7.** (**a**) PV irradiation level, (**b**) DC bus voltage, (**c**) state of charge of the lead-acid battery bank, (**d**) the lead-acid battery current and reference current, (**e**) the lead-acid battery voltage (**f**) the PV current.

**Figure 8.** (**a**) PV irradiation level, (**b**) the EV battery bank current and reference current, (**c**) the EV battery voltage, (**d**) state of charge of the EV battery, (**e**) the PV and lead-acid battery power (**f**) the EV charging power.

#### *7.2. Experimental Results*

An experimental prototype is built, as shown in Figure 9, to verify the simulation results of the proposed system. The prototype has the same parameters listed in Table 1. A single-chip PIC18F4550 microcontroller, with a 16 MHz oscillator, is utilized to achieve simultaneously five controllers. The five controllers utilize three timers of the microcontroller (T0, T1, and T2) and the PWM module of the microcontroller. The microcontroller generates the control signals for the switches S1, S2, S3, and S4. The switching frequency is suitable for the converters and gives very good results. All the controllers are included in a single chip microcontroller and all control signals are generated from this microcontroller. Therefore, the execution time of different sections in the codes forces the switching frequency to be not so high. A drive circuit for each control signal is used to raise its level voltage to a suitable level. However, the drive circuits invert the generated control signals,

and this inversion is considered in the written code of all controllers. The five controllers are described as follows:

• The boost converter controller

A perturb and observe maximum power point tracker is applied to achieve maximum power extraction of the PV panel. The microcontroller receives the PV voltage and current, performs the perturb-observe algorithm, then generates the control signal to the boost converter switch. This controller uses T2 and CCP modules are operating in the PWM mode.

• The DC bus voltage controller

The voltage of the DC bus is maintained constant during charging both batteries in the sunshine day hours and during night hours (discharging lead-acid battery). The controller gives the required lead-acid current in both modes of operation of the lead-acid battery considering the maximum charging current and maximum discharging current of the lead-acid battery.

• The lead-acid battery voltage controller

During the constant voltage stage of charging the lead-acid battery, its voltage is maintained at a slight value below the gassing voltage of the battery (14.4 V). During discharging mode of the battery, its voltage starts to decrease. The battery voltage is monitored so that the cut-off voltage should not be reached. This controller utilizes the reference battery voltage which is generated by the previous controller and generates the control signals to S<sup>1</sup> and S2. This controller employs T1 and the interrupt module to achieve its target.

• The lithium-ion voltage and current controllers

The lithium-ion battery pack is charged using the constant current—constant voltage charging method. The maximum allowable charging voltage and current of the lithium-ion battery pack are controlled using the two controllers. The outer loop (voltage controller) controls the battery voltage and generates the suitable battery current taking into consideration the maximum charging current (6.5 A). The inner loop (current controller) generates the control signal to S3. This controller employs T0 and the interrupt module to realize its target.

**Figure 9.** The experimental setup.

The step response of the charge controller of the lithium-ion battery is illustrated in Figure 10. The reference current is stepped at values of 3 A, 2 A, and 1 A. The voltage controller of the battery at the same time keeps the battery voltage at the suitable level corresponding to each current level. The corresponding control signal to S<sup>3</sup> is shown. It is noticed that the duty cycle of S<sup>3</sup> decreases as the reference current decreases. On the other side, the DC bus voltage is maintained constant.

**Figure 10.** The experimental response of the EV controller: Ch1: Control signal of S<sup>3</sup> (5 V/div) Ch2: Li-ion battery voltage (5 V/div.) Ch3: Li-ion battery current (4 A/div), Ch4: DC bus voltage (5 V/div).

Figure 11 shows the effects of disconnecting the PV panel. The figure presents DC bus voltage, lead-acid battery voltage, lithium-ion battery voltage, and current. The lead-acid battery current changes its direction at the instant of disconnection. The controller keeps the DC bus voltage constant after the instant of disconnecting the PV panel where the lead-acid battery operates in the boost mode in which it starts discharging and its voltage slightly decreases. The charge controller of the lithium-ion battery keeps its level voltage and current at the same values before disconnecting the PV panels.

**Figure 11.** The system response upon disconnecting the PV: Ch1: lead acid battery current (6 A/div) Ch2: Li-ion battery voltage (5 V/div) Ch3: lead acid battery voltage (5 V/div), Ch4: Li-ion battery current (4 A/div).

Disconnecting and reconnecting the PV panel is illustrated in Figure 12a,b. The figures give the DC bus voltage, lead-acid battery, and lithium-ion battery voltage. In Figure 12a, the PV panel is disconnected and the lead-acid battery lonely charges the lithium-ion battery. The DC bus voltage and lithium-ion battery voltage are kept at the original levels while the slightly decreases. Figure 12b shows the reconnection of the PV panel in which the two batteries are being charged and the lead-acid battery voltage slightly increases.

**Figure 12.** The system response upon: (**a**) connecting and (**b**) disconnecting the PV. Ch1: lead–acid battery voltage (5 V/div) Ch2: DC bus voltage (5 V/div) Ch3: Li-ion battery voltage (5 V/div).

Figure 13a,b present the control signals of the switches S<sup>1</sup> through S<sup>4</sup> during connecting and disconnecting the PV, respectively. The experimental results are summarized in Table 2.

**Figure 13.** Control signals from the microcontroller for the switches: (**a**) PV panel is connected, and the two batteries are being charged, (**b**) PV panel is disconnected. S4 (CH1)—S1 (CH2)—S2 (CH3)—S3 (CH4).


**Table 2.** The experimental results summary.

#### **8. Conclusions**

An isolated EV charging station based on a PV energy source is proposed. The system consists of PV panel, boost converter, ESS batteries, two DC/DC charging converters, and an EV battery. The control system consists of three controllers named the MPPT, the EV charger, and the storage converter controller. PI voltage and current controllers are adapted to control charging/discharging of the ESS system and the EV charger as well. The system is simulated and implemented physically. A single-chip PIC18F4550 microcontroller is utilized to realize the system controllers. New simple energy and power analyses procedure has been introduced. Hence, closed-form equations have been derived to help in the design phase. Complete design of the system, including the ESS size, the PV rating, and the filter components, has been proposed. Simulation and experimental results are very close and verify the effectiveness of the proposed system. At different insolation levels, the results show that the charging process of the EV battery is steady without any disturbance. However, the charging/discharging of the ESS battery responds perfectly to store and compensate for PV energy variations. The current and voltage controllers of the converters give good responses and track their references well. In addition, the MPPT controller tracks the peak conditions of the PV precisely.

**Author Contributions:** I.E.A. collected the funding and resources, E.H. helped in validation and visualization, and S.A.Z. conceived, designed the system model, and analyzed the results. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research was funded by the University of Tabuk, Grant Number S-1441-0172 at https://www.ut.edu.sa/web/deanship-of-scientific-research/home (accessed on 16 July 2021).

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **References**

