How the cable, switchgear & SLD tools fit together — pages, backend, workers, deployment
M-PowerC v1.8 is an offline-first electrical design assistant for Munters DH and plus-system units. It turns electrical drawings into structured cable schedules, sizes cables to EN 60204-1, lets engineers draft single-line diagrams, and offers an AI assistant for free-form switchgear & cable questions. All UIs run in the browser — no install for end-users.
Landing dashboard. Routes the user to every other tool and shows help + datasheets.
Drives the end-to-end pipeline: Drawing PDF → Vision → JSON → Rules Engine → Excel.
In-browser PDF parser for Munters AirC 800 drawings. Extracts cable schedule, BOM and main-power summary.
Interactive table to pick switchgear components and matching cables for DH-unit systems.
Older selector that also handles plus-system units. Kept for reference.
Multi-cable sizing calculator following EN 60204-1 with full compliance report.
Extended EN 60204-1 calculator that supports parallel cable runs and a print-optimised layout.
Canvas-based Single Line Diagram builder with an electrical component palette.
Hybrid assistant: deterministic rule-engine for live-calc questions + a hosted LLM (Llama 3.3 70B class) for freeform Q&A.
Served by the pause worker when the site is taken offline for maintenance.
pause.bat / resume.batSingle source of truth describing every page, backend script, worker and deployment path.
The user always lands on the Electrical Tools Main Page. From there, three flows are possible: (1) use a standalone calculator/selector page, (2) run the Drawing→Excel pipeline via Auto Cable Schedule + local Python server, (3) ask the M-PowerC AI Assistant, which talks to a hosted LLM through a Cloudflare Worker proxy.
The LLM API key lives only as a secret on the Worker — never in the browser.
.xlsxFrontend pages are self-contained, but two helper layers exist: Python scripts for PDF parsing (only used by the workflow page), and JavaScript workers for AI proxying and maintenance mode.
| File | Role | What it does |
|---|---|---|
cable schedule.py |
PDF → schedule | Reads Munters drawings with pdfplumber, groups words into table rows, and emits a structured cable schedule (Cable designation, From, To, Cable type, Conductors, Ø, Length, Munters part no., Function text). |
bom download.py |
PDF → BOM | Extracts Bill-of-Materials tables (Description, Qty, Manufacturer, Type Number, Munters Part No) and returns cleaned structured data. |
build_deck.py / build_deployment_deck.py |
Doc builder | Generate PowerPoint decks (M-PowerC_Overview.pptx, M-PowerC_Deployment.pptx) from templates. |
| File | Role | What it does |
|---|---|---|
chatbot.js |
In-page AI client | CableBot v4. Hybrid assistant embedded in tool pages. Routes deterministic live-calc questions to a local rule engine, and freeform questions to a hosted LLM via the Worker proxy. Each host page provides window.CableBotSnapshot() for context. |
_worker.js |
Pause worker | Cloudflare Pages Function. When deployed at site root, intercepts every request and returns maintenance.html. Lets static assets (bg image, favicon) through. |
pause-worker.js |
Pause worker (backup) | Identical copy of _worker.js kept aside so pause.bat/resume.bat can swap it in and out. |
pilot/cloudflare-worker.js |
AI proxy | Receives chat requests from chatbot.js, injects the secret LLM API key (Worker Secret), forwards to the hosted LLM’s OpenAI-compatible /chat/completions endpoint, and streams the response back. Includes 60 req/min per-IP throttle and an origin allow-list. |
pilot/ contains the 15-minute setup for the free Cloudflare proxy:
PILOT_SETUP.md (step-by-step guide), cloudflare-worker.js (the proxy)
and wrangler.toml (deploy config). On the Cloudflare free tier this gives
~14,400 calls/day — enough for 3–10 colleagues — with the LLM API key never leaving the Worker.
Three independent deployment surfaces. Pick whichever your IT setup allows — pages stay the same; only hosting differs.
python\Run Cable Pipeline.bat once127.0.0.1:5057_worker.js handles maintenance modepilot/cloudflare-worker.js separately for AI proxyLLM_API_KEY)pause.bat → swaps _worker.js in, serves maintenance.htmlresume.bat → removes the worker, site returns to normalPick a page below to see what's inside it and what you can do there. The details panel appears just below the picker.