In the context of the global shift toward renewable energy, photovoltaic (PV) power generation systems have become a key technology for sustainable electricity production. Among the critical components of a PV system, the solar inverter plays a vital role by converting the direct current (DC) generated by solar panels into alternating current (AC) for grid integration. However, the performance and operational stability of a solar inverter are significantly influenced by its working temperature. Elevated temperatures can accelerate component degradation, reduce conversion efficiency, and even lead to catastrophic failure, while excessively low temperatures may affect system startup and stability. Therefore, accurate prediction of the solar inverter temperature is essential for proactive maintenance, operational optimization, and ensuring the long-term reliability of the entire PV system.
This study originates from a “Photovoltaic Power Generation Intelligent Management Cloud Platform” project applied in a domestic oilfield. In this project, we collected real-time operational data from a solar inverter deployed in the oilfield, including inverter temperature, output voltage, output current, ambient temperature, and ambient humidity. The goal is to develop a deep learning-based method that can predict the future temperature trend of the solar inverter, enabling early detection of anomalies and supporting decision-making for maintenance scheduling.
Traditional statistical methods for temperature prediction often struggle with the complex, nonlinear, and time-varying nature of environmental and operational conditions. To address this challenge, we propose a hybrid neural network model that combines a convolutional neural network (CNN) with a long short-term memory (LSTM) network. The CNN component is adept at extracting local spatial patterns from multivariate time series data, while the LSTM component captures long-term temporal dependencies. By integrating both architectures, the model can effectively learn the intricate relationships among multiple variables and produce more accurate and stable predictions of the solar inverter temperature.
In this paper, we present the design, implementation, and evaluation of the CNN-LSTM hybrid model. We compare its performance against a standalone LSTM model using real-world data collected over eight days at one-minute intervals. The experimental results demonstrate that the hybrid model significantly reduces prediction errors and improves the coefficient of determination (R²), confirming its superiority for solar inverter temperature forecasting.

1. Methodology
1.1 Convolutional Neural Network (CNN)
Convolutional neural networks are widely used for grid-structured data such as images, but recent research has shown their effectiveness in processing time series data as well. For time series, a one-dimensional convolution (1D-CNN) can be employed to extract local patterns, such as trends and periodic fluctuations, by sliding filters along the temporal axis. The CNN architecture consists of convolutional layers, pooling layers, and fully connected layers. The convolutional layers apply learnable filters to produce feature maps, capturing important patterns. Pooling layers (e.g., max pooling) reduce the dimensionality and computational cost while helping to prevent overfitting. Finally, fully connected layers combine the extracted features for regression tasks.
The operation of a 1D convolution layer can be expressed as:
$$ (X * W)(t) = \sum_{i=1}^{k} X(t+i) \cdot W(i) + b $$
where $X$ is the input sequence, $W$ is the filter of length $k$, $b$ is the bias, and $t$ indexes the time step. After convolution, an activation function such as ReLU introduces nonlinearity:
$$ \text{ReLU}(z) = \max(0, z) $$
Pooling then reduces the feature map size, retaining the most salient information.
1.2 Long Short-Term Memory (LSTM)
LSTM is a specialized recurrent neural network (RNN) designed to overcome the vanishing/exploding gradient problems of traditional RNNs. It incorporates a memory cell and three gating mechanisms: forget gate, input gate, and output gate. The LSTM unit dynamics are given by the following equations:
Forget gate:
$$ f_t = \sigma(W_f \cdot [h_{t-1}, x_t] + b_f) $$
Input gate:
$$ i_t = \sigma(W_i \cdot [h_{t-1}, x_t] + b_i) $$
Candidate cell state:
$$ \tilde{c}_t = \tanh(W_c \cdot [h_{t-1}, x_t] + b_c) $$
Cell state update:
$$ c_t = f_t \odot c_{t-1} + i_t \odot \tilde{c}_t $$
Output gate:
$$ o_t = \sigma(W_o \cdot [h_{t-1}, x_t] + b_o) $$
Hidden state output:
$$ h_t = o_t \odot \tanh(c_t) $$
Here, $\sigma$ is the sigmoid function, $\odot$ denotes element-wise multiplication, $W$ and $b$ are weight matrices and biases, $x_t$ is the input at time $t$, $h_{t-1}$ is the previous hidden state, and $c_{t-1}$ is the previous cell state. The LSTM’s ability to selectively remember or forget information over long sequences makes it ideal for time series forecasting.
1.3 Proposed CNN-LSTM Hybrid Model
The hybrid CNN-LSTM model integrates the spatial feature extraction capability of CNN with the temporal modeling capability of LSTM. The overall architecture is as follows:
Input layer: The multivariate time series data (e.g., inverter temperature, output voltage, output current, ambient temperature, ambient humidity) are fed into the network. Each input sample consists of a sequence of past observations of length $T_{in}$ (sequence length).
Convolutional layers: Two 1D convolutional layers are applied sequentially. The first convolutional layer transforms the input into 32 feature channels, and the second into 64 feature channels. Each convolutional layer is followed by a ReLU activation and a max-pooling layer to reduce temporal dimensionality and extract dominant features.
LSTM layer: The output feature maps from the last pooling layer are flattened and reshaped appropriately before being fed into an LSTM layer. This layer captures the temporal dependencies among the extracted features across time steps.
Fully connected layer: The LSTM output at the last time step is passed through one or more fully connected layers to produce the final prediction of the solar inverter temperature for the future horizon $T_{out}$.
Output layer: The output is a sequence of predicted temperature values.
The model is trained end-to-end using backpropagation through time (BPTT) with an appropriate loss function (e.g., mean squared error).
| Layer | Type | Filters/Units | Kernel Size | Activation | Output Shape |
|---|---|---|---|---|---|
| 0 | Input | – | – | – | (batch, 180, 5) |
| 1 | Conv1D | 32 | 3 | ReLU | (batch, 178, 32) |
| 2 | MaxPooling1D | – | 2 | – | (batch, 89, 32) |
| 3 | Conv1D | 64 | 3 | ReLU | (batch, 87, 64) |
| 4 | MaxPooling1D | – | 2 | – | (batch, 43, 64) |
| 5 | Flatten/Reshape | – | – | – | (batch, 43, 64) |
| 6 | LSTM | 50 | – | tanh | (batch, 50) |
| 7 | Dense | 25 | – | ReLU | (batch, 25) |
| 8 | Dense (Output) | 60 | – | Linear | (batch, 60) |
2. Experimental Setup
2.1 Environment
The experiments were conducted using PyCharm with Python 3.9 and the PyTorch deep learning framework. The hardware environment consisted of an Intel Core i5-7300HQ CPU running at 2.50 GHz, an NVIDIA GeForce GTX 1050Ti GPU, and 16 GB of RAM, operating on Windows 10.
2.2 Dataset
The data used in this study were collected from a real solar inverter installed in an oilfield PV power station. The dataset includes five parameters recorded at one-minute intervals over eight days, resulting in a total of 11,520 records. The parameters are:
- Solar inverter temperature (T) – target variable
- Output voltage (P) – (though variable name suggests power, in the original dataset it corresponds to voltage measured; but we keep original notation)
- Output current (Ia)
- Ambient temperature (Ambient_temperature)
- Ambient humidity (Ambient_humidity)
The dataset reflects the realistic operating conditions of the solar inverter, including variations due to daytime/nighttime cycles, weather changes, and load variations.
2.3 Data Preprocessing
All features were normalized to the range [0,1] using min-max normalization to improve training stability and convergence:
$$ x_{\text{norm}} = \frac{x – x_{\min}}{x_{\max} – x_{\min}} $$
Subsequently, time series samples were constructed using a sliding window approach. For each sample, we used past 180 time steps (3 hours) to predict the next 60 time steps (1 hour) of the solar inverter temperature. This sequence length and prediction horizon were chosen to balance between capturing sufficient historical context and providing practically useful forecasts.
The dataset was split into training and testing sets: the first 80% of the chronological data (approximately 9,216 records) were used for training, and the remaining 20% (2,304 records) for testing. To avoid data leakage, the sequence construction was performed after the split.
2.4 Model Configuration and Training
Two models were implemented for comparison: a standalone LSTM model and the proposed CNN-LSTM hybrid model. The LSTM model used two LSTM layers with 50 units each, followed by a dense layer for output. The CNN-LSTM model followed the architecture detailed in Table 1. Both models were trained using the Adam optimizer with a learning rate of 0.001 and batch size of 32. The loss function was mean squared error (MSE). Early stopping with a patience of 10 epochs was applied to prevent overfitting. The maximum number of epochs was set to 100.
Evaluation metrics included:
- Mean Absolute Error (MAE): $$ \text{MAE} = \frac{1}{n} \sum_{i=1}^{n} |y_i – \hat{y}_i| $$
- Mean Squared Error (MSE): $$ \text{MSE} = \frac{1}{n} \sum_{i=1}^{n} (y_i – \hat{y}_i)^2 $$
- Coefficient of Determination (R²): $$ R^2 = 1 – \frac{\sum_{i=1}^{n} (y_i – \hat{y}_i)^2}{\sum_{i=1}^{n} (y_i – \bar{y})^2} $$
Additionally, the performance improvement percentage of the hybrid model over the LSTM model was computed using:
$$ P = \left| \frac{\text{MAE}_{\text{LSTM}} – \text{MAE}_{\text{CNN-LSTM}}}{\text{MAE}_{\text{LSTM}}} \right| \times 100\% $$
3. Results and Discussion
3.1 Quantitative Results
The experimental results are summarized in Table 2. The CNN-LSTM hybrid model achieved an MAE of 0.010152, an MSE of 0.0433, and an R² of 0.9655. In comparison, the standalone LSTM model yielded an MAE of 0.018073, an MSE of 0.0610, and an R² of 0.9236.
| Model | MAE | MSE | R² |
|---|---|---|---|
| LSTM | 0.018073 | 0.0610 | 0.9236 |
| CNN-LSTM | 0.010152 | 0.0433 | 0.9655 |
The improvement in MAE was:
$$ P = \frac{0.018073 – 0.010152}{0.018073} \times 100\% \approx 43.8\% $$
This significant reduction in error demonstrates that the CNN-LSTM model is substantially more accurate than the LSTM model alone. The higher R² value (0.9655 vs. 0.9236) indicates that the hybrid model explains about 96.55% of the variance in the solar inverter temperature data, compared to 92.36% for the LSTM model.
3.2 Visual Analysis
The prediction curves (not shown as images but described) reveal that the CNN-LSTM model’s predicted temperature profile closely follows the actual temperature measurements, especially at peaks and troughs where the LSTM model tends to exhibit larger deviations. The hybrid model captures both the overall trend and fine-grained fluctuations more effectively, thanks to the CNN’s ability to extract local patterns such as rapid changes due to cloud cover or load variations, and the LSTM’s capacity to retain long-term dependencies such as diurnal cycles.
3.3 Discussion
The superior performance of the CNN-LSTM model can be attributed to several factors:
- Feature extraction: The convolutional layers learn spatial hierarchies among the multiple input variables. For example, the correlation between ambient temperature and inverter cooling, or between output current and internal heat generation, are captured as local features.
- Temporal modeling: The LSTM layer effectively models the sequential nature of the data, capturing the fact that the solar inverter temperature evolves smoothly over time and depends on its previous states.
- Combined representation: By first applying CNN to transform the raw multivariate sequence into a more informative representation, the LSTM receives a richer input that highlights relevant patterns. This synergy reduces the burden on the LSTM to learn both feature extraction and sequence modeling.
The results also indicate that the CNN-LSTM model generalizes well to unseen data, as the testing set was derived from a continuous time period not seen during training. The consistent performance across training and testing phases suggests no significant overfitting. The early stopping mechanism further ensured that training halted before memorization occurred.
3.4 Practical Implications
Accurate prediction of solar inverter temperature has several practical benefits:
- Preventive maintenance: If the predicted temperature exceeds a safe threshold, alerts can be generated to schedule cooling system checks or component replacements before failure occurs.
- Operational optimization: Knowing future temperature trends allows the inverter’s control system to adjust power output or engage active cooling strategies, maximizing lifespan.
- Energy yield forecasting: Temperature affects conversion efficiency; thus, accurate temperature forecasts contribute to more precise energy production estimates.
Furthermore, the method can be extended to other Solar inverter fleet monitoring scenarios, where multiple inverters are deployed across large areas. The model’s reliance only on commonly measured parameters (voltage, current, ambient conditions) makes it easily deployable without additional hardware.
4. Conclusion
This study presented a CNN-LSTM hybrid neural network for predicting the temperature of a solar inverter in a photovoltaic power generation system. By leveraging the convolutional neural network’s feature extraction capability and the long short-term memory network’s temporal modeling strength, the proposed model achieved significantly lower prediction errors and higher R² compared to a standalone LSTM model. The experiments were conducted on real-world data collected from an oilfield PV station, demonstrating practical applicability.
The key findings are:
- The CNN-LSTM model reduced the MAE by approximately 43.8% relative to the LSTM model.
- The model achieved an R² of 0.9655, indicating excellent explanatory power.
- The hybrid architecture effectively captures both local spatial patterns and long-term dependencies in multivariate time series data.
Future work will explore more advanced architectures, such as incorporating attention mechanisms, bidirectional LSTM layers, or graph convolutional networks to capture spatial relationships among multiple inverters. Additionally, hyperparameter optimization using Bayesian methods or evolutionary algorithms may further improve performance. Testing the model under different climatic regions and inverter types will validate its generalization ability. Finally, integrating the temperature prediction module into an online monitoring system for real-time decision support is a natural next step.
In summary, the CNN-LSTM hybrid model provides a robust and accurate solution for predicting solar inverter temperature, contributing to the reliable and efficient operation of photovoltaic power systems in the renewable energy landscape.
