In present, there lies a need for accurate estimation of SOC primarily to enhance the energy management in HEVs. DL based a proposed SOC estimation model called as the Renewable energy management SOC estimation model based on a hybrid technique26,27,28. Two major parts of the model include a QGAN for SOC prediction and TOA for hyperparameters tuning and improving prediction accuracy.
The Fig. 1 portrays, a QGAN for SOC estimation in HEV. It employs voltage data, current data and temperature data gathered from the vehicle. In this paper, the estimated SOC is obtained through the least-squares method for the difference between real and modeled voltage, and with the TOA for adjusting the parameters.

(a) Overall structure of the proposed model (b) Schematic process.
Detailed dissection of the suggested model
This section discusses the creation of a new method for estimating state of charge (SOC) using deep learning (DL) within a safe Renewable Energy Management (REM) framework designed for Hybrid Electric Vehicles (HEVs), referred to as DLSOC-REM. To enhance the accuracy and reliability of SOC estimates, the framework utilizes a QGAN model. The QGAN effectively captures the complex relationships between inputs and outputs of the battery model, making the modeling process simpler and improving estimation accuracy. To further enhance the SOC estimation results, the model incorporates the TOA for hyperparameter tuning. TOA boosts the QGAN’s performance by optimizing its parameters, which in turn increases the robustness and precision of SOC predictions. This method ensures a well-adjusted model that can adapt to various battery types and operating conditions. The uniqueness of this work lies in the combined use of the QGAN model with TOA, offering an innovative solution for precise and efficient SOC estimation in renewable energy-driven HEVs.
Defining model inputs and outputs
Taking into account the requirements of the neural network, it can be noted that such inputs and outputs of the model are distinguished. The battery’s current condition is represented by the SOC measurement at a discrete time step \(S\), which is an input to the model and is written as \(SOC(s)\). SOC is affected by variables that have a non-linear relationship with SOC, like as the battery’s terminal voltage and current drawn28,29.
Current and voltage as model variables
One of the key inputs is the current’s direct parameter \(I(s)\). The model’s output is defined as the battery terminal voltage at step \(S\),\(V(s)\). The voltage at the previous time step \(V(s – 1)\) is also given as an input to record the historical data. By taking into account former conditions, this prior voltage enhances the accuracy of the model by offering insight into the battery’s previous operational status.
Defining terminal voltage at current step \(V(s)\)
The following represents the terminal voltage \(V(s)\) at time step \(S\) is given in Eq. (1).
$$V(k) = OCV(SOC(s)) + R_{b} I(s) + U_{RC} (s)$$
(1)
where, \(OCV(SOC(s))\) indicates the open-circuit voltage, a process of SOC, \(R_{b}\) denotes the internal resistance of battery, and \(U_{RC} (s)\) signifies the voltage associated with the RC circuit of the battery, which depends on \(U_{RC} (s – 1)\).
Direct measurement of variables
The RC circuit voltage at the previous stage \(U_{RC} (s – 1)\), is merged into \(V(s – 1)\) in order to directly measure the model inputs. Because \(V(s – 1)\) closely correlates with \(V(s)\), the dependence structure is made simpler and the learning model is able to create a function that connects the input variables to the output voltage.
Synthesized function for terminal voltage
The function \(f\), which connects the current inputs, is used to express the terminal voltage at time step \(S\) is given in Eq. (2)30,31.
$$V(s) = f(V(s – 1),I(s),SOC(s))$$
(2)
The QGAN learning model approximates this function \(f\) and is subsequently trained to accurately predict \(V(s)\).
Defining input and output vectors
The input and output vectors are defined in a systematic manner by the battery model. At time step \(S\), the input vector is given in Eq. (3)32.
$$p(s) = [V(s – 1)I\,SOC(s)]^{T}$$
(3)
where the output at time \(S\) is the terminal voltage \(V(s)\), and \(T\) denotes the transposition.
Formulating the functional mapping
The model’s functional mapping can then be shown as follows in Eq. (4).
And the input vector \(p(s)\) is mapped to the terminal voltage \(V(s)\) by the function F.
Model training process
Prior to training, the input–output pairings \(\{ p(s)\sim V(s)\}\) are generated and gathered. The training set can be defined as follows if denote each input \(p(s)\) as \(x_{j}\) and each output \(V(s)\) as \(t_{j}\) is given in Eq. (5).
$$\{ (x_{j} ,t_{j} )|x_{j} \in R^{n} ,t_{j} \in R^{m} ,j = 1,…..,N\}$$
(5)
where, there are \(N\) total training examples, and \(x_{j}\) is an n-dimensional input vector and \(t_{j}\) is an m-dimensional output vector. In the REM-SOCQGAN model, where the QGAN predicts SOC and the TOA adjusts the model’s hyperparameters for maximum accuracy, this dataset structure is essential for efficient training and SOC prediction.
QGAN based estimation of SOC
The Quaternion Generative Adversarial Network (QGAN) and the Tyrannosaurus Optimization Algorithm (TOA) present notable benefits over traditional methods for predicting the State of Charge (SOC) in hybrid electric vehicles. QGAN is particularly effective at modeling the intricate, multidimensional relationships between input and output variables, thanks to its capability to process quaternion-valued data. This results in a more precise and thorough depiction of battery dynamics, simplifying the modeling process and improving the reliability of SOC predictions compared to standard neural networks. Meanwhile, TOA enhances performance by effectively fine-tuning the hyperparameters of QGAN, leading to optimized SOC estimation across different operating conditions. In contrast to typical optimization algorithms, TOA offers faster convergence, avoids getting stuck in local minima, and adapts well to high-dimensional, nonlinear optimization challenges, which are prevalent in energy management. The integration of QGAN and TOA boosts prediction accuracy, computational efficiency, and adaptability, positioning them as a state-of-the-art solution for SOC estimation in hybrid electric vehicles powered by renewable energy. In order to effectively manage renewable energy resources inside their EMS, HEVs must have their SOC estimated. Accurately forecasting the battery’s power availability under changing operating and load conditions is difficult. Figure 2 give the representation of a QGAN.

Representation of a quaternion generative adversarial network.
Because of their limited adaptability to dynamic battery conditions, noise sensitivity, and simplified battery models, traditional SoC estimate techniques which rely on electrochemical data-driven approaches or simplified battery models frequently struggle with real-time accuracy. Use a Quaternion Generative Adversarial Network (QGAN), which optimizes the representation and processing of SoC-related data by fusing the power of quaternions with generative adversarial models, to overcome these constraints.
Quaternion deconvolution for SoC feature extraction
The Quaternion generative adversarial network (QGAN) is a sophisticated machine learning model that efficiently processes and models multidimensional data using quaternion algebra. Unlike traditional GANs that work with real numbers, QGANs utilize quaternions—hypercomplex numbers with four components—to more naturally handle multi-channel inputs, such as spatial–temporal data. This approach allows the model to capture intricate relationships between features while minimizing computational demands. In a QGAN, the generator creates data that mimics real samples, while the discriminator differentiates between real and synthetic data. The design of QGAN promotes quicker convergence, improved feature representation, and less parameterization, making it particularly suitable for applications like battery state of charge (SOC) estimation and signal processing. To train the QGAN-TOA model effectively, it is crucial to have a diverse dataset that encompasses various driving cycles, battery states, temperatures, and charging/discharging scenarios. Generally, tens of thousands of samples are necessary to achieve precise SOC estimation, with the exact data volume depending on the model’s complexity and the variability of driving conditions. Quaternion deconvolution is used in this QGAN model to extract multi-dimensional SoC features, which improves battery data representation and processing. Here, quaternion deconvolution is modified to handle data encoded in quaternion structures from several sensor sources, including temperature, voltage, and current. Assume that the quaternion vector output represented by \(O \in Q^{m}\), is the SoC estimate. It is obtained from input data, \(I \in Q^{n}\), and a sparse quaternion matrix \(K \in Q^{m}\), which includes the kernel’s convolution components. One way to express the forward propagation of SoC estimate is as follows in Eq. (6).
If the backpropagation is applicable and \(\hat{R}\) is a quaternion rotation matrix with scaled components is given in Eq. (7).
$$\frac{\partial loss}{{\partial I}} = \hat{R}^{T} \frac{\partial loss}{{\partial O}}$$
(7)
Given the extremely dynamic environment of the HEV, quaternion convolution is essential for capturing the spatial–temporal correlation in SoC data and minimizing potential model over fitting through implicit regularization.
Quaternion batch normalization (QBN) for stability
By standardizing quaternion data across all layers, quaternion batch normalization (QBN) minimizes the internal covariance shift (ICS) that might happen in quaternion space and stabilizes the SoC estimation procedure. QBN normalizes each quaternion input \(I_{k}\) as follows in Eq. (8).
$$\hat{I}_{k} = \frac{{I_{k} – E[I_{k} ]}}{{\sqrt {Var[I_{k} ] + \in } }}$$
(8)
In which, \(Var[I_{k} ]\) and \(E[I_{k} ]\) denotes the variance and mean for each dimension. The expressive power is then preserved by a linear transformation in Eq. (9).
$$O_{k} = \lambda_{k} \hat{I}_{k} + \beta_{k}$$
(9)
where, \(\beta_{k}\) is the quaternion bias and \(\lambda_{k}\) is a real scaling factor. This allows for real-time data fluctuations, improving the accuracy of the SOC estimation.
QGAN for SoC prediction
A quaternion-based generator in the QGAN model creates realistic SoC estimates, and the discriminator helps to refine the generator’s output by separating real from synthetic SoC data. The loss function is minimized by the generator in Eq. (10).
$$_{\,\,G\,\,\,\,\,\,\,\,D}^{\min \,\,\,\max } \,V(G,D) = E_{{I\sim p_{data} }} [\log (D(I))] + E_{{z\sim p_{z} }} [\log (1 – D(G(z)))]$$
(10)
The QGAN generator uses quaternion convolution to maximize SoC prediction, and all of its elements have quaternion values. Because it preserves rotational invariance and takes into consideration the multidimensional nature of SoC-related data, this quaternion-based method is more reliable than scalar GANs.
Loss function for SoC optimization
By maintaining uncorrupted, crucial data regions, the QGAN uses a quaternion context loss \(Loss_{c}\) to guarantee correct SoC estimations is given in Eq. (11).
$$Loss_{c} (z|O,M) = ||M.G(z) – M.O||_{1}$$
(11)
where, \(M\) is a quaternion matrix mask that represents the availability of data. Sensitivity to crucial SoC data is increased by a weighted term \(W\), which accounts for the significance of nearby data points is given in Eq. (12).
$$Loss_{c} (z) = ||W.(G(z) – O)||_{1}$$
(12)
Lastly, by striking a balance between precisely learnt data and the synthesized SoC output, a quaternion priori loss \(Loss_{p} (z)\) aids the generator in producing realistic SoC estimates is given in Eq. (13).
$$Loss_{p} (z) = \gamma \log (1 – D(G(z)))$$
(13)
where,\(\gamma\) optimizes SoC estimate by balancing the context and past losses.
Through these procedures, quaternion generative adversarial network (QGAN) gives a complex and precise SoC estimation method for HEV renewable energy controlling systems. Using quaternion deconvolution, batch normalization, and well-defined loss function, a high level of prediction accuracy with the improved robustness and adaptability to dynamic SoC estimation problem, QGAN presents itself as the potential solution to the traditional problems.
Parameters tuning using TOA
In order to introduce the TOA for improving the estimation of SOC in HEVs, envisage that the use of such behaviour of T-Rex to adjust weight, bias and loss function of a Quaternion Generative Adversarial Network (QGAN). Based on the simulation of the predator–prey relationship, the algorithm developed in this paper can be used to support enhancing the HEV systems such as the renewable energy management application, and the parameter tuning of complicated models like QGANs.
Inspiration for the TOA in SoC estimation
The strategy of optimization is borrowed from the fact of T-Rex’s role of both scavenger and the predator of top rank. The search and convergence mechanism of the algorithm is reflected by the T-Rex white pattern, which switches between charging and randomly wandering. Thanks to the population-oriented approach, TOA is able to predict person’s selection (exploitation) and search (exploration).
-
Apex predator (exploitation): Similar to how TOA takes advantage of the best-performing solutions (weights and biases) during the optimization process, the T-Rex tracks and captures prey using its powerful hunting skills.
-
Scavenger (exploration): When there is no prey, the T-Rex scavenges and searches new areas for potential prey. This feature is similar to TOA’s exploration phase, in which local minima are escaped by random searches.
Mathematical model of TOA
Step 1: initialization (Prey location/parameter initialization).
The prey’s starting locations are chosen at random from a predetermined search space. These “prey locations” in the context of QGAN are the model’s weights and biases, which are initialized at random within a higher and lower bound. For each prey (i.e., a possible solution in the search space), let \(T_{i}\) represent the starting parameter set is given in Eq. (14).
$$T_{i} = rand(NP,\dim ) \times (Ub – Lb) + Lb$$
(14)
where, the prey’s position, or the weight/bias of the QGAN model at iteration \(i\), is denoted by \(T_{i}\), the number of populations, or individual solutions, is denoted by \(NP\). The number of dimensions (for each weight and bias parameter) is denoted by \(\dim\), and the lower and upper boundaries of the weight and bias values are denoted by \(Lb\) and \(Ub\).This initialization guarantees a broad search throughout the QGAN model’s parameter space in order to identify the best solutions for SoC estimation.
Step 2: Hunting and chasing (parameter update—exploitation phase).
The T-Rex uses a pursuit technique to find its prey (the ideal weight/bias) during the hunting phase. Similar to this, TOA updates the prey placements (weights and biases) by assessing the current solution’s fitness and shifting the positions in the direction of the most promising areas. If the T-Rex is successful in hunting the prey (i.e., the optimization is successful), let \(T_{new}\) represent the revised location (new weights and biases) is given in Eq. (15).
$$T_{new} = \left\{ \begin{gathered} t_{new} \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,if\,rand() < E_{r} \hfill \\ Random\,\,\,\,\,\,\,otherwise \hfill \\ \end{gathered} \right.$$
(15)
where, the likelihood of successfully reaching the prey, denoted by \(E_{r}\), is determined by the fitness function. The updated position, denoted by \(t_{new}\), is determined by the hunting formula is given in Eq. (16).
$$t_{new} = t + rand() \times s_{r} \times (x_{pos} \times x_{r} – t\arg et \times p_{r} )$$
(16)
where, \(t\) is the prey’s current location (weight/bias).The T-Rex is in position \(x_{pos}\). The algorithm converges at a pace denoted by \(x_{r}\), which represents the T-Rex’s running rate. The hunting success rate \(s_{r}\), affects how much the position shifts. The prey’s running speed, represented by \(p_{r}\) is a metaphor for the pace at which the weight or bias changes. In this stage, the algorithm adjusts the parameters in order to move them in the direction of a better solution based on the fitness value of the weights and biases.
Step 3: selection (exploitation phase—choosing the best weights and biases).
Following the hunting phase, the selection phase uses the fitness value to decide whether to accept or reject the new prey position. Let the fitness function (such as the loss function for the QGAN model be represented by \(f(T)\). The following is the selection procedure is given in Eq. (17).
$$T_{k + 1} = \left\{ \begin{gathered} if\,f(T) < f(T_{ne} )\,\,\,\,\,\,\,update\,t\arg et\,position\, \hfill \\ Otherwise\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,t\arg et\,is\,zero \hfill \\ \end{gathered} \right.$$
(17)
where, the fitness function assessed at the present position (current weights and biases) is denoted by \(f(T)\).The fitness function assessed at the new position (with updated weights and biases) is denoted by \(f(T_{new} )\).The prey (weights and biases) is updated if the new position provides a better solution (i.e., reduced loss); if not, the prey stays at the old location.
In this case, the loss function utilized in QGAN for SoC estimate is the fitness function \(f(T)\). In order to get the estimated SoC of the HEV as near to the actual amount as possible, the QGAN model’s loss (or accuracy) must be minimized. The step by step procedure of TOA is given in Fig. 3.

Step by step process of TOA.
By following these optimization procedures, TOA assists in optimizing the settings of the QGAN, guaranteeing precise SoC estimation for HEVs, which results in improved battery life and effective energy management. In the optimization process, the balance between exploration and exploitation is symbolized by the hunting and scavenging behavior of Tyrannosaurus Rex.
