Back to prompt library
Build a Desalination Chemical Inventory and Treatment Scenario Evaluator — implementation
Linked challenge: Build a Desalination Chemical Inventory and Treatment Scenario Evaluator
Prompt source
implementation66 lines11 sectionsNo variables1 code block
## Build
Assess antiscalant and coagulant dosage scenarios across seawater reverse osmosis trains. Compare operational chemical consumption against water recovery targets and regulatory discharge limits.
## User
Seawater reverse osmosis process engineers and water treatment plant operators
## Workflow
1. Ingest raw seawater salinity, turbidity metrics, and high-pressure reverse osmosis membrane runtimes.
2. Model chemical dosage rates and membrane scaling risk using WaterTAP treatment flowsheet principles.
3. Formulate multi-day chemical inventory depletion forecasts under varying recovery rate scenarios.
4. Export an inventory reorder and dosing recommendation dossier for chemical superintendent review.
## Interface
Chemical dosing scenario workspace with slider controls for target water recovery and inventory runout warning cards.
## Data
Utilize WaterTAP public desalination flowsheet examples and mock SWRO operational logs hosted on a local repo. These logs are simplified synthetic app records, not complete official schema files.
Starter examples below are synthetic. They are not downloaded records.
## Source
[WaterTAP treatment modeling](https://raw.githubusercontent.com/watertap-org/watertap/main/README.md)
Applies reverse osmosis membrane and water treatment flowsheet parameters derived from the WaterTAP repository.
## Tools
pydantic-ai, mlflow, watertap.
pydantic-ai provides strict type validation for chemical stoichiometry and inventory threshold models.
Hosted LLM API providing structured JSON validation and analytical scenario comparisons.
## 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
- Computes daily antiscalant consumption based on raw seawater feed flow and dosing setpoints.
- Flags inventory exhaustion events when projected chemical stocks fall below the mandatory 5-day reserve.
- Generates structured recovery comparison tables comparing standard and high-efficiency operating modes.
- Requires chemical plant manager sign-off prior to modifying simulated bulk dosing pump settings.
## Starter Examples
```json
[
{
"input": {
"feed_flow_m3_day": 50000,
"feed_tds_ppm": 42000,
"current_antiscalant_stock_kg": 4500,
"target_recovery_pct": 45,
"antiscalant_dose_ppm": 2.5
},
"expected_output": {
"daily_chemical_use_kg": 125,
"days_inventory_remaining": 36,
"reserve_threshold_breached": false,
"recommended_action": "Maintain current antiscalant dosing setpoint of 2.5 ppm."
}
},
{
"input": {
"feed_flow_m3_day": 75000,
"feed_tds_ppm": 48000,
"current_antiscalant_stock_kg": 400,
"target_recovery_pct": 50,
"antiscalant_dose_ppm": 4
},
"expected_output": {
"daily_chemical_use_kg": 300,
"days_inventory_remaining": 1.33,
"reserve_threshold_breached": true,
"recommended_action": "Emergency reorder: Inventory below 5-day safety margin; derate recovery to 40%."
}
}
]
```
## Safety
Operational simulations only; automated dosing changes must be verified against water chemistry lab assays.
Use mock external writes. Require human review before any real deployment.