Next Article in Journal
Stability and Local Bifurcations of a Discrete Predator–Prey System with Allee Effect and Holling-IV Functional Response
Previous Article in Journal
Positive Solutions of a Fifth-Order Boundary Value Problem for Couple-Stress Porous-Channel Flow
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Hybrid Index Matrix Framework for Python-Based Modeling, Simulation, and Local One-Step Sensitivity Diagnostics of Bidirectional DC–DC Converters

1
CoE “National Center of Mechatronics and Clean Technologies”, 1000 Sofia, Bulgaria
2
Department of Intelligent Technology in Industry, Faculty of Computer Systems and Technologies, Technical University of Sofia, 1000 Sofia, Bulgaria
3
Department of Computer Systems, Faculty of Computer Systems and Technologies, Technical University of Sofia, 1000 Sofia, Bulgaria
4
Department of Telecommunications, University of Telecommunications and Posts, 1700 Sofia, Bulgaria
*
Author to whom correspondence should be addressed.
Mathematics 2026, 14(17), 3197; https://doi.org/10.3390/math14173197
Submission received: 31 July 2026 / Revised: 20 August 2026 / Accepted: 22 August 2026 / Published: 4 September 2026

Abstract

Bidirectional DC–DC converters are key interfaces in battery energy storage systems, electric vehicles, fuel cell vehicles, and DC microgrids, where transparent mathematical models are required for simulation, controller evaluation, and energy-flow analysis. This paper presents a hybrid index matrix framework for the Python-based modeling of a bidirectional buck–boost converter coupled to a first-order Thevenin battery model. In contrast to a classical state-space formulation, the index matrix is used as a label-aware model-assembly layer: component equations are aligned by explicit row and column identifiers and subsequently projected into ordered numerical matrices for solution. Charging, idle, and discharging equations are solved using a fixed-step backward-Euler procedure, and a PI current controller with duty-cycle saturation and anti-windup regulates the power-flow direction. A conventional switched ODE implementation is retained only as a software-level numerical-consistency check between two implementations of the same assumptions; it is not presented as experimental validation or as an independent physical benchmark. For the reported 60 s current profile, the model gives a current RMSE of 0.0863 A and a peak current of 4.3684 A, corresponding to 9.2094% overshoot at the idle-to-discharge transition. The power-integration balance is 1.6091 Wh input, 1.5868 Wh output, and 0.0223 Wh estimated loss under the adopted conduction-oriented loss model. The conditional one-step sensitivity matrices have a spectral radius of 1.00000 in all three modes; the unit eigenvalue is consistent with the slowly varying SOC state, while the remaining electrical eigenvalues lie inside the unit circle. These eigenvalue results are interpreted as local non-divergence diagnostics rather than proof of asymptotic closed-loop or switched-system stability. The framework provides a transparent and reproducible numerical workflow, while experimental validation, detailed switching-level loss modeling, step-size convergence, and formal closed-loop/switched-system stability analysis remain necessary future work.

1. Introduction

The increasing integration of renewable energy sources, battery energy storage systems, electric vehicles, including fuel cell vehicles, and DC microgrids has intensified the need for efficient and flexible power electronic interfaces [1,2,3,4,5,6]. In fuel-cell and hybrid-electric-vehicle architectures, DC–DC converters are commonly required to interface fuel-cell stacks, batteries, supercapacitors, and DC-link buses under variable power-flow conditions. Bidirectional DC–DC converters are essential components in these systems because they enable controlled energy exchange between batteries, DC buses, supercapacitors, renewable generators, and electrical loads [7,8,9]. Depending on the operating requirements, such converters must support battery charging, battery discharging, voltage regulation, current limitation, idle operation, and reversal of the power-flow direction [10,11]. Their design therefore requires mathematical and computational models capable of representing operating modes, non-ideal electrical components, battery dynamics, control functions, and operating constraints within a unified framework [12,13].
Power electronic converters are commonly modeled using switched differential equations, state-space representations, averaged models, or detailed circuit-oriented simulation environments [14,15]. Switched differential models provide a physically interpretable description of the converter but require a separate equation set for each switching configuration [16]. Their formulation becomes increasingly complex when semiconductor non-idealities, parasitic component parameters, battery dynamics, and digital controllers are considered simultaneously [17,18]. State-space models offer a compact representation suitable for control-system analysis; however, the system matrices are topology-dependent and must generally be derived for every operating mode [19,20]. Averaged models reduce the computational burden and are widely applied in controller design, but they do not resolve individual switching events, discontinuous-conduction effects, or high-frequency parasitic phenomena [21,22].
Detailed circuit simulation tools provide comprehensive component libraries and numerical solvers, but repeated simulations may require considerable computational resources [23,24]. This limitation becomes particularly important in model-based design, where large parameter spaces must be explored, and thousands of simulations may be required for controller tuning, sensitivity studies, multi-objective optimization, and uncertainty analysis [25,26]. A suitable modeling framework should therefore combine physical interpretability, computational efficiency, automated model assembly, and compatibility with numerical optimization and stability-analysis tools.
Recent bidirectional converter studies cover wide-bandgap devices, battery emulation, V2G interfaces, energy-management strategies, multiport structures, and controller design for topology-specific applications [27,28,29,30,31,32,33,34,35,36,37,38]. These studies underscore that converter equations, controller states, and parameter sets are commonly tailored to a particular circuit and operating regime. Matrix-based and model-depth investigations further show that the choice of representation affects transparency, computational burden, and suitability for repeated analysis [39,40]. The present work addresses a narrower methodological question: how component and mode equations can be assembled through explicit labels before projection into the ordered matrices required by conventional numerical solvers.
Index matrices extend the functionality of classical matrices by assigning explicit indices to rows and columns. These indices may represent electrical variables, component identifiers, circuit equations, discrete control signals, or operating modes [41,42]. As a result, component equations can be combined according to their physical meaning without requiring a fixed global ordering of the variables. Index matrices with real-valued elements have previously been used to describe resistors, inductors, capacitors, voltage sources, semiconductor switches, electrical nodes, circuit loops, and control blocks within a common discrete-time formulation [43,44].
Earlier work demonstrated software-oriented assembly of power-electronic component, interconnection, and controller equations through real-valued index matrices [43]. The resulting systems are converted to ordered algebraic equations and solved at consecutive time instants, providing a reusable model-construction layer for several converter structures.
A subsequent study applied the approach to a buck DC–DC converter with non-ideal components and a proportional–integral controller and coupled the model to repeated parameter-space calculations [44]. That study remained unidirectional and considered a more limited set of operating modes; the present work extends the formulation to a battery-coupled bidirectional case.
Bidirectional converters introduce additional mathematical and computational challenges. Their operating topology changes not only according to the instantaneous semiconductor switching signals but also according to the required direction of power transfer. The converter may operate in charging, discharging, freewheeling, idle, or transitional states. Some theoretical switching combinations may be physically inadmissible because they can produce shoot-through conditions, uncontrolled current paths, or electrical configurations that violate the operating constraints. A systematic procedure is therefore required to generate the possible switching modes, determine their corresponding mathematical models, and exclude invalid configurations before the simulation is performed.
The presence of a battery introduces further dynamic states. The battery terminal voltage cannot generally be represented by an ideal constant voltage source because it depends on the state of charge, current direction, internal resistance, polarization effects, temperature, and operating history. Even when a first-order equivalent-circuit model is employed, its dynamic equations must be coupled with the converter inductor current, DC-link voltage, switching state, and control variables. This coupling converts the complete system into a hybrid dynamical model containing both continuous electrical quantities and discrete operating decisions.
Hybrid converter systems are often represented by a family of mode-dependent state-space equations. Although this representation is appropriate for numerical solution and control analysis, manual derivation and reordering become labor-intensive when the power stage, battery, supervisory logic, and digital controller are developed as separate model blocks. This fragmented treatment also increases the risk of inconsistent variable ordering and sign conventions across charging, idle, and discharging modes.
The index matrix approach used in this work does not replace classical state-space analysis. Its role is to provide a label-aware assembly layer in which rows identify equations and columns identify physical variables, states, inputs, or constants. Component equations are first combined by these symbolic identifiers; the assembled indexed system is then projected into an ordered classical matrix for solution with standard numerical linear-algebra routines. The incremental contribution is therefore the reproducible assembly and management of the multi-mode converter–battery–controller model, rather than a new state-space stability theorem.
Local dynamic behavior is examined through a one-step finite-difference matrix at representative fixed-mode operating points. Because this diagnostic is local and the controller integral memory is not included as an independent state in the reported four-state vector, its eigenvalues must not be interpreted as a complete closed-loop or switched-system stability proof. A formal assessment would require an augmented closed-loop state, operating-point coverage, switching-sequence analysis, and, where appropriate, Lyapunov-based arguments.
Component tolerances and operating uncertainty remain important for hardware-oriented design. However, the present paper evaluates a nominal parameter set only. Sensitivity, uncertainty, and robust multi-objective optimization are therefore identified as follow-up studies rather than presented as completed contributions.
Python provides an open environment for the proposed workflow. NumPy is used for indexed-array operations and linear-system solution, pandas for data export, and matplotlib for visualization. The present implementation is intentionally limited to model assembly, fixed-step simulation, post-processing, and local one-step diagnostics; optimization and convex stability tools are not required for the results reported here.
In the present study, a custom index matrix data structure stores explicit row and column identifiers together with the corresponding numerical coefficients. The implemented workflow supports label-consistent addition, projection, conversion to an ordered classical matrix, and fixed-step solution of the mode-dependent algebraic systems. Reusable component-level models are provided for the inductor, capacitor, source, simplified semiconductor switches, electrical interconnections, first-order Thevenin battery, supervisory logic, and PI controller. The same workflow performs metric extraction, energy-flow post-processing, data export, and local one-step finite-difference diagnostics.
The reference switched ODE implementation is used only as a software-level numerical-consistency check. It represents the same converter, battery, controller, mode logic, and sign conventions in conventional differential-equation form. Agreement can reveal coding or assembly inconsistencies between the two implementations, but it cannot establish physical accuracy because both descriptions share the same modeling assumptions.
Accordingly, the study focuses on label-aware model assembly, Python-based fixed-step simulation, performance-metric evaluation, conduction-oriented energy accounting, and conditional one-step diagnostics for three fixed operating modes. Experimental validation, comparison with detailed switching-level software, step-size convergence, uncertainty analysis, robust optimization, and formal switched-system stability are outside the present scope and are stated explicitly as future work.
Despite previous applications of index matrices to power-electronic systems, several gaps motivate the present work. First, the extension from a unidirectional converter to a battery-coupled bidirectional structure requires explicit handling of charging, idle, and discharging operation. Second, converter, battery, controller, and supervisory equations must be assembled without relying on a fragile global variable order. Third, the relationship between the indexed assembly and the downstream ordered numerical matrices must be made explicit. Fourth, the limits of a local one-step finite-difference diagnostic must be reported transparently. Finally, a compact Python workflow integrating these elements has not been demonstrated sufficiently for the considered bidirectional case.
The objective of this study is therefore to develop a Python-based hybrid index matrix framework for the unified assembly and simulation of a bidirectional DC–DC converter connected to a battery energy storage system. The framework combines the power converter, non-ideal passive components, simplified switch constraints, battery dynamics, digital current controller, and supervisory mode-selection logic in a common indexed representation. Mode-dependent systems are generated for charging, idle, and discharging operation and solved with a fixed-step implicit procedure. The resulting data are used to evaluate current tracking, DC-link voltage deviation, power flow, physically scaled SOC evolution, conduction-oriented energy accounting, and conditional one-step sensitivity diagnostics.
Compared with previous index matrix studies focused mainly on unidirectional converter structures, the present work advances the methodology in six specific ways. First, charging, idle, and discharging modes are represented within one indexed computational structure. Second, a first-order Thevenin battery model is coupled to the converter through indexed state variables, including open-circuit voltage, ohmic drop, polarization dynamics, and SOC evolution. Third, supervisory mode selection is based on the current-reference sign and SOC limits. Fourth, a mode-dependent coefficient enforces a consistent bidirectional current sign convention. Fifth, the assembly rule distinguishes a genuinely absent coefficient from a conflicting duplicate row–column label. Sixth, the Python workflow integrates fixed-step solution, PI current control, quantitative metrics, energy post-processing, and a clearly delimited one-step finite-difference diagnostic. Thus, the index matrix acts as a label-aware assembly mechanism, whereas classical ordered matrices remain the downstream representation used by conventional solvers and eigenvalue routines.
The main contributions of this study are summarized as follows:
  • A hybrid index matrix model is developed for a bidirectional buck–boost DC–DC converter connected to a battery energy storage system, covering charging, idle, and discharging operation.
  • A first-order Thevenin battery model is integrated into the indexed formulation, including open-circuit voltage, ohmic resistance, polarization dynamics, SOC evolution, and charge/discharge efficiencies.
  • A label-aware Python procedure assembles the mode-dependent equation systems by symbolic row and column identifiers and projects them into ordered numerical matrices for fixed-step solution.
  • Supervisory logic selects charging, idle, or discharging according to the current-reference sign and SOC limits, while a mode coefficient enforces a consistent bidirectional current convention.
  • A PI current controller with duty-cycle saturation and anti-windup is incorporated to regulate the current magnitude in both power-flow directions.
  • The deterministic simulation is quantified using current-error metrics, DC-link deviation, physically scaled SOC, power integration, and conduction-oriented loss indicators.
  • A conditional one-step finite-difference diagnostic is constructed for representative charging, idle, and discharging operating points. The resulting matrices, eigenvalues, and spectral radii are reported as local sensitivity indicators, not as proof of asymptotic closed-loop or switched-system stability.
  • The complete workflow exports numerical data and publication-oriented figures without requiring proprietary power-electronics simulation software.

2. Mathematical Framework and Numerical Formulation

2.1. Real-Valued Index Matrix Representation

In a conventional matrix, the interpretation of each element depends on its numerical position. In an index matrix, every row and column is associated with an explicit symbolic index. Each real-valued index matrix is defined by
F = R F , C F , a F , a F :   R F × C F .
Here, R F and C F are the row- and column-index sets, respectively, and a F :   R F × C F maps each indexed pair ( r , c ) to a real coefficient. For the ordered index tuples
R F = ( r 1 , r 2 , , r m ) , C F = ( c 1 , c 2 , , c n ) .
The corresponding coefficient array is defined by
[ A F ] i j = a F ( r i , c j ) , i = 1 , , m , j = 1 , , n .
In the present paper, each row index represents an equation, whereas each column index identifies a physical variable, state quantity, control signal, or constant term. This enables the electrical-component, circuit-constraint, battery, and controller equations to be assembled according to physical meaning. For example, i L , k denotes the inductor current at the current time step, while i L , k 1 denotes its value at the preceding step. The active operating mode can therefore be changed without manually reordering the matrices.

2.2. Index Matrix Addition

Let two index matrices be given by
F 1 = R F 1 , C F 1 , a F 1 , F 2 = R F 2 , C F 2 , a F 2 .
Their addition is denoted by
F = R F , C F , a F = F 1 F 2 .
with resulting row- and column-index sets
R F = R F 1 R F 2 , C F = C F 1 C F 2 .
For arbitrary r R F and c C F , let a F ν 0 ( r , c ) equal a F ν ( r , c ) when the key ( r , c ) exists in F ν and equal zero otherwise. The resulting coefficient is
a F ( r , c ) = a F 1 0 ( r , c ) + a F 2 0 ( r , c ) , r R F , | c C F .
An absent coefficient is assigned the value zero only after the symbolic row and column identifiers have been matched. Index matrix addition therefore does not rely on numerical position, and no positional shifting of terms is permitted.
During assembly, each coefficient is addressed by the key (row label, column label). A missing key is initialized to zero. Contributions assigned to an existing key may be accumulated only when they refer to the same physical equation and the same physical variable with compatible units and sign conventions; otherwise, the assembly is classified as a conflict and the model construction must stop rather than silently combine the terms.
This rule is applied when component-level equations for inductors, capacitors, sources, switches, battery elements, electrical nodes, loops, and control blocks are combined. Unique equation labels and consistent variable labels are therefore prerequisites for model assembly. The rule prevents unintended merging of unrelated quantities and addresses row/column mismatch at assembly time.
Index matrix addition is consequently a label-consistent assembly operation, not a blind numerical sum. The zero convention applies only to genuinely absent terms in otherwise compatible indexed equations.

2.3. Projection and Conversion to a Classical Matrix

Before numerical solution, the assembled index matrix is projected onto selected sets of equations and unknown variables to a classical matrix:
F P = proj ( F , R P , C P ) = proj ( R F , C F , a F , R P , C P ) .
Here
R P = ( r 1 , r 2 , , r v ) , C P = ( c 1 , c 2 , , c w ) .
are ordered index sets under condition
{ r 1 , r 2 , , r v } R F , { c 1 , c 2 , , c w } C F .
The corresponding classical numerical matrix is
A = [ a F ( r 1 , c 1 ) a F ( r 1 , c 2 ) a F ( r 1 , c w ) a F ( r 2 , c 1 ) a F ( r 2 , c 2 ) a F ( r 2 , c w ) a F ( r v , c 1 ) a F ( r v , c 2 ) a F ( r v , c w ) ] .
Thus, symbolic indices are retained during model construction, whereas conventional numerical linear-algebra routines are employed during the solution stage.

2.4. Discrete-Time Formulation

The proposed model is formulated in discrete time using a constant integration interval:
Δ t = t k t k 1 > 0 , Δ t = constant .
The dynamic component equations are discretized by the backward Euler method:
d x ( t ) d t | t = t k x k x k 1 Δ t .
This implicit approximation converts the differential equations into algebraic equations that are solved at every simulation step.

2.5. Inductor Model

For an inductor with inductance L and series resistance R L , the continuous-time equation is
u L ( t ) = L d i L ( t ) d t + R L i L ( t ) .
After applying the backward Euler approximation,
u L , k = L Δ t ( i L , k i L , k 1 ) + R L i L , k .
An algebraic equation included in the index matrix is
u L , k + ( L Δ t + R L ) i L , k L Δ t i L , k 1 = 0 .
and its corresponding index matrix is
( a L ( e L , u L , k ) , a L ( e L , i L , k ) , a L ( e L , i L , k 1 ) ) = ( 1 , L Δ t + R L , L Δ t ) .

2.6. Capacitor Model

For a capacitor with capacitance C and equivalent series resistance R C , the terminal voltage is
u C ( t ) = u C , 0 ( t ) + R C i C ( t ) .
where the ideal capacitor current is
i C ( t ) = C d u C , 0 ( t ) d t .
After discretization,
i C , k = C Δ t [ ( u C , k u C , k 1 ) R C ( i C , k i C , k 1 ) ] .
and the resulting algebraic equation is
C Δ t u C , k ( 1 + C R C Δ t ) i C , k C Δ t u C , k 1 + C R C Δ t i C , k 1 = 0 .
The capacitor index matrix is
( a C ( e C , u C , k ) , a C ( e C , i C , k ) , a C ( e C , u C , k 1 ) , a C ( e C , i C , k 1 ) ) = ( C Δ t , 1 C R C Δ t , C Δ t , C R C Δ t ) .

2.7. Resistor Model

The resistor equation is
u R , k = R i R , k .
Its corresponding index matrix is
( a R ( e R , u R , k ) , a R ( e R , i R , k ) ) = ( 1 , R ) .

2.8. Voltage-Source Model

A non-ideal voltage source with electromotive force E and internal resistance R E is considered. With i E , k defined as positive when the source delivers current to the external circuit, its terminal voltage is
u E , k = E R E i E , k .
Its index matrix is
( a E ( e E , u E , k ) , a E ( e E , i E , k ) , a E ( e E , 1 ) ) = ( 1 , R E , E ) .
The auxiliary column indexed by 1 represents a constant term.

2.9. Semiconductor Switch Representation

The semiconductor switch is represented by a simplified algebraic model with two operating states: the conducting and blocking states. This representation is used to construct the mode-dependent index matrix equations and to demonstrate how switching conditions can be included in the proposed indexed formulation.
In the conducting state, the switch is modeled by its on-state resistance:
u S , k = R on i S , k .
where R on is the on-state resistance. The corresponding indexed coefficient row is
( a S , on ( e S , on , u S , k ) , a S , on ( e S , on , i S , k ) ) = ( 1 , R on ) .
In the blocking state, the switch current is forced to zero:
i S , k = 0 .
The corresponding index matrix is
a S , off ( e S , off , i S , k ) = 1 .
The active switch equation is selected based on the switching variable sk ∈ {0,1}, where sk = 1 denotes the conducting state and sk = 0 denotes the blocking state.
It should be emphasized that this switch representation is a first-order algebraic approximation. It is introduced to support the construction of the index matrix model and the numerical simulation of the converter operating modes. The model does not include switching transients, parasitic capacitances, reverse-recovery effects, gate-drive losses, temperature-dependent semiconductor parameters, or switching-frequency-dependent losses.
Therefore, the switch equations used in the present work should not be interpreted as a detailed semiconductor device model. They provide a compact representation of the conducting and blocking constraints required for the mode-dependent converter equations. A more detailed implementation may replace this simplified switch row with an extended semiconductor model including conduction losses, switching losses, diode recovery effects, parasitic elements, and thermal dependencies.
This clarification is important for interpreting the efficiency and loss results presented later. Because the switch model includes only simplified resistive behavior, the reported efficiency is an estimated conduction-oriented internal-model indicator, not a prediction of the full hardware efficiency of a real converter.

2.10. Circuit Interconnection Equations

Kirchhoff’s current law for node n is expressed as
j N ( n ) σ j n i j n = 0 , σ j n { 1 , + 1 } .
Here, j N ( n ) denotes a node adjacent to n . The incidence factor is σ j n = + 1 for a branch current directed into node n and σ j n = 1 for a current directed out of the node.
Kirchhoff’s voltage law for loop l is
b ( l ) σ b l u b l = 0 , σ b l { 1 , + 1 } .
Here, b ( l ) denotes a branch in loop l . The orientation factor is σ b l = + 1 when the branch-voltage orientation agrees with the loop orientation and σ b l = 1 otherwise.
The node and loop index matrices are denoted by F n and F l , respectively, while F c denotes the index matrix of component c .
The complete system index matrix is assembled as
F sys = F comp F node F loop .
The individual parts are
F comp = c F c , F node = n F n , F loop = l F l .

2.11. Operating Modes

Three principal operating modes are considered:
m = { charge , idle , discharge } .
For each operating mode, a discrete system with a state vector
x k = [ i L , k u DC , k u p , k S O C k ] T .
Here, i L , k is the inductor-current magnitude, u DC , k is the DC-link voltage, u p , k is the battery polarization voltage, and S O C k is the battery state of charge at time step k .

2.12. Battery Model

The battery is represented by a first-order Thevenin equivalent circuit containing an open-circuit voltage source, an ohmic resistance R 0 , and a polarization branch R p  −  C p . The terminal voltage is
u bat = u oc ( SOC ) + R 0 i bat + u p .
The adopted sign convention is i bat > 0 during charging and i bat < 0 during discharging. The polarization-voltage dynamics are
d u p d t = u p R p C p + i bat C p .
Using backward Euler discretization gives
( 1 Δ t + 1 R p C p ) u p , k + 1 i bat , k + 1 C p = u p , k Δ t .
The battery state of charge is calculated by Coulomb counting. During charging,
S O C k + 1 = S O C k + η ch Δ t 3600 Q n i bat , k + 1 .
During discharging,
S O C k + 1 = S O C k + Δ t 3600 η dis Q n i bat , k + 1 .
For an optional visualization only, the physical SOC increment Δ S O C k ( phys ) may be scaled by a factor K SOC :
S O C k + 1 ( vis ) = S O C k + K SOC Δ S O C k ( phys ) .
All numerical results and the SOC curve reported in this paper use
K SOC = 1 .
Values K SOC > 1 are not used in the Results section and must not be interpreted as physical Coulomb-counting results.

2.13. PI Current Controller

The current-control error is defined as
e i , k = | i ref , k | i L , k .
The integral contribution is updated using a clamping anti-windup rule:
I k = sat   ( I k 1 + K i e i , k Δ t , I max , I max ) .
For charging operation, the preliminary duty-cycle command is
d k = d ff , k + K p e i , k + I k .
For discharging operation,
d k = d ff , k K p e i , k I k .
The feedforward component is calculated as
d ff , k = u oc , k u DC , k .
The applied duty cycle is constrained by
d k = sat ( d k , d min , d max ) = { d min , d k < d min , d k , d min d k d max , d max , d k > d max .
Equation (45) limits the integral contribution to [ I max , I max ] , while Equation (49) separately constrains the applied duty cycle. This prevents continued integral growth when the actuator is saturated.

2.14. Reference Switched ODE Model for Numerical Consistency Checking

For numerical-consistency checking, a reference switched ODE model is formulated using the same physical assumptions as the index matrix model. Its purpose is limited to software-level numerical-consistency checking: it tests whether the indexed assembly reproduces the intended converter, battery, controller, and mode equations in a conventional implementation. It is not an experimental validation of the physical converter.
The reference model is written as
x ˙ ( t ) = f m   ( x ( t ) , u ( t ) , t ) .
The continuous state vector is
x ( t ) = [ i L ( t ) u DC ( t ) u p ( t ) SOC ( t ) ] T .
Here, i L ( t ) is the inductor-current magnitude, u DC ( t ) is the DC-link voltage, u p ( t ) is the battery polarization voltage, and SOC ( t ) is the battery state of charge.
The reference-model operating mode is selected from the current-reference sign together with the SOC limits:
m ( t ) = { charge , i ref ( t ) > 0 | and | SOC ( t ) < S O C max , discharge , i ref ( t ) < 0 | and | SOC ( t ) > S O C min , idle , otherwise .
The reference ODE implementation uses the same sign convention, battery equivalent-circuit equations, PI current-control law, and supervisory mode logic as the index matrix formulation. The equations are coded separately in conventional switched differential-equation form so that discrepancies caused by indexing, assembly, or sign errors can be detected. The reference is independent at the software-implementation level, but not at the level of physical assumptions.
The comparison should therefore be interpreted only as a numerical-consistency check between two implementations of the same assumed model. Agreement does not demonstrate correspondence with a real converter, experimentally identified battery, or switching-level semiconductor behavior.
Physical validation would require laboratory measurements, experimentally identified parameters, measured loss data, or comparison with a detailed switching-level benchmark. These activities are outside the present scope and are identified as necessary future work.

3. Bidirectional Converter, Battery, and Control System Model

3.1. Converter Structure and Operating Principle

The investigated system is a bidirectional buck–boost DC–DC converter connected between a DC source/load side and a battery energy storage system. Charging transfers energy from the DC bus to the battery, discharging transfers energy from the battery to the DC bus, and the idle state represents a zero reference or an active SOC constraint. The discrete operating mode is selected as
m k = { charge , i ref , k > 0 | and | S O C k < S O C max , discharge , i ref , k < 0 | and | S O C k > S O C min , idle , otherwise .
The upper SOC limit disables charging and the lower SOC limit disables discharging; both constraints are included explicitly in Equation (53).

3.2. Charge, Idle, and Discharge Modes

The battery-current sign is represented by the mode-dependent coefficient β m , defined as
β m = { + 1 , m = charge , 0 , m = idle , 1 , m = discharge .
The battery current is related to the inductor-current magnitude by
i bat , k = β m i L , k .
Thus, positive battery current denotes charging and negative battery current denotes discharging. The duty cycle d k controls the averaged converter-side voltage, and the applied command is constrained by
d min d k d max .

3.3. DC-Link Voltage Equation

The DC-link voltage is determined by the balance between the source current, load current, converter bus current, and DC-link capacitor current. The source current is modeled as
i s , k = U s u DC , k R s .
where U s is the source electromotive force and R s is the equivalent series resistance. The minus sign in Equation (57) follows from defining i s , k as current delivered by the source.
The load current is
i load , k = u DC , k R load .
The current exchanged by the converter with the DC bus is approximated as
i conv , k = β m d k i L , k .
Using backward Euler discretization, the DC-link capacitor equation can be written in the form
C DC Δ t u DC , k + 1 + ( 1 R s + 1 R load ) u DC , k + 1 + β m d k i L , k + 1 = C DC Δ t u DC , k + U s R s .
This equation is included as one row of the mode-dependent index matrix.

3.4. Inductor-Current Equation

In charging mode, the positive current direction is from the DC link toward the battery. Substitution of the Thevenin terminal-voltage relation into the backward-Euler inductor equation gives
( L Δ t + R L + R 0 ) i L , k + 1 d k u DC , k + 1 + u p , k + 1 = L Δ t i L , k u oc , k .
In discharging mode, the physical branch current reverses while i L remains a non-negative magnitude. This reverses the signs of the DC-link and polarization terms and gives
( L Δ t + R L + R 0 ) i L , k + 1 + d k u DC , k + 1 u p , k + 1 = L Δ t i L , k + u oc , k .
In idle mode, the battery is decoupled from the active power-transfer path, and the inductor current decays according to
( L Δ t + R L ) i L , k + 1 = L Δ t i L , k .

3.5. Battery Equivalent-Circuit Model

The battery is represented by a first-order Thevenin equivalent model. The terminal voltage is calculated as
u bat , k = u oc ( S O C k ) + R 0 i bat , k + u p , k .
The open-circuit voltage is approximated by a smooth nonlinear function of the state of charge
u oc ( SOC ) = U 0 + K 1 S O C + K 2 tan h   [ K 3 ( SOC S O C 0 ) ] .
This expression provides a smooth analytical dependence on SOC . The coefficients U 0 , K 1 , K 2 , K 3 , and S O C 0 are illustrative and may be replaced by values identified for a specific battery chemistry.
The polarization-voltage dynamics are described by
d u p d t = u p R p C p + i bat C p .
Using backward Euler discretization gives
( 1 Δ t + 1 R p C p ) u p , k + 1 β m C p i L , k + 1 = u p , k Δ t .
This equation accounts for the transient voltage behavior caused by the polarization branch of the battery model.

3.6. State-of-Charge Equation

The state of charge is updated using Coulomb counting. The general discrete form is
S O C k + 1 = S O C k + γ m i L , k + 1 .
where the mode-dependent SOC gain γ m is
γ m = { η ch Δ t 3600 Q n , m = charge , 0 , m = idle , Δ t 3600 η dis Q n , m = discharge .
Here, Q n is the nominal battery capacity in ampere-hours, η ch is the charging efficiency, and η dis is the discharging efficiency. The negative discharge coefficient in Equation (69) is required because i L is stored as a positive magnitude.
S O C k + 1 ( vis ) = S O C k + K SOC γ m i L , k + 1 .
For compatibility with the optional visualization notation, one may write
K SOC = 1 .
All reported simulations use K SOC = 1 ; hence Equation (70) reduces to the physical update in Equation (68).

4. Python Implementation and Simulation Procedure

4.1. Required Python Libraries

The simulation framework is implemented in Python using standard scientific libraries. NumPy is used for numerical calculations, indexed-array operations, matrix assembly, and solution of the linear systems arising from the index matrix formulation. In particular, np.linalg.solve() obtains the next state at each fixed step, while np.linalg.eigvals() is used for the local one-step eigenvalue diagnostic. pandas organizes the simulated data and exports them to CSV files, and matplotlib generates separate publication-oriented figures in raster and vector formats. The dataclasses and pathlib modules provide structured parameter definitions and platform-independent output management. No specialized power-electronics simulation package is required for the reported numerical workflow.

4.2. General Implementation Structure

The proposed hybrid index matrix model is implemented entirely in Python 3.10 as a single-file program suitable for execution in a lightweight environment such as Thonny. The implementation does not require a graphical user interface. All converter, battery, controller, and simulation parameters are defined directly in the program, while the numerical results are automatically exported as CSV files and publication-oriented figures. The numerical implementation follows the mathematical formulation introduced in Section 2 and Section 3. In particular, the mode-dependent discrete index matrix model, the battery equations, the PI current controller, the power-flow calculations, and the local one-step sensitivity diagnostic are implemented in Python according to the previously defined equations. At each simulation step, the program assembles the corresponding mode-dependent linear system and solves it directly. The use of np.linalg.solve() improves numerical robustness and avoids unnecessary matrix inversion. This structure follows the theoretical model while keeping the implementation compact and transparent.

4.3. State Variables and Initial Conditions

The state vector defined in the previous section is stored in Python as a NumPy array. The individual variables are accessed by their positions in the state vector. The initial conditions are defined directly in the program. The inductor current and polarization voltage are initially set to zero, the DC-link voltage is initialized with the source voltage, and the battery state of charge is set by the user. The simulation time vector is generated with a fixed time step. This implementation corresponds to the fixed-step discretization introduced in the mathematical model.

4.4. Reference-Current Profile and Mode Selection

The reference-current profile introduced in Section 3 is implemented as a piecewise function. This profile allows the converter to operate sequentially in charging, idle, discharging, idle, and final charging intervals. The operating mode is selected according to the reference-current sign and the battery SOC limits. A supervisory condition prevents overcharging and excessive discharging of the battery. The implementation directly follows the sign convention defined in the converter model.

4.5. Battery Model Implementation

The first-order Thevenin battery model described in Section 3 is implemented through the open-circuit voltage, ohmic voltage drop, polarization voltage, and SOC update. The polarization-voltage equation is included as one row of the assembled matrix system.

4.6. PI Current Controller Implementation

The PI controller is implemented in discrete time. The current-magnitude error and feedforward duty component are evaluated from the current state. The integral contribution is clamped to [ I max , I max ] , the preliminary mode-dependent command is formed, and the final duty cycle is saturated to [ d min , d max ] . This is the anti-windup convention used in Equations (45) and (49).

4.7. Power and Energy Calculation

The power and energy quantities defined in the previous section are calculated during post-processing. The battery power, source power, load power, converter input power, converter output power, and loss power are evaluated at each time step. The estimated instantaneous efficiency under the adopted conduction-oriented loss model is calculated only when the modeled input power is positive. These calculations are used to evaluate the direction and amount of transferred energy during charging and discharging intervals.

4.8. Simulation Metrics Implementation

At sample k , the regulated-magnitude error is e k = | i ref , k | i L , k , with t k = k Δ t , k = 1 , , N , and T sim = N Δ t . The sample-averaged indicators are
RMSE = 1 N k = 1 N e k 2 , MAE = 1 N k = 1 N | e k | .
The integral error criteria are evaluated on the same fixed grid:
IAE Δ t k = 1 N | e k | , ISE Δ t k = 1 N e k 2 , ITAE Δ t k = 1 N t k | e k | .
For a sampled power series P q , k , energy in watt-hours and the duration and share of mode m are calculated as
E q Δ t 3600 k = 1 N P q , k , T m = N m Δ t , r m = 100 N m N | % .
Using the same samples and rectangular-integration convention gives the internal-consistency relations
RMSE ISE T sim , MAE IAE T sim .

4.9. Local One-Step Sensitivity-Matrix Construction

The local analysis is implemented as a one-step finite-difference procedure around one representative operating point in each fixed mode. Its purpose is to characterize the immediate numerical sensitivity of the reported plant-and-battery state vector; it is not a proof of global, switched, or complete closed-loop stability.
For each operating mode, one representative operating point is selected from the simulated trajectory after the corresponding transient has decreased. The selected operating point is defined by the state vector
x 0 = [ i L , 0 u DC , 0 u p , 0 S O C 0 ] T .
Here, i L , 0 , u DC , 0 , u p , 0 , and S O C 0 denote the selected operating-point coordinates.
The nominal next-step response is first calculated by applying the same fixed-step solver used in the main simulation:
x 1 = f m   ( x 0 ; I 0 , i ref , 0 , Δ t ) .
Here, f m ( ) denotes one complete fixed-step update for mode m , conditional on the common pre-step PI memory I 0 , reference i ref , 0 , and step Δ t . The mode is held fixed and the duty command is recomputed consistently for the nominal and perturbed plant states.
After the nominal response is obtained, each state variable is perturbed separately. For the j-th state variable, the perturbed state vector is
x 0 ( j ) = x 0 + h j e j .
Here, e j is the unit vector for state j and h j is its finite-difference magnitude. One state is perturbed at a time. The adopted vector is h = [ 10 5 | A , 10 4 | V , 10 5 | V , 10 6 ] T ; these values are small relative to the corresponding operating-point scales while avoiding round-off-dominated differences.
For each perturbed state, the model is advanced by exactly one fixed simulation step:
x 1 ( j ) = f m   ( x 0 ( j ) ; I 0 , i ref , 0 , Δ t ) .
Each perturbed state is advanced by exactly one fixed step; no multi-step trajectory is generated. The converter, battery, and PI-control equations are evaluated once, while the operating mode and pre-step controller memory remain fixed. Because the PI memory is not an independent coordinate of the four-state vector, the resulting 4 × 4 matrix is a conditional one-step sensitivity matrix rather than a complete closed-loop state-transition matrix.
The vector A m , j forming the j th column of the local one-step sensitivity matrix is calculated as
A m , j = x 1 ( j ) x 1 h j .
After all four states have been perturbed, the matrix A m = [ A m , 1 | A m , 2 | A m , 3 | A m , 4 ] is obtained. Its eigenpairs satisfy
A m v i = λ i v i , i = 1 , , 4 .
The spectral radius is then defined as
ρ ( A m ) = max 1 i 4 | λ i | .
For a complete autonomous discrete-time state matrix, the condition ρ(Am) < 1 would imply local asymptotic stability. In the present conditional mapping, the same threshold is used only as a diagnostic reference and must be interpreted together with the state definition and the observed unit eigenvalue.
The procedure is repeated for charging, idle, and discharging. The reported eigenvalues and spectral radii characterize only the selected fixed-mode operating points and one-step mapping; they do not cover arbitrary switching sequences, controller-memory perturbations, perturbation-size convergence, parameter uncertainty, or the full operating domain.

4.10. Data Export and Figure Generation

All simulated quantities are stored in arrays and exported to a CSV file. The exported dataset includes time, operating mode, reference and inductor currents, battery current, DC-link and battery voltages, SOC, duty cycle, power terms, estimated losses, current error, and voltage deviation. The Results section reports separate figures for current response, duty cycle and mode, current error, reference-versus-actual current, polarization voltage, DC-link voltage deviation, physically scaled SOC, power flow, cumulative battery energy, absolute error, error distribution, estimated conduction-oriented efficiency, estimated loss power, energy balance, one-step eigenvalues, and spectral radius.

5. Results and Discussion

5.1. Simulation Setup and Input Parameters

The proposed Python-based framework was applied to a bidirectional buck–boost DC–DC converter connected to a battery energy storage system. The simulation evaluates charging, idle operation, discharging, and subsequent charging within one reference profile. The reported quantities include current tracking, DC-link voltage deviation, battery SOC, power-flow direction, integrated energy, estimated conduction-oriented losses, and local one-step sensitivity indicators.
The converter operates according to a predefined current-reference profile consisting of five consecutive intervals: charging, idle operation, discharging, idle operation, and final charging. This operating scenario allows the model to be tested under both directions of power flow and during mode transitions.
The input parameters are grouped into converter, battery, controller, and simulation settings. Converter parameters define the DC source, load, inductor, parasitic resistance, and DC-link capacitor. Battery parameters define the first-order Thevenin model, nominal capacity, SOC limits, and charge/discharge efficiencies. Controller parameters specify the PI gains, duty-cycle limits, and anti-windup bound. Simulation settings specify the duration, fixed step, reference-current sequence, initial SOC, and SOC scaling factor.
Table 1 summarizes the main simulation parameters used in the implemented Python model.
The selected parameters define a low-voltage bidirectional converter used for the reported numerical study. The source voltage is set to 48 V, while the resistive load and source resistance define the DC-link operating conditions. The inductor and DC-link capacitor values are selected to provide observable dynamic behavior during current-reference changes and power-flow reversals.
The battery is modeled using a first-order Thevenin equivalent circuit. The nominal capacity is 20 Ah, and the initial SOC is set to 0.55. The SOC limits are introduced to prevent operation outside the admissible battery range. The charge and discharge efficiencies are included in the SOC update and energy-flow interpretation.
The PI current controller is tuned to provide bounded current tracking in the reported numerical scenario. The duty cycle is limited between 0.05 and 0.95, while the anti-windup bound restricts integral accumulation during saturation. These parameter values are not presented as a hardware-optimal controller design.
The simulation duration is 60 s and the fixed step is Δt = 1 ms. The reference-current sequence contains a 3 A charging interval, a zero-current idle interval, a −4 A discharging interval, a second idle interval, and a final 2 A charging interval.
The SOC scaling factor is K SOC = 1 for all reported results. Consequently, the SOC curve is physically scaled according to the stated 20 Ah capacity and the Coulomb-counting equation. No accelerated SOC curve is used in the Results section.
The fixed step is intended for an averaged, control-oriented model and not for resolving individual semiconductor switching events at tens of kilohertz. Backward Euler provides numerical robustness, but numerical stability of the integration formula alone does not establish time-step convergence of the coupled model.
A nominal time-scale check gives τ DC ( R s R load ) C DC = 4.52 | ms , τ L , act L / ( R L + R 0 ) = 21.7 | ms in the active modes, τ L , idle L / R L = 33.3 | ms in idle, and τ p = R p C p = 40 | s . Thus, Δ t / τ is approximately 0.221, 0.046, 0.030, and 2.5 × 10 5 , respectively.
The battery polarization branch has the time constant τp.
These ratios support use of the selected step for the qualitative averaged-model demonstration, but they do not constitute a convergence study. In particular, the fastest nominal DC-link time scale warrants caution when interpreting precise transient amplitudes and one-step eigenvalues.
A systematic rerun with smaller steps is not included in the present study. All numerical values are therefore conditional on Δt = 1 ms, and a step-size sensitivity study is identified as necessary future work. Switching-level accuracy would additionally require explicit switching frequency, device transitions, parasitic capacitances, reverse recovery, and a substantially smaller integration step.
During the simulation, all relevant quantities are stored as time-domain arrays. These include reference current, inductor current, battery current, DC-link voltage, battery terminal voltage, open-circuit voltage, polarization voltage, SOC, duty cycle, source current, load current, power quantities, estimated conduction-oriented loss and efficiency indicators, current-tracking error, DC-link voltage deviation, operating mode, and local one-step sensitivity indicators. These data are used for the graphical and quantitative analyses presented in the following subsections.

5.2. Current Tracking and Mode Transitions

The first part of the result analysis focuses on the current-tracking behavior of the bidirectional converter and on the transitions between the operating modes. The imposed current-reference profile includes five consecutive intervals: charging, idle operation, discharging, idle operation, and final charging. This sequence allows the dynamic response of the converter to be evaluated under both directions of power flow and during zero-current transitions.
The simulated inductor current follows the magnitude of the imposed reference current during the active charging and discharging intervals. During the first charging interval, the converter increases the inductor current toward the prescribed positive-current level. After the transition to idle operation, the reference current becomes zero and the inductor current decreases accordingly. In the discharging interval, the reference-current sign changes, while the implemented current-control strategy regulates the inductor-current magnitude according to the absolute value of the reference. Finally, the converter returns to idle operation and then enters a second charging interval with a lower reference-current value.
The current response is shown in Figure 1. The figure compares the reference current and the simulated inductor current over the full operating sequence. In the reported numerical scenario, the current magnitude follows the imposed profile in both charging and discharging operation. Small deviations occur mainly during mode transitions because of the finite inductor response, duty-cycle saturation, and discrete-time PI action.
The operating-mode sequence and duty-cycle variation are shown in Figure 2. The mode signal matches the charging, idle, and discharging intervals selected from the reference-current sign and SOC constraints. During active power-transfer intervals, the duty cycle changes in response to the current-control error and the DC-link and battery-side voltages. During idle intervals, the converter does not intentionally transfer energy between the battery and the DC bus, and the control command is reduced accordingly.
The current tracking error is shown in Figure 3. The error remains relatively small during the steady parts of the charging and discharging intervals and increases mainly at the instants of current-reference changes. These peaks are associated with the abrupt transition between different operating modes and reference-current levels. After each transition, the PI controller reduces the tracking error and drives the system toward the new operating condition.
The relationship between the reference current and the simulated inductor current is further illustrated in Figure 4. This representation compares the commanded and obtained current values. The concentration of points near the ideal tracking line is consistent with bounded current-magnitude tracking within the tested numerical profile.
The results show that the implemented model reproduces the prescribed sequence and that the controller maintains bounded tracking in the tested profile. The largest errors occur at abrupt mode transitions, where the reference changes discontinuously and the duty cycle is constrained. These observations support use of the framework for numerical exploration of current regulation and mode transitions, but they do not constitute experimental validation.

5.3. Voltage-Related Diagnostics

The voltage diagnostics retained in this study are the battery polarization voltage and the DC-link voltage deviation. These quantities are reported separately to maintain a one-to-one correspondence between each figure and its discussion. A battery-terminal-voltage curve is not included; accordingly, no conclusion is drawn for that quantity.
The polarization-voltage response is shown in Figure 5. It reflects the transient behavior of the Rp–Cp branch of the first-order Thevenin battery model. During charging and discharging, the polarization voltage changes with the battery-current direction and magnitude; during idle intervals, it relaxes according to the 40 s time constant.
The DC-link voltage deviation is shown in Figure 6. The largest deviations occur around abrupt reference-current changes and active power-transfer intervals, whereas the deviation decreases during idle operation. The curve is a response of the adopted averaged numerical model and should not be interpreted as a measured voltage-regulation result.
Together, Figure 5 and Figure 6 show bounded voltage-related states over the reported 60 s scenario. The polarization branch exhibits the expected slow relaxation, while the DC-link deviation follows the changes in operating mode. Quantitative hardware conclusions require experimental parameters, step-size convergence, and measurement-based validation.

5.4. Battery SOC, Power Flow, and Energy Transfer

The battery state of charge, power-flow direction, and cumulative energy are analyzed to illustrate the bidirectional energy exchange represented by the numerical model, including charging, discharging, idle operation, and reversal of power flow.
The physically scaled battery SOC is shown in Figure 7. It increases during charging, decreases during discharging, and remains nearly constant during idle operation, consistent with the sign convention and Coulomb-counting equation.
The SOC curve in Figure 7 uses KSOC = 1. Its sub-percentage variation over 60 s is compatible with the stated 20 Ah capacity and the short charge/discharge intervals.
The instantaneous power-flow behavior is shown in Figure 8. Positive battery power denotes charging and negative battery power denotes discharging under the adopted sign convention. The first and final charging intervals therefore appear positive, while the −4 A interval produces negative battery power.
The idle intervals are characterized by a marked reduction in battery power, consistent with the supervisory logic reducing active power transfer when the reference current is zero. Small residual values may occur because of numerical dynamics, state relaxation, or controller and battery-model transients.
The cumulative battery energy is presented in Figure 9. Its slope follows the instantaneous battery power: it rises during charging, decreases during discharging, and changes only slightly in idle intervals. The larger discharge-current magnitude produces the largest energy change over the profile.
The energy-transfer results are consistent with the imposed current-reference sequence and selected operating modes. The converter first stores energy in the battery, pauses active exchange during idle operation, returns energy from the battery to the DC side during discharge, and finally enters a lower-power charging condition. This behavior is consistent with the intended bidirectional sign convention and operating sequence of the numerical model.
Overall, the SOC, power-flow, and cumulative-energy results show how the index matrix framework can be used, within the adopted model assumptions, to analyze energy exchange in bidirectional DC–DC converters. The model provides a clear distinction between charging and discharging operation, preserves the expected sign convention of battery power, and enables energy-transfer quantities to be evaluated together with current, voltage, and control responses.

5.5. Controller Performance and Error Metrics

The PI-controller results are quantified using error metrics rather than by repeating the current-error and reference-versus-actual plots already reported as Figure 3 and Figure 4. The error magnitude and its distribution are retained because they provide complementary information about transient peaks and the fraction of samples concentrated near zero.
The absolute current error is presented in Figure 10. The largest values occur around mode transitions; after each transition, the error decreases as the numerical controller approaches the new operating condition.
The distribution of the signed current error is illustrated in Figure 11. A concentration close to zero indicates that most samples belong to steady or near-steady intervals, whereas the tails correspond primarily to the short transition periods. The legend reports the signed sample mean (approximately 0.0002 A), whereas Table 2 reports the mean absolute error; these are distinct quantities. Sample-averaged metrics must therefore be interpreted together with RMSE and the peak error.
Table 2 summarizes RMSE, MAE, integral error measures, peak current, overshoot, the last tolerance-band re-entry time over the complete multi-step profile, and the full-profile current range. The last two quantities are not interpreted as the settling time or switching ripple of a single isolated step response.
The RMSE is 0.0863 A and the MAE is 0.0045 A. These values are internally consistent with the integral metrics over T sim = 60 | s : MAE IAE / T sim = 0.2714 / 60 = 0.00452 | A and RMSE ISE / T sim = 0.4472 / 60 = 0.08633 | A , with the small differences caused by rounding. IAE, ISE, and ITAE summarize one deterministic profile; they are not statistical confidence measures.
The peak inductor current is 4.3684 A, corresponding to 0.3684 A or 9.2094% above the maximum reference-current magnitude of 4 A. The event occurs at the idle-to-discharge transition, where the command changes abruptly from 0 to −4 A. Plausible contributors are the finite inductor dynamics, duty-cycle saturation, and the retained PI integral state at the mode transition; the available simulation does not isolate these mechanisms through a controller-state reset ablation.
The 9.2094% overshoot is reported as an outcome of the selected controller and step-reference profile and is not treated as universally acceptable. Hardware admissibility would have to be checked against semiconductor current ratings, inductor saturation, battery-current limits, protection thresholds, and thermal constraints.
If a smaller peak is required, appropriate remedies include a ramped current reference, bumpless transfer or integral-state reset at mode changes, revised anti-windup logic, explicit current limiting, and controller retuning. These alternatives are design recommendations and were not simulated in the present study.
The reported value of 51.0240 s is the last re-entry into the adopted tolerance band over a profile containing several steps and idle intervals. It is not the settling time of one isolated transition. Likewise, the 4.3684 A peak-to-peak value is the full-profile current range, not a switching-ripple measurement.
Overall, the metrics indicate small steady-interval tracking errors and short transition-dominated peaks for the selected scenario. The absence of repeated runs, parameter sweeps, or experimental data remains a limitation.

5.6. Conduction-Oriented Efficiency, Estimated Losses, and Energy Balance

This subsection reports internal energy accounting under the adopted simplified conduction-oriented loss model. The indicators complement the current, voltage, and SOC results but are not hardware-efficiency predictions.
The semiconductor switches are represented by algebraic conducting and blocking constraints, and the post-processing model mainly includes conduction-oriented terms. Switching-frequency-dependent turn-on and turn-off energy, diode reverse recovery, parasitic-capacitance loss, gate-drive power, magnetic core loss, temperature dependence, and thermal coupling are omitted. The efficiency values are therefore explicitly labeled as estimated conduction-oriented internal-model indicators.
The estimated conduction-oriented instantaneous efficiency is shown in Figure 12 for active power-transfer intervals. Idle intervals are excluded from physical interpretation because the transferred power approaches zero and the ratio becomes ill-conditioned.
The estimated loss power is presented in Figure 13. It increases during active charging and discharging, with the largest values occurring at the higher current magnitude. The curve reflects the adopted post-processing equations only.
The energy quantities in Table 3 are calculated independently by integrating the simulated power, so SOC represents accumulated charge, whereas the Wh values also include the time-varying battery voltage.
The integrated input energy is 1.6091 Wh, the output energy is 1.5868 Wh, and their difference is 0.0223 Wh. The corresponding estimated conduction-oriented internal-model efficiency is 98.6166%. This value is mathematically consistent with the stated energy balance, but it is not a hardware-efficiency prediction.
The mean estimated instantaneous efficiency is 98.6799%, close to the accumulated ratio. This agreement checks the internal post-processing arithmetic, not the completeness of the loss physics. Missing switching, magnetic, thermal, and auxiliary losses would reduce a hardware efficiency estimate.
The peak estimated loss power is 7.9775 W. Integrated battery energy is 0.7488 Wh during charging and 0.8521 Wh during discharging; the larger discharged value follows from the higher −4 A reference and interval durations. These quantities are obtained from power integration and are separate from the Coulomb-counted SOC calculation.
The internal energy balance is summarized in Figure 14. The correspondence EinEout + Eloss shows arithmetic closure for the adopted numerical model.
The interpretation is deliberately limited: the figures show internally consistent energy accounting under a conduction-oriented approximation. A realistic hardware-efficiency assessment would require a defined switching frequency, device switching-energy data or waveforms, magnetic-loss estimation, temperature-dependent parameters, auxiliary consumption, and experimental or detailed circuit-simulation benchmarking.

5.7. Local One-Step Sensitivity and Spectral-Radius Diagnostic

The finite-difference analysis is evaluated for representative charging, idle, and discharging operating points. It characterizes the immediate mapping of the four reported plant-and-battery states for a fixed operating mode and common pre-step controller memory. It is not a complete closed-loop state matrix because the PI integral memory is not included as an independent state.
For each mode, one state variable is perturbed at a time using the vector stated in Section 4.9, and the model is advanced by exactly one 1 ms step. The nominal and perturbed evaluations use the same mode and pre-step controller memory, while the duty command is recomputed from the corresponding state.
The resulting 4 × 4 matrix is therefore interpreted as a conditional one-step sensitivity matrix. Its eigenvalues may reveal numerical amplification or damping in the selected local mapping, but they cannot establish global or arbitrary-switching stability.
The eigenvalue locations are shown in Figure 15. Each mode contains one eigenvalue at z = 1, while the remaining electrical eigenvalues lie inside the unit circle for the selected operating points.
The corresponding spectral radii are shown in Figure 16. The plotted values are ρ = 1.00000 for charging, idle, and discharging; they are not below unity.
The unit spectral radius results from the eigenvalue at z = 1, which is consistent with the SOC-like integrating state over the one-step horizon. The full four-state mapping is therefore marginal or non-expansive at the displayed numerical precision, not locally asymptotically stable according to the strict criterion ρ < 1. The electrical eigenvalues inside the unit circle indicate local damping of the faster electrical components at the selected points.
The bounded 60 s trajectories are consistent with the absence of numerical divergence in the tested scenario, but bounded simulation alone is not a stability proof. In particular, no claim is made for controller-memory perturbations, other operating points, smaller time steps, parameter uncertainty, or arbitrary mode switching.
The eigenvalue analysis is retained as a transparent local diagnostic because it exposes both the damped electrical modes and the unit SOC mode. A formal closed-loop assessment would require augmenting the state with the PI integral memory, repeating the analysis over the operating domain, checking step-size sensitivity, and applying an appropriate switched-system or Lyapunov framework.

5.8. General Discussion

The study has several limitations that govern the interpretation of the results. First, it is a numerical modeling and software-level numerical-consistency study without experimental validation. Current, voltage, power, energy, and eigenvalue results are outputs of the adopted equations and parameter set rather than direct predictions of a laboratory converter.
Second, the semiconductor model contains simplified conducting and blocking constraints and a conduction-oriented post-processing loss estimate. Switching transients, reverse recovery, parasitic capacitances, gate-drive power, magnetic loss, temperature dependence, and thermal coupling are omitted; consequently, the reported efficiency values are estimated conduction-oriented internal-model indicators.
Third, the battery is represented by a first-order Thevenin equivalent circuit without detailed electrochemistry, temperature dependence, aging, hysteresis, or degradation. The reported results use K SOC = 1 , so the displayed SOC is physically scaled; however, the parameters are illustrative rather than experimentally identified for a specific cell.
Fourth, the finite-difference matrix is local, one-step, fixed-mode, and conditional on common pre-step controller memory. The observed ρ = 1.00000 does not satisfy the strict asymptotic-stability condition and must not be reported as proof of local or switched-system stability.
Fifth, the study does not include a full parameter-sensitivity analysis, uncertainty analysis, step-size convergence test, experimental measurements, or a detailed circuit-simulation benchmark. These omissions limit quantitative hardware-oriented conclusions.
Within these limits, the label-aware index matrix framework provides a transparent way to assemble and simulate a multi-mode converter–battery–controller model in Python. Its principal value is methodological organization, traceable variable alignment, and reproducible generation of deterministic numerical outputs.
Future work should prioritize experimental validation, detailed semiconductor, magnetic, thermal, and auxiliary loss models, step-size convergence, parameter sensitivity and uncertainty, controller-state augmentation, comparison with a detailed switching-level benchmark, and formal analysis of the switched multi-mode system.

6. Conclusions

This paper presented a Python-based hybrid index matrix framework for label-aware assembly and simulation of a bidirectional buck–boost DC–DC converter connected to a first-order Thevenin battery model. Real-valued row and column identifiers preserve the relationship between component equations and physical variables before the system is projected into ordered numerical matrices for solution.
The workflow covers charging, idle, and discharging operation, supervisory mode selection, a discrete-time PI current controller with saturation and anti-windup, deterministic performance metrics, physically scaled SOC, conduction-oriented energy accounting, and a conditional one-step finite-difference diagnostic.
For the prescribed 60 s profile, the current RMSE is 0.0863 A and the peak current is 4.3684 A, corresponding to 9.2094% overshoot at the idle-to-discharge transition. The overshoot is reported as a scenario-dependent controller outcome; its hardware admissibility cannot be determined without current ratings, saturation limits, protection thresholds, and thermal constraints.
The SOC result uses K SOC = 1 and is therefore physically scaled according to the stated 20 Ah capacity and Coulomb-counting equation. Integrated power gives 0.7488 Wh charged energy and 0.8521 Wh discharged energy; these Wh quantities include the time-varying battery voltage and are not inferred directly from the SOC percentage.
The numerical energy balance is 1.6091 Wh input, 1.5868 Wh output, and 0.0223 Wh estimated loss. The corresponding 98.6166% ratio is an estimated conduction-oriented internal-model result and is not a hardware-efficiency prediction.
The conditional one-step matrices have spectral radius 1.00000 in all three fixed modes because of a unit SOC-related eigenvalue. The strict condition ρ < 1 is therefore not satisfied for the reported four-state mapping. The remaining electrical eigenvalues lie inside the unit circle, which supports only a local non-divergence interpretation for the selected points; it does not prove complete closed-loop or switched-system stability.
The main contribution is the transparent label-aware assembly of converter, battery, controller, and supervisory equations within one reproducible Python workflow. The reference ODE implementation serves only as a software-level numerical-consistency check between two formulations of the same assumptions.
The principal limitations are the absence of experimental validation; omission of detailed switching, magnetic, thermal, and auxiliary loss physics; lack of parameter-uncertainty and step-size-convergence studies; exclusion of controller memory from the eigenvalue state; and absence of formal switched-system analysis.
Future work will address laboratory validation, experimentally identified battery and semiconductor parameters, detailed switching, magnetic, thermal, and auxiliary loss models, smaller-step convergence tests, sensitivity and uncertainty analysis, improved transition control, comparison with specialized switching-level simulation, and augmented closed-loop stability analysis.

Author Contributions

N.H., V.G., P.G. and P.S. contributed to conceptualization, methodology, modeling, numerical verification, visualization, and manuscript preparation. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported by the European Regional Development Fund under the “Research Innovation and Digitization for Smart Transformation” program 2021–2027 under Project BG16RFPR002-1.014-0006 “National Centre of Excellence Mechatronics and Clean Technologies”, and the APC was funded by Project BG16RFPR002-1.014-0006.

Data Availability Statement

The equations, parameter values, and numerical results needed to interpret the reported study are provided in the article. The Python implementation and the generated CSV output files are available from the corresponding author upon reasonable request.

Acknowledgments

The present research was carried out under Project BG16RFPR002-1.014-0006 “National Centre of Excellence Mechatronics and Clean Technologies”.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Tong, Y.; Salhi, I.; Wang, Q.; Lu, G.; Wu, S. Bidirectional DC-DC Converter Topologies for Hybrid Energy Storage Systems in Electric Vehicles: A Comprehensive Review. Energies 2025, 18, 2312. [Google Scholar] [CrossRef] [Scilit]
  2. Wang, J.; Wang, B.; Zhang, L.; Wang, J.; Shchurov, N.I.; Malozyomov, B.V. Review of Bidirectional DC–DC Converter Topologies for Hybrid Energy Storage System of New Energy Vehicles. Green Energy Intell. Transp. 2022, 1, 100010. [Google Scholar] [CrossRef] [Scilit]
  3. Yildirim, B.; Elgendy, M.A.; Smith, A.; Kulan, M.C.; Akbal, B. Modular-Multi-Port-Converter-Based Battery Energy Storage System with Integrated Battery Management Functions. Energies 2025, 18, 3142. [Google Scholar] [CrossRef] [Scilit]
  4. Chmielewski, A.; Piórkowski, P.; Bogdziński, K.; Możaryn, J. Application of a Bidirectional DC/DC Converter to Control the Power Distribution in the Battery–Ultracapacitor System. Energies 2023, 16, 3687. [Google Scholar] [CrossRef] [Scilit]
  5. Sharma, P.; Palwalia, D.K.; Sharma, A.K.; Gopal, Y.; Rosas-Caro, J.C. Novel Current-Fed Bidirectional DC-DC Converter for Battery Charging in Electric Vehicle Applications with Reduced Spikes. Electricity 2024, 5, 1022–1048. [Google Scholar] [CrossRef] [Scilit]
  6. Wang, Z.; Su, X.; Zeng, N.; Jiang, J. Overview of Isolated Bidirectional DC–DC Converter Topology and Switching Strategies for Electric Vehicle Applications. Energies 2024, 17, 2434. [Google Scholar] [CrossRef] [Scilit]
  7. Cosso, S.; Benevieri, A.; Marchesoni, M.; Passalacqua, M.; Vaccaro, L.; Pozzobon, P. A New Topology of Multi-Input Bidirectional DC-DC Converters for Hybrid Energy Storage Systems. Energies 2024, 17, 5120. [Google Scholar] [CrossRef] [Scilit]
  8. Hasan, M.M.; Jaman, S.; Geury, T.; Hegazy, O. Performance Assessment of a Grid-Connected Two-Stage Bidirectional Converter for a Combined PV–Battery Energy Storage System. Energies 2023, 16, 4486. [Google Scholar] [CrossRef] [Scilit]
  9. Elakkad, S.; Hesham, M.; Bastawrous, H.A.; Makeen, P. Design, Control, and Evaluation of a Photovoltaic Snow Removal Strategy Based on a Bidirectional DC-DC Converter for Photovoltaic–Electric Vehicle Application. Energies 2024, 17, 6468. [Google Scholar] [CrossRef] [Scilit]
  10. Koroglu, T.; Ekici, E.; Savrun, M.M. Five-Port Isolated Bidirectional DC-DC Converter for Interfacing a Hybrid Photovoltaic–Fuel Cell–Battery System with Bipolar DC Microgrids. Electronics 2024, 13, 1036. [Google Scholar] [CrossRef] [Scilit]
  11. Khan, J.M.; Khan, A.A.; Jamil, M. A Novel Non-Isolated Bidirectional DC-DC Converter with Improved Current Ripples for Low-Voltage On-Board Charging. Energies 2024, 17, 3570. [Google Scholar] [CrossRef] [Scilit]
  12. Li, X.; He, Y.; Li, M. Control Strategy for Bus Voltage in a Wind–Solar DC Microgrid Incorporating Energy Storage. Electronics 2024, 13, 5018. [Google Scholar] [CrossRef] [Scilit]
  13. Dodda, S.R.; Sandepudi, S.R. Control of Three-level Bidirectional Buck-boost Converter for Battery Energy Storage System in Bi-polar DC Microgrid. Energy Storage 2024, 6, e582. [Google Scholar] [CrossRef] [Scilit]
  14. Aeggegn, D.B.; Nyakoe, G.N.; Wekesa, C. ANFIS-Controlled Boost and Bidirectional Buck-Boost DC-DC Converters for Solar PV, Fuel Cell, and BESS-Based Microgrid Application. Int. Trans. Electr. Energy Syst. 2024, 2024, 6484369. [Google Scholar] [CrossRef] [Scilit]
  15. Jalilzadeh, T.; Rostami, N. New Multi-operational Multi-port DC–DC Converter with Bidirectional Capability. IET Renew. Power Gener. 2023, 17, 1518–1534. [Google Scholar] [CrossRef] [Scilit]
  16. Malik, M.Z.; Zhang, S.; Hong, Y.; Alwahkyan, A.R.A.Y.; Ali, A.; Farooq, A. A Coupled Inductor-Based Bidirectional DC-DC Converter with Step-Up Step-Down Operation for Electric Vehicle Applications. Int. Trans. Electr. Energy Syst. 2023, 2023, 9277881. [Google Scholar] [CrossRef] [Scilit]
  17. Shahed, M.T.; Rashid, A.B.M.H.-U. An Improved Topology of Isolated Bidirectional Resonant DC-DC Converter Based on Wide Bandgap Transistors for Electric Vehicle Onboard Chargers. Int. Trans. Electr. Energy Syst. 2023, 2023, 2609168. [Google Scholar] [CrossRef] [Scilit]
  18. Alatai, S.; Salem, M.; Delgado, M.T.; Ishak, D.; Kamarol, M. Modelling a Five-level LLC Resonant Converter for Bidirectional Battery Application. Int. J. Circuit Theory Appl. 2024, 52, 3477–3501. [Google Scholar] [CrossRef] [Scilit]
  19. Banaei, M.R.; Golmohamadi, M.; Afsharirad, H. A Bidirectional High Voltage Ratio DC–DC Topology for Energy Storage Systems in Microgrid. IET Power Electron. 2023, 17, 281–294. [Google Scholar] [CrossRef] [Scilit]
  20. Mesalam, Y.I.; Awdallh, S.; Gaied, H.; Flah, A. Interleaved Bidirectional DC-DC Converter for Renewable Energy Application Based on a Multiple Storage System. Eng. Technol. Appl. Sci. Res. 2024, 14, 13329–13334. [Google Scholar] [CrossRef] [Scilit]
  21. Li, Z.; Hu, X.; Wang, L.; Meng, L.; Zhao, Y.; Zhang, R. Design and Control Optimization of a Three-Level Bidirectional DC–DC Converter for Energy Storage System. Energy Rep. 2023, 9, 1681–1695. [Google Scholar] [CrossRef] [Scilit]
  22. Hu, X.; Shao, W.; Cheng, Y.; Zhang, C.; Han, Y. Research on ADRC Controller of Bidirectional DC–DC Converter for MMC-BESS. Energy Rep. 2023, 9, 1627–1636. [Google Scholar] [CrossRef] [Scilit]
  23. Pramanik, R.; Pati, B.B. Modelling and Control of a Non-Isolated Half-Bridge Bidirectional DC-DC Converter with an Energy Management Topology Applicable with EV/HEV. J. King Saud Univ. Eng. Sci. 2021, 35, 116–122. [Google Scholar] [CrossRef] [Scilit]
  24. Hong, S.-Y.; Ryu, S.-G.; Park, C.-B.; Lee, H.-W.; Lee, J.-B. Two-Stage Isolated Bidirectional DC-DC Converter with Low Profile and Double Heat Sink for Battery Charging/Discharging System. Electronics 2025, 14, 283. [Google Scholar] [CrossRef] [Scilit]
  25. Monteiro, V.; Afonso, J.A.; Afonso, J.L. Bidirectional Power Converters for EV Battery Chargers. Energies 2023, 16, 1694. [Google Scholar] [CrossRef] [Scilit]
  26. Jain, A.; Gupta, K.K.; Jain, S.K.; Bhatnagar, P.; Vahedi, H. A V2G Enabled Bidirectional Single/Three-Phase EV Charging Interface Using Modular Multilevel BuCk PFC Rectifier. Electronics 2022, 11, 1891. [Google Scholar] [CrossRef] [Scilit]
  27. Sakhare, A.; Mikkili, S. Advanced DC–DC Converter Topologies for Electric Vehicles: Wide Bandgap Technologies, Emerging Trends and Future Challenges. Electr. Mater. Appl. 2025, 2, e70023. [Google Scholar] [CrossRef] [Scilit]
  28. Fan, B.; Zhang, B.; Shi, Y.; Chang, Y. A High-Fidelity Lithium-Ion Battery Emulator for Electric Vehicle Application. Sci. Rep. 2024, 14, 19742. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  29. Jia, C.; Liu, W.; Chau, K.T.; He, H.; Zhou, J.; Niu, S. Passenger-Aware Reinforcement Learning for Efficient and Robust Energy Management of Fuel Cell Buses. Etransportation 2026, 27, 100537. [Google Scholar] [CrossRef] [Scilit]
  30. Surendar, A. Model Predictive Control of Bidirectional Converters in Grid-Interactive Battery Systems. Available online: https://secitsociety.org/index.php/T-PERES/article/view/34 (accessed on 23 July 2026).
  31. Rajender, J.; Dubey, M.; Kumar, Y.; Somanna, B.; Alshareef, M.; Namomsa, B.; Ghoneim, S.S.M.; Abdelwahab, S.A.M. Design and Analysis of a High-Efficiency Bi-Directional DAB Converter for EV Charging. Sci. Rep. 2024, 14, 23764. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  32. Kumar, K.R.; Vignesh, C.P.; Sanjeevikumar, P.; Bhaskar, M.S. Comprehensive Review of Multiport DC-DC Converter Topologies for Renewable Energy Systems. Discov. Sustain. 2026. Epub ahead of printing. [Google Scholar] [CrossRef] [Scilit]
  33. Keerthi, A.; Dhanamjayulu, C. A Thorough Review of Energy Management and an Advanced Control Techniques for Bi-Directional DC-DC Converters in Electric Vehicle Applications. Results Eng. 2025, 27, 106726. [Google Scholar] [CrossRef] [Scilit]
  34. Varma, R.; Dhanamjayulu, C. Innovative Perspectives on Energy Management Strategies for Bidirectional DC-DC Converters with Hybrid Storage Integration in HEVs. Results Eng. 2025, 27, 106749. [Google Scholar] [CrossRef] [Scilit]
  35. Reyes-Cruz, D.; Martinez-Rodriguez, P.R.; Langarica-Cordoba, D.; Vazquez-Guzman, G.; Sosa-Zuniga, J.M.; Hernández-Gómez, Á.; Rodríguez-Cortés, C.J. High-Gain Step-Down DC–DC Converter Employed in a Battery Charging Application. IEEE Access 2023, 11, 121859–121869. [Google Scholar] [CrossRef] [Scilit]
  36. Sugumaran, G. A Modularized Active Cell Balancing of Lithium-Ion Battery Packs Using Buck-Boost Converter for Electric Vehicle Applications. Comput. Electr. Eng. 2025, 128, 110736. [Google Scholar] [CrossRef] [Scilit]
  37. Yıldız, S.; Sayan, H.H. Bidirectional DC-DC Converter and Single-Phase Grid-Connected Inverter Design for Energy Management in V2G Topology. Gazi J. Eng. Sci. 2024, 10, 419–431. [Google Scholar] [CrossRef] [Scilit]
  38. Mahmud, M.; Abedin, T.; Mostofa, K.Z.; Rahman, A.; Basher, M.K.; Nur-E-Alam, M. Battery and Ultra-Capacitor Based Hybrid Energy Storage System Utilizing a Multi-Input DC-DC Buck-Boost Converter. J. Graph. Era Univ. 2025, 13, 155–182. [Google Scholar] [CrossRef] [Scilit]
  39. Narula, A.; Imgart, P.; Bongiorno, M.; Mattavelli, P.; Beza, M.; Svensson, J.R. Power-Response Matrix-Based Modeling of Converter Systems for Small-Signal Analysis. In Proceedings of the 2024 IEEE Energy Conversion Congress and Exposition (ECCE); IEEE: New York, NY, USA, 2024; pp. 4724–4731. [Google Scholar] [CrossRef] [Scilit]
  40. De Carne, G.; Lauss, G.; Syed, M.H.; Monti, A.; Benigni, A.; Karrari, S.; Kotsampopoulos, P.; Faruque, M.O. On Modeling Depths of Power Electronic Circuits for Real-Time Simulation—A Comparative Analysis for Power Systems. IEEE Open Access J. Power Energy 2022, 9, 76–87. [Google Scholar] [CrossRef] [Scilit]
  41. Nguyen, B.L.-H.; Cha, H.; Vu, T.; Nguyen, T.-T. Integrated Multiport Bidirectional DC-DC Converter for HEV/FCV Applications. In Proceedings of the IECON 2021—47th Annual Conference of the IEEE Industrial Electronics Society; IEEE: New York, NY, USA, 2021; pp. 1–6. [Google Scholar] [CrossRef] [Scilit]
  42. Todorov, G.; Kamberov, K.; Ivanov, T.; Dimitrov, K. Virtual and Physical Prototyping in Mechanical Shock Test of an EV Battery Module. Eng. Proc. 2026, 121, 12. [Google Scholar] [CrossRef] [Scilit]
  43. Hinov, N.; Gocheva, P.; Gochev, V. Index Matrices—Based Software Implementation of Power Electronic Circuit Design. Electronics 2022, 11, 675. [Google Scholar] [CrossRef] [Scilit]
  44. Hinov, N.; Gocheva, P.; Gochev, V. Index Matrix-Based Modeling and Simulation of Buck Converter. Mathematics 2023, 11, 4756. [Google Scholar] [CrossRef] [Scilit]
Figure 1. Current response of the bidirectional converter during charging, idle operation, discharging, and final charging. Green shaded regions indicate charging operation, the red shaded region indicates discharging operation, and unshaded regions indicate idle operation.
Figure 1. Current response of the bidirectional converter during charging, idle operation, discharging, and final charging. Green shaded regions indicate charging operation, the red shaded region indicates discharging operation, and unshaded regions indicate idle operation.
Mathematics 14 03197 g001
Figure 2. Duty-cycle command and operating-mode sequence of the bidirectional converter. Green-shaded regions indicate charging operation, red-shaded regions indicate discharging operation, and unshaded regions indicate idle operation.
Figure 2. Duty-cycle command and operating-mode sequence of the bidirectional converter. Green-shaded regions indicate charging operation, red-shaded regions indicate discharging operation, and unshaded regions indicate idle operation.
Mathematics 14 03197 g002
Figure 3. Current-tracking error during the simulated operating sequence. The shaded background regions indicate the active operating mode: green regions correspond to charging operation, the red region corresponds to discharging operation, and unshaded regions correspond to idle operation. The error peaks occur mainly at the mode-transition instants due to abrupt changes in the reference-current command.
Figure 3. Current-tracking error during the simulated operating sequence. The shaded background regions indicate the active operating mode: green regions correspond to charging operation, the red region corresponds to discharging operation, and unshaded regions correspond to idle operation. The error peaks occur mainly at the mode-transition instants due to abrupt changes in the reference-current command.
Mathematics 14 03197 g003
Figure 4. Reference-current tracking comparison.
Figure 4. Reference-current tracking comparison.
Mathematics 14 03197 g004
Figure 5. Polarization voltage response of the Thevenin battery model during the simulated operating sequence. The shaded background regions indicate the active operating mode: green regions correspond to charging operation, the red region corresponds to discharging operation, and unshaded regions correspond to idle operation.
Figure 5. Polarization voltage response of the Thevenin battery model during the simulated operating sequence. The shaded background regions indicate the active operating mode: green regions correspond to charging operation, the red region corresponds to discharging operation, and unshaded regions correspond to idle operation.
Mathematics 14 03197 g005
Figure 6. DC-link voltage deviation during the simulated charging, idle, discharging, and final charging intervals. The shaded background regions indicate the active operating mode: green regions correspond to charging operation, the red region corresponds to discharging operation, and unshaded regions correspond to idle operation.
Figure 6. DC-link voltage deviation during the simulated charging, idle, discharging, and final charging intervals. The shaded background regions indicate the active operating mode: green regions correspond to charging operation, the red region corresponds to discharging operation, and unshaded regions correspond to idle operation.
Mathematics 14 03197 g006
Figure 7. Battery state-of-charge variation during the simulated operating sequence. The shaded background regions indicate the active operating mode: green regions correspond to charging operation, the red region corresponds to discharging operation, and unshaded regions correspond to idle operation. The SOC increases during charging intervals and decreases during the discharging interval according to the imposed battery-current direction.
Figure 7. Battery state-of-charge variation during the simulated operating sequence. The shaded background regions indicate the active operating mode: green regions correspond to charging operation, the red region corresponds to discharging operation, and unshaded regions correspond to idle operation. The SOC increases during charging intervals and decreases during the discharging interval according to the imposed battery-current direction.
Mathematics 14 03197 g007
Figure 8. Power-flow response during the simulated operating sequence. Green shaded regions indicate charging operation, the red shaded region indicates discharging operation, and unshaded regions indicate idle operation.
Figure 8. Power-flow response during the simulated operating sequence. Green shaded regions indicate charging operation, the red shaded region indicates discharging operation, and unshaded regions indicate idle operation.
Mathematics 14 03197 g008
Figure 9. Cumulative battery energy exchanged during the simulated operating sequence. The shaded background regions indicate the active operating mode: green regions correspond to charging operation, the red region corresponds to discharging operation, and unshaded regions correspond to idle operation. The cumulative energy increases during charging intervals and decreases during the discharging interval.
Figure 9. Cumulative battery energy exchanged during the simulated operating sequence. The shaded background regions indicate the active operating mode: green regions correspond to charging operation, the red region corresponds to discharging operation, and unshaded regions correspond to idle operation. The cumulative energy increases during charging intervals and decreases during the discharging interval.
Mathematics 14 03197 g009
Figure 10. Absolute current-tracking error during the simulated operating sequence. The shaded background regions indicate the active operating mode: green regions correspond to charging operation, the red region corresponds to discharging operation, and unshaded regions correspond to idle operation. The error peaks occur mainly at the mode-transition instants due to abrupt changes in the reference-current command.
Figure 10. Absolute current-tracking error during the simulated operating sequence. The shaded background regions indicate the active operating mode: green regions correspond to charging operation, the red region corresponds to discharging operation, and unshaded regions correspond to idle operation. The error peaks occur mainly at the mode-transition instants due to abrupt changes in the reference-current command.
Mathematics 14 03197 g010
Figure 11. Distribution of the current-tracking error.
Figure 11. Distribution of the current-tracking error.
Mathematics 14 03197 g011
Figure 12. Instantaneous converter efficiency during the simulated operating sequence. The shaded background regions indicate the active operating mode: green regions correspond to charging operation, the red region corresponds to discharging operation, and unshaded regions correspond to idle operation.
Figure 12. Instantaneous converter efficiency during the simulated operating sequence. The shaded background regions indicate the active operating mode: green regions correspond to charging operation, the red region corresponds to discharging operation, and unshaded regions correspond to idle operation.
Mathematics 14 03197 g012
Figure 13. Estimated converter loss power during the simulated operating sequence. The shaded background regions indicate the active operating mode: green regions correspond to charging operation, the red region corresponds to discharging operation, and unshaded regions correspond to idle operation. The estimated loss power is higher during active power-transfer intervals and lower during idle operation.
Figure 13. Estimated converter loss power during the simulated operating sequence. The shaded background regions indicate the active operating mode: green regions correspond to charging operation, the red region corresponds to discharging operation, and unshaded regions correspond to idle operation. The estimated loss power is higher during active power-transfer intervals and lower during idle operation.
Mathematics 14 03197 g013
Figure 14. Internal energy balance of the simplified converter model.
Figure 14. Internal energy balance of the simplified converter model.
Mathematics 14 03197 g014
Figure 15. Eigenvalues of the conditional one-step sensitivity matrices for the three fixed operating modes.
Figure 15. Eigenvalues of the conditional one-step sensitivity matrices for the three fixed operating modes.
Mathematics 14 03197 g015
Figure 16. Spectral radius of the conditional one-step sensitivity matrix for charging, idle, and discharging.
Figure 16. Spectral radius of the conditional one-step sensitivity matrix for charging, idle, and discharging.
Mathematics 14 03197 g016
Table 1. Main simulation parameters used in the Python model.
Table 1. Main simulation parameters used in the Python model.
ParameterSymbolValueUnit
Source voltage U s 48.0V
Source resistance R s 1.0Ω
Load resistance R load 25.0Ω
Inductance L 5.0mH
Inductor resistance R L 0.15Ω
DC-link capacitance C DC 4.7mF
Minimum duty cycle d min 0.05-
Maximum duty cycle d max 0.95-
Proportional current gain K p 0.025A−1
Integral current gain K i 2.5A−1·s−1
Anti-windup limit I max 0.30-
Nominal battery capacity Q n 20.0Ah
Battery ohmic resistance R 0 0.08Ω
Polarization resistance R p 0.05Ω
Equivalent polarization capacitance C p 800.0F
Polarization time constant τ p 40.0s
Charging efficiency η ch 0.98-
Discharging efficiency η dis 0.96-
Minimum state of charge S O C min 0.10-
Maximum state of charge S O C max 0.95-
Initial state of charge S O C 0 0.55-
Total simulation time T 60.0s
Time step Δ t 1.0ms
Charging reference current I ch 3.0A
Discharging reference current I dis −4.0A
Final charging reference current I ch , 2 2.0A
SOC scaling factor K SOC 1.0-
Table 2. Current-tracking and full-profile dynamic indicators obtained from the simulation.
Table 2. Current-tracking and full-profile dynamic indicators obtained from the simulation.
MetricSymbolValueUnit
Root-mean-square current error RMSE i 0.0863A
Mean absolute current error MAE i 0.0045A
Integral absolute error IAE 0.2714A·s
Integral squared error ISE 0.4472A2·s
Integral time-weighted absolute error ITAE 8.6686A·s2
Peak inductor current i L , max 4.3684A
Current overshoot M p , i 0.3684A
Current overshoot M p , i , % 9.2094%
Last tolerance-band re-entry time (full profile) t s 51.0240s
Full-profile inductor-current range Δ i L , pp 4.3684A
Table 3. Energy and loss indicators under the simplified conduction-oriented model.
Table 3. Energy and loss indicators under the simplified conduction-oriented model.
MetricSymbolValueUnit
Converter input energy E in 1.6091Wh
Converter output energy E out 1.5868Wh
Estimated converter loss energy E loss 0.0223Wh
Estimated conduction-oriented energy efficiency η E 98.6166%
Mean estimated conduction-oriented efficiency η 98.6799%
Peak converter loss power p loss , max 7.9775W
Charged battery energy E ch 0.7488Wh
Discharged battery energy E dis 0.8521Wh
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Stanchev, P.; Hinov, N.; Gocheva, P.; Gochev, V. A Hybrid Index Matrix Framework for Python-Based Modeling, Simulation, and Local One-Step Sensitivity Diagnostics of Bidirectional DC–DC Converters. Mathematics 2026, 14, 3197. https://doi.org/10.3390/math14173197

AMA Style

Stanchev P, Hinov N, Gocheva P, Gochev V. A Hybrid Index Matrix Framework for Python-Based Modeling, Simulation, and Local One-Step Sensitivity Diagnostics of Bidirectional DC–DC Converters. Mathematics. 2026; 14(17):3197. https://doi.org/10.3390/math14173197

Chicago/Turabian Style

Stanchev, Plamen, Nikolay Hinov, Polya Gocheva, and Valeri Gochev. 2026. "A Hybrid Index Matrix Framework for Python-Based Modeling, Simulation, and Local One-Step Sensitivity Diagnostics of Bidirectional DC–DC Converters" Mathematics 14, no. 17: 3197. https://doi.org/10.3390/math14173197

APA Style

Stanchev, P., Hinov, N., Gocheva, P., & Gochev, V. (2026). A Hybrid Index Matrix Framework for Python-Based Modeling, Simulation, and Local One-Step Sensitivity Diagnostics of Bidirectional DC–DC Converters. Mathematics, 14(17), 3197. https://doi.org/10.3390/math14173197

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop