Explainable AI for Carbon Accountability in Decentralized Energy Systems across Sub-Saharan Africa
Sam Odongo · Nairobi, Kenya
LSTM-SHAP Battery AI
Interpretable battery health prediction accounting for hot-climate African minigrid conditions and PAYG charging patterns
MORL Carbon Optimizer
Multi-objective RL balancing cost and carbon reduction across P2P minigrid nodes, validated on East African solar and diesel data
Community-Trusted XAI
SHAP explanations designed for community cooperative operators and EPRA regulators, not just data scientists
Abstract
Sub-Saharan Africa contributes roughly 3% of global carbon emissions but absorbs a disproportionate share of the consequences. The continent's path out of this injustice runs through decentralized renewable energy: minigrids, solar home systems, and peer-to-peer trading networks that can electrify the 600 million people still without reliable power without locking in decades of fossil fuel dependence. The AI systems currently managing these grids are opaque, single-objective, and built for temperate infrastructure assumptions that do not hold in East Africa's climate and connectivity conditions.
This paper proposes an explainable AI framework combining Long Short-Term Memory models with SHapley Additive exPlanations and Multi-Objective Reinforcement Learning to optimize battery health, energy routing, and carbon accountability simultaneously in decentralized East African energy systems. LSTM-SHAP provides interpretable predictions of battery degradation calibrated for high-ambient-temperature conditions and the irregular charging patterns of pay-as-you-go solar systems. MORL manages the cost-carbon tradeoff across P2P minigrid nodes, optimizing energy flow without black-box decisions that community operators cannot interrogate or regulators cannot audit.
Validated against operational data from Kenyan minigrids and PAYG solar deployments across East Africa, the framework targets a 30% reduction in carbon intensity relative to diesel-hybrid baselines. The system runs on edge hardware deployable at minigrid control nodes without continuous cloud connectivity, and produces explanations designed to be legible to community energy cooperative operators, not only data scientists. Open-source, licensed for adaptation across the continent.
Research Background
There is a specific irony in the East African energy picture that I keep coming back to. The Lake Turkana Wind Power project, 310 megawatts cutting across Kenya's Turkana corridor, is the largest wind farm in Africa. It pumps clean electricity into the national grid, helping Kenya achieve one of the highest renewable energy shares of any country in the world, around 90% of grid generation. Yet 200 kilometres from those turbines, communities in Lodwar run petrol generators for four hours a night and pay roughly ten times the grid tariff for the privilege. The grid exists. The renewable capacity exists. The gap is in the last mile, and it is measured in diesel fumes.
East Africa's answer to the last-mile problem is the minigrid. Kenya, Tanzania, Uganda, and Ethiopia collectively operate more than 3,000 minigrids, with the Africa Mini-grid Developers Association projecting that 90% of new rural electrification across the continent will come from decentralized sources by 2030. These systems pair solar generation with battery storage, often supplemented by diesel backup, and increasingly route surplus energy across peer-to-peer networks between households and small businesses. The economics are improving. The carbon accounting, for the most part, does not exist.
The AI optimization tools that exist for decentralized energy grids were built for European and North American contexts: stable grid connections, mild ambient temperatures, consumers who interact with energy apps on smartphones, and regulators who think in megawatt-hours not kilowatt-hours. Applied to a rural Kenyan minigrid, those assumptions break in sequence. Battery degradation in 35-degree heat follows a different curve than at 20 degrees. Pay-as-you-go charging patterns, where households top up daily credit via M-Pesa rather than paying a monthly bill, create irregular load profiles that standard demand forecasting handles poorly. And the energy cooperative that manages the local minigrid, often run by a committee of farmers and small traders, cannot act on an AI recommendation it cannot understand.
This is where explainability stops being a nice-to-have and becomes a hard requirement. A SHAP output that a data scientist reads in a notebook is useless to a cooperative manager in Kisumu who needs to explain to 200 member households why the system shifted load away from grinding machines at 6pm. Transparency in this context means something specific: explanations that hold up in a community meeting, in Swahili, delivered by someone who did not study machine learning.
Africa's carbon accounting problem adds another layer. The continent's Nationally Determined Contributions under the Paris Agreement are among the most ambitious in proportional terms: Kenya has committed to a 32% emissions reduction by 2030. The Africa Carbon Markets Initiative, launched at COP27, targets 300 million verified carbon credits from African projects by 2030. But the minigrid systems generating real emission reductions from displacing diesel have no reliable mechanism to measure, attribute, and verify those reductions in a form that satisfies carbon standard auditors. What is being burned, when, and by how much is either unrecorded or stored in disconnected spreadsheets that cannot be audited at scale.
This project builds the missing layer: an interpretable AI framework that simultaneously optimizes battery longevity, minimizes carbon intensity, and produces auditable explanations of every routing and dispatch decision, designed from the ground up for East Africa's conditions rather than retrofitted from a European smart grid context.
Research Objectives
Build an LSTM-SHAP battery health prediction system calibrated for African conditions
Train LSTM models on battery telemetry from PAYG solar deployments and minigrid storage systems across East Africa, incorporating ambient temperature, irregular charge-discharge cycles, and depth-of-discharge patterns specific to Kenyan and Tanzanian operational conditions. Apply SHAP to produce operator-legible explanations of degradation predictions.
Develop a Multi-Objective Reinforcement Learning optimizer for cost-carbon tradeoffs
Design a MORL algorithm that optimizes energy dispatch across minigrid P2P nodes simultaneously for cost minimization and carbon intensity reduction, using real-time battery state, solar irradiance, demand forecasts, and diesel fuel price signals. Validated against rule-based dispatch systems currently used by REREC-managed minigrids.
Create an explainability layer for community operators and EPRA regulators
Design SHAP output interfaces that translate model decisions into plain-language explanations legible to non-technical minigrid cooperative operators. Validate through structured user surveys with community managers across Kenyan minigrids. Produce audit trail outputs meeting EPRA's emerging data reporting requirements for smart grid systems.
Deploy on edge hardware suitable for off-grid environments
Implement the full LSTM-SHAP-MORL pipeline on NVIDIA Jetson and equivalent edge platforms deployable at minigrid control nodes without continuous internet connectivity. Benchmark inference latency and power draw against the operational constraints of solar-powered control infrastructure in East Africa.
Research Questions
How can LSTM models combined with SHAP provide interpretable battery degradation predictions that remain accurate under East African operating conditions: ambient temperatures above 30 degrees, irregular PAYG charge cycles, and lead-acid or LFP chemistry mixes typical of rural minigrids?
What MORL reward function formulations allow effective balancing of diesel displacement, carbon intensity reduction, and per-unit cost in minigrid P2P networks where the cost-carbon tradeoff shifts daily based on fuel price volatility and solar irradiance?
How can XAI frameworks be designed to produce explanations that are actionable and trustworthy for community energy cooperative managers with no machine learning background, and what design decisions determine whether those explanations survive the social test of a community meeting?
What are the verifiable carbon accounting benefits of deploying MORL-optimized dispatch in East African minigrids relative to rule-based baselines, and can those benefits be structured to meet Verified Carbon Standard or Gold Standard audit requirements for carbon credit issuance?
Methodology
Four phases over 24 months, sequenced around data access realities. East African minigrid operational data is available but fragmented across operators, so Phase 1 requires active partnership development, not just API calls.
Data Collection and Grid Simulation (Months 1–6)
- +Primary datasets: Partner with REREC (Kenya's Rural Electrification and Renewable Energy Corporation) and the Africa Mini-grid Developers Association for operational data from Kenyan minigrids, including battery telemetry, solar irradiance logs, demand profiles, and diesel consumption records.
- +PAYG battery data: Engage M-KOPA and Strathmore Energy Research Centre for anonymized battery telemetry from PAYG solar home systems across Kenya and Uganda, covering charge cycles, depth of discharge, ambient temperature, and failure events across multiple battery chemistries.
- +P2P grid simulation: Model a representative East African minigrid using Python and Pandapower, parameterized with real irradiance data from the Kenya Meteorological Department and load profiles from REREC community surveys. Represent 50 to 100 nodes including solar households, small businesses, and a diesel backup generator.
- +Carbon baseline: Establish diesel displacement and carbon intensity baselines using EPRA fuel consumption reporting data and GOGLA off-grid solar impact metrics, structured to map onto Verified Carbon Standard measurement and reporting protocols.
Model Development (Months 7–12)
- +LSTM battery model: Train on combined REREC minigrid and M-KOPA telemetry datasets, with separate model variants for lead-acid and lithium iron phosphate chemistries. Apply temperature-adjusted degradation curves derived from real East African battery failure data rather than manufacturer specifications calibrated for temperate climates.
- +SHAP integration: Apply SHAP to the trained LSTM to identify the dominant factors driving degradation predictions, charge depth, ambient temperature, discharge rate, time since last full cycle, and generate ranked explanations for each prediction. Design explanation output formats for three audiences: data dashboard, operator plain-language summary, and EPRA audit log.
- +MORL optimizer: Develop a multi-objective RL agent using Pareto-front optimization across three reward signals: minimizing per-unit energy cost, maximizing diesel displacement as a fraction of total generation, and maximizing battery state-of-health over a rolling 90-day horizon. Train against the simulated East African P2P grid with stochastic solar and demand inputs drawn from real seasonal variation in the Rift Valley region.
- +Local language layer: Develop Swahili-language explanation templates for the operator interface, validated for accuracy and comprehensibility with native Swahili speakers from minigrid communities in Kisumu and Nakuru counties.
Testing and Validation (Months 13–18)
- +Benchmarking: Compare LSTM-SHAP battery predictions against rule-based time-to-replacement heuristics currently used by REREC field technicians and against Deep Q-Network baselines without SHAP explainability. Measure prediction accuracy on held-out battery failure events from the REREC dataset.
- +MORL carbon validation: Simulate 12-month grid operation under MORL dispatch versus current rule-based dispatch. Measure diesel displacement percentage, cost per kWh, and battery replacement interval. Target 30% improvement in carbon intensity relative to diesel-hybrid baseline, consistent with Gold Standard project eligibility thresholds.
- +Community trust study: Conduct structured user studies with minigrid cooperative managers in three Kenyan counties. Present SHAP explanations and operator summaries for five representative dispatch decisions. Measure comprehension, decision confidence, and self-reported trust versus equivalent black-box outputs. Iterate explanation design based on findings.
- +EPRA compliance review: Present the audit trail output format to Energy and Petroleum Regulatory Authority stakeholders for feedback on compatibility with Kenya's emerging smart grid data reporting requirements.
Deployment and Policy Impact (Months 19–24)
- +Edge deployment: Package the LSTM-SHAP-MORL pipeline for NVIDIA Jetson and Raspberry Pi 4 edge deployment. Test at a live REREC-managed minigrid site, validating real-time inference latency, power consumption, and behaviour under intermittent connectivity. Target inference time under 500ms on Jetson for dispatch decisions.
- +Carbon credit framework: Work with a Gold Standard-accredited carbon project developer to assess whether MORL-verified diesel displacement records meet measurement, reporting, and verification requirements for carbon credit issuance. Produce a technical appendix for project developers seeking to integrate AI-optimized minigrids into African carbon markets.
- +Policy output: Publish a whitepaper for Kenya's EPRA, Tanzania's Energy and Water Utilities Regulatory Authority (EWURA), and the East African Community Secretariat on XAI standards for minigrid management, covering transparency requirements, audit trail formats, and community consent for algorithmic dispatch decisions.
- +Open-source release: Full codebase on GitHub including Swahili operator interface, REREC-compatible data connectors, and Pandapower simulation templates for East African minigrid configurations.
Expected Outcomes
Technical
- +Open-source LSTM-SHAP-MORL framework for decentralized energy management, targeting Applied Energy or IEEE Transactions on Smart Grid for publication.
- +Battery degradation model calibrated for East African operating conditions: high ambient temperature, PAYG charging patterns, and mixed battery chemistry deployments, filling a gap that European-derived models do not address.
- +MORL dispatch policy achieving 30% carbon intensity reduction relative to diesel-hybrid baselines, with verifiable audit logs structured for Gold Standard and Verified Carbon Standard project developers.
- +Edge-deployable system running on NVIDIA Jetson at minigrid control nodes, validated for continuous operation in low-connectivity environments across rural East Africa.
Societal
- +Give community energy cooperative managers in Kenya, Tanzania, and Uganda the first XAI tool designed for their context: explanations in Swahili, interfaces built for non-technical operators, and audit trails that hold up to regulatory scrutiny.
- +Provide a technical foundation for East African minigrids to access carbon markets, unlocking revenue streams that could subsidize grid expansion to communities that currently cannot afford connection.
- +Reduce battery replacement costs for PAYG solar operators and minigrid developers by extending battery life through predictive maintenance, directly improving the unit economics of rural electrification.
- +Give EPRA, EWURA, and the East African Community a concrete XAI governance framework for regulating algorithmic dispatch in decentralized energy systems, a gap in current regional energy regulation.
Why Africa First
The standard argument for applying AI to energy systems is efficiency: smarter dispatch, lower cost, flatter demand curves. That argument works fine in a European smart grid context where efficiency is the binding constraint. In Sub-Saharan Africa, the binding constraints are different, and they make the XAI problem both harder and more consequential.
Start with batteries. A lithium iron phosphate battery rated for 2,000 cycles at 25 degrees Celsius will deliver something closer to 1,200 cycles if it spends its life at 35 degrees, which is the average ambient temperature in parts of northern Kenya and the Rift Valley lowlands. Every early battery replacement adds cost that either bankrupts a minigrid operator or gets passed to households paying 50 to 80 KES per kilowatt-hour for electricity they desperately need. Getting battery health prediction wrong in this environment is not an inconvenience. It determines whether a minigrid survives its first five years.
Now add trust. East Africa's minigrid ownership model is often cooperative. A group of households buys into shared infrastructure, elects a committee, and that committee makes decisions about energy allocation that affect livelihoods. Maize grinding mills, water pumps, refrigeration for small traders, phone charging businesses. If the dispatch algorithm shifts load away from grinding machines at peak morning hours to conserve battery capacity for the evening, that committee needs to be able to explain that decision to the members who couldn't grind their maize. A black-box RL agent that produces no audit trail and no explanation cannot function in that governance structure. The community will override it or stop using it.
Explainability in African energy AI is not a regulatory compliance checkbox. It is the condition under which the technology gets adopted at all. Design for this from the start, or watch technically correct systems get switched off by communities who never trusted them.
The carbon accounting angle is equally specific to Africa. Western XAI energy research is largely about helping utilities meet net-zero commitments in systems that are already majority-renewable. In East Africa, the marginal unit of electricity is a diesel generator. Every kilowatt-hour cleanly dispatched from solar plus battery displaces real diesel combustion with real emissions. The Africa Carbon Markets Initiative needs exactly this kind of verifiable, attributable carbon reduction at scale, and minigrids are where most of it will come from. But you cannot sell a carbon credit without an audit trail, and you cannot build an audit trail from an opaque reinforcement learning policy. XAI is not optional here. It is the mechanism by which AI-optimized minigrids access the financial system that funds their expansion.
The technical research problems that this context creates, hot-climate battery degradation modeling, MORL for high fuel-price-volatility environments, SHAP interfaces for low-literacy users, edge deployment without cloud dependency, are genuinely novel. They are not edge cases of the European smart grid literature. Solving them for East Africa produces insights that apply across the continent and, eventually, to any decentralized energy context where trust, cost, and carbon accountability are all binding constraints at once.
References
IEA. (2023). Africa Energy Outlook 2023. International Energy Agency, Paris.
Africa Mini-grid Developers Association (AMDA). (2024). Africa Mini-grid Market Outlook. AMDA, Nairobi.
IRENA. (2023). Renewable Power Generation Costs in 2022. International Renewable Energy Agency, Abu Dhabi.
Kenya Energy and Petroleum Regulatory Authority (EPRA). (2024). Energy Sector Report 2023/24. EPRA, Nairobi.
Africa Carbon Markets Initiative (ACMI). (2022). Mobilizing Africa's Carbon Markets. ACMI COP27 Report.
Strathmore Energy Research Centre (SERC). (2023). Kenya Minigrid Performance Report. Strathmore University, Nairobi.
Moraliyage, H., Dahanayake, S., De Silva, D., Mills, N., Rathnayaka, P., Nguyen, S., & Jennings, A. (2022). A robust artificial intelligence approach with explainability for measurement and verification of energy efficient infrastructure for net zero carbon emissions. Sensors, 22(23), 9503.
Ukoba, K., Olatunji, K. O., Adeoye, E., Jen, T. C., & Madyira, D. M. (2024). Optimizing renewable energy systems through artificial intelligence: Review and future prospects. Energy & Environment, 35(7), 3833–3879.
Inderwildi, O., Zhang, C., Wang, X., & Kraft, M. (2020). The impact of intelligent cyber-physical systems on the decarbonization of energy. Energy & Environmental Science, 13(3), 744–771.
Farooq, O., & Khan, A. (2025). The impact of machine learning on climate change modeling and environmental sustainability. Artificial Intelligence and Machine Learning Review, 6(1), 8–16.
Ke, H., Jin, W., & Wang, H. (2024). CarbonCP: Carbon-aware DNN partitioning with conformal prediction for sustainable edge intelligence. arXiv preprint arXiv:2404.16970.
Baklaga, L. (2024). Synergizing AI and blockchain: Innovations in decentralized carbon markets for emission reduction through intelligent carbon credit trading. Journal of Computer Science and Technology Studies, 6(2), 111–120.
Misaghian, M. S., Tardioli, G., Cabrera, A. G., Salerno, I., Flynn, D., & Kerrigan, R. (2022). Assessment of carbon-aware flexibility measures from data centres using machine learning. IEEE Transactions on Industry Applications, 59(1), 70–80.
KenGen. (2023). Annual Report and Financial Statements 2022/23. Kenya Electricity Generating Company, Nairobi.