Skip to content

bugsbunny88/vpp-simulator

Repository files navigation

vpp-sim

Originally forked from jdhoffa/vpp-sim, now an independent project with a different architecture and direction.

A neighborhood-scale Virtual Power Plant simulator written in Rust. Models a local distribution feeder with solar PV, battery storage, EV charging, and demand response — letting you test control strategies and load-shifting decisions before committing capital.

Architecture

Modular crate layout with feature-gated optional modules:

src/
  config.rs          TOML scenario config and preset loading
  forecast.rs        Load and generation forecasting
  devices/           Solar PV (simple + AR(1) cloud model), battery, EV charger, baseload
  sim/               Engine, controller trait, feeder limits, scheduling, KPI, imbalance settlement
  io/                CSV telemetry export
  api/               REST API via Axum (feature: api)
  tui/               Live terminal dashboard via Ratatui (feature: tui)

Key design choices:

  • Feature gatesapi and tui are optional Cargo features, keeping the core sim dependency-free of network/UI crates
  • lib.rs separation — simulation logic is a library; main.rs is a thin CLI driver
  • Rust edition 2024

Simulation model

  • GreedyController with forecast-aware battery dispatch (charge during excess solar, discharge into evening peak)
  • Stochastic weather via AR(1) cloud variability on solar generation
  • Imbalance settlement costing — tracks deviation from scheduled dispatch
  • Demand response events with configurable curtailment windows
  • Feeder capacity constraints (import/export limits)
  • KPI reporting — RMSE tracking error, curtailment %, feeder peak

Usage

Prerequisites

Run with defaults

cargo run --release

Run with a scenario preset

cargo run --release -- --preset high_solar
cargo run --release -- --preset dr_stress

Enable the REST API

cargo run --release --features api

Enable the live TUI

cargo run --release --features tui

Custom scenario

cargo run --release -- --config path/to/scenario.toml

See scenarios/ for example TOML files (default.toml, high_solar.toml, dr_stress.toml).

Building docs

cargo doc --open

License

MIT. See LICENSE.

About

Neighborhood-scale virtual power plant simulator — solar, battery, EV, demand response

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages