Skip to content

Bittencourt/openDESSEM

Repository files navigation

OpenDESSEM

License: MIT Julia 1.10 codecov

Open-source implementation of DESSEM (Daily Short-Term Hydrothermal Scheduling Model) in Julia using JuMP.

Overview

OpenDESSEM is a Julia-based implementation of Brazil's official day-ahead hydrothermal dispatch optimization model (DESSEM - Modelo de Programação Diária da Operação de Sistemas Hidrotérmicos). This project aims to provide a transparent, reproducible, and extensible version for research, validation, and innovation in short-term electricity market optimization.

Key Features

  • 🏗️ Entity-Driven Architecture - Model dynamically builds itself from system entities
  • 💾 Database-Ready - Native PostgreSQL support with SQLite for development
  • 🔧 Modular Constraints - Pluggable constraint system for extensibility
  • 🌊 Full Hydro Modeling - Cascade reservoirs with time delays and spillage
  • 🔥 Thermal Unit Commitment - Complete UC with ramp rates and min up/down times
  • Network Model - DC-OPF and AC-OPF using PowerModels.jl (proven formulations)
  • 📊 Renewable Integration - Wind, solar, and hybrid plants with forecasting
  • 🎯 Brazilian Market Compatible - PLD calculation and CCEE output formats

Quick Start

Installation

# Clone the repository
git clone https://github.com/your-org/openDESSEM.git
cd openDESSEM

# Install Julia dependencies
julia --project=. -e 'using Pkg; Pkg.instantiate()'

Basic Usage

using OpenDESSEM

# Load system from database
loader = DatabaseLoader(
    connection = LibPQ.Connection("dbname=opendessem"),
    scenario_id = "deterministic",
    base_date = Date("2024-01-15")
)
system = load_system(loader)

# Create optimization model
model = DessemModel(system, time_periods=168, discretization=:hourly)

# Add constraints
add_constraint!(model, EnergyBalanceConstraint(...))
add_constraint!(model, ThermalUnitCommitmentConstraint(...))
add_constraint!(model, HydroWaterBalanceConstraint(...))
add_constraint!(model, PowerModelsDCOPFConstraint(...))  # Using PowerModels.jl

# Build and solve
create_variables!(model)
build_objective!(model)
solution = optimize!(model, HiGHS.Optimizer)

# Extract results
dispatch = extract_dispatch(solution)
prices = calculate_marginal_costs(solution)  # PLD

Documentation

Quick Links

Core Documentation

Examples & Tutorials

Project Structure

openDESSEM/
├── src/               # Source code
│   ├── core/          # Core model structures
│   ├── entities/      # Entity type definitions
│   ├── constraints/   # Constraint implementations
│   ├── data/          # Data loading (database, files)
│   ├── solvers/       # Solver interfaces
│   └── analysis/      # Results and visualization
├── test/              # Test suites (TDD)
├── database/          # Database schema and migrations
├── examples/          # Example scripts
├── docs/              # Documentation
└── scripts/           # Development utilities

Development Status

✅ Phase 1: Objective Function (Complete)

  • FCF curve loader from infofcf.dat
  • Load shedding and deficit variables
  • Production cost objective with scaling
  • Terminal water value from FCF curves

✅ Phase 2: Hydro Modeling (Complete)

  • Cascade topology utility with cycle detection
  • Inflow data loading from dadvaz.dat
  • Water balance with cascade delays and inflows

✅ Phase 3: Solver Interface (Complete)

  • Unified solve_model!() API with two-stage pricing
  • Lazy loading for optional solvers (Gurobi, CPLEX, GLPK)
  • Infeasibility diagnostics with compute_iis!()
  • PLD DataFrame output and cost breakdown
  • End-to-end integration tests

✅ Phase 4: Solution Extraction & Export (Complete)

  • All variable extraction (thermal, hydro, renewable, deficit)
  • PLD dual extraction from energy balance constraints
  • CSV/JSON export with formatting
  • Constraint violation reporting with type classification
  • Nodal LMP extraction via PowerModels DC-OPF
  • Unified pricing pipeline (nodal-first, zonal-fallback)

📋 Phase 5: End-to-End Validation (Planned)

  • Validation types and reference data loaders
  • Comparators for cost, PLD, and dispatch
  • Multi-format reporters (console, markdown, JSON)
  • End-to-end integration test with ONS sample data

Technology Stack

  • Language: Julia 1.10+
  • Optimization: JuMP.jl
  • Network Constraints: PowerModels.jl (DC-OPF, AC-OPF formulations)
  • Data Parsing: PWF.jl (Brazilian .pwf file support)
  • Solvers: HiGHS.jl (open-source), Gurobi.jl (optional)
  • Database: PostgreSQL (production), SQLite (development)
  • Testing: Test.jl
  • Documentation: Documenter.jl

Background

DESSEM is Brazil's official day-ahead hydrothermal dispatch model, operated by ONS (Operador Nacional do Sistema Elétrico) and CCEE (Câmara de Comercialização de Energia Elétrica) since January 2020. It solves the daily energy dispatch problem for:

  • Temporal scope: 1-14 days with hourly/half-hourly discretization
  • Spatial scope: Brazilian Interconnected System (SIN)
    • ~158 hydro plants
    • ~109 thermal plants
    • 4 submarkets (N, NE, SE/CO, S)
    • ~6,450 buses
    • ~8,850 transmission lines

For more details, see the planning document.

Contributing

We welcome contributions! Please see:

  1. Development Guidelines - TDD, commit conventions, code style
  2. Quick Reference - Essential commands
  3. Technical Plan - Architecture overview

Development Workflow

# 1. Write tests first (TDD)
# 2. Implement feature
# 3. Run tests
julia --project=test test/runtests.jl

# 4. Clean and check
./scripts/clean_before_commit.sh
julia scripts/pre_commit_check.jl

# 5. Commit
git commit -m "feat(scope): description"

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • ONS - Operador Nacional do Sistema Elétrico (Brazilian System Operator)
  • CCEE - Câmara de Comercialização de Energia Elétrica (Electricity Trading Chamber)
  • CEPEL - Centro de Pesquisas de Energia Elétrica (original DESSEM developers)
  • JuMP.dev - Optimization modeling in Julia

References

Contact


Status: ✅ Phases 1-4 Complete - Ready for Validation

Test Coverage: 2075+ tests with >90% coverage

Sample Data: ONS DS_ONS_102025_RV2D11, CCEE DS_CCEE_102025_SEMREDE_RV1D04

Note: This is an independent open-source project and is not affiliated with or endorsed by ONS, CCEE, or CEPEL.

About

Open-source implementation of DESSEM (Daily Short-Term Hydrothermal Scheduling Model) in Julia using JuMP

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages