Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Command-Line Interface

GDM-Flow includes a modern CLI built with Typer and Rich for colorful, readable terminal output.

Installation

The CLI is installed automatically with the package:

pip install -e ".[optimization]"

The command gdm-flow becomes available in your terminal.

Commands

gdm-flow info

Display system topology, component counts, and power summary.

gdm-flow info examples/models/p5r.json

Output includes:

gdm-flow run

Run one or more solvers on a distribution system model.

# Run AC OPF only (default)
gdm-flow run examples/models/p5r.json

# Run multiple solvers
gdm-flow run examples/models/p5r.json -s ac -s pf -s dc -s ldf

# Verbose — show voltage table and dispatch details
gdm-flow run examples/models/p5r.json -s ac -s dc -v

Options:

FlagDefaultDescription
-s, --solveracSolver(s) to run: ac, pf, dc, ldf (repeatable)
-v, --verbosefalseShow detailed voltage and dispatch tables

gdm-flow compare

Run all four solvers and display a side-by-side comparison.

gdm-flow compare examples/models/p5r.json

# Also generate an HTML comparison plot
gdm-flow compare examples/models/p5r.json -o comparison.html

The comparison shows:

Options:

FlagDefaultDescription
-o, --outputNoneExport comparison to interactive HTML (requires plotly)

gdm-flow plot

Generate an interactive Plotly dashboard with voltage profiles, power flows, branch loading, losses, and equipment state.

# Generate dashboard with all four solvers
gdm-flow plot examples/models/p5r.json

# Select specific solvers
gdm-flow plot examples/models/p5r.json -s ac -s pf

# Custom output path
gdm-flow plot examples/models/p5r.json -o my_dashboard.html

The dashboard includes:

Options:

FlagDefaultDescription
--output, -o<model>_dashboard.htmlOutput HTML path
-s, --solverac pf dc ldfSolver(s) to include (repeatable)

Requires: pip install -e '.[plotting]' (installs plotly)

gdm-flow export

Run solvers and export results to a SQLite database.

# Export all solvers
gdm-flow export examples/models/p5r.json --db results.db

# Export only AC and DC
gdm-flow export examples/models/p5r.json --db results.db -s ac -s dc

Options:

FlagDefaultDescription
--dbrequiredPath to SQLite database file
-s, --solverac pf dc ldfSolver(s) to export (repeatable)

gdm-flow report-overvoltage

Print voltage limit violations from exported AC OPF or LinDistFlow node results.

# Check latest AC run in database
gdm-flow report-overvoltage --db results.db

# Check latest AC PF run
gdm-flow report-overvoltage --db results.db -s pf

# Check latest LinDistFlow run
gdm-flow report-overvoltage --db results.db -s ldf

# Check a specific run id
gdm-flow report-overvoltage --db results.db -s ac --run-id ac_123456abcdef

Options:

FlagDefaultDescription
--dbrequiredPath to SQLite database file
-s, --solveracSolver result set: ac, pf, or ldf
--run-idlatest runSpecific run id to inspect

gdm-flow report-overload

Print branch loading violations from exported AC OPF, DC OPF, or LinDistFlow branch results.

DC note: -s dc uses a post-processed DC approximation (angle-difference, P-only proxy), not full AC branch power flow.

# Check latest LinDistFlow run
gdm-flow report-overload --db results.db

# Check latest AC OPF run
gdm-flow report-overload --db results.db -s ac

# Check latest DC OPF run
gdm-flow report-overload --db results.db -s dc

# For DC, optionally print full percentage table instead of ranked severity
gdm-flow report-overload --db results.db -s dc --no-dc-severity-only

# Check a specific run id
gdm-flow report-overload --db results.db --run-id lindistflow_123456abcdef

Options:

FlagDefaultDescription
--dbrequiredPath to SQLite database file
-s, --solverldfSolver result set: ac, dc, or ldf
--run-idlatest solver runSpecific run id to inspect
--dc-severity-only/--no-dc-severity-onlytrueFor DC reports, show ranked severity instead of percent magnitudes

gdm-flow db-schema

Print the SQLite table/column schema for a database file.

# Show user tables and columns
gdm-flow db-schema --db results.db

# Include sqlite_* internal tables
gdm-flow db-schema --db results.db --include-internal

Options:

FlagDefaultDescription
--dbrequiredPath to SQLite database file
--include-internalfalseInclude SQLite internal tables

Time Series Commands

gdm-flow ts-info

Display time series data availability for each component type in a model.

gdm-flow ts-info examples/models/p5r.json

Output includes:

gdm-flow qsts

Run a Quasi-Static Time Series simulation. Each timestep is solved independently using the selected solver, with automatic warm-starting from the previous solution.

# Run LinDistFlow QSTS for first 24 hours (96 × 15-min steps)
gdm-flow qsts examples/models/p5r.json --solver ldf --end 96

# Stream results to SQLite
gdm-flow qsts examples/models/p5r.json -s ac --end 96 --db qsts.db

# Custom timestep range with stride
gdm-flow qsts examples/models/p5r.json -s pf --start 0 --end 192 --step 2

Options:

FlagDefaultDescription
-s, --solverldfSolver to use: ac, pf, dc, ldf
--start0First timestep index
--endallLast timestep index
--step1Timestep stride
--dbNoneSQLite path for streaming results

gdm-flow multiperiod

Run multi-period OPF with battery SOC coupling across the full time horizon.

# Multi-period DC OPF for 24 hours
gdm-flow multiperiod examples/models/p5r.json --solver dc --end 96

# With generator ramp limits and SQLite export
gdm-flow multiperiod examples/models/p5r.json -s dc --end 96 --ramp 5000 --db mp.db

# Multi-period LinDistFlow
gdm-flow multiperiod examples/models/p5r.json -s ldf --end 96

Options:

FlagDefaultDescription
-s, --solverdcSolver: dc or ldf only
--start0First timestep index
--end96Last timestep index
--step1Timestep stride
--rampNoneGenerator ramp limit in watts (DC OPF only)
--dbNoneSQLite database path

gdm-flow plot-ts

Generate interactive Plotly HTML plots from QSTS or multi-period results stored in SQLite.

# Plot latest run
gdm-flow plot-ts qsts.db

# Plot specific run with custom output
gdm-flow plot-ts qsts.db --run-id ldf_abc123 -o timeseries.html

Output includes:

Options:

FlagDefaultDescription
--run-idlatestSpecific run ID
-o, --output<db>_ts.htmlOutput HTML path

Requires: pip install -e '.[plotting]' (installs plotly)

Examples

Quick System Check

# What's in this model?
gdm-flow info examples/models/p5r.json

# Run all solvers and see if they agree
gdm-flow compare examples/models/p5r.json

Full Analysis Pipeline

# 1. Inspect the system
gdm-flow info examples/models/p5r.json

# 2. Run solvers with detailed output
gdm-flow run examples/models/p5r.json -s ac -s pf -s dc -s ldf -v

# 3. Export to database for further analysis
gdm-flow export examples/models/p5r.json --db analysis.db

# 4. Generate comparison plot
gdm-flow compare examples/models/p5r.json -o comparison.html

# 5. Generate interactive dashboard
gdm-flow plot examples/models/p5r.json -o dashboard.html