Driving–Charging Integrated Controller for Electric Vehicles

Motor driving technology and battery charging technology are the two core technologies of electric vehicles (EVs). They have a profound impact on the performance and mileage of EVs. Based on the topology of a traditional EV motor controller, this study employs the time-sharing multiplexing insulated gate bipolar transistor (IGBT) power module form to expand the functions of the motor controller. This paper proposes an integrated driving–charging controller structure that enables the controller to realize the motor driving and on-board charging simultaneously. A decoupling analysis was performed at the topology level, mathematical models of two bidirectional converters in the integrated topology were established, and a reasonable control strategy for the double-closed-loop control system was designed. The simulation system was built in Simulink, and the simulation results verified the effectiveness of the system topology and control strategy. We made an integrated controller experimental platform based on TMS320F28335. A resistive load simulated the power battery to verify the charging mode, and a 5 kW permanent magnet synchronous motor (PMSM) was used to verify the driving mode. The experimental results demonstrated the driving–charging integrated controller’s feasibility for electric vehicles.


I. INTRODUCTION
Automotive market analysis shows that electric vehicle (EV) sales are forecasted to increase swiftly in the upcoming few years, growing from 3.1 million in 2020 to 14 million in 2025 [1], and the market share of EVs will be about 30% by 2030 [2]. EVs are often charged by on-board chargers (OBC). The structure of a common OBC is shown in Fig. 1. The front stage is an AC/DC converter to rectify AC power to DC power and power factor correction, and the rear stage is a DC/DC converter to convert DC power to a suitable voltage The associate editor coordinating the review of this manuscript and approving it for publication was Wei Xu .
to charge the battery. The OBC and the motor inverter are two indispensable cores in EVs. Since the charging and driving systems share quite a few elements, there is a trend of integrating the charging system into the inverter already present for driving the motor. An integrated controller significantly saves the EVs' internal space and increases the vehicle controller's power density.
The concept of the integrated controller was first proposed in [3] in 1985. In this reference, the motor's stator windings were used as the filter inductances, and the inverter was used as the rectifier when charging. However, the stator windings as the filter inductances produce pulsating torque. The topology used in this paper does not reuse the motor windings so that the motor does not produce pulsating torque. [4]- [7] used the control strategy to eliminate pulsating torque. However, these references all adopted single-phase charging. The efficiency of this charging method is low. [7] also lacked the PFC. In this paper, the bidirectional AC/DC converter has the function of PFC and supports the more considerable charging power due to the use of three-phase charging. The proposed studies realized integration by using the special motors (such as the multiphase motor [8]- [11], the switched reluctance motor [12], [13]) or by changing the internal structure of the motor (such as split winding [14]- [16], open winding motor [17]- [19]). These motors or motor structures are not widely used in EVs. The permanent magnet synchronous motor (PMSM) used in this paper is commonly used in electric vehicles. The controller of the special motors or motor structures needs more power electronic devices, which is contrary to the original intention of the integrated controller. Only eight insulated gate bipolar transistors (IGBTs) are used in the topology of this paper. The topologies of [20]- [22] lacked the bidirectional DC/DC converters to match the changed battery voltage. [23] introduced two kinds of bidirectional DC/DC converters used in OBC. However, these converters used more power devices, and the control strategies were complex. [24]- [26] respectively proposed three kinds of bidirectional DC/DC converters applied to the low-power charging of the EVs. In this paper, a bidirectional buck-boost converter is selected to realize the bidirectional energy flow of high power in a simple structure. This paper proposes a charging-driving integrated controller composed of the frontstage bidirectional AD/DC converter and the back-stage bidirectional DC/DC converter. A bidirectional converter control strategy suitable for general EVs is proposed based on the similarity in the mathematical modeling of the inverters and rectifiers. The advantage of this system is that it improves the utilization rate of the power devices, the energy storage elements, and sensors in the bidirectional converter, which is conducive to reducing the controller's volume and cost. In this paper, the experimental verification of this controller proves the effectiveness of the controller topology and control strategy. The paper is structured as follows. In Section II, the basic structure of the integrated controller is introduced, and the mathematical models of the bidirectional AD/DC converter and the bidirectional DC/DC converter are established. In Section III, the control strategies of the bidirectional AD/DC converter and the bidirectional DC/DC converter are proposed. In Section IV, the design of essential parameters is given. In Section V, the effectiveness of the controller is proved by simulation and experiment.

II. BASIC STRUCTURE AND MATHEMATICAL MODEL OF THE INTEGRATED CONTROLLER
To achieve more accurate and effective system control, it is necessary to deeply study the integrated controller's mathematical model and analyze the system's working characteristics in different modes.

A. BASIC STRUCTURE OF THE INTEGRATED CONTROLLER
The front stage is a bidirectional AC/DC converter, and the rear stage is a bidirectional DC/DC converter with a halfbridge structure. It can be divided into two modules based on different functions: an on-board charging module and a motor driving module. The system's overall structure is shown in Fig. 2, including PMSM, bidirectional AC/DC converter, bidirectional DC/DC converter, power battery, and energy storage elements.
In charging mode, energy flows from the grid to the power battery. The contactor K 1 is turned on, and the contactor K 2 is turned off. The grid voltage is rectified by the bidirectional AC/DC converter to output a stable bus voltage and then depressurized by the bidirectional DC/DC converter to charge the power battery in the constant voltage mode to ensure the energy reserve of the EV.
In driving mode, energy flows from the power battery to the PMSM. The contactor K 2 is turned on, the contactor K 1 is turned off, and the PMSM is connected to the main circuit. The DC output by the power battery is boosted to the set bus voltage through the bidirectional DC/DC converter and then inverted by the bidirectional AC/DC converter to obtain a three-phase AC to drive the motor. rectifier is established as follows: The mathematical model of the available voltage source PWM rectifier in the a-b-c coordinate system is derived as: Through the Clark and Park transformation matrix [27], (2) is transformed into the d-q coordinate system. Its mathematical model is: Define S i = 1 when the upper bridge arm is on, S i = 0 when the lower one is on, i=a, b, and c. Define u d0 = U dc S d and u q0 = U dc S q .

2) MATHEMATICAL MODEL OF PMSM
The equivalent circuit of the PMSM inverter is shown in Fig. 4. In the a-b-c coordinate system, the PMSM's stator voltage equation is: The flux linkage equation is: The voltage equation of PMSM in the synchronous rotating coordinate system [28] is: The electromagnetic torque is: C. MATHEMATICAL MODEL OF THE BIDIRECTIONAL DC/DC CONVERTER The bus voltage should be buck-regulated in the charging mode because of the significant voltage difference between the bus and the power battery. The power battery voltage should be boosted in the driving mode. Bidirectional DC/DC can realize the above functions. It adopts a half-bridge bidirectional buck-boost topology. The low-voltage side is connected to the power battery, and the high-voltage side is connected to the bus capacitor.

1) MATHEMATICAL MODEL OF BIDIRECTIONAL DC/DC CONVERTER IN BUCK MODE
The equivalent model of the buck circuit is shown in Fig. 5. In buck mode, S 1 needs to be controlled to work in the on-off state, S 2 is constantly turned off, and D 8 participates in freewheeling during the off period of S 1 . In buck mode, the highvoltage side can be equivalent to a DC voltage source, and the power battery on the low-voltage side can be equivalent to a load with back electromotive force [29], [30].
In the actual control system, the input voltage and load of the bidirectional DC/DC converter are usually non-constant quantities, including small-signal disturbances. Therefore, a dynamic mathematical model of the bidirectional DC/DC converter should be established to analyze the influence of the small-signal disturbance.
From the analysis in Fig. 5 above, it can be seen that in the interval [0, D 1 T s2 ], the inductor voltage and the low-voltage VOLUME 10, 2022 filter capacitor current are related as follows: In the interval [D 1 T s2 , T s2 ], the inductor voltage and the low-voltage filter capacitor current are related as follows: Combining (8) and (9) yields the equation of state within one switching cycle as follows: For the small-signal perturbation analysis of the circuit [31], the periodic variables in (10) are written in the form of a superposition of the stable DC component and the small-signal perturbation as follows: Substituting (11) into (10) and neglecting the stable DC component yields (12) as follows: The buck mode small-signal model is established based on (12), and the equivalent circuit is shown in Fig. 6.

2) MATHEMATICAL MODEL OF BIDIRECTIONAL DC/DC CONVERTER IN BUCK MODE
The equivalent model of the boost circuit is shown in Fig. 7. In boost mode, it is necessary to control S 2 to work in the onoff state, S 1 is constantly turned off, and D 1 participates in freewheeling during the off period of S 2 [9]. The high-voltage side can be equivalent to a resistive load in boost mode, and the power battery is equivalent to a voltage source. From the equivalent model analysis of the boost circuit in Fig. 7, it can be seen that in the interval [0, D 2 T s2 ], the inductor voltage and the bus capacitor current are related as follows: In the interval [D 2 T s2 , T s2 ], the inductor voltage and the bus capacitor current are related as follows: Combining (13) and (14) yields the equation of state within one switching cycle as follows: For the small-signal perturbation analysis of the circuit, the periodic variables in (15) are written in the form of a superposition of the stable DC component and the smallsignal perturbation as follows: Substituting (16) into (15) and neglecting the stable DC component yields (17) as follows: Based on (17), the small-signal model of boost mode is established, and the equivalent circuit is shown in Fig. 8.

III. CONTROL STRATEGY OF THE SYSTEM
The optimal control strategy is designed based on the mathematical model established and according to the different control methods of the two bidirectional converters. The relevant control signals of each module are sampled, and the sensors are multiplexed in different modes. By processing different feedback signals, corresponding control strategies are realized.

A. CONTROL STRATEGY IN CHARGING MODE
The control strategy block diagram of the charging mode is shown in Fig. 9. The AC/DC converter works in the rectification mode and adopts vector control. The three-phase currents i a , i b , and i c on the AC side of the bidirectional AC/DC converter are transformed to obtain currents i d0 and i q0 through coordinate transformation. The three-phase voltages e a , e b , and e c on the AC side and bus voltage U dc are sampled. After the phase-locked loop processes the three-phase voltage, the AC phase angle is provided for the coordinate transformation. The bus voltage U dc and the currents i d0 and i q0 implement a double-closed-loop control strategy with an outer voltage loop and an inner current loop. The output direct and quadrature axis voltage signals u d0 and u q0 are transformed to obtain u α0 and u β0 in the α −β coordinate system, which are used to synthesize the reference vector in the space vector pulse width modulation (SVPWM) and finally obtain the PWM signal to control the on-off of the switch tubes Q 1 -Q 6 , realize the rectification function and output a stable and adjustable DC voltage.
The DC/DC converter works in buck mode. The feedback signal of the voltage outer loop is the low-voltage side charging voltage. The PI controller adjusts the deviation between the feedback voltage and the given voltage signal to obtain the given current signal. The feedback of the current inner loop is the current flowing through the storage inductor. The PI controller adjusts the deviation between the feedback current and the given current signal to obtain a modulated wave. After the modulated wave is compared with the carrier wave, a PWM signal is generated to control the corresponding power switch tube. The step-down function can be realized when the system is stable.

1) CONTROL STRATEGY OF BIDIRECTIONAL AC/DC CONVERTER IN RECTIFICATION MODE
(3) is decoupled by feedforward to obtain the current controller equation for applying PI controller as: The sampling link is considered an inertial link with a transfer function of 1/(T s1 s + 1), and the modulation link is equated to an inertial link with a transfer function of K PWM /(0.5T s1 s+1). K PWM is the modulation equivalent gain. K PWM = 1 in ignoring the dead time.
Concerning the relationship between the control quantities in (18), a block diagram of the q-axis current loop structure is designed, as shown in Fig. 10. The transfer function of the PI controller is converted to a zero-pole expression as follows: The sampling delay link is combined with the PWM equivalent inertia link as K PWM /(1.5T s1 s + 1). The zeros of the PI controller are used to offset the poles of the transfer function of the current loop regulation object. The corrected current open-loop transfer function is obtained as: From (20), we can see that the system is a typical I -type system, and the best performance is obtained when the damping ratio is taken as 0.707. From this, it follows that: The PI control factor is obtained as: The Bode diagram is plotted as shown in Fig. 11. The phase margin of this system is more significant than zero, judging that the system is stable. The current closed-loop transfer function is: When the switching frequency is high enough, the coefficient of the s 2 term is much smaller than the coefficient of the s term. Neglecting the s 2 term, the closed-loop transfer function of the current loop can be simplified as follows: When the converter operates at unity power factor, the AC side currents i a , i b , and i c can be expressed as: where I m is the peak value of the current on the AC side, the current and the voltage are in the same phase.
By ignoring the DC load, the DC side current i dc can be expressed as: When the switching frequency of the system is sufficiently high, only considering the low-frequency components of the switching function can be obtained: where θ is the initial phase angle of the fundamental wave of the switching function and m is the modulation ratio (m 1).
Substitute (11) and (13) into (12) to obtain: Combined with (10) and (14), the structure of the designed voltage outer loop control system is shown in Fig. 12. The transfer function of the PI controller is converted to a zero-pole expression as follows: The sampling delay link is combined with the current loop equivalent inertia link as 1/(4T s1 s + 1). 0.75mcosθ ≈ 0.75. The voltage open-loop transfer function is: Design of voltage loop PI regulator using type II system. From this, it follows that: where h 0 = τ u0 /4T s1 is the voltage loop frequency width.
In general, h 0 = 5, which can be obtained by substituting (31) as follows: The voltage loop Bode diagram is plotted as shown in Fig. 13. The phase margin of this system is more significant than zero, judging that the system is stable.

2) CONTROL STRATEGY OF BIDIRECTIONAL DC/DC CONVERTER IN BUCK MODE
Laplace transforms on (12), and we get: In (33), there are five disturbance quantities. Let the smallsignal disturbance of the bus voltage be zero. The first two equations can be solved simultaneously. The transfer function between the duty cycle disturbance of the current inner loop and the current is: The transfer function between the duty cycle disturbance of the voltage outer loop and the battery charging voltage is: PI controllers are used for both the current and voltage loops. The PWM link is equated to an inertial link with a transfer function of 1/ (T s2 s+1). The feedback gain coefficient VOLUME 10, 2022  is taken as 1. The double-closed-loop control block diagram in buck mode is shown in Fig. 14.
The current open-loop transfer function is: The current loop is selected with crossing frequency f c1 = f s2 /10 and turning frequency f r1 = f c1 /10. The zero point of the PI regulator is set at the turning frequency. The loop gain at the crossing frequency is 1. From this, it follows that: The solution is K iP1 = 0.08 and K iI1 = 100. K iP1 and K iI1 are substituted into (36) to derive the current open-loop transfer function as: W oi1 (s) = 0.0012s 2 + 1639s + 2.06 × 10 6 2.25 × 10 −12 s 4 + 3.2 × 10 −6 s 3 + 0.125s 2 + s The current-loop Bode diagram is plotted as shown in Fig. 15. From the Fig. 15, it can be seen that the shear frequency ω c = 1.26 × 10 4 rad/s, phase margin γ = 67 • , and 20lg|GH| = −20lgK g < 0, K g > 1. The system is stable. The voltage open-loop transfer function is: The voltage loop is selected with crossing frequency f c2 = f c1 /10 and turning frequency f r2 = 10 Hz. The zero point of the PI regulator is set at the turning frequency. The loop gain at the crossing frequency is 1. From this, it follows that: The solution is K uP1 = 40 and K uI1 = 2491. K uP1 and K uI1 are substituted into (39) The voltage loop Bode diagram is plotted as shown in Fig. 16. The phase margin of this system is more significant than zero, judging that the system is stable.

B. CONTROL STRATEGY IN DRIVING MODE
The block diagram of the driving mode control strategy is shown in Fig. 17. The DC/DC converter works in boost mode. The feedback signal of the voltage outer loop is the DC bus voltage of the high voltage side. The deviation after the feedback voltage is compared to the given voltage signal outputted as a given current signal through the PI regulator. The feedback of the current inner loop is the current flowing through the energy storage inductor. The PI controller adjusts the deviation between the feedback current and the given current signal to obtain a modulated wave. After comparing the modulated wave with the carrier, a PWM signal is generated to control the corresponding power switch. When the system is stable, the boost function can be realized.
The AC/DC converter works in the driving mode and adopts the i d1 = 0 control strategy. The inverter link samples the three-phase currents i u , i v , and i w on the AC side of the bidirectional AC/DC converter to obtain the currents i d1 and i q1 through coordinate transformation. The relative position and speed of the rotor are obtained through the motor encoder. The relative position provides the phase angle for coordinate transformation calculations. The rotor speed and the current i d1 and i q1 implement the double-closed-loop control strategy of the speed outer loop and the current inner loop. The output direct and quadrature axis voltage signals u d1 and u q1 are transformed to obtain u α1 and u β1 in the two-phase static coordinate system, which is used to synthesize the reference vector in the SVPWM modulation, and finally obtain the PWM signal to control the on-off of the switch tubes Q 1 -Q 6 , realize the inverter function and output a three-phase AC to drive the motor.

1) CONTROL STRATEGY OF BIDIRECTIONAL DC/DC CONVERTER IN BOOST MODE
Laplace transforms on (17) yields: In (42), there are four disturbance quantities. If the smallsignal disturbance quantity of the vehicle power battery voltage is zero, it can be solved simultaneously. The transfer function between the duty cycle disturbance of the current inner loop and the current is: The transfer function between the duty cycle disturbance of the voltage outer loop and the voltage is: Combining (43) and (44) yields the double-closed-loop control block diagram for the boost mode, as shown in Fig. 18. The current open-loop transfer function is: The current loop is selected with crossing frequency f c1 = f s2 /10 and turning frequency f r1 = f c1 /10. The zero point of VOLUME 10, 2022 the PI regulator is set at the turning frequency. The loop gain at the crossing frequency is 1. From this, it follows that: The solution is K iP1 = 0.08 and K iI1 = 98.7. K iP1 and K iI1 are substituted into (45)  The current-loop Bode diagram is plotted as shown in Fig. 19. From the Fig. 19, it can be seen that the shear frequency ω c = 1.26 × 10 4 rad/s, phase margin γ = 66.8 • , and 20lg|GH| = −20lgK g < 0, K g > 1. The system is stable.
The voltage open-loop transfer function is: The voltage loop is selected with crossing frequency f c2 = f c1 /10 and turning frequency f r2 = 10 Hz. The zero point of the PI regulator is set at the turning frequency. The loop gain at the crossing frequency is 1. From this, it follows that: The solution is K uP1 = 1.  The voltage loop Bode diagram is plotted as shown in Fig. 20. The phase margin of this system is more significant than zero, judging that the system is stable.

2) CONTROL STRATEGY OF BIDIRECTIONAL AC/DC CONVERTER IN INVERTER MODE
(6) is decoupled by feedforward to obtain the current controller equation for applying PI controller as: Using the q-axis as an example to design the current circuit, the effect of the motor's back-electric potential is not guaranteed. Clearly, from the above equations, the transfer function from voltage to current is: The sampling link is considered an inertial link with a transfer function of 1/(T s1 s + 1), and the modulation link is equated to an inertial link with a transfer function of K PWM /(0.5T s1 s+1). K PWM is the modulation equivalent gain. K PWM = 1 in ignoring the dead time. Concerning the relationship between the control quantities in (51), a block diagram of the q-axis current loop structure is designed, as shown in Fig. 21.
The transfer function of the PI controller is converted to a zero-pole expression as follows: The sampling delay link is combined with the PWM equivalent inertia link as K PWM /(1.5T s1 s + 1). The zeros of the PI controller are used to offset the poles of the transfer function of the current loop regulation object. The corrected current open-loop transfer function is obtained as: From (54), we can see that the system is a typical I-type system, and the best performance is obtained when the damping ratio is taken as 0.707. From this, it follows that: The PI control factor is obtained as: The Bode diagram is plotted as shown in Fig. 22. The phase margin of this system is more significant than zero, judging that the system is stable. The current closed-loop transfer function is: When the switching frequency is high enough, the coefficient of the s 2 term is much smaller than the coefficient of the s term. Neglecting the s 2 term, the closed-loop transfer function of the current loop can be simplified as follows: In Fig. 22, the sampling link is an inertia link whose transfer function is 1/(T s1 s + 1). The SVPWM modulation link is equivalent to a small inertia link K PWM /(0.5T s1 s + 1), where K PWM is the equivalent gain of SVPWM modulation. K i is the current feedback gain.
When i d1 = 0, the relationship between the quadrature axis current and the electromagnetic torque can be obtained from (7) as follows: From the speed equation and the relationship between speed and torque, the relationship between speed, electromagnetic torque, and load torque can be obtained as: Considering (58) and (60), the block diagram of speed outer loop control is obtained, as shown in Fig. 23. The transfer function of the PI controller is converted to a zero-pole expression as follows: The sampling delay link is combined with the current loop equivalent inertia link as 1/(4T s1 s + 1). K n = T em /i q1 = 3p n d /2. The motor speed open-loop transfer function is: Design of speed loop PI regulator using type II system. From this, it follows that: where h 1 = τ n /4T s1 is the voltage loop frequency width. In general, h 1 = 5, which can be obtained by substituting (63) as follows: The motor speed loop Bode diagram is plotted as shown in Fig. 24. The phase margin of this system is more significant than zero, judging that the system is stable.

IV. PARAMETER CALCULATION OF ENERGY STORAGE ELEMENT
In the integrated controller design, some energy storage elements in the power circuit are also multiplexed in different modes, such as the energy storage inductance in bidirectional DC/DC converter and the bus capacitance in bidirectional AC/DC converter. Therefore, for the parameter design of the multiplexing element, the hardware requirements in the two modes should be considered. The integrated controller design indicators are shown in Table 1.

A. BUS CAPACITANCE ON HIGH VOLTAGE SIDE
The lower limit of the bus capacitance value is mainly based on the working conditions in the driving mode. When the bidirectional converter works in a higher power mode, the bus filter capacitor can still act as buffering energy and stabilize the voltage.
The energy that the bus capacitor can supply in one switching cycle is where P max is the maximum variation of the load power in one switching cycle; U dc is the pulsating bus voltage, and the pulsation rate is set to 5%. By substituting (66) into (65), we get: The bus filter capacitor should meet: The peak power P max = 10 kW. Substitute into (68) to calculate the lower limit of the bus capacitance: C dc ≥ 31.3 µF.
The calculation of the upper limit of the bus capacitor value is mainly to meet the fast follow-up of the outer voltage loop DC voltage in the charging mode. When the integrated controller works in the charging mode, the grid is connected to the circuit as an input, and the PWM control has not been performed, the controller can be equivalent to an uncontrolled rectifier bridge. The DC side voltage at this time is the minimum value in the charging mode, and its average value U dc_er is where U I is the practical value of the input line voltage of the AC side of the bidirectional DC/AC converter in the charging mode.
When the bidirectional DC/AC converter works stably, the DC voltage output is a given value, as follows: where P 0 is the rated output power. When the output voltage does not reach the given voltage, the DC side will charge the bus capacitor with the maximum current I d_max . Meanwhile, the output voltage rises at the fastest speed. This process can be expressed as: The charging time t can be calculated as: In order to meet the tracking performance of the output voltage, the voltage rise time should be less than the maximum inertia time constant of the converter. Thus, we can obtain: Because U dc > U dc_er , ln VOLUME 10, 2022 The maximum charging current I d_max = 1.2U dc /R L in practical engineering applications is usually taken. Therefore, (74) can be simplified as: Normally, T i_max = 20 ms and R L = 10 . The DC side capacitance value range can be obtained as follows: 31 µF ≤ C dc ≤ 1700 µF. Finally, the bus capacitance is selected as 1000 µF.

B. ENERGY STORAGE INDUCTANCE ON LOW VOLTAGE SIDE
The design of the energy storage inductor should consider the size of the output current ripple and the dynamic response speed of the system. Consequently, it is also necessary to ensure that the bidirectional DC/DC converter satisfies the continuity of the current when the energy flows in different directions.
When the bidirectional DC/DC converter is in boost mode, the critical value of the inductance when the current is continuous is: When the bidirectional DC/DC converter is in buck mode, the critical value of the inductance when the current is continuous is: where I omin is the critical continuous load current. The peak discharge current of the power battery in the driving mode is I o1 = P/E = 42 A, and the peak charging current of the power battery in the charging mode is I o2 = 20 A. With 10% of the maximum output current guaranteed, the output inductor current should remain continuous. The continuous critical load current I omin1 = 4.2 A, I omin2 = 2 A, and the inductance L ≥ 1.2 mH are calculated. The final selected inductance value is 3 mH.

C. FILTER CAPACITORS ON LOW VOLTAGE SIDE
The low-voltage side filter capacitor's design is mainly considered the design of the low-voltage output side filter capacitor in the buck mode of the bidirectional DC/DC converter.
When the bidirectional DC/DC converter works in buck mode, the variation of the inductor current is: i L1 is the sum of the capacitor current i c and the variation of the load current i o .
If i o = 0, the change in the inductor current is the change in the capacitor current. Assuming that the capacitor is fully charged within the time interval of (T on + T off )/2 = T s2 /2, the average current of the filter capacitor charging is: The peak ripple voltage of the filter capacitor is: (80) Based on the system requirements, the maximum ripple factor of the charging voltage should not exceed 1%, which can be obtained from The size of the filter capacitor C sc is obtained as: Finally, select the DC low-voltage side filter capacitor C sc = 30 µF.

V. SIMULATION ANALYSIS AND EXPERIMENTAL VERIFICATION
The simulation model can be divided into two types of circuits: power and control. The power circuit includes a grid, a bidirectional AC/DC converter, a bidirectional DC/DC converter, a PMSM, and a battery.
Step signals control the switching of the two modes.
The control circuit section includes sampling (motor stator current i a , i b and i c , motor mechanical angle θ, motor angular speed ω m , torque T e , and grid voltage e a , e b and e c ), coordinate transformation (i a , i b and i c transformed into i d and i q , u a , u b and u c transformed into u d and u q , and u d and u q transformed into u α and u β ), PI controller (current loop, voltage loop, and speed loop), and SVPWM modulation (u α and u β modulated as PWM signal). The three signal selector switches were controlled to process different control signals in different modes by inputting digital 0 or 1. Two of them were the signals obtained from the power circuit sampling, the three-phase current, and the phase angle sampled from the AC side of the bidirectional AC/DC converter. The other one was the vector synthesis signal of space voltage, and finally, the PWM pulses were output by SVPWM modulation to control the three-phase bridge topology to work in inverter or rectifier mode. The integrated system simulation model is shown in Fig. 25.
Parameters of bidirectional AC/DC controller were set as listed in Table 2.
Parameters of bidirectional DC/DC controller were set as listed in Table 3.
The parameters of the battery model were set as listed in Table 4.
Parameters of the PMSM model were set as listed in Table 5.
The control system experimental platform was built based on the simulation, as shown in (Fig 26). It mainly includes a power circuit board, a driver board, a control board, a 5 kW    PMSM, an electronic load, and a DC power source. The main control chip, TMS320F28335, is located on the control board. Electronic load and DC power source are used to replace the function of batteries. TMS320F28335 is chosen as the master chip due to its powerful performance and the fact that it comes with ADC module, EPWM module and EQEP module. The structure of DSP28335 is shown in Fig. 27. The sampled twelve voltage and current signals entered the ADC module of the DSP for processing. The sampled motor speed signal entered the EQEP module of the DSP for processing. The calculated PWM drive signal was output through the EPWM module of the DSP. In order to protect the DSP, it is necessary to add a sample conditioning circuit and an optocoupler technology in the PWM driver circuit to isolate the high-power circuit from the low power circuit.

A. SIMULATION ANALYSIS AND EXPERIMENTAL VERIFICATION IN CHARGING MODE
The grid phase voltage has a root mean square (RMS) value of 170 V and a frequency of 50 Hz in the charging mode. After PWM rectification, a bus voltage of 400 V was output, which was stepped down to 240 V through a buck converter to charge the battery. Fig. 28 showed the pulse widths of the drive waveforms of the two IGBTs of the A-phase bridge arm   in the experiment. The two PWM pulses were complementary outputs with an amplitude of 3 V and a dead time of 3 µs.
The simulations in Fig. 29 and Fig. 30 showed that the DC bus voltage eventually stabilized at 400V, and the charging voltage eventually stabilized at 236.6 V. The SOC of the battery raised steadily, and the stable charging current was about 8 A. When the bus voltage was low, the battery discharged briefly. The experimental results in Fig. 31 showed that U dc was stable at 400V and U sc at 230 V.  The simulated and experimental waveforms of the voltage and current of phase A of the grid are shown in Fig. 32 and Fig. 33. The peak voltage reaches 240 V, the peak current is 10 A, the frequency is 50 Hz, the voltage and current are at the same frequency and phase, and the power factor of the rectifier circuit is 1.

B. SIMULATION ANALYSIS AND EXPERIMENTAL VERIFICATION IN DRIVING MODE
The motor speed was given as 1000 r/min in the drive mode, and a load torque of 10 N · m was suddenly applied to the motor. The simulation process of battery discharging is shown in Fig. 34. After the bus voltage was stabilized, the battery VOLUME 10, 2022    started to discharge. After adding the load torque, the SOC of the battery decreased rapidly. The discharge current increased and finally stabilized at 20 A. The discharge voltage increased and finally stabilized at approximately 238.6 V.      35 shows the three-phase currents during the simulation. In the experiment, when the motor is stabilized, and a load torque of 10 N · m is applied, the peak U-phase current increases from 1.5 A to about 7.5 A, as shown in Fig. 36.   The simulation results and experimental results for increasing torque are shown in Fig. 37 and Fig. 38. Fig. 39 and Fig. 40 show the simulation results and experimental results of the motor's direct and quadrature axis currents. In the experiments, after adding the load torque, the straight axis component of the current was 0 A, and the quadrature axis component gradually increased and finally stabilized at about 7.5 A.
The motor speed was set to 1000 r/min. The main feedback quantities of the speed loop were the rotor position angle and speed. The simulation results are shown in Fig. 41 and Fig. 43. When the motor was running steadily without a load, it took 60 ms for the rotor position angle of the motor to rotate one revolution. The experimental result is shown in Fig. 42. After a load torque of 10 N · m was applied, the speed dropped to   about 900 r/min, and the speed adjustment time was about 2 s. The experimental results are shown in Fig. 44.

VI. CONCLUSION
In this study, an integrated controller for the driving and charging of electric vehicles was developed based on circuit topology proposal, mathematical model establishment, control strategy design, and result analysis. The main conclusions are as follows: 1) The driving-charging integrated controller can reduce the volume and weight of the electric vehicle on-board controller by multiplexing the power device of the bidirectional converter, the energy storage element in the circuit, the sampling device, and some hardware circuits. VOLUME 10, 2022  2) The equivalent mathematical models of the bidirectional DC/DC and bidirectional AC/DC converters in different working modes are similar. Regardless of the state (boost, inverter, rectification, or buck state), the energy flow is always the opposite, and the equivalent circuit of the topology is significantly close. 3) In the two working modes, for the double-closed-loop controller design of the bidirectional AC/DC converter, the design of the current inner loop PI regulator is significantly similar, but the outer loop control variables are designed as speed and voltage. For the design of the control loop of the bidirectional DC/DC converter, the difference in different modes is substantially negligible. The simulation model of the control system results shows that the design method proposed in this paper is feasible. 4) Experiments showed that the system could operate normally under no-load and light-load conditions in the driving mode. The battery was simulated with a resistive load in charging mode, and the bidirectional DC/DC circuit also usually worked. The experiment verified that the integrated system could run stably and reliably.