Skip to main content
Loading navigation
Back to prompt library

Build a Seawater RO Desalination Energy Procurement Allocator — implementation

Linked challenge: Build a Seawater RO Desalination Energy Procurement Allocator

Prompt source

implementation88 lines11 sectionsNo variables1 code block
## Build
Align reverse osmosis high-pressure pump power consumption with solar generation curves and time-of-day tariffs. Formulate hourly desalination production setpoints to minimize grid energy costs.

## User
Desalination Plant Operations Dispatcher

## Workflow
1. Ingest seawater reverse osmosis membrane flux models, recovery ratios, and specific energy consumption metrics.
2. Model co-located photovoltaic solar production curves using pvlib irradiance and temperature functions.
3. Incorporate WaterTAP membrane unit performance equations for pressure versus permeate flux.
4. Synthesize an hourly high-pressure pump scheduling plan balancing potable water reservoir levels and tariff windows.

## Interface
Dashboard showing solar forecast overlays, power tariff bands, simulated permeate production curves, and pump setpoint controls.

## Data
Synthesize 24-hour time-series datasets containing hourly solar irradiance, water demand profiles, and membrane operating coefficients.
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 WaterTAP membrane treatment model specifications for calculating reverse osmosis specific energy consumption under variable flux.

## Tools
ray-serve, pvlib, numpy.
Ray Serve provides scalable model serving to run concurrent hydrodynamic and energy simulation tasks.
Local Python execution for mathematical optimization and hosted Claude API for operational summary generation.

## 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
- Maintains water reservoir storage between minimum reserve (20%) and maximum buffer (95%) across 24 hours.
- Shifts high-pressure pump load by at least 25% into peak solar production hours.
- Outputs an hourly pumping schedule with estimated power purchase costs.

## Starter Examples
```json
[
  {
    "input": {
      "plant_id": "SWRO-01",
      "storage_initial_m3": 15000,
      "storage_max_m3": 50000,
      "target_daily_output_m3": 30000,
      "peak_solar_hours": [
        10,
        11,
        12,
        13,
        14
      ],
      "peak_grid_tariff_hours": [
        17,
        18,
        19,
        20
      ]
    },
    "expected_output": {
      "solar_hour_pump_load_pct": 100,
      "grid_peak_pump_load_pct": 40,
      "projected_final_storage_m3": 18200,
      "energy_cost_status": "OPTIMIZED",
      "curtailment_avoided_mwh": 8.4
    }
  },
  {
    "input": {
      "plant_id": "SWRO-02",
      "storage_initial_m3": 5000,
      "storage_max_m3": 50000,
      "target_daily_output_m3": 35000,
      "peak_solar_hours": [
        11,
        12,
        13
      ],
      "peak_grid_tariff_hours": [
        18,
        19,
        20
      ]
    },
    "expected_output": {
      "solar_hour_pump_load_pct": 100,
      "grid_peak_pump_load_pct": 75,
      "projected_final_storage_m3": 11500,
      "energy_cost_status": "CONSTRAINED_BY_MINIMUM_STORAGE",
      "curtailment_avoided_mwh": 3.1
    }
  }
]
```

## Safety
Pump setpoints are recommendations; minimum system pressures must remain within physical membrane manufacturer limits to prevent collapse.
Use mock external writes. Require human review before any real deployment.