| name | eptr2-imbalance-costs |
| description | Calculate and analyze Turkish electricity imbalance costs including KUPST (Kesinleşmiş Üretim Planından Sapma Tutarı/Production Plan Deviation Cost), positive/negative imbalance penalties, and DSG (Dengeden Sorumlu Grup) tolerance calculations. Use when asking about imbalance settlement, deviation costs, KUPST, energy surplus/deficit penalties, or imbalance calculations in Turkey. Triggers on: dengesizlik maliyeti, sapma tutarı, KUPST, KÜPST, enerji açığı, enerji fazlası, imbalance penalty. |
Turkish Electricity Imbalance Cost Calculations with eptr2
Overview
This skill helps you calculate and analyze electricity imbalance costs in Turkey's energy market using the eptr2 Python library. Imbalance costs are critical for market participants who deviate from their scheduled positions.
Quick Start
from eptr2 import EPTR2
from eptr2.composite import get_hourly_price_and_cost_data
eptr = EPTR2(use_dotenv=True, recycle_tgt=True)
df = get_hourly_price_and_cost_data(
eptr,
start_date="2024-07-29",
end_date="2024-07-29"
)
print(df[['date', 'mcp', 'smp', 'pos_imb_cost', 'neg_imb_cost', 'kupst_cost']])
Key Concepts
System Direction (Sistem Yönü)
| Turkish | English | Meaning | sd_sign |
|---|
| Enerji Açığı | Energy Deficit | System is short, up-regulation | -1 |
| Enerji Fazlası | Energy Surplus | System is long, down-regulation | +1 |
| Dengede | Balanced | System is balanced | 0 |
Imbalance Types
| Type | Turkish | When Applied |
|---|
| Positive Imbalance | Pozitif Dengesizlik | You have surplus energy (produced more or consumed less than scheduled) |
| Negative Imbalance | Negatif Dengesizlik | You have deficit energy (produced less or consumed more than scheduled) |
Imbalance Price Formulas
Current Regulation (2024)
penalty_margin = 0.03
pos_imb_price = (1 - penalty_margin) * min(MCP, SMP)
pos_imb_price = 0.97 * min(MCP, SMP)
neg_imb_price = (1 + penalty_margin) * max(MCP, SMP)
neg_imb_price = 1.03 * max(MCP, SMP)
Imbalance Cost (Per MWh)
pos_imb_cost = MCP - pos_imb_price
neg_imb_cost = neg_imb_price - MCP
KUPST (Deviation Cost from Production Plan)
KUPST applies to deviations from scheduled production plans (KGÜP).
Formula
kupst_multiplier = 0.03
kupst_floor_price = 750
kupst_cost = max(MCP, SMP, kupst_floor_price) * kupst_multiplier
Tolerance Rates by Source
| Source | Tolerance |
|---|
| Wind | 17% |
| Solar | 10% |
| Other | 5% |
Cost Calculation Functions
Using eptr2 Utility Functions
from eptr2.util.costs import (
calculate_unit_imbalance_cost,
calculate_unit_kupst_cost,
calculate_imb_cost,
calculate_imbalance_amounts
)
mcp, smp = 2500, 2800
unit_costs = calculate_unit_imbalance_cost(mcp=mcp, smp=smp)
print(f"Positive imbalance cost: {unit_costs['pos']:.2f} TL/MWh")
print(f"Negative imbalance cost: {unit_costs['neg']:.2f} TL/MWh")
kupst = calculate_unit_kupst_cost(mcp=mcp, smp=smp)
print(f"KUPST cost: {kupst:.2f} TL/MWh")
Full Imbalance Cost Calculation
from eptr2.util.costs import calculate_imb_cost
result = calculate_imb_cost(
actual=100,
forecast=90,
mcp=2500,
smp=2800,
is_producer=True,
imb_tol=0.1,
return_detail=True
)
print(f"Total Imbalance Cost: {result['costs']['total_imb_cost']:.2f} TL")
Common Use Cases
1. Estimate Daily Imbalance Exposure
from eptr2.composite import get_hourly_price_and_cost_data
df = get_hourly_price_and_cost_data(eptr, "2024-07-15", "2024-07-15")
surplus_mwh = 5
daily_surplus_cost = (df['pos_imb_cost'] * surplus_mwh).sum()
print(f"Daily cost of 5 MWh/h surplus: {daily_surplus_cost:,.0f} TL")
deficit_mwh = 5
daily_deficit_cost = (df['neg_imb_cost'] * deficit_mwh).sum()
print(f"Daily cost of 5 MWh/h deficit: {daily_deficit_cost:,.0f} TL")
2. Analyze System Direction Impact
df = get_hourly_price_and_cost_data(eptr, "2024-07-01", "2024-07-31")
direction_analysis = df.groupby('system_direction').agg({
'pos_imb_cost': 'mean',
'neg_imb_cost': 'mean',
'mcp': 'count'
}).rename(columns={'mcp': 'hours'})
print("Average Imbalance Costs by System Direction:")
print(direction_analysis)
Authentication
Set credentials in .env file:
EPTR_USERNAME=your_email@example.com
EPTR_PASSWORD=your_password
For More Details