A mistake in a 15-minute interval can cost 500 rubles — over a month, that adds up to 15,000 rubles, and over a year, up to 180,000 rubles of pure loss. Owners of microgeneration face a dilemma: sell surplus to the grid at the night tariff or store it in a BESS for the morning peak. Without an accurate forecast, decisions are made intuitively — and lead to losses. Every day, you make up to 96 energy distribution decisions. A single error can negate the benefit of the rest.
We build AI systems that automatically manage microgeneration. Our algorithms account for weather forecasts, tariff curves, BESS state, and site load. The result: up to 30% savings on electricity costs and additional revenue from surplus sales. Get a consultation on implementing such a system for your site.
How an AI System Reduces Losses in Microgeneration Management
Generation Forecast with 15-Minute Accuracy
The microgenerator's task: every 15 minutes, decide whether to sell surplus, charge the BESS, or draw power from the grid. The decision depends on three factors:
- Forecast of own generation (solar, wind) for the next 24–48 hours
- Forecast of site consumption
- Tariff curve (time-of-use tariff: night/day/peak)
For forecasting, we use the Prophet model with additional regressors: GHI (global horizontal irradiance), temperature, cloud cover. This yields generation forecast accuracy of ±8% (MAPE) for the next day. In practice, you know 96% accurately how much energy you will get tomorrow. Compare forecasting methods:
| Method | Accuracy (MAPE) | Data Requirements | Training Speed |
|---|---|---|---|
| Prophet | 8% | 6–12 months at 15-min intervals | Fast (1-2 min) |
| LSTM (2 layers) | 6% | 12+ months, GPU | 2-4 hours |
| Gradient Boosting | 7% | 6–12 months, features | 10-20 min |
The choice depends on data volume and required accuracy. For a typical site with 6–12 months of history, Prophet is optimal.
import numpy as np
import pandas as pd
from prophet import Prophet
class MicrogenerationForecaster:
"""Forecast generation and consumption for a microgeneration site"""
def fit_solar_model(self, historical_generation, capacity_kw):
"""Forecast solar generation using Prophet"""
df = historical_generation.reset_index()
df.columns = ['ds', 'y']
df['y'] = df['y'] / capacity_kw # normalize to capacity factor
model = Prophet(
changepoint_prior_scale=0.05,
seasonality_mode='multiplicative',
yearly_seasonality=10,
daily_seasonality=True,
weekly_seasonality=False # solar does not depend on day of week
)
model.fit(df)
return model
def predict_next_day(self, solar_model, load_model, weather_forecast):
"""Combined forecast for the next 24 hours"""
future = solar_model.make_future_dataframe(periods=96, freq='15min')
# Add weather regressor
future = future.merge(weather_forecast[['ds', 'ghi', 'temperature']],
on='ds', how='left')
solar_forecast = solar_model.predict(future)
load_forecast = load_model.predict(future)
return pd.DataFrame({
'timestamp': future['ds'],
'solar_kw': solar_forecast['yhat'].clip(0) * self.capacity_kw,
'load_kw': load_forecast['yhat'].clip(0),
'net_kw': (solar_forecast['yhat'] - load_forecast['yhat']).clip(-self.max_load)
})
How to Optimize BESS with AI?
The charge/discharge strategy of the BESS is solved as a stochastic optimization problem with a 24–48 hour horizon. We use linear programming (LP). Variables: BESS charge/discharge power, grid purchase/sale. Criterion: minimize cost or maximize revenue. Typical constraints: capacity 10 kWh, max power 5 kW, depth of discharge 10–90%, efficiency 90%.
from scipy.optimize import linprog
import numpy as np
def optimize_bess_schedule(
solar_forecast, # kW per hour
load_forecast, # kW per hour
tariff_grid_buy, # RUB/kWh per hour (grid purchase)
tariff_grid_sell, # RUB/kWh per hour (grid sale)
bess_capacity_kwh=10,
bess_max_power_kw=5,
bess_soc_init=0.5,
bess_soc_min=0.1,
bess_soc_max=0.9,
bess_efficiency=0.9
):
"""
Optimize BESS schedule.
Variables: [p_charge_t, p_discharge_t, p_grid_buy_t, p_grid_sell_t] × 24h
"""
T = len(solar_forecast)
# Linear programming (LP)
# Simplified: not considering binary constraints for simultaneous charge/discharge
# Variables: [charge[0..T], discharge[0..T], buy[0..T], sell[0..T], soc[0..T]]
n_vars = T * 4 + T # charge, discharge, buy, sell, SoC
c = np.zeros(n_vars)
# Minimize cost: purchase cost - sale revenue
for t in range(T):
c[2*T + t] = tariff_grid_buy[t] # purchase — cost
c[3*T + t] = -tariff_grid_sell[t] # sale — revenue (negative)
# Constraints (simplified)
# SoC balance, power limits, SoC limits
result = linprog(c, method='highs') # HiGHS solver
return result
AI optimization is 2-3 times more effective than manual control in cost savings. Compare:
| Parameter | Without AI | With AI |
|---|---|---|
| Decision "sell/store" | Intuition | Optimization with 48-h horizon |
| Tariff consideration | No | Time-of-use |
| Zero-Export | Surplus curtailment | Smooth load management |
| Savings | Baseline | +25–40% |
Why Zero-Export Control Is Critical for Microgeneration?
If the grid sale tariff is unfavorable or unavailable, reverse power flow must be prevented. Zero-Export Control addresses this:
- Forecast surplus → increase load of controllable devices (water heater, pump, EV charging).
- If unable to absorb, curtail inverter output.
- Fast control loop (100 ms): measure current at point of connection → PID controller for inverter output power.
More on the Zero-Export control loop
Zero-Export is implemented using a PID controller with a predictive component. Power at the point of connection is measured every 100 ms, surplus is forecast 5 seconds ahead. If a threshold is exceeded, a command is sent to reduce inverter power via Modbus. Additionally, controllable loads (water heater, EV) are activated by priority.Aggregation for Demand Response Programs (VPP)
Hundreds of private microgenerators are aggregated into a virtual power plant (VPP). An AI aggregator:
- Forecasts total export capacity.
- Participates in the balancing market.
- Distributes payments among participants based on contribution (Shapley Values).
Monitoring and Diagnostics
Since the legalization of microgeneration, we have completed 15+ projects. Panel degradation assessment:
- Monitor Performance Ratio (PR): expected vs. actual generation.
- PR decline of 0.5%/year is normal; >1.5%/year indicates degradation or soiling.
- IV-curve analysis: identify shading, bypass diode failure.
What Is Included in the Development of an AI Microgeneration Management System
- Data analysis: collection and aggregation of historical generation, consumption, and tariff data. Check for gaps and outliers.
- Development of forecasting models: Prophet or LSTM for generation, ARIMA for consumption. Accuracy assessment via cross-validation.
- BESS optimizer setup: solve LP problem with actual BESS parameters and tariffs.
- Equipment integration: connect to inverters (Huawei, Sungrow, Victron) via Modbus/SunSpec, to BMS and meters.
- Testing on historical data: A/B experiment — compare AI decisions with actual data.
- Documentation and training: operator manual, algorithm description, model update schedule.
- 12-month warranty support: bug fixes, consultations, adaptation to tariff changes.
Development timeline: 2–4 months for a system with forecasting, BESS optimization, and Zero-Export control. Cost is calculated individually based on equipment complexity and data volume.
Our team has 6+ years of experience in AI for energy. Order a consultation — we will assess your microgeneration project in 2 days. Contact us to discuss implementation details.







