<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Namandeep Kaur Chahal on Medium]]></title>
        <description><![CDATA[Stories by Namandeep Kaur Chahal on Medium]]></description>
        <link>https://medium.com/@chahalnamandeep123?source=rss-3e98f3596733------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*UfhR6WGFeYVVUgXN</url>
            <title>Stories by Namandeep Kaur Chahal on Medium</title>
            <link>https://medium.com/@chahalnamandeep123?source=rss-3e98f3596733------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 21:40:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chahalnamandeep123/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[AI-Powered State of Charge Prediction for Solar Battery Storage Using LSTM Neural Networks]]></title>
            <link>https://medium.com/@chahalnamandeep123/ai-powered-state-of-charge-prediction-for-solar-battery-storage-using-lstm-neural-networks-f2c697067bf2?source=rss-3e98f3596733------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2c697067bf2</guid>
            <dc:creator><![CDATA[Namandeep Kaur Chahal]]></dc:creator>
            <pubDate>Sat, 28 Mar 2026 16:41:04 GMT</pubDate>
            <atom:updated>2026-03-29T08:30:18.558Z</atom:updated>
            <content:encoded><![CDATA[<h3>1. Introduction</h3><p>Solar panels generate energy intermittently, producing excess power during the day and none at night. Battery storage systems solve this problem by storing surplus energy for later use. However, the efficiency of these systems depends heavily on how accurately the Battery Management System (BMS) can estimate the battery’s State of Charge (SoC).</p><p>The State of Charge of a battery is defined as the ratio of remaining charge in the battery compared to its maximum charge capacity. In practical terms, SoC is expressed as a value between 0.0 and 1.0, where 1.0 represents a fully charged battery and 0.0 represents empty. Since SoC cannot be measured directly, it must always be estimated. This makes accurate estimation one of the most critical functions of any BMS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/1*C0DLu-S6qbjvR40o1Ogn6w.png" /></figure><p>where,</p><ol><li>Q(0) is the Initial charge of the battery</li><li>Q is the quantity of electricity delivered by or supplied to, the battery.</li><li>Q(max) is the maximum charge that can be stored in the battery.</li><li>SoC(0) (%) is the initial state-of-charge (SoC %) of the battery.</li></ol><p>Reliable SoC estimation is essential for preventing overcharging and over-discharging, both of which reduce battery lifespan. It also enables smarter energy decisions about when to draw from stored energy versus when to rely on the grid or direct solar generation.</p><p>In desert environments such as the United Arab Emirates, these challenges become more severe. High temperatures, large day–night fluctuations, dust affecting solar output, and irregular charging cycles all introduce uncertainty into battery behavior. Under such dynamic conditions, traditional SoC estimation methods often struggle to maintain accuracy.</p><h3>2. Factors That Affect State of Charge</h3><p>Before looking at estimation methods, it’s important to understand what actually affects SoC in real-world battery systems. In practice, SoC is not stable, it is influenced by several dynamic factors that make accurate estimation challenging.</p><p><strong>Battery Age</strong> gradually reduces capacity over time. As batteries degrade, their maximum charge decreases, internal resistance increases, and voltage behavior shifts. This means a battery after two years no longer behaves like a new one, making pre-calibrated estimation methods less reliable.</p><p><strong>Temperature</strong> has a major impact on battery performance. High temperatures accelerate chemical degradation, while low temperatures can disrupt normal charge behavior. In environments like the United Arab Emirates, where temperatures can range from around 15°C at night to over 45°C during the day, this becomes a critical source of error in SoC estimation.</p><p><strong>Battery Chemistry</strong> also plays a key role. Different battery types such as lithium-ion, lead-acid, and LFP (Lithium Iron Phosphate) have different charge and discharge characteristics. While lithium-ion batteries (commonly used in solar storage) offer relatively stable performance, they are still affected by temperature, aging, and operating conditions.</p><p><strong>Charge Rate and Load</strong> influence how energy moves inside the battery. High charge rates and heavy usage can cause internal imbalances, leading to temporary voltage drops and inaccurate SoC readings. Under real operating conditions, this makes it difficult to rely on simple measurement-based methods.</p><h3>3. Current SoC Estimation Methods</h3><p>Several methods are widely used to estimate SoC in commercial battery systems, but each struggles under real-world conditions.</p><p><strong>Coulomb Counting</strong> is the most commonly used approach in devices ranging from consumer electronics to electric vehicles and solar storage systems. It estimates SoC by tracking the current flowing in and out of the battery over time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*U1OuwzwCznXaI3yHpKvzkQ.png" /></figure><p>where,</p><ol><li>SoC(0) (%) is the initial state of charge of the battery.</li><li>C(rated)is the rated capacity of the battery</li><li>I(b) is the battery current</li><li>I(loss) is the current consumed by loss reactions</li></ol><p>While simple and easy to implement, even small measurement errors accumulate over multiple charge cycles. Since the battery loses energy through inefficiencies and self-discharge, the method gradually drifts away from the true SoC unless it is frequently recalibrated. In solar systems, where charging is irregular due to changing sunlight, this drift becomes even more pronounced.</p><p><strong>Voltage-Based Estimation</strong> relies on the relationship between battery voltage and SoC. Higher voltage generally indicates higher charge, and lower voltage indicates depletion. To improve accuracy, this method uses open-circuit voltage (OCV), measured when the battery is at rest. However, this creates a major limitation because batteries in real systems are rarely at rest. Voltage is also affected by temperature, aging, and load conditions, meaning the same voltage can correspond to very different SoC values.</p><p><strong>Kalman Filtering</strong> improves upon these methods by combining measurements with a mathematical model of battery behavior. It continuously predicts the battery’s state and corrects it using real-time data, making it more robust to changing conditions. However, this approach depends heavily on an accurate battery model, significant computational resources, and proper initialization. As batteries age and behave nonlinearly, maintaining an accurate model becomes increasingly difficult.</p><p>All three methods share a fundamental limitation: they depend on predefined models or assumptions about battery behavior. In environments like the UAE, where high temperatures, irregular charging patterns, and battery degradation are common, these assumptions break down. As a result, estimation accuracy declines over time, especially under dynamic, real-world conditions.</p><h3>4. Methodology</h3><h4>4.1. Dataset</h4><p>This study uses the LG 18650HG2 Li-ion Battery Dataset, a publicly available dataset containing real laboratory battery cycling data. Six charge–discharge cycle files were combined, resulting in 406,575 timestamped samples recorded at ~1-second intervals.</p><p>Each sample includes:</p><ul><li>Voltage (V)</li><li>Current (A)</li><li>Temperature (°C)</li><li>Capacity (Ah)</li></ul><h4>4.2. Data Preprocessing</h4><p>Irrelevant columns (e.g., step number, status flags) were removed, and remaining data was cleaned and converted to numeric format. Capacity values were converted to absolute values to handle signed discharge readings.</p><p>All input features such voltage, current, and temperature were normalized to the range [0,1] using MinMaxScaler. Scaling is critical because the three variables operate on different numerical scales. Without it, the model would treat current as more important simply because its raw numbers are larger. Scaling ensures all three features contribute equally.</p><h4>4.3. Feature Selection</h4><p>Voltage, current, and temperature were selected as input features due to their direct influence on battery behavior. Voltage reflects charge level, Current tells the model how fast energy is flowing out, higher discharge current means SoC drops faster. Temperature affects battery efficiency , cold batteries discharge differently from warm ones</p><p>Unlike traditional methods, the model does not rely on prior SoC values or accumulated charge. Instead, it learns SoC directly from raw sensor data.</p><h4>4.4. Sequence Creation</h4><p>LSTM networks require sequential input. A sliding window approach (technique that breaks a long time-series sequence into smaller, overlapping segments of fixed length) created sequences of 10 consecutive timesteps, with the model predicting SoC at the next timestep.</p><pre>Timestep 1:  Voltage=0.82, Current=0.03, Temp=0.41<br>Timestep 2:  Voltage=0.81, Current=0.04, Temp=0.42<br>...<br>Timestep 10: Voltage=0.62, Current=0.23, Temp=0.50<br>→ Predict: SoC at timestep 11</pre><p>The window slides one step forward each time. Sequence 2 uses timesteps 2–11, sequence 3 uses timesteps 3–12, and so on. This generated over 400,000 training sequences from the combined dataset.</p><h4>4.5. Baseline Model</h4><p>A Linear Regression model was trained on flattened input sequences to serve as a baseline. This provides a reference for evaluating the performance improvement achieved by the LSTM model.</p><h3>5. LSTM Architecture</h3><p>The model architecture is as follows:</p><ul><li>Input: 10 timesteps × 3 features</li><li>LSTM layer: 64 units</li><li>Dropout: 0.2</li><li>Dense layer: 32 neurons (ReLU activation)</li><li>Output layer: 1 neuron (linear activation)</li></ul><p><strong>5.1. LSTM Layer (64 units):</strong> Each of the 64 memory cells learns different temporal patterns in the battery data. Internal gates control the flow of information:</p><ul><li><strong>Forget gate</strong> decides what past information to discard</li><li><strong>Input gate</strong> decides what new information to store</li><li><strong>Output gate</strong> decides what information to pass forward</li></ul><p>Together, these gates allow the model to remember relevant long-term patterns while ignoring noise.</p><p><strong>5.2. Dropout (0.2):</strong> During training, 20% of neurons are randomly ignored at each step. This prevents overfitting by forcing the model to distribute learning across all neurons rather than relying on a few.</p><p><strong>5.3. Dense Layer (32 neurons, ReLU):</strong> Processes the output of the LSTM layer. ReLU activation introduces nonlinearity, allowing the model to learn complex relationships in the data.</p><p><strong>5.4. Output Layer (1 neuron, Linear):</strong> Produces the predicted SoC as a continuous value between 0 and 1.</p><p><strong>Training Details:</strong> The model was compiled with the Adam optimizer and mean squared error (MSE) loss. It was trained with a batch size of 32 for up to 50 epochs, using early stopping (patience = 5) to prevent overfitting. Training stopped at epoch 11, restoring the best weights from epoch 6.</p><h3>6. Model Prediction Process</h3><p>For a new input sequence of 10 timesteps, the LSTM model predicts SoC in a single forward pass. The scaled voltage, current, and temperature values are processed sequentially through the LSTM layer, which updates its internal memory to capture temporal patterns. The resulting summary vector is then processed by the dense layer, producing a final prediction between 0 and 1.</p><p>This forward pass occurs in milliseconds. In a real battery management system for solar storage, the model could run continuously, updating the predicted SoC every second as new measurements arrive.</p><h3>7. Results</h3><h4>7.1. Model Comparison</h4><p>The LSTM model outperformed the baseline Linear Regression model in predicting battery State of Charge (SoC). Performance metrics are summarized below:</p><pre>Linear Regression — MAE: 0.0465 | RMSE: 0.0615<br>LSTM              — MAE: 0.0325 | RMSE: 0.0435</pre><p>The LSTM achieved a mean absolute error (MAE) of 0.0325, meaning its predictions deviate from the actual SoC by approximately 3.25 percentage points on average. This represents a <strong>30% improvement over the Linear Regression baseline</strong>, demonstrating that the LSTM can more accurately capture the nonlinear and time-dependent behavior of real battery systems.</p><p>These results highlight the advantage of data-driven LSTM models over simpler, rule-based approaches for dynamic environments such as solar battery storage in desert climates.</p><h4>7.2. Why LSTM Outperforms Linear Regression</h4><p>Linear Regression predicts SoC by fitting a straight-line relationship to the three input features at a single timestep. It cannot account for how quickly voltage changes, whether the battery is charging or discharging, or the nonlinear voltage–SoC curve near full or empty states.</p><p>In contrast, the LSTM observes 10 consecutive timesteps simultaneously, learning temporal dynamics such as the rate of change, direction, and nonlinear patterns. This enables it to make more accurate predictions, capturing battery behavior that a simple linear model cannot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*OqFaO7DJAIcd5UlXnJ7M5w.png" /></figure><p>Figure shows the LSTM’s predicted SoC versus actual SoC across the test set, with the diagonal line representing perfect predictions.Predictions closely follow this line across the full 0–1 range, indicating strong accuracy. Slightly higher scatter appears at low (0–0.2) and high (0.8–1.0) SoC levels, where battery behavior is more nonlinear. An overall MAE of <strong>3.25%</strong> confirms that the model generalizes well across the entire charge range.</p><h4>7.3. Training Behavior</h4><p>The LSTM’s training loss declined steadily from epoch 1 through epoch 11, starting at 0.0059 and falling to 0.00075. Validation loss reached its best point of 0.0011 at epoch 6, then began rising and fluctuating indicating overfitting after epoch 6. Early stopping triggered at epoch 11 with patience of 5 epochs, restoring the best weights from epoch 6. This ensured the final model represents its best generalization performance rather than its most trained state</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-1moYhxWGMW0LgKh37_tVw.png" /></figure><p>Figure shows training and validation loss over 11 epochs. Training loss steadily decreases, while validation loss improves until epoch 6 and then begins to rise, indicating overfitting. Early stopping halted training at epoch 11 and restored the best weights from epoch 6, ensuring optimal generalization.</p><h4>7.4. Feature Relationships</h4><p>Analysis of feature correlations revealed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i5b1Vy9qztMFYdX9LJIlgg.png" /></figure><ul><li><strong>Voltage</strong> shows a strong but nonlinear relationship with SoC. Higher voltage generally indicates higher charge, while lower voltage corresponds to lower charge — especially under open-circuit conditions. However, this relationship is not linear. Battery voltage curves become highly nonlinear near full and empty states, which limits the accuracy of simple voltage-based lookup methods. The scatter plot in Figure 1 reflects this nonlinearity across the full SoC range.</li><li><strong>Current</strong> has a temporal relationship with SoC rather than an instantaneous one. During discharge, higher current accelerates the rate at which SoC decreases. During charging, current contributes to a gradual increase in SoC over time. A single current reading provides little information about the current SoC level. However, a sequence of readings allows the model to infer whether the battery is charging or discharging, and at what rate. This time-dependent behavior cannot be captured by static models like linear regression but is learned naturally by the LSTM.</li><li><strong>Temperature</strong> affects both battery behavior and SoC estimation accuracy. Around 25°C, batteries operate near optimal conditions, resulting in more stable and reliable predictions. Low temperatures increase internal resistance and reduce usable capacity, while high temperatures (&gt;40°C) can distort SoC estimation and accelerate long-term degradation. In this dataset, temperature variation is limited due to controlled laboratory conditions, with most values near room temperature. In real-world solar storage systems particularly in environments like the UAE, temperature varies significantly (15°C to 45°C+), making it a much more critical factor for accurate SoC prediction.</li></ul><p>These insights highlight how the LSTM leverages physical relationships in the data while also learning temporal dynamics that static models cannot capture.</p><h3>8. Interactive Dashboard</h3><p>To demonstrate the practical application of the trained LSTM model, an interactive web dashboard was developed using Streamlit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-14dSoe-ub9TqcczkL2e6Q.png" /></figure><h4>8.1. How It Works</h4><p>The dashboard allows users to input three battery parameters — voltage (2.5V–4.5V), current (0A–5A), and temperature (0°C–50°C) using interactive sliders.</p><p>Since the LSTM model requires sequential time-series data rather than isolated inputs, the dashboard uses a <strong>nearest-match approach</strong>. User inputs are first scaled using the same MinMaxScaler applied during training. The system then searches the test dataset for the closest matching real battery reading and retrieves the corresponding 10-timestep sequence. This sequence is passed into the LSTM to generate a predicted SoC.</p><p>As a result, predictions are based on <strong>real battery behavior</strong>, not synthetic or simulated inputs.</p><h4>8.2. What the Dashboard Displays</h4><p>The predicted SoC is shown as a percentage along with a color-coded status indicator:</p><ul><li><strong>Green:</strong> Good (&gt;50%)</li><li><strong>Orange:</strong> Moderate (20–50%)</li><li><strong>Red:</strong> Low (&lt;20%)</li></ul><p>The dashboard also displays the <strong>actual SoC</strong> at the matched data point and the <strong>prediction error</strong>, allowing users to directly evaluate model accuracy.</p><h4>8.3. Interpretation of Input Variables</h4><p>The dashboard provides a simplified interpretation of how each variable relates to SoC:</p><ul><li><strong>Voltage:</strong> Positive relationship — higher voltage indicates higher charge.</li><li><strong>Current:</strong> Temporal effect — higher discharge current leads to faster SoC decrease over time (not an instantaneous change).</li><li><strong>Temperature:</strong></li></ul><ol><li>Below 10°C: Reduced performance (negative impact)</li><li>10–35°C: Optimal range (minimal impact)</li><li>Above 35°C: Increased estimation uncertainty and long-term degradation</li></ol><h3>9. Limitations</h3><p>The model’s performance is constrained by the distribution and scale of the training data.</p><p><strong>Temperature Range:</strong> The dataset was collected at near-room temperatures (mean 24.2°C), with most values between 0°C and 26°C. As a result, the model shows limited reliability at higher temperatures (&gt;40°C), which are common in regions like the United Arab Emirates. In the dashboard, inputs outside this range are handled using a nearest-match approach, mapping them to the closest available data point. This does not represent true battery behavior under extreme conditions and limits real-world applicability.</p><p><strong>Single Battery Chemistry:</strong> The model was trained exclusively on LG 18650HG2 lithium-ion cells. Different chemistries, such as LFP, NMC, or solid-state batteries, exhibit different charge–discharge characteristics and would require separate training data.</p><p><strong>Dataset Scale:</strong> Industrial battery systems are trained on millions of cycles across thousands of batteries. This study uses only six cycles from a single battery, which is sufficient for a proof of concept but limits generalizability.</p><p>These limitations highlight the need for future work involving larger, more diverse datasets, particularly including high-temperature conditions to improve model robustness for real-world deployment.</p><h3>10. Real-World Applications</h3><p>This LSTM-based approach is directly relevant to commercial battery storage systems:</p><ul><li><strong>Tesla Powerwall:</strong> Uses proprietary BMS with Coulomb counting, voltage correction, and thermal management, with ML updates pushed remotely.</li><li><strong>Sonnen:</strong> Combines Coulomb counting with a Kalman filter layer.</li><li><strong>LG Chem RESU:</strong> Uses standard Coulomb counting with temperature correction and is widely deployed in UAE residential solar installations.</li><li><strong>Huawei LUNA:</strong> Claims AI-assisted correction in newer models, though implementation details are not publicly disclosed.</li></ul><p>All these systems face common challenges: irregular charging patterns, partial cycles, temperature extremes, and battery aging. An LSTM trained on diverse real-world data directly addresses these challenges by learning nonlinear patterns rather than relying on fixed mathematical models.</p><h3>11. Future Work</h3><ul><li><strong>High-Temperature Training:</strong> Including battery data at 40°C+ will improve reliability for desert deployment.</li><li><strong>Battery Aging:</strong> Incorporating aged battery data will allow the model to adapt SoC predictions over a 10–15 year lifespan.</li><li><strong>Real-Time Deployment:</strong> Integrating live BMS sensor feeds would enable genuine sequential inference, replacing the nearest-match approximation.</li><li><strong>Multi-Chemistry Testing:</strong> Training across multiple battery chemistries will enhance generalizability beyond LG 18650HG2 cells.</li></ul><h3>12. Conclusion</h3><p>This study demonstrates that an LSTM neural network can predict battery State of Charge with <strong>30% greater accuracy than a Linear Regression baseline</strong>, achieving a mean absolute error of <strong>3.25%</strong> on unseen test data. By learning nonlinear temporal relationships between voltage, current, and temperature directly from real battery cycling data, the model avoids the fixed assumptions that limit traditional methods.</p><p>For solar energy storage in desert climates like the UAE, accurate SoC estimation is <strong>critical</strong>. Temperature extremes, irregular charging from variable solar generation, partial discharge cycles, and progressive battery aging all degrade traditional BMS accuracy. The LSTM approach addresses these challenges directly by learning from data rather than relying on idealized models.</p><p>This work represents a proof of concept showing that deep learning can significantly improve upon current commercial BMS methods. As edge computing advances make neural networks feasible on embedded hardware, LSTM-based SoC estimation is well-positioned to become the next-generation standard for battery management in solar storage systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2c697067bf2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Solar Panel Efficiency Loss Using Data and Predictive Modeling]]></title>
            <link>https://medium.com/@chahalnamandeep123/understanding-solar-panel-efficiency-loss-using-data-and-predictive-modeling-32706da4b3f9?source=rss-3e98f3596733------2</link>
            <guid isPermaLink="false">https://medium.com/p/32706da4b3f9</guid>
            <dc:creator><![CDATA[Namandeep Kaur Chahal]]></dc:creator>
            <pubDate>Mon, 22 Dec 2025 18:12:41 GMT</pubDate>
            <atom:updated>2026-08-03T08:52:42.361Z</atom:updated>
            <content:encoded><![CDATA[<h3>Solar Energy Generation Prediction Using Machine Learning</h3><h3>Introduction</h3><p>As renewable energy adoption increases worldwide, solar power has become one of the most promising sources of clean energy. However, one of the biggest challenges with solar energy is its variability. Unlike traditional power sources, solar generation depends heavily on changing environmental conditions such as temperature, humidity, wind, and time of day.</p><p>Accurate solar generation forecasting is essential for efficient energy management. It helps grid operators balance electricity supply and demand, allows businesses to optimize energy usage, and improves the integration of renewable sources with battery storage systems.</p><p>For this project, I explored whether machine learning models could predict solar energy generation using real-world weather and temporal data. Instead of relying only on physical equations, the goal was to allow models to learn complex patterns directly from historical solar generation data.</p><p>The project compares multiple machine learning approaches, starting with a simple Linear Regression baseline and progressing to advanced tree-based models such as Random Forest and XGBoost.</p><h3>Dataset</h3><p>This project uses the <strong>UNISOLAR Solar Energy Generation Dataset</strong>, which contains solar generation measurements combined with corresponding weather information.</p><p>Two datasets were used:</p><h4>Solar Energy Generation Data</h4><p>Contains historical solar power generation measurements, including:</p><ul><li>Solar generation output</li><li>Campus location identifiers</li><li>Timestamp information</li></ul><h4>Weather Data</h4><p>Contains environmental conditions recorded at the same timestamps, including:</p><ul><li>Air temperature</li><li>Dew point temperature</li><li>Relative humidity</li><li>Wind speed</li><li>Wind direction</li></ul><p>After merging both datasets using <strong>CampusKey and Timestamp</strong>, the final dataset contained:</p><ul><li>Initial merged samples: 2,699,161</li><li>Final cleaned samples: 2,317,943</li></ul><p>The dataset contains timestamped solar generation and weather measurements collected across multiple years, enabling time-series forecasting.</p><p>Unlike simulated datasets, this data represents real operating conditions, allowing machine learning models to learn patterns influenced by actual environmental variation.</p><h3>Methodology</h3><p>The methodology of this project focused on developing a machine learning pipeline to predict solar energy generation using historical solar production data combined with environmental conditions. The workflow consisted of data preprocessing, feature engineering, model development, evaluation, and comparison of multiple machine learning algorithms.</p><h4>1. Data Preprocessing</h4><p>The raw solar generation and weather datasets were first combined using common identifiers, including <strong>CampusKey</strong> and <strong>Timestamp</strong>, to create a unified dataset containing both power generation measurements and environmental variables.</p><p>The merged dataset initially contained approximately <strong>2.7 million records</strong>. Data cleaning was performed to improve reliability and remove inconsistencies:</p><ul><li>Timestamp values were converted into datetime format to enable time-based analysis.</li><li>Missing nighttime solar generation values were replaced with zero, since photovoltaic systems naturally produce no energy during periods without sunlight.</li><li>Remaining missing solar generation values were removed.</li><li>Weather-related missing values were handled using interpolation within each campus to preserve temporal continuity.</li><li>Duplicate records were checked and removed where necessary.</li><li>A problematic campus with inconsistent data distribution was excluded to prevent model bias.</li></ul><p>After preprocessing, the final dataset contained approximately <strong>2.31 million valid observations</strong>.</p><h4>2. Feature Engineering</h4><p>Solar generation is strongly influenced by temporal patterns because photovoltaic systems follow daily and seasonal cycles. To allow machine learning models to capture these patterns, additional time-based features were extracted from the timestamp.</p><p>The following features were created:</p><ul><li><strong>Hour</strong>: captures daily solar production patterns.</li><li><strong>Month</strong>: represents seasonal variations.</li><li><strong>Day of Year</strong>: captures yearly changes in solar availability.</li><li><strong>Day of Week</strong>: accounts for possible weekly operational differences.</li></ul><p>Since time variables are cyclical rather than continuous, sine and cosine transformations were applied:</p><ul><li><strong>Hour_sin and Hour_cos</strong> represent the 24-hour daily cycle.</li><li><strong>Month_sin and Month_cos</strong> represent the yearly seasonal cycle.</li></ul><p>Cyclic encoding prevents the model from incorrectly interpreting values such as 23:00 and 00:00 as far apart, even though they represent adjacent points in time.</p><p>The apparent temperature feature was removed due to its strong correlation with other temperature variables, reducing unnecessary redundancy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aFjy2BA4InC5bdo9HlKk1A.png" /><figcaption>Daily Solar Generation Pattern. The average generation profile demonstrates the strong dependence of photovoltaic output on time of day, supporting the inclusion of temporal features such as Hour_sin and Hour_cos during model training.</figcaption></figure><h4>3. Dataset Split</h4><p>To simulate a real-world forecasting scenario, the dataset was divided using a time-based split rather than random sampling.</p><ul><li><strong>Training data:</strong> Records before January 2022</li><li><strong>Testing data:</strong> Records from January 2022 onwards</li></ul><p>This approach ensures that the model is evaluated on future unseen conditions rather than randomly mixed historical data.</p><p>The final dataset was divided into:</p><ul><li>Training set: <strong>1,919,787 samples</strong></li><li>Testing set: <strong>398,156 samples</strong></li></ul><h4>4. Machine Learning Models</h4><p>Three regression models were developed and compared to evaluate their ability to predict solar generation.</p><p><strong>Linear Regression (Baseline Model)</strong></p><p>Linear Regression was used as the baseline model because of its simplicity and interpretability. It assumes that solar generation has a primarily linear relationship with environmental and temporal variables.</p><p>Although useful for understanding general trends, Linear Regression has limitations when dealing with nonlinear relationships commonly present in photovoltaic systems.</p><p><strong>Random Forest Regression</strong></p><p>Random Forest was implemented as an ensemble learning approach. It combines multiple decision trees to capture complex relationships between input variables and solar generation.</p><p>The model was configured with:</p><ul><li>100 decision trees</li><li>Maximum depth of 20</li><li>Parallel processing enabled</li></ul><p>Random Forest was selected because solar generation depends on nonlinear interactions between factors such as time, location, temperature, and humidity.</p><p><strong>XGBoost Regression</strong></p><p>XGBoost (Extreme Gradient Boosting) was implemented as an advanced gradient boosting model. Unlike Random Forest, which builds trees independently, XGBoost builds trees sequentially, where each new tree attempts to correct errors made by previous trees.</p><p>The model was configured with:</p><ul><li>300 boosting estimators</li><li>Learning rate: 0.05</li><li>Maximum tree depth: 8</li><li>Subsampling: 80%</li><li>Feature sampling: 80%</li></ul><p>XGBoost was selected because gradient boosting methods are highly effective for structured tabular datasets and can capture complex nonlinear relationships.</p><h4>5. Model Evaluation</h4><p>The performance of each model was evaluated using three regression metrics:</p><p><strong>Mean Absolute Error (MAE)</strong>: MAE measures the average absolute difference between predicted and actual solar generation values. Lower MAE indicates more accurate predictions.</p><p><strong>Root Mean Squared Error (RMSE)</strong>: RMSE penalizes larger prediction errors more heavily, making it useful for identifying significant prediction deviations.</p><p><strong>R² Score:</strong> The R² score measures how much variation in solar generation is explained by the model. A value closer to 1 indicates stronger predictive performance.</p><p>The three models were compared using these metrics to determine the most effective approach for solar generation prediction.</p><h3>Linear Regression Baseline</h3><p>Linear Regression achieved an R² score of approximately 0.24, showing that solar generation cannot be fully explained through simple linear relationships. The model struggled with nonlinear interactions between weather conditions, location, and time-based patterns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*9ffB-nANuuXzsnauDHu_kQ.png" /></figure><h3>2. Random Forest Regression</h3><p>Random Forest significantly improved performance, achieving an R² score of approximately 0.84. Its ability to capture nonlinear relationships allowed it to better model interactions between environmental variables and solar generation patterns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*00tSAGweGNmpCHF4J7D13g.png" /></figure><h3>3. XGBoost (Extreme Gradient Boosting) Regression</h3><p>XGBoost achieved the best overall performance with an R² score of 0.863 and RMSE of 3.59. Its sequential boosting approach allowed it to capture complex relationships between temporal patterns, weather conditions, and site-specific characteristics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*ni-dFp5G5a54-ZaNxap3Hg.png" /></figure><h3>Model Comparison</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/1*Xes-b0rxjbEB34lQvscWBg.png" /></figure><p>The results show a significant improvement from traditional linear modeling to ensemble-based machine learning approaches. Linear Regression struggled because solar generation depends on complex nonlinear interactions between environmental variables and temporal patterns.</p><p>Random Forest greatly improved prediction accuracy by capturing nonlinear relationships between weather conditions, location, and time-based features.</p><p>XGBoost achieved the strongest overall performance, obtaining the highest R² score (0.863) and lowest RMSE (3.59). This indicates that gradient boosting was able to better capture subtle relationships within the structured solar generation dataset.</p><h3><strong>Feature Importance Analysis</strong></h3><p>Feature importance was analyzed using the XGBoost model to understand which variables contributed most to prediction accuracy.</p><p>The most influential feature was <strong>SiteKey</strong>, indicating that different solar installations have unique generation patterns due to differences in system configuration, installation conditions, and local environment.</p><p>Time-based features, especially hour of day, were also highly important because solar generation follows predictable daily cycles. Weather variables such as humidity and temperature provided additional information by capturing environmental changes affecting solar output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K7ONfSdqnwXRSCfg9h2smw.png" /><figcaption>XGBoost Feature Importance Ranking Showing the Contribution of Different Temporal, Location, and Weather Variables to Solar Generation Prediction.</figcaption></figure><h3>Actual vs Predicted Solar Generation</h3><p>The graph compares actual solar generation with XGBoost predictions over 500 time steps. The blue line represents measured values, while the orange line represents predicted values.</p><p>The model captures the overall trend of solar generation, including increases during high-generation periods and decreases during low-generation periods. However, some differences appear during rapid changes, where predictions may slightly overestimate or underestimate actual values.</p><p>These errors occur because solar generation is influenced by complex factors such as weather fluctuations, cloud movement, and variables not included in the dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N2rG230MelMwgMf6DG-N3w.png" /><figcaption>Actual vs Predicted Solar Generation Using XGBoost Over 500 Time Steps.</figcaption></figure><h3>Real-World Applications</h3><p>Accurate solar generation forecasting can improve decision-making in renewable energy systems.</p><p><strong>Smart Energy Management: </strong>Predicted solar output can help optimize energy usage by estimating future electricity availability.</p><p><strong>Battery Storage Optimization: </strong>Combined with battery State of Charge prediction, solar forecasting can help determine when to store excess energy, use stored power, or rely on alternative sources.</p><p><strong>Renewable Grid Integration: </strong>Forecasting allows energy providers to better balance renewable generation with electricity demand.</p><h3>Limitations</h3><p>Although the model achieved strong performance, several limitations remain.</p><p><strong>Location Dependence: </strong>The model learned patterns from the solar sites present in the dataset. Performance may decrease when applied to completely new locations with different system characteristics.</p><p><strong>Weather Forecast Uncertainty: </strong>Real-time solar prediction depends on accurate weather inputs. Errors in weather forecasts can directly affect generation predictions.</p><p><strong>Limited Physical Variables: </strong>The dataset did not include important photovoltaic factors such as solar irradiance, panel orientation, shading, dust accumulation, and long-term degradation. Including these variables could improve accuracy and make the model more suitable for real-world deployment.</p><h3>Future Work</h3><p>Future improvements could include:</p><ul><li>Adding satellite-based irradiance data</li><li>Incorporating dust accumulation measurements</li><li>Developing real-time forecasting systems</li><li>Combining solar generation prediction with battery SoC prediction</li><li>Creating an intelligent energy management system</li></ul><h3>Conclusion</h3><p>This project demonstrates how machine learning can be used to forecast solar energy generation using real-world environmental and temporal data.</p><p>Starting with a simple Linear Regression baseline, more advanced models such as Random Forest and XGBoost were evaluated. XGBoost achieved the best performance with an R² score of 0.863, showing its ability to capture complex relationships within solar generation data.</p><p>The results highlight how AI can support renewable energy systems by improving prediction accuracy, enabling better energy planning, and creating opportunities for smarter solar and storage solutions.</p><p>This project represents the first part of a larger goal: developing AI-driven renewable energy systems that combine solar forecasting with intelligent battery management.</p><h3>About Me</h3><p>My name is Namandeep Kaur, a Grade 11 student studying in Dubai. I am passionate about renewable energy, AI, and applied engineering. This project reflects my interest in understanding real-world energy systems and using data-driven approaches to solve technical problems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32706da4b3f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How AI Could Transform Solar Energy Efficiency and Storage in Desert Climates]]></title>
            <link>https://medium.com/@chahalnamandeep123/how-ai-could-transform-solar-energy-storage-in-desert-climates-09e06c4b23ff?source=rss-3e98f3596733------2</link>
            <guid isPermaLink="false">https://medium.com/p/09e06c4b23ff</guid>
            <dc:creator><![CDATA[Namandeep Kaur Chahal]]></dc:creator>
            <pubDate>Fri, 07 Nov 2025 07:27:13 GMT</pubDate>
            <atom:updated>2025-12-06T17:49:59.261Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever looked out across the desert and wondered why a region flooded with sunlight still struggles with renewable energy reliability?</p><p>I did.</p><p>Living in Dubai, I’ve always been fascinated by how much potential our endless sunshine holds and equally surprised by how often it goes unused. Cities like Dubai and Riyadh have some of the highest solar potential in the world, yet they face one of energy’s biggest paradoxes. The sun shines all day, but when night falls or a sandstorm rolls in, solar power vanishes. The problem isn’t generation; it’s optimization, storing and managing energy efficiently when the desert itself seems to fight against you.</p><p>That’s where Artificial Intelligence comes in.</p><p>Imagine solar panels that don’t just capture sunlight, but <em>learn</em> from it, predicting sandstorms, adjusting storage levels, and even deciding when to clean themselves. Combining AI with solar energy systems could transform the deserts of today into the intelligent energy ecosystems of tomorrow, where every ray of sunlight is captured, stored, and used wisely.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R9lwERR9rlRxVsaVmtXSvg.jpeg" /><figcaption>Source: The Next Web</figcaption></figure><h3>The Paradox of Desert Solar</h3><p>Deserts appear to be the perfect setting for solar farms, vast open land, endless sunlight, and minimal rainfall. Yet, the very conditions that make them promising also pose significant challenges. In the Gulf region, temperatures often exceed 45°C, reducing solar panel efficiency by 25–30%. Dust and sandstorms accumulate on panels, blocking sunlight and increasing maintenance demands, while lithium-ion batteries degrade faster under extreme heat. Energy demand fluctuates sharply, spiking during the day for cooling and dropping at night.</p><p>Through my research, I realized that the true challenge is not in generating solar power, but in ensuring it remains reliable and efficiently stored in such harsh environments. Deserts, once thought to be perfect places for solar power, are actually challenging environments that test new and creative energy ideas.</p><h3>Why This Challenge Matters</h3><p>Addressing this issue is not just about sustainability, it’s a complex engineering problem. Engineers must design systems that:</p><ul><li>Cool panels efficiently in extreme heat</li><li>Prevent dust from blocking sunlight</li><li>Store energy intelligently and respond to fluctuating demand in real time</li></ul><p>The <strong>International Renewable Energy Agency (IRENA) </strong>projects global energy demand will increase by over 40% by 2030, much of it in already hot regions. Without resilient renewable systems, nations will remain dependent on fossil fuels, worsening climate change and energy inequities.</p><p>Optimizing solar energy in deserts could turn these regions into global clean energy leaders. Reliable and intelligent solar systems would provide affordable power to millions, contributing to <strong>UN SDG 7 (Affordable and Clean Energy)</strong> and <strong>SDG 13 (Climate Action)</strong>. For me, this is more than a technical challenge, it’s an opportunity to rethink sustainability itself.</p><h3>How Solar Panels Work</h3><p>Solar panels convert sunlight into electricity through the <strong>photovoltaic effect</strong>. When sunlight hits silicon cells in a panel, it excites electrons, creating direct current (DC) electricity. An <strong>inverter</strong> then converts this DC into alternating current (AC), which can power homes, businesses, or be stored in batteries. Understanding this basic mechanism is essential before exploring how AI can optimize energy capture, storage, and distribution in harsh desert environments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*-K4B-ABoxSHC5PKZtHtFJg.png" /><figcaption>Source: U.S. Energy Information Administration</figcaption></figure><h3><strong>How AI Changes the Game</strong></h3><p>I set out to answer one core question: <em>Can AI realistically solve the desert’s biggest renewable-energy paradox that is endless sunlight, yet unreliable solar output?</em> In other words, could solar farms in harsh climates not only function but adapt, learning from their environment to maximize both efficiency and reliability?</p><p>Artificial Intelligence has the potential to become the <strong>brain of solar ecosystems</strong>. Unlike traditional systems that react after problems arise, AI can <strong>predict, optimize, and self-correct</strong> in real time, capabilities especially critical in deserts, where extreme heat, sandstorms, and fluctuating demand overwhelm conventional solutions.</p><h4>Prediction: Learning the Desert</h4><p>AI models analyze historical weather data, satellite imagery, and live sensor feeds to anticipate events such as sandstorms, panel overheating, or sudden demand surges. For example:</p><ul><li>Predicting when panel efficiency will drop due to dust build-up.</li><li>Estimating urban energy demand in the next hour.</li></ul><p>Studies in desert environments report <strong>soiling-related output losses of up to ~40%</strong>, underscoring why predictive cleaning and maintenance matter so much.</p><h4>Optimization: Smarter Energy Flow</h4><p>Once a system forecasts patterns, it determines how to <strong>use, store, or distribute energy</strong>. Hybrid storage systems provide the flexibility needed for desert environments:</p><ul><li><strong>Batteries</strong> (lithium-ion or next-generation sodium-ion) for immediate supply.</li><li><strong>Thermal storage</strong> (e.g., molten salts) for releasing energy when sunlight fades.</li><li><strong>Grid feed-in</strong> for sharing excess power.</li></ul><p>By dynamically allocating between these options, AI reduces waste, extends storage lifespan, and ensures reliable electricity even when sunlight is intermittent.</p><h4>Integrating Hybrid Systems for Desert Reliability</h4><p>In desert regions, where sunlight is abundant but unpredictable, <strong>hybrid solar systems</strong> play a crucial role in maintaining consistent energy output. By combining solar panels with battery storage and grid backup, they act as a buffer against fluctuations in sunlight and temperature. When integrated with AI, these systems can autonomously switch between solar, battery, and grid power that can optimizing performance, conserving stored energy, and ensuring uninterrupted electricity during sandstorms or cloudy intervals. This synergy between <strong>AI and hybrid infrastructure</strong> is what makes desert solar farms both efficient and resilient.</p><h4>Maintenance Intelligence: Preventing Problems Before They Happen</h4><p>Dust, sand, and heat silently degrade solar-farm performance. AI, using IoT sensors, thermal imaging, and computer vision, shifts maintenance from <strong>reactive to predictive</strong>. Projects have shown that <strong>AI-assisted cleaning strategies can restore up to 30% more energy output</strong> while cutting cleaning resources by a third or more. In desert climates, this means fewer outages, less water and labor, and longer-lasting equipment.</p><p>Embedding AI as the “brain” of solar farms transforms regions of unlimited sunlight into <strong>resilient, self-optimizing ecosystems</strong>. Engineers remain essential, but AI amplifies their decisions, turning massive data streams into actionable strategies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*abzzQwA4A2-csiJo_us7Fg.png" /><figcaption>Source: MDPI</figcaption></figure><h3>Who’s Leading the Charge</h3><p>The integration of AI into solar energy is accelerating worldwide. Companies like <strong>Tesla </strong>are advancing with Megapack storage systems and AI-based grid balancing in Australia and California, while <strong>Siemens Energy</strong> and <strong>Google DeepMind</strong> develop forecasting algorithms to predict renewable output days in advance.</p><p>In the Middle East, <strong>Masdar (UAE)</strong> and <strong>ACWA Power (Saudi Arabia)</strong> lead large-scale solar projects, with Masdar testing AI-assisted monitoring to improve performance under desert conditions.<strong> Dubai Electricity and Water Authority (DEWA)</strong> applies predictive AI maintenance at the Mohammed bin Rashid Al Maktoum Solar Park, one of the largest solar installations globally.</p><p>Research institutions are also contributing. The <strong>Khalifa University</strong> Center for Renewable Energy Mapping and Assessment in Abu Dhabi develops predictive solar models for desert environments, while <strong>MIT</strong>’s Energy Initiative and<strong> Stanford’s Precourt Institute </strong>explore reinforcement learning for energy storage optimization.</p><p>Startups like <strong>GridX AI</strong>, <strong>AutoGrid</strong>, and <strong>FlexGen</strong> are building intelligent software that automatically balances supply and demand based on learned energy patterns.</p><p>Despite these advances, most global AI energy models still overlook desert-specific challenges such as extreme heat, dust accumulation, and fluctuating solar intensity. This gap presents a unique opportunity for innovation in the Middle East, positioning the region as a potential leader in adaptive, AI-driven solar energy systems.</p><h3><strong>What the Gap is</strong></h3><p>Most global solar optimization systems assume predictable weather and clean air. Deserts are neither. They are chaotic, dynamic ecosystems where a clear blue sky can turn into a sandstorm within minutes. In such places, systems must learn and adapt in real time.</p><p>An AI model trained specifically for desert climates could simulate these unpredictable conditions and make decisions optimized for survival and performance. It could balance panel cooling against power output, predict sand accumulation based on wind data, and even integrate energy demand from nearby cities to ensure grid stability. In other words, it could make solar farms more resilient, adaptable, and intelligent.</p><h3><strong>The Roadblocks Ahead</strong></h3><p>This vision isn’t without its challenges. A major limitation is <strong>data scarcity </strong>because long-term solar performance data from desert environments is limited, making it difficult to train accurate AI models. <strong>Hardware constraints</strong> also pose a challenge as batteries degrade quickly under extreme heat, and sensors can fail during sandstorms. Additionally, the <strong>initial cost</strong> of integrating AI, IoT, and data infrastructure into large-scale solar farms remains high, particularly in developing nations.</p><p><strong>Policy and regulatory frameworks</strong> often lag behind technological advances. Many regions still treat energy systems as static, centralized structures rather than dynamic, AI-driven networks. For adaptive solar ecosystems to succeed, governments, research institutions, and the private sector must collaborate, share data, develop adaptive energy standards, and invest in long-term climate intelligence.</p><h3>My Hypothesis: Where I See This Heading</h3><p>I believe the next era of clean energy won’t come from building more solar farms, but from making existing ones smarter. Within the next decade, adaptive solar ecosystems will sense, learn, and evolve in real time. These AI-driven networks could manage everything from sunlight capture to energy distribution, acting as a “climate whisperer” that keeps renewable energy stable even under punishing desert heat.</p><p>Cities like Dubai, Riyadh, or NEOM could become living laboratories for this transformation, where solar farms continuously optimize themselves using real-time sensor data. Partnerships between AI companies and energy ministries might create national energy networks, allowing farms to communicate, share data, and respond instantly to changing conditions.</p><p>This isn’t just about better technology, it’s about reimagining sustainability as a living, learning system. AI could make sunlight, our planet’s most abundant resource, truly intelligent and reliable. In a world struggling with climate change, the adaptability of AI-driven solar farms may be our greatest source of hope.</p><p>AI has already proven it can master games, drive cars, and write code. Now, it’s time for it to master the greatest challenge of all that is helping humanity power itself sustainably. The desert, with all its extremes, may be the best place to start.</p><h3>Further Reading &amp; References</h3><ol><li>International Energy Agency (IEA): Solar Energy Explained<em> </em><a href="https://www.iea.org/energy-system/renewables/solar-pv">https://www.iea.org/energy-system/renewables/solar-pv</a></li><li>Masdar Clean Energy Projects Overview<br><a href="https://masdar.ae/en/renewables">https://masdar.ae/en/renewables</a></li><li>Tesla Megapack and Energy Storage Systems <a href="https://www.tesla.com/ar_ae/megapack">https://www.tesla.com/ar_ae/megapack</a></li><li>MIT Energy Initiative — The Future of Solar Energy Report <a href="https://energy.mit.edu/research/future-solar-energy/">https://energy.mit.edu/research/future-solar-energy/</a></li><li>Siemens Energy AI Forecasting Project <a href="https://www.siemens-energy.com/global/en/home.html">https://www.siemens-energy.com/global/en/home.html</a></li></ol><h3>About The Author</h3><p>I’m Namandeep Kaur, a Grade 11 student in Dubai and a member of The Knowledge Society (TKS). My focus area lies at the intersection of Artificial Intelligence and Sustainability, where I explore how emerging technologies can help solve climate challenges in extreme environments. I’m passionate about building intelligent systems that make clean energy accessible, efficient, and adaptive, starting with the deserts I call home.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=09e06c4b23ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>