1. Introduction
The increasing deployment of distributed battery energy storage systems (BESSs) within renewable-integrated power networks has transformed electrochemical storage units from passive backup devices into dynamically interacting energy assets. Lithium-ion batteries are now routinely embedded within hybrid solar-grid architectures, microgrids, and distributed prosumer environments, where they operate under rapidly varying charging and discharging conditions dictated by renewable intermittency, load variability, and supervisory control policies [
1,
2,
3,
4]. In [
1], a comprehensive assessment of distributed BESS integration highlights the operational challenges introduced by renewable intermittency and stochastic load behavior. Similarly, reference [
2] analyzes coordinated battery operation within grid-connected microgrids and demonstrates the necessity of dynamic control under fluctuating renewable inputs. The authors in [
3] investigate the interaction between distributed storage and feeder-level voltage stability, showing that rapid power transitions can significantly alter local voltage profiles. In [
4], a hybrid renewable-storage framework is examined, emphasizing the nonstationary nature of battery charging regimes in real-world systems. Collectively, these studies establish that modern BESS units operate under highly dynamic conditions that depart from quasi-static design assumptions. Yet, despite this recognition, existing monitoring approaches have not adapted to these dynamics; they continue to rely on static thresholds that fail to capture trajectory-level behavior during rapid mode transitions.
Unlike conventional stationary loads, lithium-ion batteries exhibit tightly coupled electrochemical and thermal dynamics. Terminal voltage depends nonlinearly on state of charge (SoC) and internal resistance, while thermal behavior is driven by Joule heating and convective dissipation. In [
5], an equivalent circuit model incorporating SoC-dependent open-circuit voltage is validated experimentally, demonstrating strong nonlinear coupling between current and terminal voltage. The electro-thermal interaction is further quantified in [
6], where lumped thermal models are shown to accurately capture temperature rise during high-current charging. Reference [
7] provides a detailed analysis of heat generation mechanisms in lithium-ion cells, linking internal resistance to irreversible entropy production. More recently, reference [
8] presents a combined electrochemical–thermal model for fast-charging scenarios, illustrating the amplification of temperature gradients under transient power conditions. These results confirm that electro-thermal coupling must be explicitly considered when analyzing dynamic battery behavior. However, the coupling between electrical and thermal dynamics is often treated separately in monitoring algorithms, leaving the coordinated detection of electro-thermal deviations, where a temperature rise coincides with abnormal voltage behavior, largely unaddressed.
If improperly monitored, such interactions may lead to over-voltage, over-current, or thermal excursions, potentially accelerating degradation or triggering protection mechanisms. The degradation mechanisms associated with high current stress are examined in [
9], where capacity fade is shown to correlate with repeated current spikes. In [
10], thermal runaway propagation under abnormal current profiles is experimentally characterized, emphasizing the safety-critical role of temperature monitoring. These studies underscore that dynamic deviations can precede threshold violations and therefore require trajectory-level supervision. Yet, current monitoring frameworks lack the capability to detect such precursors because they are designed to react to limit violations rather than to anticipate them through trajectory analysis.
Conventional battery management systems (BMSs) rely primarily on threshold-based protection mechanisms, enforcing limits on voltage, current, temperature, and SoC. In [
11], industrial BMS architectures are surveyed, showing that hard constraint enforcement remains the dominant protection strategy. Reference [
12] describes a multi-threshold safety scheme used in automotive battery packs, highlighting its reactive nature. In [
13], over-voltage and over-temperature detection algorithms are analyzed, revealing that threshold violations often occur after significant dynamic inconsistency has already developed. While effective for preventing catastrophic failure, such mechanisms operate reactively and do not characterize the admissible trajectory structure of the battery under dynamic hybrid operation. Consequently, they offer no insight into whether the battery is approaching an unsafe condition until the limit is already breached, a fundamental limitation that motivates the need for predictive, trajectory-aware monitoring.
To address these limitations, a substantial body of work has explored model-based state estimation and observer design for lithium-ion batteries. In [
14], an extended Kalman filter is applied to SoC estimation using an equivalent circuit model, demonstrating improved estimation accuracy under variable loads. Reference [
15] introduces a dual Kalman filtering scheme that jointly estimates SoC and internal resistance, thereby capturing slow parameter drift. The authors in [
16] present a nonlinear observer for reduced-order electrochemical battery models, formulated using Lyapunov’s direct method and solved via linear matrix inequalities (LMIs). This approach explicitly guarantees robust state reconstruction under parameter uncertainty, a critical advancement over conventional estimators that lack proof of formal stability. In [
17], adaptive estimation is proposed using a descriptor system framework with LMI-based design conditions, which explicitly compensates for aging-induced parameter changes while ensuring a guaranteed region of convergence and peak-to-peak performance bounds against exogenous inputs—moving beyond heuristic adaptation rules. More recently, reference [
18] investigates observer-based thermal state estimation under aggressive charging conditions, employing a fractional-order model integrated with an
H∞ filter and adaptive noise covariance adjustment. Although these methods significantly advance state reconstruction through provable convergence properties and uncertainty handling, they focus primarily on estimation accuracy and do not explicitly define admissible trajectory manifolds for deviation detection. In other words, they tell us where the state is, but not whether the trajectory that produced it is physically admissible under the system’s dynamic constraints, a distinction that is critical for early anomaly detection.
In parallel, data-driven and machine learning techniques have been introduced for battery fault detection and anomaly identification. In [
19], a deep generative modeling approach is proposed, employing an autoencoder within a generative adversarial network (GAN) framework to detect internal short circuits from voltage signatures. The method learns a low-dimensional manifold of nominal voltage behavior and identifies faults through reconstruction error analysis, achieving detection of weak short circuits within 1.6 h without requiring labeled fault data for training. In [
20], a regularized linear classifier with elastic net penalization is developed to predict battery cycle life before observable capacity degradation. By extracting voltage trajectory features from the first 100 cycles, the model identifies that variance in discharge voltage capacity is the most predictive feature, enabling classification of batteries into long-life and short-life groups with 90% accuracy using only early-cycle data. Reference [
21] introduces CGMA-Net, a fusion deep learning architecture combining convolutional neural networks (CNNs), gated recurrent units (GRUs), and multi-head self-attention mechanisms for state-of-health estimation from electrochemical impedance spectroscopy data. The model captures both spatial features across frequency spectra and temporal dependencies across aging cycles, while the attention mechanism provides interpretability by quantifying which frequency regions contribute most to degradation predictions. Although these supervised and semi-supervised approaches demonstrate strong predictive capability, they require extensive training data and may not generalize to anomalous patterns outside their training distributions. Moreover, their purely data-driven nature provides no mechanism to enforce physical consistency, meaning that a prediction may satisfy statistical patterns while violating fundamental electro-thermal constraints, which is a risk that is unacceptable in safety-critical applications.
Unsupervised anomaly-detection methods have also been investigated. In [
22], a Bayesian convolutional autoencoder with adaptive mixture priors is combined with unsupervised clustering to identify atypical degradation behavior in lithium-ion batteries without requiring fault labels, using latent feature extraction from raw data. The authors in [
23] apply a convolutional autoencoder to incremental capacity analysis and recurrence plot images derived from charging profiles, achieving high AUC scores (>0.91) for detecting subtle cell-level anomalies without labeled fault data. Reference [
24] introduces an adaptive Isolation Forest with Sub-Forest progressive updating, demonstrating computational efficiency for high-dimensional streaming data in smart grid monitoring by dynamically adapting to concept drift without manual intervention. In [
25], one-class SVM and Isolation Forest are applied to detect cyber-physical anomalies in distributed energy resources, identifying pre-attack phases through boundary learning and anomaly scoring without requiring labeled attack data. Similarly, reference [
26] presents a survey on cyberattacks’ impact on battery energy sources, including unsupervised intrusion detection using LSTM autoencoders within energy management systems. Additionally, Zhao et al. proposed an unsupervised minor short-circuit fault diagnosis framework integrating hybrid feature extraction with deep support vector data description, achieving a 94% detection rate with a 3% false alarm rate while maintaining computational efficiency suitable for real-time deployment [
27]. Similarly, Arulmozhi et al. presented a hybrid framework combining Isolation Forest with heuristic fault analysis, demonstrating 90–95% accuracy in detecting internal short circuits and thermal anomalies in lithium-ion batteries [
28]. Although these approaches demonstrate the viability of unsupervised learning for anomaly detection, they typically operate independently of first-principles electro-thermal models. Consequently, the physical interpretability of detected anomalies and their consistency with admissible battery dynamics are not formally established. This separation between data-driven detection and physics-based verification leaves a critical gap: anomalies may be flagged for purely statistical reasons without any guarantee that they represent genuine electro-thermal inconsistencies.
More broadly, anomaly detection in power systems has increasingly adopted hybrid frameworks combining physics-based constraints with data-driven techniques [
29,
30,
31,
32,
33]. In [
29], a survey of hybrid AI-physics anomaly detection in smart grids demonstrates that integrating physical laws with data-driven methods improves robustness over purely data-driven approaches for cyberattack and equipment-failure detection. Reference [
30] develops an adaptive physics-informed neural network (PINN) for battery state estimation using a temperature-coupled extended single particle model. The framework enforces electrochemical consistency through the model structure, achieving 77.95% lower error than GRU and 57.95% lower than LSTM—directly validating physics-constrained learning for BESS under dynamic operation. Reference [
31] proposes a PINN for joint SOC, SOP, and SOH estimation with explicit safety constraints, embedding electrochemical limits into the network to enable trajectory-level supervision that detects deviations before threshold violations occur. Reference [
32] introduces SL-DSVDD, a scale-learning deep support vector data description network for battery anomaly detection that addresses variability deception through hypersphere geometry and distributional feature alignment, enabling unsupervised detection with physical interpretability. Similarly, Kumar et al. introduced an Improved Random Forest framework integrating physics-informed methodologies with data-driven models for predictive maintenance, achieving a classification accuracy of 99.99% with no false negatives, demonstrating the viability of tree-based ensemble methods for real-time battery health diagnostics [
33].
These works demonstrate the promise of hybrid modeling, yet their systematic integration for lithium-ion batteries under stochastic hybrid supply remains limited. Specifically, no existing framework simultaneously addresses:
- (i)
Power-feasibility constraints arising from the quadratic voltage–current–power coupling in BESS;
- (ii)
Stochastic mode switching due to renewable intermittency;
- (iii)
Trajectory-level deviation detection that combines physics-based reachability with empirical support estimation, the gap that motivates the present work.
Motivated by these gaps, this paper proposes a hybrid electro-thermal deviation detection framework for lithium-ion batteries operating under stochastic hybrid supply conditions. The core idea is to treat anomaly detection not as a purely statistical classification task nor as a simple threshold-violation problem but as a trajectory-consistency problem defined over a Markov jump nonlinear system with power-feasible dynamics. The main contributions of this work are as follows:
Disturbance-robust invariant region for BESS: A forward invariant operating region is established under explicit current bounds and bounded disturbances, ensuring that the electro-thermal state of the lithium-ion battery remains within safe limits despite mode transitions and measurement uncertainty.
Reachable-set equivalence for dynamic consistency: An equivalence is derived linking residual consistency to disturbance-augmented trajectory membership, enabling computationally efficient online verification of dynamic consistency without explicit reachable-set recomputation, which is a formal guarantee for battery trajectory monitoring.
Empirical support estimation for BESS trajectory manifolds: Building upon the analytical model, Markov-constrained Isolation Forest is proposed as an unsupervised support estimator that approximates the nominal electro-thermal trajectory manifold, capturing nonlinear and mode-dependent behaviors not fully described by the analytical disturbance bounds.
Proposing a unified sequential detection rule: A detection mechanism integrates structural violations, model-based residuals, and empirical support inconsistencies into a coherent sequential monitoring algorithm with persistence filtering for false alarm suppression.
Experimental validation on a hybrid solar-grid BESS platform: The proposed framework is validated on a hybrid solar-grid battery Raspberry Pi platform under multiple operating modes. Results demonstrate detection of dynamic inconsistencies during mode transitions and depletion events prior to threshold violations, with robustness to bounded disturbances and measurement noise.
The remainder of this paper is organized as follows.
Section 2 presents the hybrid electro-thermal Markov model with explicit power-feasibility constraints.
Section 3 develops the invariant-region and trajectory-support-based deviation detection framework.
Section 4 presents the developed experimental prototype for this work.
Section 5 presents case study and discuss results.
Section 6 concludes the paper.
2. Hybrid Electro-Thermal Markov Model with Power-Feasible Dynamics
The lithium-ion storage unit operates under a hybrid solar-grid supply with time-varying load demand. The modeling objective is to derive a discrete-time, electro-thermal representation that (i) preserves charge and energy consistency, (ii) resolves the voltage–current–power algebraic coupling explicitly, (iii) formalizes mode-dependent admissible inputs, and (iv) admits bounded disturbance analysis. Let the system be sampled at instants
k ∈
Z ≥ 0 with sampling period Δ
t > 0. The minimal dynamic state is defined as
where
∈ [0, 1] denotes the SoC, and
Tk ∈
R denotes the cell temperature. Stored energy is treated as a derived quantity as follows:
with C
nom being the nominal capacity (Ah) and
being the nominal voltage. Equation (2) is not a dynamic constraint but an algebraic definition; hence,
Ek is excluded from the state vector to avoid redundancy. The battery operates under discrete modes reflecting the supply configuration. Let
qk ∈
Q denote the mode at time
k, where
Q = {1, 2, 3, 4} corresponds to solar charging, grid charging, mixed charging, and discharge-only operation.
The mode evolution is modeled as a time-homogeneous Markov chain:
Let the external power components be
representing solar input, grid input, and load demand, respectively. The net battery power is defined as
Mode–input coupling is formalized by defining a mode-dependent admissible set
where, for example,
Thus, the Markov chain governs supply configuration, while the input vector is constrained accordingly. This yields a well-defined Markov jump system with constrained inputs.
The terminal voltage is modeled by a first-order equivalent circuit:
where
is continuously differentiable and strictly positive on [0, 1], and
> 0 is internal resistance. Now, net battery power satisfies the following:
Substituting Equation (8) into Equation (9) yields
which rearranges to the quadratic equation in the current:
The discriminant condition is required for real-valued solutions. Hence, the following inequality constitutes a power feasibility constraint induced by internal resistance.
The physically admissible branch is
which ensures continuity with respect to
Pk and yields
→
Pk/
as
Rint → 0. Terminal voltage is then computed from
Equations (11)–(14) explicitly resolve the algebraic loop. For given
and
Pk, current and voltage are uniquely determined whenever Equation (12) holds. Additionally, charge conservation gives
where
η ∈ [0, 1] is coulombic efficiency, and
models bounded integration error or sensor noise satisfying:
Then, thermal evolution is modeled as
with
Cth > 0 being thermal capacitance,
h > 0 being heat transfer coefficient, and bounded disturbance as follows:
To ensure numerical stability of the explicit Euler discretization, the sampling period must satisfy the following:
Condition (20) guarantees that the homogeneous thermal subsystem remains stable in discrete time. It is worth mentioning that for the Motorola BP7X battery utilized in this study, with an estimated thermal capacitance ≈ 50 J/K and heat transfer coefficient h ≈ 0.2 W/K, Condition (20) yields Δt < 500 s, which is satisfied by the chosen Δt = 30 s.
To unify the continuous electro-thermal dynamics with the discrete charging-state transitions, we construct a compact hybrid representation of the system. By substituting the previously derived expressions, the overall model is expressed as a Markov jump nonlinear system with structured and bounded disturbance terms, enabling tractable stability and robustness analysis. Substituting Equation (13) into Equations (15) and (19), the closed-form Markov jump nonlinear system is
where
The disturbance components satisfy the component-wise bounds as follows:
Equivalently, the disturbance set is the rectangle:
In addition to the power feasibility constraint Equation (12), admissible operation requires
where
= 2.75 V and
= 4.2 V are the battery’s manufacturer-specified voltage limits, and
= 45 °C is the recommended maximum operating temperature for safe operation.
Lemma 1. Charge–Power Consistency.
Under Equations (13) and (15), if δk(z) = 0, then Proof. From Equation (13), sign = sign (Pk). Substituting into Equation (15) yields the result. □
3. Hybrid Reachability, Support Estimation, and Sequential Deviation Detection
The hybrid electro-thermal model developed in
Section 2 defines a Markov jump nonlinear system with bounded disturbances and power-feasible input constraints. The purpose of this section is threefold. First, to establish a rigorously defined, robust forward invariant region under bounded current and disturbance. Second, to characterize admissible trajectories via reachable-set geometry in a manner compatible with disturbance bounds. Third, to introduce a data-driven support estimator, implemented via Isolation Forest, as a central component of the deviation detection mechanism.
Throughout this section, we adopt the following terminology to maintain precision. The invariant region Ω denotes the disturbance-robust operating set derived in
Section 3.1. The reachable set
refers to the one-step forward propagation of a given state under the nominal dynamics plus bounded disturbances, as defined in
Section 3.2. The empirical support
denotes the data-driven estimate of the nominal trajectory manifold obtained via Isolation Forest in
Section 3.3. These three constructs—invariant region, reachable set, and empirical support—form the basis of the unified detection rule in
Section 3.4.
3.1. Robust Forward Invariant Region
Robust forward invariance requires that the input-induced state increments remain compatible with both the electrochemical constraints and the disturbance bounds; we therefore begin by characterizing the admissible current structure.
From Equation (13), the current
ik is a function of
zk and
Pk. The admissible power set
P(
zk) defined in Equation (36) implies that real solutions exist only if
In addition, the hardware constraint must hold as follows:
where
is the maximum continuous discharge current specified by the battery manufacturer (Motorola BP7X, 2.5 A) used in this work. This bound ensures operation remains within the battery’s rated electrical limits; converter current limits from the PiJuice HAT (the experimental platform in this study, rated at 3 A) are less restrictive and therefore do not further constrain operation. The effective current bounds are therefore
where
These bounds are finite for all
zk ∈ [0, 1] because
is bounded and strictly positive. Let
Then, the SoC update is given as
The worst-case increase in SoC occurs under maximal charging current
ik =
imin (
zk) ≤ 0, yielding
The worst-case decrease in SoC occurs under maximal discharging current
ik =
imax (
zk) ≥ 0, yielding
To ensure forward invariance within a tightened interval
It is sufficient to require
and
Since the suprema are finite by Equation (33), such
ρz exists. A similar argument applies to temperature. From Equation (19),
Because ∣
ik∣ ≤
, we obtain a finite bound on
. Hence, the temperature increment is uniformly bounded above and below, and there exists
ρT > 0 such that
All bounds employed in the invariant region analysis are derived from the Motorola BP7X battery datasheet and the PiJuice HAT power management module specifications. The current bound = 2.5 A is determined by the battery’s maximum continuous discharge rating, while the voltage limits correspond to the cell’s safe operating window. The temperature bound is conservatively set below the thermal runaway threshold to maintain operation within the nominal safety envelope. This establishes rigorous disturbance-robust forward invariance of an invariant region Ω.
3.2. Reachable Sets and Minkowski Representation
Having established robust invariance conditions, we next describe the disturbance-induced state propagation through a reachable-set formulation corresponding to the hybrid dynamics.
For fixed
xk and
qk, let us define the nominal prediction as follows:
With disturbance set
defined in Equation (25), the one-step reachable set is
where ⊕ denotes Minkowski sum. This representation is equivalent to Equation (40) but avoids the recomputation of the full reachable geometry online. The residual
Define component-normalized residual and model-based deviation functional as follows:
then
The mode-increment inequalities (Equations (48) and (49)) are now interpreted as necessary but not sufficient consistency checks, subordinate to Equation (49).
3.3. Empirical Support Estimation via Isolation Forest
The model-based reachable set Φ
qk(
xk) assumes that the disturbance bounds fully characterize admissible variation. In practice, additional nonlinearities, sensor bias, and mode-transition artifacts generate trajectory variations not captured by
. To reconcile model-based reachability with empirical trajectory distributions, we construct a data-driven approximation of the empirical support
, the region of the state space where nominal trajectories reside under mode
q, as follows:
Isolation Forest is employed to estimate a level set
where
is the normalized isolation score, and
is chosen to match the nominal contamination level. It is worth mentioning that while Isolation Forest is conventionally used for outlier detection, its anomaly score can be interpreted as an inverse measure of empirical density. By thresholding at a specified contamination level, the resulting level set
provides a data-driven approximation of the support of the nominal trajectory distribution under mode
q; a standard approach in unsupervised anomaly detection [
24,
25]. This interpretation aligns with the geometric view of anomaly detection as identifying points outside the nominal manifold. The ML deviation functional is defined as
This measures distance to empirical support. Isolation Forest, therefore, approximates the true reachable-support set
with inclusion holding approximately under consistent training. Isolation Forest therefore approximates the empirical support of nominal trajectories, which is generally larger than the disturbance-augmented reachable set due to unmodeled nonlinearities and measurement artifacts. Under consistent training, the inclusion of Condition (53) holds approximately, meaning that the empirical support serves as a superset that captures behaviors described by the analytical disturbance bounds.
3.4. Unified Hybrid Detection Rule
Having established (i) a disturbance-robust invariant electro-thermal region, (ii) a model-based one-step reachable set characterization, and (iii) an empirical approximation of nominal trajectory support, we now synthesize these elements into a unified hybrid detection rule. The objective is to construct an instantaneous anomaly indicator that jointly accounts for constraint violations, model-consistency deviations, and data-driven support inconsistencies. This is to ensure that deviations are detected only when they violate either physical invariance, reachable-set geometry, or learned nominal support, thereby preserving consistency with both the analytical model and empirical operational data.
Define structural violation indicator:
And define model-based violation, as follows:
Define ML-based deviation:
Then, the unified instantaneous anomaly indicator is
It is worth mentioning that the three detection layers are not redundant but complementary, each capturing a distinct aspect of abnormal behavior. The structural indicator
flags physical violations that no admissible trajectory should exceed. The model-based indicator
detects dynamic inconsistency: a one-step transition that cannot be explained by the nominal dynamics plus bounded disturbances. The ML-based indicator
detects departure from the empirical trajectory manifold; the current state is atypical relative to historical nominal operation, even if the one-step transition is dynamically consistent. Consequently, when
alone triggers, the system has experienced a transient disturbance that quickly returns to the empirical manifold; on the other hand, when
alone triggers, the system has drifted to an atypical region through dynamically consistent steps. When both trigger simultaneously, the system has undergone an abrupt anomaly that violates both dynamic consistency and historical regularity, constituting the strongest indication of a fault. Hence, the sequential persistence rule is defined as
The persistence window length m is chosen as m = 3 based on the sampling interval Δt = 30s, yielding a 90-s observation horizon. This duration is sufficiently short to detect sustained electro-thermal deviations before they evolve into hard constraint violations, yet sufficiently long to suppress isolated spurious detections arising from sensor noise or brief transients, consistent with the exponential false alarm suppression property that is discussed in the next subsection.
The detection algorithm is therefore hybrid in a rigorous sense. At each time step, three distinct criteria are evaluated simultaneously: hard constraint violations that no admissible trajectory should exceed, model-consistent residual violations indicating departures from the disturbance-augmented dynamics, and empirical support violations flagged when the state falls outside the region where normal operation has been observed. Any one of these three conditions triggers an instantaneous flag, and a persistent anomaly is declared when the flags accumulate over a sliding window. The result is a multi-layered monitor that combines the guarantees of first-principles models with the flexibility of data-driven support estimation.
3.5. Analytical Properties and Consistency of the Hybrid Detection Framework
The unified detection mechanism defined by Equations (54)–(58) combines structural constraints, model-consistent residual analysis, and empirical support estimation. In this subsection, we formalize several properties of the resulting detection framework under nominal bounded disturbances and consistent training conditions.
We first characterize the behavior of the residual-based deviation functional under disturbance-consistent evolution. Assume that the system evolves according to
with disturbance set
defined in Equation (25), and that the power feasibility constraint Equation (12) and admissible input Condition (6) hold. From Equation (45), the residual satisfies
Therefore, from Equation (47),
This yields the following result.
Proposition 1. No False Model-Based Alarm Under Nominal Disturbance.
If the electro-thermal system evolves according to Equation (59) with δk∈ , thenand consequently, This establishes that the model-based residual test is consistent with the disturbance characterization and does not generate false alarms under nominal bounded perturbations.
From Equation (44), the reachable set is The conditionis equivalent to Therefore, the normalized residual test (Equation (48)) is equivalent to checking membership in the disturbance-augmented reachable set, as the following proposition highlights.
Proposition 2. Equivalence of Residual and Reachable-Set Condition.
Thus, the residual test provides a computationally efficient surrogate for online reachable-set membership without explicitly recomputing .
The model-based reachable set accounts only for bounded disturbances within the analytical model. In practice, unmodeled nonlinearities, sensor bias, discretization artifacts, and mode-transition effects induce trajectory variations beyond Let the empirical trajectory support under normal operation and mode q be Isolation Forest constructs a score function sq(x) and corresponding level set, as follows:which approximates from data. Under standard assumptions for isolation-based support estimation (finite contamination; i.i.d. sampling of nominal trajectories), the estimator converges in probability to a level-set approximation of as the training sample size increases. While a full statistical convergence proof is beyond the scope of this work, the key implication for detection is the following:
Proposition 3. Empirical Support Consistency Under Nominal Operation.
Assume that (i) the system operates under nominal bounded disturbances, (ii) training data are drawn from the same distribution as nominal operation, and (iii) the contamination parameter is correctly specified. Then, with high probability,under nominal conditions, implying This establishes that the ML-based component does not contradict the model-based framework but enlarges the admissible set from the disturbance-rectangular region
to the empirically observed support
The unified detection rule is
The unified detection rule given in Equation (73) combines three distinct indicators, each serving a specific purpose in the monitoring hierarchy. The structural indicator detects hard constraint violations that no admissible trajectory should ever exceed. The model-based indicator flags dynamic inconsistency relative to the analytical electro-thermal model, identifying transitions that fall outside the disturbance-augmented reachable set. The ML-based indicator captures deviations from the empirical support of normal trajectories learned from historical operation.
The ML layer plays a distinct role not fully covered by the model-based check. Because the empirical support set learned by Isolation Forest is generally larger than the disturbance-rectangular set implied by , it does not simply duplicate the model-based detection. Instead, it primarily captures three types of behavior that the analytical model may miss: nonlinear transition artifacts arising from unmodeled dynamics, slowly drifting behaviors that remain within instantaneous residual bounds, and structured deviations that do not manifest as large one-step residuals but nevertheless depart from historically observed patterns.
It is worth mentioning that the persistence rule (Equation (58)) introduces a temporal filter, as follows:
If the instantaneous false alarm probability under nominal conditions is
p ≪ 1, then the probability of triggering a false alarm under independence approximation satisfies
The persistence parameter m thus provides exponential suppression of isolated spurious detections while preserving sensitivity to sustained deviations.
Finally, the proposed hybrid detection framework is physically grounded through robust invariant-region analysis, dynamically consistent via equivalence between residual consistency and reachable-set membership, empirically adaptive through Isolation Forest support estimation, and sequentially robust via persistence filtering. The analytical components introduced above are consolidated into the computational procedure summarized in Algorithm 1, which outlines the real-time implementation of the hybrid electro-thermal anomaly-detection framework. This provides a complete theoretical foundation for the experimental validation presented in the following section.
| Algorithm 1. Hybrid electro-thermal deviation detection |
| Initialization (Offline) |
| 1 | Set battery parameters:
|
| 2 | |
| 3 | |
| 4 | |
| Online Monitoring (At each sampling instant ) |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | go to 21 |
| 10 | |
| 11 | |
| 12 |
|
| 13 | Nominal prediction |
| 14 | |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 | |
| 19 | |
| 20 | |
| 21 |
|
| 22 |
|
| 23 | then trigger alert |
| 24 | go to 5 |
4. Experimental Setup
The proposed framework was implemented on a hybrid solar-grid battery platform comprising a 6 W photovoltaic panel, a 3.7 V 1820 mAh lithium-ion battery, a PiJuice HAT power management module, and a Raspberry Pi 4 for load and data acquisition. The PiJuice HAT performs automatic power-path selection, generating four operating modes corresponding to those defined in
Section 2: solar charging, grid charging, mixed charging, and discharge-only operation.
Figure 1 shows the experimental hardware developed for this work, whereas
Figure 2 presents a schematic system architecture of the developed hardware set.
Data were collected over four consecutive days at 30-s sampling intervals. The sampling period is Δt = 30, corresponding to a sampling frequency of 1/30 Hz. Recorded quantities include voltage, current, SoC, temperature, source identification, and charging status. Operational state classification was performed in real time based on current direction, SoC trends, and source voltage presence. The feature vector combined instantaneous measurements with rolling window statistics from the most recent twenty samples. The complete feature vector comprises 18 dimensions: instantaneous measurements (voltage, current, SoC, temperature, and net power), temporal derivatives (ΔSoC and Δvoltage computed over one sampling interval), rolling window statistics (mean and standard deviation of voltage and current over the most recent twenty samples), cumulative energy metrics (charged and discharged energy), and one-hot encoded categorical variables for operating mode (solar charging, grid charging, mixed charging, and discharge) and power source (solar, grid, and battery). All features are normalized using a fitted StandardScaler prior to model training and inference.
Isolation Forest was configured with 100 estimators and 5% contamination. The model employs bootstrap sampling with a maximum sample size of 256 per tree, parallel processing across all available CPU cores, and a random state of 42 for reproducibility. Training follows the standard Isolation Forest algorithm: for each tree, a random subsample of the training data is drawn, and recursive random partitioning isolates observations. Anomaly scores are computed as the average path length normalized by the expected path length for random trees, with scores below zero indicating increasing anomaly likelihood. The contamination parameter was set to 5% based on empirical analysis of the training dataset, which showed that approximately 4.8% of samples exhibited minor deviations under nominal operation. This value serves as an upper bound on the expected anomaly rate, ensuring that the Isolation Forest threshold
is set conservatively to capture true deviations while maintaining sensitivity. The persistence rule (
Section 3.4) further suppresses any isolated false positives that may arise from this threshold selection. Training on 3976 samples required 0.8 s on the Raspberry Pi, confirming edge deployment feasibility.
To assess real-time deployment feasibility, the computational latency of the complete detection pipeline was measured over 1000 consecutive inference cycles on the Raspberry Pi 4. The average per-cycle execution time was 47 ms (standard deviation 12 ms), well within the 30-s sampling interval. This timing encompasses measurement acquisition, state classification, feature vector construction (including rolling window statistics from the most recent twenty samples), feature normalization, Isolation Forest score computation, and evaluation of the three-layer detection logic with persistence filtering. The peak memory footprint of the Python runtime (version 3.10), including the loaded Isolation Forest models, feature scalers, and data buffers, was measured at 156 MB. The sequential detection rule updates at the same 30-s sampling interval, with the persistence window m = 3 corresponding to a 90-s observation horizon before alert generation.
5. Case Study and Results
The proposed hybrid electro-thermal detection framework was evaluated using the four-day dataset described in
Section 3, comprising 3976 samples collected at 30-s intervals under hybrid solar-grid operation. The objective of this case study is not merely to demonstrate anomaly-detection capability but to verify consistency between the disturbance-robust invariant region, the reachable-set formulation, and the empirical support estimator under realistic operating conditions involving source intermittency, load variation, and charge–discharge cycling. It is important to emphasize that the purpose of this experimental study is not to claim statistical generalization across all operating conditions but rather to validate the structural consistency between the proposed analytical framework and real electro-thermal system behavior under hybrid solar-grid operation. The dataset is designed to capture representative transitions, including charging–discharging switching, depletion dynamics, and thermal coupling, which constitute the primary mechanisms targeted by the proposed detection formulation.
In this study, an anomaly is defined as any deviation from nominal electro-thermal behavior that manifests in one of three forms: (i) violation of structural constraints (voltage, current, temperature, or SoC limits); (ii) dynamic inconsistency, where the one-step transition falls outside the disturbance-augmented reachable set; or (iii) departure from the empirical support of nominal trajectories learned from historical data. All anomalies reported in this study are naturally occurring; they arise from transient dynamics during mode transitions (solar-to-discharge switching), depletion behavior at low state of charge, or electro-thermal coupling effects under fluctuating solar input.
The hybrid detection framework’s three-layer architecture is first evaluated against the complete four-day training dataset, as shown in
Figure 3, which synchronizes voltage, current, power, SoC, cumulative energy, temperature, and anomaly score across a common time axis. Specifically, the measured state trajectory remains fully contained within the admissible electro-thermal region defined in
Section 3, with no violation of voltage, temperature, or SoC constraints. This confirms that the invariant set Ω is respected under hybrid solar-grid operation. The anomaly score distribution is concentrated near zero, indicating that the learned support set
S accurately approximates the reachable state manifold. Minor negative score excursions are temporally aligned with rapid current polarity reversals and short voltage relaxations. Electrically, these correspond to internal resistance transients and converter switching dynamics. From the geometric standpoint of the model, these events move the trajectory toward lower-density regions of the learned support without exiting it. This behavior validates the interpretation of anomaly detection as boundary proximity in state space rather than threshold violation in a single electrical variable.
Figure 4 examines depletion behavior through the joint evolution of SoC and terminal voltage. The nonlinear coupling follows the expected lithium-ion discharge characteristic: a flat mid-region near 3.7 V followed by a steeper decline below 20% SoC. Deviation indicators appear before SoC approaches the hardware threshold of 10%, indicating sensitivity to trajectory curvature rather than absolute limit violation. This behavior is explained electrochemically: as SoC decreases, effective internal resistance increases, causing greater voltage sensitivity to current fluctuations. The model-based layer detects this as increased residual magnitude when the linearized disturbance bounds underestimate the actual voltage variation. The ML layer corroborates by flagging points where the SoC-voltage trajectory deviates from the manifold learned during nominal operation. Critically, no significant anomalies (score < −0.1) occur during steady discharge in the flat voltage region, confirming that the contamination parameter yields conservative classification under nominal conditions. The early warning demonstrated here—detection at 20% SoC versus threshold violation at 10%—illustrates the advantage of trajectory-level monitoring over reactive threshold enforcement.
Figure 5 presents thermal behavior and operating state distribution. Battery temperature remains within the optimal range of 25–35 °C, with moderate elevation during sustained discharge due to I
2R losses. No excursions into the warning zone (>45 °C) occur, consistent with the invariant region analysis of
Section 3.1. The operating state distribution shows grid-assisted charging as dominant (52%), followed by discharge (31%) and solar charging (17%). Deviation markers correlate primarily with transitions between these states rather than with any single steady mode. This observation aligns with the reachable-set interpretation: mode switching alters the admissible electro-thermal state space, temporarily increasing trajectory dispersion. From a power electronics perspective, switching between power sources modifies the effective input impedance of the PiJuice HAT power-path controller, introducing short-duration current perturbations. These perturbations propagate through the coupled electro-thermal dynamics, appearing as increased variance in the SoC-power manifold. The ML layer’s sensitivity to these transient regions demonstrates that Isolation Forest effectively learns the geometric structure of the admissible trajectory set rather than merely encoding steady-state averages.
Figure 6 isolates solar-to-discharge transition intervals. Rapid current reversal and temporary voltage dip are evident during loss of solar input. These events reflect the finite response time (approximately 2–3 sampling intervals) of the power-path management circuitry and the battery’s internal electrochemical relaxation dynamics. The unified detection rule activates during these intervals yet remains inactive during steady solar charging and steady discharge. Examining the detection layers individually reveals that
triggers first when the instantaneous residual exceeds disturbance bounds during the initial voltage dip, followed by
as the trajectory moves outside the empirical support region. The sequential activation confirms complementarity: the model-based layer catches abrupt dynamic inconsistency, while the ML layer captures the resulting trajectory deviation. The absence of persistent activation—flags disappear within 2–3 samples—indicates that both the disturbance bounds and empirical support remain compatible with true system behavior once transients settle.
Figure 7 summarizes anomaly score distribution and detection statistics. The score histogram exhibits a dominant mass near zero with a mild left tail corresponding to minor deviations. The overall deviation rate of 4.8% aligns with the configured contamination parameter of 5%. More revealing is the distribution across operating states: deviation density is highest during transition intervals and lowest during steady grid charging. This spatial concentration reinforces the geometric interpretation developed in
Section 3.3: the empirical nominal support
forms a structured manifold in the electro-thermal state space, and deviations appear near its boundaries during dynamic transitions. Notably, only 12% of detected anomalies correspond to isolated single-sample flags; the remaining 88% occur in sequences of two or more consecutive detections. This validates the persistence rule design: isolated spurious detections are exponentially suppressed by the requirement of m consecutive flags, while sustained deviations accumulate and trigger alerts. In this dataset, no false alarms occurred during steady operation, and all transition-related deviations cleared within the persistence window without triggering alerts, demonstrating an appropriate balance between sensitivity and robustness.
To assess sensitivity to the persistence window length, the detection results were recomputed for
m = 2,
m = 3, and
m = 4. For
m = 2, the false alarm rate increased marginally due to isolated single-sample flags crossing the threshold, while for
m = 4, detection of short-duration transition anomalies was delayed by one to two samples, but no anomalies were missed. The chosen value
m = 3 balances prompt detection with robustness to spurious fluctuations, and the overall conclusions regarding anomaly localization and detection timing remain stable across this range. In all, the sensitivity analysis results, summarized in
Table 1, show that detection conclusions remain stable across
m = 2,
m = 3, and
m = 4, with the chosen value m = 3 balancing prompt detection and false alarm suppression.
Lastly,
Figure 8 presents the empirical operating trajectory of the battery projected onto the power–state-of-charge plane. Panel (a) classifies each measurement according to the anomaly score threshold defined in
Section 3: normal operation (score ≥ 0, blue) and anomalous behavior (score < −0.1, red). The resulting visualization reveals that anomalous samples are not uniformly distributed but instead concentrate in two distinct operational regimes. The primary cluster appears below 20% of state of charge during discharge events, exceeding approximately 2 W and corresponding to battery depletion under sustained load, where terminal voltage approaches the cutoff threshold. A secondary concentration of anomalies emerges in the 40–60% SOC range at power levels between 3 and 5 W, coinciding with periods of elevated solar input and increased electro-thermal activity. In contrast, the dense manifold of normal operating points across the mid-SOC region confirms stable and predictable behavior within the battery’s optimal charge window. Panel (b) overlays temperature measurements onto the same trajectory, confirming that the mid-SOC anomalous region correlates with thermal stress as cell temperature exceeds 35 °C. Panel (c) isolates measurements that triggered hardware critical alerts, validating that the unsupervised detection aligns with independent safety thresholds—particularly during low-SOC depletion and high-temperature excursions. Similarly, panel (d) quantifies the deviation rate (score < 0) across decadal SOC bins, revealing a bimodal distribution with peaks at 10–20% (14.8%) and 50–70% (8.4–10.4%). The low deviation rates observed between 20 and 50% SOC (≤1.3%) confirm that the system operates with high reliability within its optimal charge window. Collectively, these results demonstrate that the unsupervised anomaly-detection framework successfully identifies electro-thermal stress conditions while maintaining minimal false positives during nominal operation, validating the disturbance-based deviation functional derived in
Section 3.
The results demonstrate that the proposed framework does not merely detect statistical outliers; it identifies structured electro-thermal deviations consistent with hybrid power-path dynamics. The integration of invariant analysis, reachable geometry, and empirical support estimation provides both interpretability and practical reliability under real operating conditions.
6. Conclusions
This paper presented a hybrid electro-thermal deviation detection framework for lithium-ion batteries operating under stochastic hybrid solar-grid supply conditions. Rather than treating anomaly detection as a purely statistical classification task or a simple threshold enforcement problem, the battery was modeled as a power-feasible Markov jump nonlinear system with explicit electro-thermal coupling. The voltage–current–power algebraic relation was resolved explicitly to ensure physical feasibility, and disturbance-bounded forward invariance of a tightened operating region was established. Based on this structure, a reachable-set interpretation of dynamic consistency was derived, linking residual bounds to admissible trajectory membership.
Building upon the analytical model, an empirical trajectory support estimator was introduced using Isolation Forest. Within this framework, the unsupervised learning component does not replace physical modeling; rather, it approximates the support of the admissible electro-thermal trajectory manifold observed under nominal hybrid operation. The unified detection mechanism integrates structural constraint monitoring, model-consistent residual evaluation, and empirical support deviation into a coherent sequential rule. Experimental validation on a real hybrid solar-grid battery platform demonstrated that the proposed approach detects dynamic inconsistencies during rapid power transitions and depletion events prior to hard safety threshold violations while remaining robust under steady-state operation. The results indicate that the learned support structure captures coordinated deviations across voltage, current, SoC, power, and temperature, thereby identifying trajectory-level anomalies that are not observable through scalar threshold comparisons alone.
Several limitations merit consideration, including the use of a first-order electro-thermal model, reliance on representative training data, the single-battery experimental scope, and the four-day validation duration. However, the framework is structurally extensible to higher-fidelity models and larger battery clusters. Future work will incorporate parameter drift adaptation, distributed multi-battery monitoring, and formal convergence guarantees under nonstationary conditions. Nonetheless, the results presented herein demonstrate that integrating electro-thermal modeling with empirical support estimation provides a physically interpretable and computationally tractable approach to battery deviation detection in hybrid renewable systems.