Skip to content
Engineering Decision Intelligence
TutorialVersion 0.4.1

Build a QSDsan wastewater and nutrient-recovery case

Use the supported structured QSDsan sanitation workflow and inspect wastewater composite and nutrient-recovery metrics.

Current sanitation workflow

build_sanitation_system exposes a small structured QSDsan wastewater/nutrient-recovery workflow. It is not a general QSDsan flowsheet builder.

1. Define the influent

json
{
  "flow_tot": 1000,
  "concentrations": {
    "S_F": 200,
    "S_NH4": 40,
    "S_PO4": 8
  },
  "N_recovery": 0.6,
  "P_recovery": 0.8
}

flow_tot is in m³/h and concentrations are in mg/L. Concentration keys must be valid identifiers from QSDsan's default component set.

2. Build the sanitation system

text
build_sanitation_system(spec={...})

The tool stores the QSDsan system and returns a result_id. The current implementation transfers the configured fractions of S_NH4 and S_PO4 into a recovered stream.

3. Inspect wastewater metrics

text
get_wastewater_results(result_id=...)
  • Influent and effluent COD, BOD, TN, and TP.
  • COD/TN/TP removal percentages where defined.
  • Recovered NH4 and PO4 mass flow in kg/h.

4. Inspect and clean up

text
get_flowsheet_diagram(result_id=...)
→ dispose_result(result_id=...)

Dispose the stored result only after the analysis no longer needs it.

5. Hand-check nutrient recovery

For the documented 1000 m³/h case, 8 mg/L PO4 corresponds to 8 kg/h entering the system. At P_recovery = 0.8, the expected recovered PO4 mass is 6.4 kg/h. Likewise, 40 mg/L NH4 corresponds to 40 kg/h and N_recovery = 0.6 gives 24 kg/h recovered on the configured NH4 stream basis.

text
PO4: 8 mg/L × 1000 m³/h = 8 kg/h; 8 × 0.8 = 6.4 kg/h
NH4: 40 mg/L × 1000 m³/h = 40 kg/h; 40 × 0.6 = 24 kg/h

Note

Use this arithmetic as a sanity check on the structured recovery tool. The repository also includes a separate 300-sample QSDsan case study, but the MCP run_uncertainty tool currently targets BioSTEAM economic parameters rather than sanitation recovery parameters.

Scientific boundary

This narrow workflow does not independently establish wastewater characterization quality, biological kinetics, treatment feasibility, regulatory compliance, nutrient-product quality, life-cycle impacts, or TEA feasibility.