OpenCBP enables solar battery systems to participate in utility Demand Response (DR) and Time-of-Use (TOU) programs using sophisticated game-theoretic bidding strategies. Built on OpenADR 2.0 and Modbus communication, the system runs on a Raspberry Pi Zero with FreeRTOS to deliver automated, intelligent responses to grid signals.
- Game-Theoretic Bidding: Optimizes bid pricing based on market competition and grid demand dynamics
- Non-Linear Battery Degradation Modeling: Incorporates physics-based degradation costs using rainflow cycle counting
- Dynamic Opportunity Cost Calculation: Considers potential revenue from reserving capacity for high-value future DR events
- Multi-Program Optimization: Simultaneously optimizes across fast DR dispatch and capacity bidding markets
- OpenADR 2.0 Compliance: Seamless integration with utility Virtual Top Nodes (VTNs) for demand response programs
- Modbus (RS485) Communication: Direct interface with solar battery systems for real-time monitoring and control
- Flexible DR Program Support: Compatible with CPP, CBP, Fast DR, and DER-based programs
- Anti-Flutter Timer: Prevents rapid cycling with a 3600-second (1-hour) minimum interval between DR events
- 20% SOC Safety Latch: Ensures the battery never discharges below 20% SOC to protect battery health
- Non-Linear Degradation Protection: Makes economically efficient decisions that preserve battery lifespan
- FreeRTOS Implementation: Reliable real-time task scheduling on resource-constrained hardware
- Optimized Algorithms: SQP solver and efficient implementation for low-power devices
- Adaptive Response: Continuously adjusts strategy based on market conditions and battery state
| Strategy | Annual Revenue ($) | Battery Cycles | Effective $/kWh | Profit Margin (%) |
|---|---|---|---|---|
| OpenCBP Price | XXX.XX | XXX | X.XXX | XX.X |
| Fixed-margin (10%) | XXX.XX | XXX | X.XXX | XX.X |
| Price-threshold | XXX.XX | XXX | X.XXX | XX.X |
| Naive peak-shaving | XXX.XX | XXX | X.XXX | XX.X |
Note: Performance results are pending completion of empirical simulation studies using LFP-specific degradation parameters and 2023 California ISO (CAISO) market data. Preliminary analysis indicates significant revenue improvements and reduced battery cycling compared to traditional bidding strategies, with statistical significance testing underway.
The OpenCBP model leverages several key theoretical insights:
-
Strategic Pricing in Non-Cooperative Markets: Our non-cooperative game formulation models the strategic interaction between market participants, allowing the BESS operator to adapt bidding based on competition levels and grid demand patterns.
-
Dynamic Bid Pricing Formula:
p_bid = max(MC, p_min) * (1 + μ(D_grid, N))Where MC is the marginal cost, p_min is the minimum acceptable price, and μ(D_grid, N) is a markup function based on grid demand and competition.
-
Capacity Allocation Function:
φ(h) = (e^(γ · R(h))) / (∑_{h' ∈ H} e^(γ · R(h')))This distributes available capacity across hours based on expected profitability, with γ determining allocation aggressiveness.
- Solar Battery System: Must support Modbus (RS485) communication
- Gridlink OpenADR Gateway: Acts as a Virtual End Node (VEN) to communicate with utility VTNs
- Raspberry Pi Zero: For running the RTOS application and interfacing with the Gridlink gateway
- RS485 Interface: For communication with the battery's BMS
The implementation consists of several key files:
-
demand_response.h/c: Core bidding strategy implementation
- Non-linear battery degradation model
- Competitive price calculation
- Capacity allocation algorithms
- Opportunity cost estimation
-
sunlight_lut.h/c: System integration and RTOS tasks
- Modbus communication with battery
- OpenADR event handling
- Anti-flutter protection
- SOC safety mechanisms
-
openadr_ven-client.py: OpenADR client implementation
- DR event reception and processing
- Telemetry reporting
- Bid submission
- Critical Peak Pricing (CPP): Avoid high electricity costs by discharging the battery during peak pricing events
- Capacity Bidding Program (CBP): Bid battery capacity to reduce load during high-demand periods
- Fast DR Dispatch / Ancillary Services: Provide rapid grid support during emergencies
- Distributed Energy Resources (DER) DR Program: Smooth integration of solar batteries into the grid
-
Connect the Gridlink Gateway:
- Connect the Gridlink OpenADR gateway to your solar battery system using the RS485 interface
- Configure the gateway with the correct Modbus registers for SOC, charge/discharge status, and other parameters
-
Install FreeRTOS on Raspberry Pi Zero:
- Follow the FreeRTOS Raspberry Pi Zero guide to set up the RTOS environment
-
Compile and Deploy:
- Clone this repository
- Compile
demand_response.c,sunlight_lut.cand associated headers - Deploy the application to the Raspberry Pi Zero
-
Register with a Utility:
- Sign up for a utility DR program that supports OpenADR 2.0
- Provide the utility with your Gridlink gateway's Virtual End Node (VEN) details
-
Configure Market Parameters:
- Set appropriate values for the markup parameters (α, β) based on your market
- Configure battery degradation parameters for your specific battery chemistry
- Set up time-of-use pricing information relevant to your utility
The system creates three main RTOS tasks:
-
SpoofSOC Task:
- Manages SOC monitoring and anti-flutter protection
- Enforces 3600-second minimum interval between DR events
- Ensures battery never discharges below 20% SOC
- Tracks battery cycles using rainflow counting
-
FastDRDispatch Task:
- Calculates optimal bid price and capacity for real-time DR events
- Uses min-max pricing to drive price efficiency
- Adjusts discharge based on grid signals and battery SOC
-
CapacityBidding Task:
- Calculates day-ahead bids for capacity markets
- Identifies expected peak hours using price forecasts
- Optimizes capacity allocation across different hours
- Adaptation to Evolving Market Structures: Implement reinforcement learning to adapt to evolving market dynamics
- Battery Technology Specificity: Extend degradation models to other chemistries (LFP, NCA, solid-state)
- Multi-Service Optimization: Expand to frequency regulation, voltage support, and other ancillary services
- Coordination with Other DERs: Develop coordinated bidding strategies for heterogeneous DER fleets
- Gridlink Technologies: OpenADR Certified Devices - Learn more about OpenADR-certified devices
- Modbus Protocol Documentation: Modbus Protocol - Official documentation for Modbus
- OpenADR 2.0 Specification: OpenADR Alliance - Detailed specifications for OpenADR 2.0
- FreeRTOS Guide: FreeRTOS Raspberry Pi Zero - Setup guide
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
\bibitem[Millner(2010)]{Millner2010} Millner, A. (2010). \newblock Modeling lithium ion battery degradation in electric vehicles. \newblock In \emph{Innovative Technologies for an Efficient and Reliable Electricity Supply (CITRES), 2010 IEEE Conference on} (pp. 349-356).
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Copyright 2025 CyberGolem LLC