Next Article in Journal
On Sequential Coupled Caputo-Type Fractional Differential Inclusions with Coupled Boundary Conditions: A Multivalued Fixed-Point Approach
Previous Article in Journal
Beyond MSE in Poisson Ridge Regression: New Ridge Parameter Estimators with Additional Distributional Performance Criteria
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Markov-Constrained Isolation Forest for Early Detection of Battery Anomalies in Solar-Grid Applications

by
Tawfiq M. Aljohani
Department of Electrical Engineering, College of Engineering at Yanbu, Taibah University, Yanbu 41911, Saudi Arabia
Mathematics 2026, 14(7), 1192; https://doi.org/10.3390/math14071192
Submission received: 6 March 2026 / Revised: 29 March 2026 / Accepted: 31 March 2026 / Published: 2 April 2026

Abstract

Lithium-ion batteries in hybrid solar-grid systems experience complex electro-thermal dynamics and stochastic mode switching that threshold-based battery management systems fail to capture. This paper proposes a hybrid deviation detection framework that treats anomaly detection as a trajectory-consistency problem over a power-feasible Markov jump nonlinear system. A disturbance-robust invariant operating region is first established under explicit current bounds. A reachable-set equivalence is then derived, linking residual consistency to disturbance-augmented trajectory membership. Building on this structure, Isolation Forest empirically estimates the support of admissible electro-thermal trajectories, capturing nonlinear and mode-dependent behaviors not fully described by the analytical disturbance model. A unified sequential detection rule integrates structural constraint violations, model-based residual deviations, and empirical support inconsistencies into a coherent real-time monitor. The framework is validated on a hybrid solar-grid platform with a 6 W photovoltaic panel, a 3.7 V 1820 mAh lithium-ion battery, and a Raspberry Pi, collecting 3976 samples over four days. Results demonstrate early detection of depletion events and mode-transition anomalies before hard threshold violations, with zero false alarms during steady operation and an overall deviation rate of 4.8%, aligning with the configured contamination level. Early warning was observed at 20% state of charge, providing a 10% margin before the hardware threshold of 10%, while 88% of detected anomalies occurred in sequences, validating the persistence rule. Real-time inference required 47 ms per cycle with a 156 MB memory footprint, confirming edge deployment feasibility.

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 kZ ≥ 0 with sampling period Δt > 0. The minimal dynamic state is defined as
X κ : = z κ T κ R 2
where z κ ∈ [0, 1] denotes the SoC, and TkR denotes the cell temperature. Stored energy is treated as a derived quantity as follows:
E κ = C n o m V n o m z κ
with Cnom being the nominal capacity (Ah) and V n o m 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 qkQ 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:
P q κ + 1 = j | q κ = i = P i j , P i j 0 , j P i j = 1
Let the external power components be
u κ : = P κ s P κ g P κ L
representing solar input, grid input, and load demand, respectively. The net battery power is defined as
P κ = P κ s + P κ g P κ L
Mode–input coupling is formalized by defining a mode-dependent admissible set
u κ U q κ
where, for example,
U 1 = u κ : P κ g = 0 , U 2 = u κ : P κ s = 0
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:
v κ = V o c z κ R i n t i k
where V o c z κ is continuously differentiable and strictly positive on [0, 1], and R i n t > 0 is internal resistance. Now, net battery power satisfies the following:
P k = v κ i κ
Substituting Equation (8) into Equation (9) yields
P κ = V o c z κ R i n t i κ i κ
which rearranges to the quadratic equation in the current:
R i n t i κ 2 V o c z κ i κ + P κ = 0
The discriminant condition is required for real-valued solutions. Hence, the following inequality constitutes a power feasibility constraint induced by internal resistance.
κ : = V o c z κ 2 4 R i n t P k 0
The physically admissible branch is
i κ = V o c z κ κ 2 R i n t
which ensures continuity with respect to Pk and yields i κ Pk/ V o c z κ as Rint → 0. Terminal voltage is then computed from
v κ = V o c z κ R i n t i κ
Equations (11)–(14) explicitly resolve the algebraic loop. For given z κ and Pk, current and voltage are uniquely determined whenever Equation (12) holds. Additionally, charge conservation gives
z κ + 1 = z κ η t C n o m i κ + δ κ z
where η ∈ [0, 1] is coulombic efficiency, and δ κ z models bounded integration error or sensor noise satisfying:
δ κ z ε z
Then, thermal evolution is modeled as
C t h T κ + 1 T κ t = i κ 2 R i n t h T κ T a m b + δ κ T
with Cth > 0 being thermal capacitance, h > 0 being heat transfer coefficient, and bounded disturbance as follows:
δ κ T ε T
Rewriting Equation (17),
T κ + 1 = T κ + t C t h i κ 2 R i n t h T κ T a m b + t C t h δ κ T
To ensure numerical stability of the explicit Euler discretization, the sampling period must satisfy the following:
0 < t < 2 C t h h
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 C t h ≈ 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
x κ + 1 = f q κ x κ , u κ + δ κ
where
δ κ : = δ κ z t C t h δ κ T
The disturbance components satisfy the component-wise bounds as follows:
δ κ z ε z
t C t h δ κ T t C t h ε T
Equivalently, the disturbance set is the rectangle:
D = ε z , ε z × t C t h ε T , t C t h ε T
In addition to the power feasibility constraint Equation (12), admissible operation requires
0 z κ 1
V m i n V κ V m a x
T κ T m a x
where V m i n = 2.75 V and V m a x = 4.2 V are the battery’s manufacturer-specified voltage limits, and T m a x = 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
s i g n z κ + 1 z κ = s i g n P κ
Proof. 
From Equation (13), sign ( i κ ) = 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 Φ q κ x κ 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 M ^ q 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
V o c z κ 2 4 R i n t P κ 0
In addition, the hardware constraint must hold as follows:
i κ i m a x
where i m a x 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
i m i n z κ i κ i m a x z κ
where
i m i n z κ : = m a x V o c z κ 2 R i n t , i m a x , i m a x z κ : = m i n V o c z κ 2 R i n t , i m a x
These bounds are finite for all zk ∈ [0, 1] because V o c z κ is bounded and strictly positive. Let
α : = η t C n o m
Then, the SoC update is given as
z κ + 1 = z κ α i κ + δ κ z
The worst-case increase in SoC occurs under maximal charging current ik = imin (zk) ≤ 0, yielding
z κ + 1 + = z κ α i m i n z κ + ε z
The worst-case decrease in SoC occurs under maximal discharging current ik = imax (zk) ≥ 0, yielding
z κ + 1 = z κ α i m a x z κ ε z
To ensure forward invariance within a tightened interval
ρ z z κ 1 ρ z
It is sufficient to require
ρ z α s u p z 0,1 i m i n z + ε z
and
ρ z α s u p z 0,1 i m a x z + ε z
Since the suprema are finite by Equation (33), such ρz exists. A similar argument applies to temperature. From Equation (19),
T κ + 1 = T κ + t C t h i κ 2 R i n t h T κ T a m b + t C t h δ κ T
Because ∣ik∣ ≤ s u p z i m a x z , we obtain a finite bound on i κ 2 R i n t . Hence, the temperature increment is uniformly bounded above and below, and there exists ρT > 0 such that
T κ T m a x ρ T T κ + 1 T m a x
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 I m a x = 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:
x ^ κ + 1 : = f q κ x κ , u κ
With disturbance set D defined in Equation (25), the one-step reachable set is
Φ q κ x κ = x ^ κ + 1 D
where ⊕ denotes Minkowski sum. This representation is equivalent to Equation (40) but avoids the recomputation of the full reachable geometry online. The residual
τ κ : = x κ + 1 x ^ κ + 1
Satisfies
x κ + 1 Φ q κ x κ τ κ D
Define component-normalized residual and model-based deviation functional as follows:
τ ~ κ : = τ κ ε z z τ κ T t C t h ε T
I κ M : = τ ~ κ
then
I κ M 1 x κ + 1 Φ q κ x κ
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 D . To reconcile model-based reachability with empirical trajectory distributions, we construct a data-driven approximation of the empirical support M q , the region of the state space where nominal trajectories reside under mode q, as follows:
M q : = s u p p P x κ | q κ = q
Isolation Forest is employed to estimate a level set
M ^ q : = x : s q x θ q
where s q x is the normalized isolation score, and θ q 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 M ^ q 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
I κ M L : = m a x 0 , θ q κ s q κ x κ
This measures distance to empirical support. Isolation Forest, therefore, approximates the true reachable-support set
Φ q κ x κ M ^ q κ
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:
χ κ S : = 1 x κ Ω
And define model-based violation, as follows:
χ κ M : = 1 I κ M > 1
Define ML-based deviation:
χ κ M L : = 1 I κ M L > 0
Then, the unified instantaneous anomaly indicator is
χ κ : = m a x χ κ S , χ κ M , χ κ M L
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 χ κ S flags physical violations that no admissible trajectory should exceed. The model-based indicator χ κ M detects dynamic inconsistency: a one-step transition that cannot be explained by the nominal dynamics plus bounded disturbances. The ML-based indicator χ κ M L 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 χ κ M alone triggers, the system has experienced a transient disturbance that quickly returns to the empirical manifold; on the other hand, when χ κ M L 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
i = κ m + 1 κ χ i m A n o m a l y
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
x κ + 1 = f q κ x κ , u κ + δ κ , δ κ D
with disturbance set D 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),
τ ~ κ = δ κ ε z z δ κ T t C t h ε T
By construction of D ,
τ ~ κ 1
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 D , then
I κ M 1 , κ
and consequently,
χ κ M = 0
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
Φ q κ x κ = x ~ κ + 1 D
The condition
x κ + 1 Φ q κ x κ
is equivalent to
τ κ D
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.
For fixed  x κ  and  q κ ,
I κ M 1 x κ + 1 Φ q κ x κ
Thus, the residual test provides a computationally efficient surrogate for online reachable-set membership without explicitly recomputing Φ q κ x κ .
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 D .  Let the empirical trajectory support under normal operation and mode q be
M q : = s u p p P x κ | q κ = q
Isolation Forest constructs a score function sq(x) and corresponding level set, as follows:
M ^ q : = x : s q x θ q
which approximates M q  from data.
Under standard assumptions for isolation-based support estimation (finite contamination; i.i.d. sampling of nominal trajectories), the estimator M ^ q converges in probability to a level-set approximation of M q 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,
x κ M ^ q κ κ
under nominal conditions, implying
χ κ M L = 0
This establishes that the ML-based component does not contradict the model-based framework but enlarges the admissible set from the disturbance-rectangular region D to the empirically observed support M ^ q . The unified detection rule is
χ κ = m a x χ κ S , χ κ M , χ κ M L
The unified detection rule given in Equation (73) combines three distinct indicators, each serving a specific purpose in the monitoring hierarchy. The structural indicator χ κ S detects hard constraint violations that no admissible trajectory should ever exceed. The model-based indicator χ κ M flags dynamic inconsistency relative to the analytical electro-thermal model, identifying transitions that fall outside the disturbance-augmented reachable set. The ML-based indicator χ κ M L 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 M ^ q learned by Isolation Forest is generally larger than the disturbance-rectangular set implied by D , 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:
S κ : = i = κ m + 1 κ χ i
If the instantaneous false alarm probability under nominal conditions is p ≪ 1, then the probability of triggering a false alarm under independence approximation satisfies
P S κ m p m
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)
1Set battery parameters: C n o m , R i n t , C t h , h , V o c . , bounds ε z , ε T sampling t   with t < 2 C t h / h
2 Define Markov matrix P R 4 × 4 and mode input sets U q for q 1,2 , 3,4
3 Train Isolation Forest models M ^ q on nominal data per mode ; set thresholds θ q
4 Define invariant region Ω = z , T : ρ z z 1 ρ z , T T m a x ρ T
Online Monitoring (At each sampling instant  κ )
5 Acquire z κ , T κ , P κ s , P κ g , P κ L determine mode q κ
6 if u κ U q κ then χ κ M 1
7 Compute P κ = P κ s + P κ g P κ L
8 Compute κ = V o c z κ 2 4 R i n t P κ
9 If κ < 0 then χ κ S 1 ; go to 21
10 i κ = V o c z κ κ 2 R i n t
11 If i κ > i m a x then χ κ S 1
12  v κ = V o c z κ R i n t i κ ; if v κ V m i n , V m a x   then χ κ S 1
13  x ^ κ + 1 = f q κ x κ , u κ Nominal prediction
14 Acquire x κ + 1 = z κ + 1 , T κ + 1 T
15  τ κ = x κ + 1 + x ^ κ + 1
16 If T κ + 1 > T m a x   or z κ + 1 0,1 then χ κ S 1
17  τ ~ κ = τ κ z / ε z , τ κ T / t C t h ε T T
18 If τ ~ κ > 1 then χ κ M 1
19 Retrieve score s q κ x κ + 1 from M ^ q κ
20 If θ q κ s q κ x κ + 1 > 0 then χ κ M L 1
21  χ κ = m a x χ κ S , χ κ M , χ κ M L
22  S κ = i = κ m + 1 κ χ i
23 If S κ m then trigger alert
24 Log data ; κ κ + 1 ; 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 θ q 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 I2R 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 χ κ M L triggers first when the instantaneous residual exceeds disturbance bounds during the initial voltage dip, followed by χ κ M L 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 M ^ q 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.

Funding

This scientific paper is derived from a research grant funded by Taibah University, Madinah, Kingdom of Saudi Arabia—with grant number (447-15-1155).

Data Availability Statement

The raw data supporting the conclusions of this article will be made available by the author on request.

Conflicts of Interest

The author declares no conflicts of interest.

Abbreviations

κ Discrete-time index
q κ Discrete operating mode at time step κ
Q Finite set of operating modes
U q κ Admissible input set under mode q κ
P Z κ Power-feasible set at state of charge Z κ
Ω Admissible electro-thermal operating region
Ω ρ Tightened robust invariant operating region
D Bounded disturbance set
Φ q k x κ One-step reachable set under mode q κ
M q Empirical nominal trajectory support under mode q.
M q ^ Isolation Forest-estimated support set
x κ = z κ , T κ τ Electro-thermal state vector
z κ State of charge (SoC)
T κ Battery temperature
E κ Stored energy (derived quantity)
x ^ κ + 1 Nominal predicted next state
x κ + 1 Measured next state
P κ s Solar power input
P κ g Grid power input
P κ L Load demand
P κ Net battery power
υ κ Terminal voltage
i κ Battery current
V o c z κ Open-circuit voltage function
R i n t Internal resistance
V n o m Nominal voltage
V m i n , V m a x Voltage safety limits
i m a x Maximum allowable current magnitude
C t h Thermal capacitance
h Heat transfer coefficient
T a m b Ambient temperature
T m a x Maximum allowable temperature
C n o m Nominal capacity
η Coulombic efficiency
t Sampling period
α = η t C n o m SoC update coefficient
δ κ z SoC disturbance term
δ κ T Thermal disturbance term
ε z Bound on SoC disturbance
ε T Bound on thermal disturbance
δ κ Stacked disturbance vector
ρ z , ρ T Robust invariant tightening margins
τ κ Residual vector x κ + 1 x ^ κ + 1
τ ¯ κ Normalized residual
I κ M Model-based deviation functional
κ Quadratic discriminant for current feasibility
s q x κ Isolation score under mode q
θ q Isolation threshold for mode q
I κ M L ML-based deviation functional
X κ S Structural violation indicator
X κ M Model-based violation indicator
X κ M L ML-based violation indicator
X κ Unified anomaly indicator
m Persistence window length
S κ Cumulative anomaly counter over window

References

  1. Mousa, H.H.H.; Mahmoud, K.; Lehtonen, M. Multi-timescale coordinated planning of BESS, seasonal hydrogen storage, and dynamic DR for unbalanced RES-rich microgrids. Energy Convers. Manag. 2025, 346, 120510. [Google Scholar] [CrossRef]
  2. Javadi, M.; Gong, Y.; Chung, C.Y. Frequency stability constrained BESS sizing model for microgrids. IEEE Trans. Power Syst. 2023, 39, 2866–2878. [Google Scholar] [CrossRef]
  3. Polat, S.; Biyik, E.; Öztura, H.Ş. Optimal active and reactive power scheduling for inverter-integrated PV and BESS under inverter current constraints. Electr. Power Syst. Res. 2025, 245, 111629. [Google Scholar] [CrossRef]
  4. Mohamed, A.; Mohammed, O. Real-time energy management scheme for hybrid renewable energy systems in smart grid applications. Electr. Power Syst. Res. 2013, 96, 133–143. [Google Scholar] [CrossRef]
  5. He, H.; Xiong, R.; Fan, J. Evaluation of lithium-ion battery equivalent circuit models for state of charge estimation by an experimental approach. Energies 2011, 4, 582–598. [Google Scholar] [CrossRef]
  6. Coman, P.T.; Darcy, E.C.; Strangways, B.; White, R.E. A reduced-order lumped model for li-ion battery packs during operation. J. Electrochem. Soc. 2021, 168, 100525. [Google Scholar] [CrossRef]
  7. Li, X.; Chang, X.; Feng, Y.; Dai, Z.; Zheng, L. Investigation on the heat generation and heat sources of cylindrical NCM811 lithium-ion batteries. Appl. Therm. Eng. 2024, 241, 122403. [Google Scholar] [CrossRef]
  8. Huang, Y.; Lai, X.; Yue, C.; Fan, Y.; Chen, F.; Ren, D.; Han, X.; Zheng, Y.; Ouyang, M. Mechanistic understanding of inhomogeneous lithium-plating behavior in large-format lithium-ion batteries during fast charging. J. Energy Storage 2026, 141, 119254. [Google Scholar] [CrossRef]
  9. Vetter, J.; Novák, P.; Wagner, M.R.; Veit, C.; Möller, K.-C.; Besenhard, J.O.; Winter, M.; Wohlfahrt-Mehrens, M.; Vogler, C.; Hammouche, A. Ageing mechanisms in lithium-ion batteries. J. Power Sources 2005, 147, 269–281. [Google Scholar] [CrossRef]
  10. Feng, X.; Ouyang, M.; Liu, X.; Lu, L.; Xia, Y.; He, X. Thermal runaway mechanism of lithium-ion battery for electric vehicles: A review. Energy Storage Mater. 2018, 10, 246–267. [Google Scholar] [CrossRef]
  11. Plett, G.L. Extended Kalman filtering for battery management systems of LiPB-based HEV battery packs—Part 1. J. Power Sources 2004, 134, 252–261. [Google Scholar] [CrossRef]
  12. Gao, D.; Du, Y.; Cheng, Y.; Yang, Q. Research on dynamic multi-level warning method for thermal runaway charging of electric vehicles. Eng. Appl. Artif. Intell. 2024, 132, 107919. [Google Scholar] [CrossRef]
  13. Wang, W.; Liu, S.; Ma, X.Y.; Jiang, J.; Yang, X.G. Advancing smart lithium-ion batteries: A review on multi-physical sensing technologies for lithium-ion batteries. Energies 2024, 17, 2273. [Google Scholar] [CrossRef]
  14. Plett, G.L. Extended Kalman filtering for battery management systems of LiPB-based HEV battery packs: Part 3. State and parameter estimation. J. Power Sources 2004, 134, 277–292. [Google Scholar] [CrossRef]
  15. Sun, L.; Li, G.; You, F. Combined internal resistance and state-of-charge estimation of lithium-ion battery based on extended state observer. Renew. Sustain. Energy Rev. 2020, 131, 109994. [Google Scholar] [CrossRef]
  16. Dey, S.; Ayalew, B.; Pisu, P. Nonlinear robust observers for state-of-charge estimation of lithium-ion cells based on a reduced electrochemical model. IEEE Trans. Control Syst. Technol. 2015, 23, 1935–1942. [Google Scholar] [CrossRef]
  17. Couto, L.D.; Schons, S.M.; Coutinho, D.; Kinnaert, M. A descriptor system approach for the nonlinear state estimation of Li-Ion battery series/parallel arrangements. IEEE Trans. Control Syst. Technol. 2022, 31, 825–840. [Google Scholar] [CrossRef]
  18. Yu, J.; Yao, F. Multi-Timescale Estimation of SOE and SOH for Lithium-Ion Batteries with a Fractional-Order Model and Multi-Innovation Filter Framework. Batteries 2025, 11, 372. [Google Scholar] [CrossRef]
  19. Zhao, H.; Zhang, C.; Liao, C.; Wang, L.; Liu, W.; Wang, L. Data-driven strategy: A robust battery anomaly detection method for short circuit fault based on mixed features and autoencoder. Appl. Energy 2025, 382, 125267. [Google Scholar] [CrossRef]
  20. Severson, K.A.; Attia, P.M.; Jin, N.; Perkins, N.; Jiang, B.; Yang, Z.; Chen, M.H.; Aykol, M.; Herring, P.K.; Fraggedakis, D.; et al. Data-driven prediction of battery cycle life before capacity degradation. Nat. Energy 2019, 4, 383–391. [Google Scholar] [CrossRef]
  21. Shao, B.; Zhong, J.; Tian, J.; Li, Y.; Chen, X.; Dou, W.; Liao, Q.; Lai, C.; Lu, T.; Xie, J. State-of-health estimation of lithium-ion batteries based on electrochemical impedance spectroscopy features and fusion interpretable deep learning framework. Energies 2025, 18, 1385. [Google Scholar] [CrossRef]
  22. Chae, S.G.; Bae, S.J. An adaptive mixture prior in Bayesian convolutional autoencoder for early detecting anomalous degradation behaviors in lithium-ion batteries. Reliab. Eng. Syst. Saf. 2025, 259, 110926. [Google Scholar] [CrossRef]
  23. Lee, D.; Sim, M.; Lee, H.; Femi, O.; Na, W.; Kim, J. ICA-RP Image Conversion Based Autoencoder for Abnormal Cell Detection in Battery Module. In Proceedings of the 2025 IEEE Energy Conversion Conference Congress and Exposition (ECCE), Philadelphia, PA, USA, 19–23 October 2025; IEEE: New York, NY, USA; pp. 1–5.
  24. Xie, T.; Li, B.; Zhen, Y.; Wei, H.; Xu, K.; Huang, J. Anomaly detection method for power dispatch streaming data based on adaptive isolation forest and self-supervised learning. Front. Phys. 2025, 13, 1704495. [Google Scholar] [CrossRef]
  25. Kabir, S.; Hannan, N.; Shufian, A.; Zishan, M.S.R. Proactive detection of cyber-physical grid attacks: A pre-attack phase identification and analysis using anomaly-based machine learning models. Array 2025, 27, 100441. [Google Scholar] [CrossRef]
  26. Aljohani, T.; Almutairi, A. A comprehensive survey of cyberattacks on EVs: Research domains, attacks, defensive mechanisms, and verification methods. Def. Technol. 2024, 42, 31–58. [Google Scholar] [CrossRef]
  27. Zhao, S.; Peng, Q.; Du, D.; Fei, M.; Peng, C.; Li, H.; Wu, Y.; Li, K.; Liu, K. Enhancing safety of lithium-ion batteries in sustainable energy systems through intelligent minor short-circuits fault detection. Renew. Sustain. Energy Rev. 2026, 229, 116576. [Google Scholar] [CrossRef]
  28. Arulmozhi, M.; Jaykrithy, U.; Kavishree, V.; Amutha, C. An intelligent hybrid framework for lithium-ion battery fault diagnostics using unsupervised learning and heuristic integration. EPJ Web Conf. 2026, 355, 01010. [Google Scholar] [CrossRef]
  29. Gaggero, G.B.; Girdinio, P.; Marchese, M. Artificial intelligence and physics-based anomaly detection in the smart grid: A survey. IEEE Access 2025, 13, 23597–23606. [Google Scholar] [CrossRef]
  30. He, L.; Tian, A.; Ding, T.; Dong, K.; Wang, Y.; Gao, Y.; Jiang, J. Lithium-ion battery state estimation based on adaptive physics-informed neural network of electrochemical model. Measurement 2025, 257, 118985. [Google Scholar] [CrossRef]
  31. Lv, T.; Yu, Y.; Wang, B.; Chen, X.; Guo, Y.; Wang, Y. Joint Online Estimation of Multiple Operating States of Lithium-Ion Batteries Considering Safety Constraints Based on Physics-Informed Neural Networks. In Proceedings of the 2025 IEEE Industry Applications Society Annual Meeting (IAS), New Taipei City, Taiwan, 15–20 June 2025; IEEE: New York, NY, USA; pp. 1–8.
  32. Liao, C.; Peng, D.; Tian, J.; Wang, Z.; Liu, C. SL-DSVDD: Scale learning based deep support vector data description network for EV battery anomaly detection. J. Energy Storage 2025, 134, 118076. [Google Scholar] [CrossRef]
  33. Kumar, R.S.; Singh, A.R.; Narayana, P.L.; Chandrika, V.S.; Bajaj, M.; Zaitsev, I. Hybrid machine learning framework for predictive maintenance and anomaly detection in lithium-ion batteries using enhanced random forest. Sci. Rep. 2025, 15, 6243. [Google Scholar] [CrossRef] [PubMed]
Figure 1. The raspberry bi hardware components of this study.
Figure 1. The raspberry bi hardware components of this study.
Mathematics 14 01192 g001
Figure 2. System architecture of the hardware components.
Figure 2. System architecture of the hardware components.
Mathematics 14 01192 g002
Figure 3. Enhanced AI training results with state-aware anomaly detection.
Figure 3. Enhanced AI training results with state-aware anomaly detection.
Mathematics 14 01192 g003
Figure 4. Battery depletion with an AI early warning system.
Figure 4. Battery depletion with an AI early warning system.
Mathematics 14 01192 g004
Figure 5. Temperature monitoring with safety zones and operating state distribution.
Figure 5. Temperature monitoring with safety zones and operating state distribution.
Mathematics 14 01192 g005
Figure 6. Voltage behavior during solar charging transition.
Figure 6. Voltage behavior during solar charging transition.
Mathematics 14 01192 g006
Figure 7. AI anomaly-detection performance metrics.
Figure 7. AI anomaly-detection performance metrics.
Mathematics 14 01192 g007
Figure 8. Operating trajectory in the power–SOC plane with anomaly classification.
Figure 8. Operating trajectory in the power–SOC plane with anomaly classification.
Mathematics 14 01192 g008
Table 1. Sensitivity of detection performance to persistence window length m.
Table 1. Sensitivity of detection performance to persistence window length m.
Persistence Length (m)False Alarm RateDetection Delay (Samples)
21.2%0–1
30.3%0–2
40.1%1–3
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

Aljohani, T.M. Markov-Constrained Isolation Forest for Early Detection of Battery Anomalies in Solar-Grid Applications. Mathematics 2026, 14, 1192. https://doi.org/10.3390/math14071192

AMA Style

Aljohani TM. Markov-Constrained Isolation Forest for Early Detection of Battery Anomalies in Solar-Grid Applications. Mathematics. 2026; 14(7):1192. https://doi.org/10.3390/math14071192

Chicago/Turabian Style

Aljohani, Tawfiq M. 2026. "Markov-Constrained Isolation Forest for Early Detection of Battery Anomalies in Solar-Grid Applications" Mathematics 14, no. 7: 1192. https://doi.org/10.3390/math14071192

APA Style

Aljohani, T. M. (2026). Markov-Constrained Isolation Forest for Early Detection of Battery Anomalies in Solar-Grid Applications. Mathematics, 14(7), 1192. https://doi.org/10.3390/math14071192

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