Introduction

Facing the severe situation of increasing environmental pollution and shortage of oil resources, the European Union formally announced that the sale of fuel vehicles would be banned in the European Union from 2035 onwards [1], and electric vehicles are widely concerned worldwide due to their advantages such as zero emission, zero pollution, high energy utilization rate, low noise, etc., which are of great significance in realizing energy conservation and emission reduction, energy security [2,3,4,5,6]. As one of the new types of batteries, lithium-ion batteries play an important role in areas such as electric vehicles and backup energy for renewable energy systems, and accelerating the construction of charging infrastructures has also become a top priority [7,8,9,10,11].

In order to shorten the charging time of lithium batteries and improve the charging efficiency of the charging pile, a variety of lithium battery fast charging technologies have emerged, while the charging pile as a supporting system how to accurately control the output current or voltage value is yet to be solved, because the system may lead to a decline in the performance of the system when too large disturbances or switching currents occur [12]. Currently, the segmented constant current charging method is usually used to charge lithium batteries, as shown in Fig. 1.

Fig. 1
figure 1

Multi-stage constant current charging curve

When switching the current value for different stages, the system can not adjust the current to a given value in time, at this time, the traditional PID controller can be used to control the system performance, and the inappropriate PID control parameters will lead to the charging control system to oscillation, overshooting, and steady state error [13]. Literature [14] summarized a review on battery charging strategies, in which the most commonly used charging method is the constant current and constant voltage charging method, but how to accurately control the current or voltage in the charging process is crucial. Literature [15] proposed an on-line real-time electrochemical impedance spectroscopy measurement method for batteries using closed-loop control of a power converter, which can better control the output voltage and eliminate the effect of perturbation ripples on the output of the system, but the method exists in the need to measure multiple impedance values at multiple frequencies during a single perturbation cycle, which makes the experimental operation more difficult. Literature [16] proposes a systematic study that combines battery charging control design with control implementation, using passive theory to develop the underlying control and ensure that the charger can track the intended charging current well. Literature [17] used a simple PID controller so that the charging current would be dynamically adjusted according to the charging temperature, which improved the charging speed, reduced the charging temperature rise, and indirectly reflected the aging and thermal environment. Literature [18] proposed a charging algorithm to improve battery life, which focuses on controlling the charging current during the charging process to predict the internal heat of the battery and extend the battery life. Literature [19] proposed a charging algorithm based on model predictive control to reduce the charging time and charging temperature rise to extend the battery life. Literature [20] proposed an implementation of a fractional order proportional-integral differential controller for DC–DCBUCK converter to obtain better controller performance by using fractional order controller instead of conventional PID controller. Literature [21] designed a two-layer optimization strategy to determine the minimum expected charging time for the top layer using a binary search based charging time region shrinkage method, and to find the corresponding optimal charging and equalization currents for the bottom layer using the barrier method. Literature [22] proposed a simple optimized fuzzy controller responsible for regulating the charging current of a battery charging system, capable of weighing the relationship between charging rate and battery temperature. Literature [23] proposed two constant current and constant voltage battery charging control system designs using a PI controller to control the battery charging current for the purpose of accurately measuring the battery SOC. Literature [24] proposed an optimization method for particle swarm optimized PID controller and DC–DC buck converter, based on particle swarm algorithm intelligent optimized PID controller to maximize the voltage tracking performance of DC–DC converter. Compared with other intelligent algorithms, the particle swarm algorithm has a short time for optimizing the proportional, integral, and differential parameters, faster convergence, stronger global optimization search ability to find the global optimal solution, and high execution efficiency of the algorithm, which is able to satisfy the control requirements of the system in demanding control scenarios.

Existing charging methods in the charging process due to the interference of external factors, there are charging pile output current or voltage between the actual value and the given value of the actual value of a large discrepancy, in the multi-stage constant-current and constant-voltage charging, can not be accurately switched to the given value of current or voltage, and charging pile charging control system exists in the control accuracy is not high, convergence speed is slow, interference resistance and robustness of performance is poor, as well as the inability to shorten the charging time and other Problems [25]. Therefore, to address the problems of the above methods, this paper designs a new type of controller as the control core of the electric vehicle charging pile control system.

The main contributions of this paper are as follows:

  1. (1)

    Currently, there is no consideration of controlling the accuracy of the output current or voltage of the charging pile so that it is close to the given value, and the situation that the actual value will have a large deviation from the given value when switching the current or voltage. This paper considers this problem and designs a charging pile charging control method that can continuously feedback the current or voltage signal according to the single closed-loop feedback control to improve the charging speed of the system.

  2. (2)

    This paper designs an improved particle swarm algorithm optimized PID controller, compared with the traditional PID and fuzzy PID algorithms, which can adaptively and precisely adjust the PID controller parameters online, so that the charging pile controller can intelligently regulate the charging current and voltage, and when switching the current or voltage, it can quickly reach the given value, with strong anti-interference ability, and also avoid the high current damage to the battery, which is wasteful to the power grid. power resources of the grid.

  3. (3)

    Compared with the particle swarm algorithm and other intelligent algorithms, the improved particle swarm algorithm designed in this paper can improve the convergence speed, and can search for the global optimum and individual optimum in a small search range, which can meet the control function of the charging pile charging control system.

The rest of the paper is organized as follows. In "Charging station control system principle", the principle of charging pile control system is introduced, in addition, the mathematical model of lithium-ion battery is established based on the second-order RC equivalent circuit model. In "Improved particle swarm algorithm to optimize PID control" firstly, the principle of PID controller and particle swarm algorithm is introduced, and based on this, the improved particle swarm algorithm of this paper is designed, and secondly, the improved particle swarm algorithm is described to optimize the principle, process and procedure of PID controller. In "Overall simulation models of four controllers", the simulation model of four kinds of controllers is established based on Matlab/Simulink, and the working principle and process of each layer is elaborated in detail. The simulation results are analyzed and the dynamic response of the four controllers are compared in "Simulation results and analysis". The full work is summarized in "Conclusion and prospect".

Charging station control system principle

Electric vehicle charging methods are divided into DC charging and AC charging, while AC charging has certain advantages over DC charging pile in terms of volume, cost and installation conditions, so AC charging is used for charging. The overall structure of the charging pile includes microcontroller, lithium battery pack, control circuit, rectifier circuit, sampling circuit and monitoring module, as shown in Fig. 2.

Fig. 2
figure 2

Charging pile structure diagram

In order to more accurately represent the external characteristics of lithium batteries, it is crucial to establish a mathematical model of lithium batteries. In this paper, the lithium battery mathematical model is established based on the equivalent circuit model composed of voltage source, resistance and capacitance, because the equivalent circuit model has a relatively simple structure. Electrical components such as resistance and capacitance can be described numerically, and the simulation accuracy is high, which is suitable for modeling and simulation of large-scale battery energy storage systems [26]. So in this paper, the lithium battery first-order RC equivalent circuit model is used to establish the mathematical model of the lithium battery, the first-order RC filter can more accurately describe the voltage response characteristics of the lithium battery, the model contains the internal battery resistance R and the capacitance C that represents the electrochemical reaction of the battery, and the inductance is connected in series in the form of as an ideal voltage source as shown in Fig. 3.

Fig. 3
figure 3

Lithium battery first order RC circuit model

The equation can be obtained from the circuit relationship as:

$$ U_{r} = L\frac{di(t)}{{dt}} + IR + U_{c} $$
(1)
$$ I = \frac{{dU_{c} (t)}}{dt} $$
(2)

According to Eqs. (1) and (2) we get

$$ U_{r} = LC\frac{{d^{2} U_{c} (t)}}{{dt^{2} }} + RC\frac{{dU_{c} (t)}}{dt} + U_{c} $$
(3)

Under the zero initial condition, the Raschel transformation on both sides of Eq. (3) yields

$$ U_{r} (s) = LCs^{2} U_{c} (s) + RCsU_{c} (s) + U_{c} (s) $$
(4)

Setting the system to exist with a certain delay time, the transfer function of the lithium battery is that,

$$ G(s) = \frac{{U_{c} (s)}}{{U_{r} (s)}} = \frac{1}{{LCs^{2} + RCs + 1}}e^{ - \tau s} $$
(5)

The variable parameters are set according to the lithium battery charging and discharging characteristics and physical parameters. Resistance \(R1 = 0.4\Omega\), capacitance \(C = 5\;{\text{F}}\), inductance \(L = 400\;{\text{mH}}\), there is a 1s delay in the system, then the mathematical model of the lithium battery is shown in Eq. (6),

$$ G\left( s \right) = \frac{1}{{2s^{2} + 4s + 1}}e^{ - s} $$
(6)

Improved particle swarm algorithm to optimize PID control

PID controller

PID controllers are widely used in industrial process control, and the main problem involved in PID controllers is the selection of optimal gain factors related to proportional, integral, and differential components [27]. The principle of PID controller is as follows:

$$ u\left( t \right) = K_{p} e\left( t \right) + K_{I} \int_{0}^{t} {e\left( t \right)dt + K_{D} } \frac{de\left( t \right)}{{dt}} $$
(7)

where \(e(t)\) is the difference between the input value \(r(t)\) and the actual output value \(y(t)\) of the controller:

$$ e\left( t \right) = r\left( t \right) - y\left( t \right) $$
(8)

In the formula, \(u(t)\) is the output value of the PID controller, \(\int_{0}^{t} {e(t)dt}\) is the cumulative error value, \(e(t)\) is the error value, \(K_{p} ,K_{i} ,K_{d}\) are proportional parameters, integral parameters, and differential parameters respectively.

When implementing a simple and highly adaptable control system, the PID controller has the characteristics of fast adjustment speed and strong robustness. However, for multi-parameter complex nonlinear systems, the control response speed will be slow and the controller parameters are difficult to control. Disadvantages of implementing self-adjustment [28].

Particle swarm optimization

In 1995, Kennedy and Eberhart proposed particle swarm optimization (PSO) technology [29]. Particle swarm optimization is an evolutionary computing technology derived from the study of the predatory behavior of bird flocks. It mainly uses methods such as invariance, multiple optimality, non-differentiability and non-linearity to find solutions to high-dimensional problems. It relies on concepts of social psychology [30]. The essence of particle swarm optimization is an iterative random search algorithm, which initializes a group of random particles through cooperation among individuals in a group, and then finds the optimal solution through iteration and information sharing [31].

The principle of PSO algorithm is to regard each particle as a bird, each particle has two attributes, speed and position, speed represents the speed of movement, position represents the direction of movement, each particle in the search space to search for the optimal solution as the current individual extreme value, and the individual extreme value is shared with other particles in the whole particle swarm. As the current global optimal solution of the entire particle swarm, all particles in the particle swarm adjust their speed and position according to the current individual extreme value and global optimal solution found by themselves. In order to improve the local and global search ability of particles in the swarm, the inertial weight factor is introduced, and the parameters will be large in the initial search, and gradually narrow the range. Down to the current range of 0.4–1.1 [32]. The basic principle of particle swarm optimization is as follows:

In a D-dimensional target search space, there are N particles forming a tribe group, in which the i-th particle and its "flight" speed can represent a D-dimensional vector [33]:

$$ X_{i} = (x_{i1} ,x_{i2} , \ldots x_{iD} ),\quad i = 1,2, \ldots ,N $$
(9)
$$ V_{i} = (v_{i1} ,v_{i2} , \ldots v_{iD} ),\quad i = 1,2, \ldots ,N $$
(10)

The individual extreme value of the \(i\)th particle and the global extreme value of the population are respectively recorded as:

$$ p_{best} = (p_{i1} ,p_{i2} , \ldots p_{iD} ),\quad i = 1,2, \ldots ,N $$
(11)
$$ g_{best} = (p_{g1} ,p_{g2} , \ldots p_{gD} ) $$
(12)

When finding individual and global extremes, update your speed and position based on (13) and (14):

$$ v_{ij} (t + 1) = \omega v_{ij} (t) + c_{1} r_{1} [p_{ij} - x_{ij} (t)] + c_{2} r_{2} [p_{gj} - x_{ij} (t)] $$
(13)
$$ x_{ij} (t + 1) = x_{ij} (t) + v_{ij} (t + 1) $$
(14)

Among them,\(\omega\) is the velocity inertia factor during velocity update; \(r_{1}\) and \(r_{2}\) are uniform random numbers within the range of [0, 1]; \(c_{1}\) and \(c_{2}\) are learning factors for PSO velocity updates, also known as acceleration constants; \(v_{ij}\) is the current velocity of the particle; \(x_{ij}\) is the current position of the particle; \(p_{best}\) represents the individual historical optimal solution of the \(i\)th particle in the particle swarm algorithm, \(g_{best}\) represents the global historical optimal solution of the entire population in the particle swarm algorithm.

Improving the principle of particle swarm optimization algorithm

In response to the current issue of PSO where population diversity decreases too quickly with increasing iteration times, making it difficult to converge to the global optimal solution [34], this article proposes an improved particle swarm optimization (IPSO) algorithm to improve the update progress and global search capability of PSO.

After weight optimization in particle swarm optimization, it can be concluded that the learning factors \(c_{1}\) and \(c_{2}\) determine the impact of particle empirical information on particle trajectory, which reflects the information exchange between particle swarm optimization, when \(c_{1}\) is large, it will cause particles to search excessively within their local range; when \(c_{2}\) is large, it will cause the particles to converge to the local optimal value too early. Therefore, in order to effectively control the particle's flight speed and achieve an effective balance between local and global search in the particle swarm algorithm, Clerc constructed a particle swarm algorithm model with a contraction factor introduced, by selecting appropriate parameters, the convergence of the PSO algorithm is ensured, and the boundary restrictions on speed can be eliminated. In order to effectively improve the update progress of particle swarm algorithm speed, further improve the accuracy of compression factor and the global search ability of particle swarm algorithm, a learning factor \(c_{3}\) has been added. At the same time, the calculation method of compression factor has been changed, and the formula for updating particle speed and position is shown in Eqs. (15) and (16).

$$\begin{aligned} & v_{ij} (t + 1) = \lambda \Big\{ \omega v_{ij} (t) + c_{1} r_{1} [p_{ij} - x_{ij} (t)]\\ & \quad + c_{2} r_{2} [p_{gj} - x_{ij} (t)] + c_{3} r_{3} [p_{gj} - x_{ij} (t)] \Big\} \end{aligned} $$
(15)
$$ x_{ij} (t + 1) = x_{ij} (t) + v_{ij} (t + 1) $$
(16)
$$ \lambda = \frac{2}{{2 - C - \sqrt {C^{2} - 4C} }} $$
(17)
$$ C = c_{1} + c_{2} + c_{3} $$
(18)

Among them, (17) and (18) represent the relationship between compression factor and learning factor. Larger \(c_{1}\) and \(c_{3}\) values will cause particles to search too much within their local range, while larger \(c_{2}\) values will cause particles to converge to the local optimum too early. Therefore, the role of compression factor is to effectively control the particle's flight speed, so that the algorithm can achieve an effective balance between global search and local search. Through the joint constraints of \(c_{1}\), \(c_{2}\), and \(c_{3}\), selecting appropriate parameter values can ensure the convergence of the improved particle swarm optimization algorithm proposed in this paper.

Improving particle swarm optimization process

In this experiment, an improved particle swarm optimization algorithm was used to optimize the proportional, integral, and differential parameters of PID control through continuous online iteration, namely \(k_{p}\), \(k_{i}\) and \(k_{d}\) to achieve the best dynamic performance and control accuracy of the charging pile control system. The structure diagram of the charging pile control system is shown in Fig. 4.

Fig. 4
figure 4

Schematic diagram of improved particle swarm optimization algorithm for PID controller optimization

The fitness function adopts the ITAE index, which can reflect the relationship between error and time. The smaller the fitness value, the better the control performance, as shown in Eq. (19):

$$ J = \int_{0}^{T} {t\left| {e(t)} \right|} dt $$
(19)

In the formula: \(e\) represents the system error, i.e. the charging current deviation; \(T\) represents the system running time.

In Fig. 4, there are three parameters that need to be optimized, so this study sets the search space of the particle swarm optimization PID controller to be three-dimensional. After multiple simulation verifications, the following optimal parameter values are selected: population size \(np = 40\); Iteration count \(gens = 30\); Take the maximum value of inertia weight \(\omega_{\max } = 0.9\) and the minimum value \(\omega_{\min } = 0.4\); learning factors \(c_{1} = c_{2} = c_{3} = 2.039\), compression factor \(\lambda = 0.2592\), the optimal individual fitness value of the improved particle swarm optimization algorithm for PID control system is 19.3083, and the minimum fitness value is 0.01, which satisfies the optimal charging curve of the charging pile control system, the following Fig. 5 is the flowchart of improving particle swarm optimization algorithm to optimize PID control system.

Fig. 5
figure 5

Flow chart of improving PSO and optimizing PID control system

The steps to improve the particle swarm optimization algorithm and optimize the PID controller are as follows:

  1. (1)

    This article adopts the mathematical model of lithium batteries as the equivalent model, as shown in Eq. (6) above.

  2. (2)

    Initialize the system and set the parameters for the improved particle swarm algorithm.

  3. (3)

    Input the lithium battery charging current value into the model of the electric vehicle charging station control system established by Matlab/Simulink, use the lithium battery charging fitness value as the control variable, and output it to the improved particle swarm optimization algorithm, update individual and global best solutions to update particle velocity and position, and search for individual and group optima through fitness value functions.

  4. (4)

    By continuously iterating and updating, determine whether the termination condition is met. If the termination condition is not met, continue to update the current particle's velocity and position based on the position and velocity update formula, calculate the velocity and position of each particle, and update the individual history and population history optimal fitness values and positions of each particle; If the termination condition is reached, output the optimal solution of particle velocity, position, and particle swarm.

  5. (5)

    Through Matlab/Simulink simulation experiments, the lithium battery charging process is verified. If the experimental output curve is relatively ideal, the optimization is terminated. If the experimental results are not ideal, the parameters and particle velocity and position of the improved particle swarm optimization algorithm are readjusted, and their values are returned to the third step to continue the optimization solution.

The specific process of optimizing PID controller using improved particle swarm optimization algorithm can be obtained from the above steps, as shown in Table 1.

Table 1 IPSO algorithm optimizes the PID controller process

Overall simulation models of four controllers

The overall module of electric vehicle charging pile consists of four parts: PID controller optimization module, fuzzy PID controller optimization module, particle swarm optimization PID controller module and improved particle swarm optimization PID controller module, as shown in Fig. 6, which are mainly built according to the mathematical model and basic working principle of electric vehicle lithium battery and the basic principle of each control algorithm.

Fig. 6
figure 6

Charging pile control system simulation model

  1. (1)

    The first module is PID control system. The single closed-loop control system is composed of input, PID controller, lithium battery transfer function and output. The critical proportion method is used to obtain PID controller parameters.

  2. (2)

    The second module is fuzzy PID control system. The single closed-loop control system is composed of input, membership function, fuzzy rule, PID controller, controlled object lithium battery transfer function and output, in which the fuzzy PID controller adopts double input and double output, and the input variable is the deviation and deviation change rate of the expected current/voltage and the actual current/voltage of the battery pack. In this paper, Gaussian function is selected as the membership function of the comparison experiment. And manually make 49 rules to control the input and output variables to achieve the optimal charging curve.

  3. (3)

    The third module is PSO optimization PID control system. The single closed-loop control system is composed of input, PID controller, controlled object lithium battery transfer function and output. Unlike PID controller, Matlab script program and Simulink model need to communicate with each other.simout module is used here for control.

  4. (4)

    The fourth module is optimized PID control system by improved particle swarm optimization algorithm designed in this paper. The single closed-loop control system consists of input, PID controller, controlled object lithium battery transfer function and output. Through the.simout module, the improved particle swarm optimization algorithm is used to select appropriate parameters, and the parameter values of the particle swarm optimization algorithm are improved through Matlab script debugging, thus constantly updating and iterating the values of \(K_{p} ,K_{i} ,K_{d}\). Finally, the local optimal solution and the global optimal solution are obtained, and the purpose of optimizing the charging curve is better.

Simulation results and analysis

Comparison of controller parameters

In this paper, under the condition that the controlled object, delay time, disturbance addition time, battery or voltage given values are consistent with the experimental conditions, the optimal output curve of the charging pile control system is obtained through continuous debugging of four controller parameters, among which four control parameters are as follows.

  1. (1)

    PID controller compares the actual value of current or voltage with the given value, passes the error signal to the input through single closed-loop feedback control, and continuously debuts the above steps through the critical proportion method, debuts the proportion coefficient first, increases or decreases the proportion coefficient value according to the oscillation degree of the output curve, then adjusts the integral coefficient and finally adjusts the differential coefficient. When the output curve of the control system reaches 4:1, the output is considered to be optimal, at which time \(K_{p} = 2,K_{i} = 0.5,K_{d} = 0.1\).

  2. (2)

    Fuzzy PID controller on the basis of PID algorithm, taking the error e and the error rate ec of current or voltage as input, using Gaussian membership function, formulate 49 fuzzy rules for fuzzy reasoning, to meet the requirements of the proportion, integral and differential parameters self-tuning of the e and ec at any time. The change curves of \(K_{p}\), \(K_{i}\) and \(K_{d}\) with input e and ec are shown in the Figs. 7, 8 and 9.

  3. (3)

    Particle swarm optimization PID controller.

Fig. 7
figure 7

\(K_{p}\) change curve

Fig. 8
figure 8

\(K_{i}\) change curve

Fig. 9
figure 9

\(K_{d}\) change curve

After the control system model is built in Simulink, the control program needs to be written in Matlab script, and the.simout module is connected with the model to realize adaptive adjustment of the scale, integral and differential parameters, and the optimization time is 605.833157 s. The parameter values of particle swarm optimization algorithm are shown in the Table 2.

Table 2 PSO parameters

Through continuous updating and iteration of particle swarm optimization algorithm, the optimal \(K_{p}\), \(K_{i}\) and \(K_{d}\) curves are obtained, as shown in the Figs. 10 and 11, and the optimal curves of the system are finally output.

Fig. 10
figure 10

PSO optimized PID optimal individual fitness value

Fig. 11
figure 11

PSO optimization PID \(K_{p}\), \(K_{i}\) and \(K_{d}\) optimization curve

  1. (4)

    Improved particle swarm optimization PID controller.

After the control system model is built in Simulink, the control program needs to be written in Matlab script program, and the. simout module is connected with the model to realize fast and accurate adjustment of the proportion, integral and differential parameters. The optimization time is 192.000188 s. The parameter values of particle swarm optimization algorithm are shown in the Table 3.

Table 3 IPSO parameter selection

Through continuous updating and iteration of particle swarm optimization algorithm, the optimal \(K_{p}\), \(K_{i}\) and \(K_{d}\) curves are obtained, as shown in the Figs. 12 and 13, and the optimal curves of the system are finally output.

Fig. 12
figure 12

IPSO optimization for PID optimal individual fitness value

Fig. 13
figure 13

Improved PSO optimization PID \(K_{p}\), \(K_{i}\) and \(K_{d}\) optimization curve

From the optimal individual fitness value of PSO optimized PID control system and improved PSO optimized PID control system and the optimization curves of \(K_{p}\), \(K_{i}\) and \(K_{d}\), it can be seen that the fitness value of PSO optimized PID controller decreases to about 20 after about 18 iterations, but it falls into local optimal solution in the subsequent iterations. In contrast, the improved particle swarm optimization algorithm proposed in this study can finally find the global optimal solution after several iterations, and the optimization time of the improved particle swarm optimization PID control algorithm is shorter than that of the particle swarm optimization algorithm, as shown in the Table 4. Therefore, the improved algorithm can meet the requirements of the charging pile control system. It is beneficial to improve the charging efficiency of electric vehicles, shorten the charging time and extend the service life of the battery.

Table 4 The optimization time of the two algorithms is compared

Therefore, the improved PSO PID controller designed in this paper, as the controller of the electric vehicle charging pile control system, can adjust the PID parameters quickly, accurately and adaptively, effectively shorten the charging time and improve the charging efficiency.

Comparison of controller response curves

In order to compare the control effects of the four control algorithms more intuitively, the four control algorithms are placed in the same graph for comparison. In the absence of disturbances in the control system, the simulation results of the current under the action of four controllers are shown in Fig. 14. when the given lithium battery charging current is 40A; When the given voltage is 100V, the voltage simulation results under the action of four controllers are shown in Fig. 15. It can be clearly seen from Figs. 9 and 10. that the response speed of the improved particle swarm optimization PID control system is 3.077 s faster than that of the particle swarm optimization PID control system, and the overshoot is reduced by 1.01%. It has the advantages of stronger stability, smaller overshoot, and faster convergence speed.

Fig. 14
figure 14

Simulation result of charging current under non-disturbance

Fig. 15
figure 15

Simulation result of charging voltage under non-disturbance

During the charging process of electric vehicles, external factors can cause fluctuations in battery charging current and voltage. Therefore, in this experiment, disturbances were added at 25 ℃. It can be seen from Figs. 16 and 17 that the improved particle swarm optimization PID control system has stronger anti-interference ability against external disturbances.

Fig. 16
figure 16

Add the simulation results of charging current under disturbance

Fig. 17
figure 17

Add the simulation results of charging voltage under disturbance

In the later stage of charging, considering the impact of battery power during the charging process of lithium batteries, in order to reduce the damage caused by excessive charging current to electric vehicle lithium batteries and ensure the service life of lithium batteries, the charging current of lithium batteries is reduced to 30 A at 25 °C. From Fig. 18, it can be concluded that the improved particle swarm optimization PID control system is more stable, with smaller overshoot and shorter convergence time.

Fig. 18
figure 18

The simulation result of reducing the charging current

Comparison of dynamic response effects of controllers

This study will compare the dynamic response effects of electric vehicle charging station control systems under traditional PID control, fuzzy PID control, particle swarm optimization PID control, and improved particle swarm optimization PID control, as shown in Table 5.

Table 5 Comparison of dynamic response effects of four controllers

So the improved particle swarm optimization PID controller designed in this study has better stability, faster convergence speed, and better anti-interference ability for the charging station control system.

Conclusion and prospect

Conclusion

Aiming at the problems such as slow charging speed, poor stability, low control accuracy and poor anti-interference ability in the control system of electric vehicle charging pile, this study combined with particle swarm optimization algorithm to optimize PID control. On the basis of particle swarm optimization algorithm, learning factor and compression factor were added to design an improved particle swarm optimization PID controller control system for electric vehicle charging pile. The simulation model was established in Matlab/Simulink, the PID program optimized by improved particle swarm optimization algorithm was written in Matlab script, the simulation module was connected with the script program, and the PID controller was optimized by comparing with PID controller, fuzzy PID controller and particle swarm optimization algorithm, and the system stability time was reduced to 14.349 s. The overshoot is reduced to 44.03, the disturbance recovery time is 8.350 s, and the search time of the improved PSO PID control algorithm is 413.832969 s shorter than that of PSO PID control algorithm. Therefore, the improved particle swarm optimization PID controller designed in this study has better stability, lower overshoot, faster convergence rate and better anti-interference ability for the charging pile control system. The system has strong adaptability and robustness, which can realize rapid and accurate adaptive adjustment of current and adapt to the constant current switching in multi-stage charging. It satisfies the purpose of close to the optimal charging curve of the battery and prolongs the service life of the battery when charging the electric vehicle with high current, and provides an effective method for efficient and fast charging in the future.

Prospect

  1. (1)

    This paper is only for the lithium battery research, the future battery materials will continue to progress and development, so if the battery material changes, then the controlled object is bound to change, so it is necessary to re-adjust the algorithm to control the changes of the battery and adapt to the development of The Times.

  2. (2)

    The current or voltage control time of the algorithm in this paper is reduced to about 3 min, achieving rapid, accurate and adaptive adjustment. Further exploration and research are needed to shorten the optimization time as far as possible in the future.