Skip to content

API Reference ​

Technical documentation for ErgoPlanner's TypeScript APIs.

Overview ​

ErgoPlanner provides comprehensive TypeScript APIs for wastewater treatment process modeling and simulation. This reference documents all core interfaces, types, and methods used throughout the application.

Core APIs ​

Simulation Engine API ​

Core calculation engine interfaces including simulation context, calculation graphs, stream data, and basic calculation results.

Key Interfaces:

  • SimulationContext - Runtime context for simulations
  • CalculationGraph - Process flow graph structure
  • StreamData - Flow and quality data at connection points
  • FlowConditionSet - Multi-condition flow scenarios
  • BasicCalculationResult - Hydraulic calculation results

Process Units API ​

Complete library of 160+ wastewater treatment process unit types and their configuration parameters.

Key Types:

  • ProcessUnitType - Enumeration of all supported process units
  • ProcessUnitParameters - Configuration parameters for units
  • ProcessUnitConfig - Quantity, duty/standby, and status configuration
  • CalculationNode - Node representation in calculation graph

Categories:

  • Preliminary Treatment (screens, grit chambers)
  • Primary Treatment (clarifiers)
  • Secondary Treatment (activated sludge, biofilters)
  • Tertiary Treatment (filtration, disinfection, membranes)
  • Sludge Treatment (thickening, digestion, dewatering)
  • Flow Control (splitters, combiners, pumps)
  • Chemical Dosing and Utilities

Controllers API ​

Process control interfaces for PID controllers and advanced control strategies.

Key Interfaces:

  • ControllerConfig - Base controller configuration
  • PIDConfiguration - Complete PID tuning parameters
  • ControllerState - Runtime controller state
  • ControllerOutput - Controller execution results
  • Extended controller types (Cascade, Ratio, Feedforward, etc.)

Data APIs ​

Mass Balance API ​

Integrated mass balance calculations for stream-by-stream process analysis.

Key Interfaces:

  • ProcessCalcMassBalance - Complete mass balance structure
  • StreamBalance - Stream flow and quality data
  • StreamMassLoads - Mass loading calculations (kg/d)
  • StreamConcentrations - Quality concentrations (mg/L)
  • BalanceCheck - Mass conservation verification

Biokinetic Models API ​

ASM and ADM biokinetic model parameter interfaces.

Note: Biokinetic model types are currently being consolidated. This section will document ASM1, ASM2d, ASM3, and ADM1 parameters when available.

Export APIs ​

Export Formats API ​

File format specifications for project data export and import.

Formats:

  • JSON - Project file schema
  • CSV - Mass balance and results export
  • PDF - Report generation structure
  • DXF - CAD drawing export

Type Conventions ​

Optional Properties ​

Properties marked with ? are optional:

typescript
interface Example {
  required: number;    // Must be provided
  optional?: number;   // May be omitted
}

Union Types ​

Types using | indicate multiple valid options:

typescript
type FlowConditionType = 'DWF' | 'avgFlow' | 'maxDaily';

Enumerations ​

Many types use string literal unions for type safety:

typescript
type EquipmentStatus = 'existing' | 'new' | 'to-be-removed' | 'future';

Units ​

ErgoPlanner uses consistent SI units throughout:

Flow:

  • m³/d (cubic meters per day) for daily flows
  • L/s (liters per second) for instantaneous flows

Concentrations:

  • mg/L (milligrams per liter) for water quality parameters
  • % (percent) for solids content

Mass Loads:

  • kg/d (kilograms per day) for mass loading rates
  • kg DS/d (kilograms dry solids per day) for sludge production

Time:

  • hours (h) for hydraulic retention time
  • days (d) for solids retention time

Energy:

  • kWh/d (kilowatt-hours per day) for energy consumption

Using This Reference ​

Each API section includes:

  1. Interface Definitions - Complete TypeScript type definitions
  2. Property Tables - Detailed property descriptions with types
  3. Code Examples - Practical usage examples in TypeScript
  4. Related Types - Cross-references to related interfaces
  5. Implementation Notes - Important constraints and considerations

Version Information ​

This API reference corresponds to ErgoPlanner version 1.0.0 (in development).

API interfaces are subject to change during active development. Breaking changes will be documented in release notes.