Intelligent Control System Development for Industrial Batteries
Goal: Maximizing profit from electricity arbitrage on the "Day-Ahead Market" (DAM).
Business Challenge
The client operated a SmartLogger 3000C01 industrial battery with a 400 kWh capacity but managed it manually. The objective was to create an automated system capable of:
Analyzing hourly electricity prices on the DAM (Day-Ahead Market).
Accounting for the facility's real-time power consumption.
Creating an optimal charge/discharge schedule.
Maximizing revenue from electricity sales.
Technical Implementation
Tech Stack:
Core: Python 3.x (Flask, SQLite)
AI: Google Gemini AI API (gemini-2.0-flash-exp)
Integrations: SOAP API (SmartLogger), REST API (OREE - Energy Market), Excel Parsing
Automation: Cron
System Architecture:
1. Data Collection Module:
Integration with OREE API to fetch DAM prices for the next day.
Parsing historical consumption data from Excel (KWT.xls).
Reading current battery status via SmartLogger SOAP API.
2. AI Optimizer (System Core):
Development of a specialized prompt for Gemini with a step-by-step algorithm.
Analysis of a 24-hour window considering:
Hourly prices (UAH/kWh).
Forecasted facility consumption.
Technical constraints (charge/discharge rates).
ROI threshold (minimum margin of 3 UAH/kWh).
Support for multi-cycle optimization (morning + evening peaks).
Adaptive discharge based on actual consumption.
3. Execution Module:
Automatic schedule execution via SOAP API.
Hourly monitoring and adjustment.
Operation logging and Telegram status notifications.
4. Web Interface (Flask):
Dashboard with performance visualization.
Operation history, profit stats, system configuration, and access control.
Results
Technical Achievements:
Increased Discharge Hours: From 2 to 10 hours per day.
Profit Growth: 11% increase (from 2,874 to 3,198 UAH/day).
Automation: 100% of routine operations automated.
Forecast Accuracy: 95%+.
Economic Impact:
Projected Monthly Profit: ~96,000 UAH.
System ROI: Payback period of 2–3 months.
Time Savings: 2–3 hours saved for the client daily.
Key Technical Solutions
AI Integration: Custom prompt engineering, JSON Mode for guaranteed response structure, and fallback mechanisms for AI unavailability.
Consumption Optimization: Analysis of historical data from the previous week and consideration of the facility's daily work schedule.
Reliability: Retry mechanisms for API requests (up to 10 attempts) and backup scenarios for connection failures.
Automation: Cron jobs for daily forecasting (00:00) and 24/7 continuous operation.
Implementation Complexity: SOAP/REST integrations, dynamic programming algorithms, production deployment (SSH, Linux). Uniqueness: Hybrid approach (AI + Business Logic), adaptability to real-time consumption rather than theoretical maximums, production-ready autonomy.
Skills Applied: Python, AI/ML Integration, Google Gemini API, SOAP/REST API, Flask, SQLite, Cron, Automation, Excel Parsing, Production Deployment, Linux Administration, Algorithm Optimization, Data Analysis, Industrial IoT.
Duration: 2 weeks | Role: Full-stack Developer + AI Integration | Status: Live in production, autonomous
Business Challenge
The client operated a SmartLogger 3000C01 industrial battery with a 400 kWh capacity but managed it manually. The objective was to create an automated system capable of:
Analyzing hourly electricity prices on the DAM (Day-Ahead Market).
Accounting for the facility's real-time power consumption.
Creating an optimal charge/discharge schedule.
Maximizing revenue from electricity sales.
Technical Implementation
Tech Stack:
Core: Python 3.x (Flask, SQLite)
AI: Google Gemini AI API (gemini-2.0-flash-exp)
Integrations: SOAP API (SmartLogger), REST API (OREE - Energy Market), Excel Parsing
Automation: Cron
System Architecture:
1. Data Collection Module:
Integration with OREE API to fetch DAM prices for the next day.
Parsing historical consumption data from Excel (KWT.xls).
Reading current battery status via SmartLogger SOAP API.
2. AI Optimizer (System Core):
Development of a specialized prompt for Gemini with a step-by-step algorithm.
Analysis of a 24-hour window considering:
Hourly prices (UAH/kWh).
Forecasted facility consumption.
Technical constraints (charge/discharge rates).
ROI threshold (minimum margin of 3 UAH/kWh).
Support for multi-cycle optimization (morning + evening peaks).
Adaptive discharge based on actual consumption.
3. Execution Module:
Automatic schedule execution via SOAP API.
Hourly monitoring and adjustment.
Operation logging and Telegram status notifications.
4. Web Interface (Flask):
Dashboard with performance visualization.
Operation history, profit stats, system configuration, and access control.
Results
Technical Achievements:
Increased Discharge Hours: From 2 to 10 hours per day.
Profit Growth: 11% increase (from 2,874 to 3,198 UAH/day).
Automation: 100% of routine operations automated.
Forecast Accuracy: 95%+.
Economic Impact:
Projected Monthly Profit: ~96,000 UAH.
System ROI: Payback period of 2–3 months.
Time Savings: 2–3 hours saved for the client daily.
Key Technical Solutions
AI Integration: Custom prompt engineering, JSON Mode for guaranteed response structure, and fallback mechanisms for AI unavailability.
Consumption Optimization: Analysis of historical data from the previous week and consideration of the facility's daily work schedule.
Reliability: Retry mechanisms for API requests (up to 10 attempts) and backup scenarios for connection failures.
Automation: Cron jobs for daily forecasting (00:00) and 24/7 continuous operation.
Implementation Complexity: SOAP/REST integrations, dynamic programming algorithms, production deployment (SSH, Linux). Uniqueness: Hybrid approach (AI + Business Logic), adaptability to real-time consumption rather than theoretical maximums, production-ready autonomy.
Skills Applied: Python, AI/ML Integration, Google Gemini API, SOAP/REST API, Flask, SQLite, Cron, Automation, Excel Parsing, Production Deployment, Linux Administration, Algorithm Optimization, Data Analysis, Industrial IoT.
Duration: 2 weeks | Role: Full-stack Developer + AI Integration | Status: Live in production, autonomous