Skip to content

HRI-EU/mpc-tech-demonstrator

Repository files navigation

MPC Tech Demonstrator

This repository contains a demonstrator for how MPC works. A small React frontend combined with a Python real-time simulation backend.

Getting started

The easiest way to run everything is to use docker. Either build the container first via

docker build -t mpc-tech-demonstrator --build-arg http_proxy=$http_proxy --build-arg https_proxy=$https_proxy .

Then you can start the docker container via

docker run -it -p 8080:80 -p 8001:8001 mpc-tech-demonstrator

This will make the demonstrator available under http://localhost:8080.

Otherwise, check Requirements and Setup below to find out how to setup a non-docker instance.

Requirements for usage without Docker

  • Node.js (>=22) with npm
  • uv
  • A cloned cosimos repository in the deps/ directory

Setup without Docker

  1. Sync your Python env:
    uv sync
    Configure the path to the cloned cosimos repository in pyproject.toml
  2. Build the frontend:
    cd client
    npm install
    npm run build
    (bundles Plotly.js, so it might take a sec)
  3. Serve the app locally or on your intranet (please don’t ever host it publicly without some major overhaul):
    ./webserver.sh
    This will start a flask server on port 80. If port 80 is already in use (or blocked), simply change the port in the script.

    Note: It binds to 0.0.0.0, so you can reach it from any device on your LAN.

  4. Start the backend:
    ./backend.sh
    This runs FastAPI with a WebSocket on port 8001.
  5. Visit http://localhost:80/ to see the demo.

Dev Setup

  1. Perform steps 1 & 2 from Setup
  2. Run the backend as usual (backend.sh or backend.bat).
  3. For the frontend, kick off the Vite dev server:
    cd client
    npm install
    npm run dev
    Live reload, no F5 needed!

Repository Structure

backend/
 ├─ main.py             # FastAPI + WebSocket simulation orchestration
 └─ simulation/         # Simulation code
     └─ hems/           # Full cosimos HEMS system implementation

client/                 # React frontend
 └─ src/apps/
     └─ hems            # HEMS demo

data/                   # Simulation profiles

webserver/              # Flask server for the React build

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published