NOTQIN Physics (Physics-Informed Industrial AI)
1. Project Summary
A physics-informed AI engine that grounds every maintenance recommendation in governing engineering equations, ODE simulations, and cost scenarios — not just statistical ML. Operators ask engineering questions about machines; the agent uses SymPy/SciPy to solve physics equations and verify recommendations against hard safety constraints before answering.
2. Architecture
POST /ask or POST /ask/stream (SSE)
↓
Claude LLM (via OpenRouter or Google AI Studio)
│ 15 tool calls
↓
┌──────────────────────────────────────────────┐
│ fetch_telemetry → InfluxDB / CSV │
│ list_equations → equations.yaml │
│ solve_equation → SymPy symbolic │
│ evaluate_equation → SymPy numerical │
│ simulate_motor_thermal → SciPy ODE (RK45) │
│ simulate_dye_bath → SciPy ODE │
│ simulate_pressure_decay → SciPy ODE │
│ classify_failure → failure-modes.yaml │
│ estimate_scenario_costs → action-scenarios.yaml│
│ verify_recommendation → constraints.yaml │
└──────────────────────────────────────────────┘
↓
ProofObject (PASS / WARN / BLOCK verdict)
↓
AnswerCard (answer + equations + confidence + cost scenarios)
3. Tech Stack
| Layer | Technology |
|---|---|
| API | FastAPI 0.115 + Uvicorn |
| LLM | Claude via OpenRouter or Google AI Studio |
| Physics Solver | SymPy 1.13 (symbolic + numerical) |
| ODE Simulator | SciPy 1.13 (solve_ivp, RK45) |
| Optimization | CasADi 3.6 (optional, nonlinear) |
| Unit Registry | Pint 0.24 (dimensional analysis) |
| Telemetry | InfluxDB client + CSV fallback |
| Config | YAML (equations, assets, constraints, scenarios, failure modes) |
| Metrics | Prometheus client |
4. Physics Engine
Equations Library (50+ equations in config/equations.yaml)
- Bearing: RMS velocity, ISO 281 L10 fatigue life, BPFO/BPFI fault frequencies
- Motor: Thermal ODE (winding temp transient), efficiency equation
- Compressor: Specific power, pressure decay ODE
- Weaving HVAC: Psychrometric dew point, saturation
- Dyeing: Heat transfer, time-to-setpoint ODE
- Each has: formula, variables (name, unit, description), tags, ISO reference
ODE Simulators
# Motor thermal winding temperature transient
SimulationEngine.motor_thermal(current, ambient_temp, thermal_resistance, thermal_capacity)
→ SimResult(time_series, units, steady_state)
# Dye bath temperature ramp (heating + hold)
SimulationEngine.dye_bath_ramp(initial_temp, target_temp, ramp_rate, hold_duration)
# Compressor pressure decay (leak detection)
SimulationEngine.compressor_pressure_decay(initial_pressure, leak_rate)Asset Library (7 families in config/assets.yaml)
- bearing, motor, compressor, weaving_hall_hvac, dyeing_machine, autoclave, cnc_machine
- Per asset: state variables, inputs, hard limits (warn/alarm thresholds), preferred solver
Constraint Library (config/constraints.yaml)
- Thermal: winding max °C, discharge max pressure bar
- Load: motor current imbalance % max
- Safety interlocks: autoclave pressure, vibration thresholds
Verification Engine
ProofObject.verdict: PASS | WARN | BLOCK
ProofObject.block_reason: "Temperature exceeds hard limit: 185°C > 180°C max"Failure Mode Taxonomy (config/failure_modes.yaml)
- Bearing: outer race spall, inner race spall, cage wear, lubrication starvation
- Motor: winding short, overtemp, current imbalance
- Compressor: discharge temp high, pressure low, leaking
- Autoclave: pressure overshoot, cure undertime, steam isolation failure
Cost Scenario Engine (config/action_scenarios.yaml)
Action: replace_bearing_now
downtime: 4h = 8,000 MAD
spares: 2,500 MAD
benefit: extends MTTF by 6 months
Action: delay_to_scheduled
risk: 35% chance of unplanned failure = 40,000 MAD average cost
Action: do_nothing
risk: progressive failure, CBAM audit evidence gap
5. Role-Aware Responses
The agent adapts its answer framing per user role:
| Role | Focus |
|---|---|
| operations | Production throughput, downtime cost |
| maintenance | Technical root cause, repair procedure |
| finance | MAD cost, payback period, CBAM exposure |
| engineering | Physics equations, ODE simulation |
| operator | Simple instructions, safety warnings |
6. Current Status
Stage: MVP — ready for integration testing
Last commit: Apr 23, 2026
API Endpoints:
POST /ask— blocking Q&A (JSON in, AnswerCard out)POST /ask/stream— SSE stream (thinking → tool calls → verification → final)GET /health— liveness + config summaryGET /equations— equation catalog (filterable by tag)GET /roles— supported user rolesGET /failure-modes— failure taxonomyGET /metrics— Prometheus metrics
Tests: tests/test_symbolic.py, tests/test_direct.py, tests/test_agent_debug.py
What’s complete (85%):
- Full agent loop with 15 tools
- SymPy solver (50+ equations)
- SciPy ODE simulator (3 simulators)
- Pint unit registry
- Failure-mode classifier
- Cost scenario estimator
- Constraint verifier
- Prometheus + SSE streaming
What’s incomplete (15%):
- 7 of 22 asset types scaffolded (others follow same pattern)
- CasADi optimization not fully wired
- No Dockerfile (run from source)
- Real telemetry caching (re-queries InfluxDB each call)
- No per-user auth on
/askendpoint - State Service integration (doesn’t poll Redis digital twin)
7. Integration Position
Physics Service ← called by →
IEIA (operational questions needing physics validation)
Analyst Service (complex anomaly explanations)
Physics Service reads from →
NOTQIN InfluxDB (live telemetry)
NOTQIN CSV (offline dev)
8. Next Actions
- Create Dockerfile for physics-service
- Add Redis cache for telemetry (don’t re-query InfluxDB per call)
- Integrate with IEIA: IEIA calls physics-service for recommendation validation
- Integrate with State Service for “current” machine condition
- Complete remaining 15 asset type schemas
- Add rate limiting + auth on
/ask - Load test with 10 concurrent requests