This repository contains a demonstrator for how MPC works. A small React frontend combined with a Python real-time simulation backend.
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-demonstratorThis 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.
- Sync your Python env:
Configure the path to the cloned
uv sync
cosimosrepository inpyproject.toml - Build the frontend:
(bundles Plotly.js, so it might take a sec)
cd client npm install npm run build - Serve the app locally or on your intranet (please don’t ever host it publicly without some major overhaul):
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.
./webserver.sh
Note: It binds to
0.0.0.0, so you can reach it from any device on your LAN. - Start the backend:
This runs FastAPI with a WebSocket on port 8001.
./backend.sh
- Visit http://localhost:80/ to see the demo.
- Perform steps 1 & 2 from Setup
- Run the backend as usual (
backend.shorbackend.bat). - For the frontend, kick off the Vite dev server:
Live reload, no F5 needed!
cd client npm install npm run dev
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