# Design and Control of a Battery Charger/Discharger Based on the Flyback Topology
## 6 Simulation Results
### Performance Evaluation  
The first test, reported in Figure 11, evaluates the correct operation of the charger/discharger concerning the ripple limits. Thus, the charger/discharger was set in the operating conditions defined for the design process (Table 1), with a bus current \(i_{dc}=1\) [A] and a reference \(v_{r}=48\) [V], which produces a duty cycle \(d=42.5\) [%], a switching frequency \(F_{sw}=25.3\) [kHz] and \(K_{i}=0.1067\) [A/V]. Therefore, the steady-state duty cycle is inside the acceptable range defined in Figure 7, and the switching frequency is lower than the maximum limit \(F_{sw,max}=30\) [kHz] defined in Table 1. The simulation reports a DC voltage ripple \(\delta v_{dc}=0.36\) [%] (top waveforms), which is lower than the maximum  
Figure 10: Circuital implementation of the battery charger/discharger in PSIM. acceptable ripple of 0.5 [%]; this is expected since the bus capacitor was defined as higher than the minimum limit reported in Figure 8. In addition, the current ripple in \(i_{m}\) is equal to the design value \(\delta i_{m}=5\) [A] imposed in Table 1 (second waveforms), this is expected since the magnetizing inductance of the selected Vitec HFT imposes that \(\delta i_{m}\) value as observed in Figure 6b. The simulation also confirms the stability of the SMC (third waveforms), since the switching function \(\Psi\) is always trapped inside the hysteresis band \([-0.5,+0.5]\), where \(\delta\Psi=0.5\) [A] was calculated at the end of Section 5.1. Finally, the control signal \(u\) is depicted at the bottom of the figure, which confirms the control law: \(u=1\) imposes a positive switching function derivative (\(\Psi\) increases), and \(u=0\) imposes a negative switching function derivative (\(\Psi\) decreases). The second test is performed to evaluate the reachability of the surface starting from outside of the hysteresis band. Figure 12 shows a first simulation in which the switching function starts above the hysteresis band (\(\Psi>+\delta\Psi\)), where the SMC follows the practical control law reported in (41): when \(\Psi=\Psi_{p}>+\delta\Psi\) the control signal is set to 0 (\(u=0\)), which imposes a negative derivative on the switching function (\(\frac{d\Psi}{dt}<0\)), forcing \(\Psi\) to enter in the hysteresis band \([-0.5,+0.5]\), keeping the switching function trapped into that band, which ensures global stability. A second simulation shows a similar behavior, but with the switching function starting below the hysteresis band (\(\Psi<-\delta\Psi\)). In this case, the control signal is set to 1 (\(u=1\)) to impose a positive derivative on the switching function (\(\frac{d\Psi}{dt}>0\)), forcing \(\Psi\) to enter in the hysteresis band, also keeping the switching function trapped into that band; this is in agreement with the SMC control law (41). Therefore, the simulations of Figure 12 confirm that the designed SMC fulfills the reachability conditions, since the charger/discharger is always controlled to enter into the sliding surface from any operation condition outside the surface, thus the system is always driven to stability. The third test is designed to evaluate the response of the charger/discharger to current derivatives on the DC bus surpassing the limit defined in Table 1. This condition can occur when a load connected to the bus experiments a failure leading to a short-circuit, thus requesting a large current step to the bus. Similarly, if a source experiments a sudden failure, thus will produce a step in current requested by the loads to the battery, since the current provided by the sources will be instantaneously reduced. Figure 13 presents a first simulation (left) in which the bus current changes with the design limit \(\frac{d_{dc}}{dt}\leq 50\) [A/ms],  
Figure 11: Steady-state operation for \(i_{dc}=1\) [A]. thus the switching function remains inside the hysteresis band.