Back to prompt library
Build a Seawater RO Membrane Spare-Parts Procurement and Clean Outage Scheduler — implementation
Linked challenge: Build a Seawater RO Membrane Spare-Parts Procurement and Clean Outage Scheduler
Prompt source
implementation96 lines11 sectionsNo variables1 code block
## Build
Correlate seawater reverse osmosis membrane fouling metrics from WaterTAP flowsheets with chemical wash inventory and spare membrane stock. Plan multi-train cleaning outages to prevent potable water supply interruptions.
## User
Desalination Plant Operations Manager
## Workflow
1. Parse WaterTAP reverse osmosis train flowsheet parameters including normalized flux and salt rejection.
2. Calculate membrane degradation trends and evaluate Clean-In-Place chemical consumption requirements.
3. Inspect warehouse inventory for replacement spiral-wound membrane elements and antiscalant stock.
4. Synthesize multi-train outage sequence schedules while maintaining water reservoir reserve commitments.
## Interface
FastAPI backend connected to an operations dashboard displaying RO train health, CIP schedules, and inventory alerts.
## Data
Construct synthetic RO membrane operating datasets mimicking WaterTAP RO flowsheet state variables under Persian Gulf salinity (42,000 ppm TDS).
Starter examples below are synthetic. They are not downloaded records.
## Source
[WaterTAP treatment modeling](https://raw.githubusercontent.com/watertap-org/watertap/main/README.md)
Leverages WaterTAP treatment modeling concepts to track membrane mass transfer coefficients, pressure drops, and salt passage.
## Tools
mastra-ai, fastapi, pydantic.
Mastra AI provides resilient workflow orchestration and event logging across multi-stage chemical and membrane operations.
Local or hosted LLM capable of evaluating industrial process constraints and generating structured scheduling JSON.
## Deliverables
Submit runnable source, pinned dependencies, setup commands, a working interface, example outputs, and a recorded end-to-end demo. Include tests and an action log.
## Acceptance
- Detects membrane differential pressure increase exceeding 20% baseline signaling mandatory CIP.
- Verifies on-site citric acid and sodium hydroxide cleaning chemical stock before scheduling train shutdown.
- Ensures total plant potable production never drops below 80% contract commitment during outages.
- Emits formal maintenance work ticket requiring plant engineering sign-off.
## Starter Examples
```json
[
{
"input": {
"plant_id": "FUJAIRAH-RO-T2",
"train_id": "TRAIN-B",
"differential_pressure_bar": 3.8,
"baseline_pressure_bar": 2.9,
"salt_rejection_percent": 98.2,
"finished_water_storage_hours": 18,
"warehouse_stock": {
"citric_acid_kg": 1500,
"naoh_kg": 800,
"spare_swro_elements": 24
},
"required_cip_chemicals": {
"citric_acid_kg": 600,
"naoh_kg": 300
}
},
"expected_output": {
"plant_id": "FUJAIRAH-RO-T2",
"train_id": "TRAIN-B",
"cip_action_required": true,
"dp_increase_percent": 31.03,
"chemical_inventory_sufficient": true,
"membrane_replacement_needed": false,
"recommended_outage_start": "Day 2 at 22:00 (Reservoir above 14h safety buffer)",
"outage_duration_hours": 8,
"requires_chief_operator_signoff": true
}
},
{
"input": {
"plant_id": "AL-ZOUR-SWRO-1",
"train_id": "TRAIN-D",
"differential_pressure_bar": 4.5,
"baseline_pressure_bar": 3,
"salt_rejection_percent": 94.1,
"finished_water_storage_hours": 7,
"warehouse_stock": {
"citric_acid_kg": 200,
"naoh_kg": 150,
"spare_swro_elements": 4
},
"required_cip_chemicals": {
"citric_acid_kg": 600,
"naoh_kg": 300
}
},
"expected_output": {
"plant_id": "AL-ZOUR-SWRO-1",
"train_id": "TRAIN-D",
"cip_action_required": true,
"dp_increase_percent": 50,
"chemical_inventory_sufficient": false,
"membrane_replacement_needed": true,
"recommended_outage_start": "BLOCKED: Storage buffer low (7h < 12h threshold) and chemical deficit",
"outage_duration_hours": 16,
"requires_chief_operator_signoff": true
}
}
]
```
## Safety
High-pressure seawater reverse osmosis trains operate up to 70-80 bar; all pump shutdowns, valving sequences, and chemical washes require human engineering supervision.
Use mock external writes. Require human review before any real deployment.