Skip to content
enerplanetPublic

About

Multi Energy Model Execution

Resources

Code of conduct

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

MEME banner MEME banner

Multi Energy Model Execution (MEME)

CI MkDocs Release Go License: MIT

MEME is a dependency-free Go service (standard library only) that accepts one canonical JSON energy-system model and translates it into the native input formats of three optimization frameworks — PyPSA, Calliope (release 0.7, with 0.6 as a selectable version) and AdOpT-NET0 — then optionally runs the solve and returns a zipped result bundle. A request targets one framework, a subset, or all of them at once; the service is a stateless translator and orchestrator, the solvers are external Python processes.

Client ──POST /simulate?target=pypsa,calliope──▶ MEME ── validate (capability gates)
       ◀──202 {id}────────────────────────────    │   ── emit native model files
Client ──GET /jobs/{id}/status──────────────────   ▼   ── run the solver (python / calliope CLI)
       ◀──state · log · per-run results────────  job ── bundle: results + inputs + config + log
Client ──GET /jobs/{id}───────────────────────▶ zip

Documentation: https://enerplanet.github.io/meme — quickstart, API reference, the canonical model, what each framework honors property by property, architecture and the decisions behind it.

How it works

  1. POST /validate|/convert|/simulate?target=… receives the canonical payload. target is one framework, a comma-separated list, or all (the default version of every framework). Validation is capability-gated: a property the selected target cannot honor is rejected with a pointed message or named in a warning — never silently dropped.
  2. The target's emitter writes the framework's native model: a PyPSA CSV folder, a Calliope model.yaml with data tables, an AdOpT input_data/ tree. Anything only one framework understands rides in that framework's native block and is merged verbatim.
  3. /simulate schedules an asynchronous job: each run is solved by an external process (a generated run.py, or the calliope CLI), sweeps expand into independent runs, and GET /jobs/{id} returns one zip with solver results, emitted inputs, driver scripts, the log and the submitted config.

Targets

Target Framework Version In all
pypsa PyPSA 1.2.4 ✓
calliope (alias calliope-0.7) Calliope 0.7 0.7.0 ✓
calliope-0.6 Calliope 0.6 0.6.8 by name
adopt-net0 AdOpT-NET0 0.1.10 ✓

GET /capabilities lists the targets, what all runs, the aliases, the framework version each target drives, and the feature matrix. One run mode is not an optimization: experiment.mode: power_flow has PyPSA solve the AC network described in the payload (voltage levels, impedances, a fixed dispatch, reactive power and voltage control) and report voltages, loading and convergence, the natural second call after a plan on any target; the other targets ignore those inputs with a warning. PyPSA also plans under the voltage law (experiment.network.model: linear_power_flow, with line expansion and security constraints), sizes storage as a Store, builds in integer modules, retires capacity, prices unmet demand and plans over investment periods.

Quickstart

Dry-run on the host (Go only — validates, translates and plans, no solve):

make run                                                        # build + serve on :8080
curl -s -X POST 'localhost:8080/validate?target=all' -d @examples/shared_full.json | jq .
curl -s -X POST 'localhost:8080/convert?target=calliope' -d @examples/calliope_full.json | jq .

Without a checkout, go install github.com/enerplanet/meme/cmd/meme@latest puts the same dry-run binary into your Go bin directory (meme -version tells you which release).

Real solvers in Docker (PyPSA/HiGHS, Calliope 0.7 and 0.6/CBC, AdOpT/GLPK):

make -C environment build ENV=dev                               # one-time image build
make -C environment run   ENV=dev                               # API on :8080, real execution
ID=$(curl -s -X POST 'localhost:8080/simulate?target=all' -d @examples/shared_full.json | jq -r .id)
curl -s "localhost:8080/jobs/$ID/status" | jq .state            # queued -> running -> succeeded
curl -s -o result.zip "localhost:8080/jobs/$ID"

Configuration (ports, work directory, API_KEY, CORS_ORIGINS) comes from CLI flags or a .env file; see .env.example and the configuration guide.

Repository layout

cmd/meme/          server main
internal/          api · cli · env · model · emit · scripts · target/{pypsa,calliope,adoptnet0} · scenarios · service
test/              test pyramid (host suites, goldens, real-solver E2E)
environment/       Docker image with the frameworks, their venvs and free solvers
examples/          ready-to-run payloads and the curl walkthrough
schemas/           the published JSON Schemas (payload contract)
docs/              the documentation site (MkDocs)

Development

make test           # vet + host suite: unit tests, golden files, validation matrix (no Python)
make schema-check   # examples and the scenario corpus against the JSON Schema
make e2e            # container: every scenario on real solvers, both Calliope releases
make docs           # build the documentation site strictly

See CONTRIBUTING.md for the workflow, CHANGELOG.md for what changed, and the testing guide for the test pyramid.

License

MIT — see LICENSE. Third-party frameworks and solvers used by the environment image are listed in ATTRIBUTIONS.md. To cite MEME, use CITATION.cff.

About

Multi Energy Model Execution

Resources

Code of conduct

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages