OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
lid.h File Reference

Low-impact development controls, usage, and state. More...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "infil.h"
Include dependency graph for lid.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  TSurfaceLayer
 
struct  TPavementLayer
 
struct  TSoilLayer
 
struct  TStorageLayer
 
struct  TDrainLayer
 
struct  TDrainMatLayer
 
struct  TLidProc
 
struct  TWaterBalance
 
struct  TLidRptFile
 
struct  TLidUnit
 

Macros

#define MAX_LAYERS   4
 

Enumerations

enum  LidTypes {
  BIO_CELL ,
  RAIN_GARDEN ,
  GREEN_ROOF ,
  INFIL_TRENCH ,
  POROUS_PAVEMENT ,
  RAIN_BARREL ,
  VEG_SWALE ,
  ROOF_DISCON
}
 
enum  TimePeriod {
  PREVIOUS ,
  CURRENT
}
 

Functions

void lid_create (int lidCount, int subcatchCount)
 Allocate LID process definitions and per-subcatchment LID group storage.
 
void lid_delete (void)
 Deletes all LID objects.
 
int lid_readProcParams (char *tok[], int ntoks)
 Reads LID process information from line of input data file.
 
int lid_readGroupParams (char *tok[], int ntoks)
 Reads input data for a LID unit placed in a subcatchment.
 
int lid_setDrainParams (int lidIndex, double coeff, double expon, double offset)
 Updates the underdrain flow parameters of a LID process at runtime (API support). The drain parameters are read live each step (lidproc.c), so an edit takes effect on the next step.
 
void lid_validate (void)
 Validates LID process and group parameters.
 
void lid_initState (void)
 Initializes the internal state of each LID in a subcatchment.
 
void lid_setOldGroupState (int subcatch)
 Saves the current drain flow rate for the LIDs in a subcatchment.
 
double lid_getPervArea (int subcatch)
 Retrieves amount of pervious LID area in a subcatchment.
 
double lid_getFlowToPerv (int subcatch)
 Retrieves flow returned from LID treatment to pervious area of a subcatchment.
 
double lid_getDrainFlow (int subcatch, int timePeriod)
 Select the previous or current total LID drain flow of a subcatchment.
 
double lid_getStoredVolume (int subcatch)
 Computes stored volume of water for all LIDs grouped within a subcatchment.
 
void lid_addDrainLoads (int subcatch, double c[], double tStep)
 Add LID drain pollutant export and BMP removal to mass-balance totals.
 
void lid_addDrainRunon (int subcatch)
 Route previous-period LID drain flow and pollutant loads to receiving subcatchments.
 
void lid_addDrainInflow (int subcatch, double f)
 Add temporally interpolated LID drain inflows to conveyance nodes.
 
void lid_getRunoff (int subcatch, double tStep)
 Advance LID units and compute runoff, drain and return flows.
 
void lid_writeSummary (void)
 Writes summary of LID processes used to report file.
 
void lid_writeWaterBalance (void)
 Writes a LID performance summary table to the project's report file.
 
void lidproc_initWaterBalance (TLidUnit *lidUnit, double initVol)
 Initializes the water balance components of a LID unit.
 
double lidproc_getOutflow (TLidUnit *lidUnit, TLidProc *lidProc, double inflow, double evap, double infil, double maxInfil, double tStep, double *lidEvap, double *lidInfil, double *lidDrain)
 Computes runoff outflow from a single LID unit.
 
void lidproc_saveResults (TLidUnit *lidUnit, double ucfRainfall, double ucfRainDepth)
 Update LID water balance and optionally emit detailed report results.
 

Detailed Description

Low-impact development controls, usage, and state.

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com (OpenSWMM maintenance and extensions)
License
Apache-2.0 for OpenSWMM contributions; original EPA SWMM provenance is retained.

Macro Definition Documentation

◆ MAX_LAYERS

#define MAX_LAYERS   4

Enumeration Type Documentation

◆ LidTypes

enum LidTypes
Enumerator
BIO_CELL 
RAIN_GARDEN 
GREEN_ROOF 
INFIL_TRENCH 
POROUS_PAVEMENT 
RAIN_BARREL 
VEG_SWALE 
ROOF_DISCON 

◆ TimePeriod

enum TimePeriod
Enumerator
PREVIOUS 
CURRENT 

Function Documentation

◆ lid_addDrainInflow()

void lid_addDrainInflow ( int j,
double f )

Add temporally interpolated LID drain inflows to conveyance nodes.

Parameters
[in]jValid contributing subcatchment index.
[in]fCurrent-period interpolation weight, normally in [0, 1]; old values use weight 1 - f and the function does not clamp extrapolation.
Postcondition
Updates receiving Node.newLatFlow and newQual loading rates and wet-weather mass-balance totals, after applying drain pollutant removal.
Here is the call graph for this function:

◆ lid_addDrainLoads()

void lid_addDrainLoads ( int j,
double c[],
double tStep )

Add LID drain pollutant export and BMP removal to mass-balance totals.

Parameters
[in]jValid contributing subcatchment index.
[in]cBorrowed Nobjects[POLLUT] concentration array, in pollutant mass per liter.
[in]tStepRunoff interval in seconds.
Postcondition
Updates loading totals for BMP_REMOVAL_LOAD and eligible RUNOFF_LOAD. Drain-to-pervious units are excluded; absent LID groups perform no action.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lid_addDrainRunon()

void lid_addDrainRunon ( int j)

Route previous-period LID drain flow and pollutant loads to receiving subcatchments.

Parameters
[in]jValid contributing subcatchment index.
Postcondition
Adds drain runon and pollutant loading rates to configured receiving subcatchments. Uses oldDrainFlow and the source oldQual, adjusted by drain removal. No action is taken when the source has no LID group.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lid_create()

void lid_create ( int lidCount,
int subcatchCount )

Allocate LID process definitions and per-subcatchment LID group storage.

Parameters
[in]lidCountNonnegative number of LID process definitions.
[in]subcatchCountNonnegative number of subcatchment group slots.
Postcondition
Initializes module pointers/counts and default layer properties. Each process receives a pollutant-removal array. Allocation failure sets ErrorCode to ERR_MEMORY and leaves partial allocations for lid_delete().
Precondition
Previous project LID storage has already been released.

◆ lid_delete()

void lid_delete ( void )

Deletes all LID objects.

◆ lid_getDrainFlow()

double lid_getDrainFlow ( int j,
int timePeriod )

Select the previous or current total LID drain flow of a subcatchment.

Parameters
[in]jValid subcatchment/LidGroups index.
[in]timePeriodPREVIOUS selects oldDrainFlow; any other value selects newDrainFlow.
Returns
Drain flow in cubic feet per second, or zero when no LID group exists.
Here is the caller graph for this function:

◆ lid_getFlowToPerv()

double lid_getFlowToPerv ( int j)

Retrieves flow returned from LID treatment to pervious area of a subcatchment.

Parameters
[in]jSubcatchment index.
Returns
Flow returned to pervious area (cfs).
Here is the caller graph for this function:

◆ lid_getPervArea()

double lid_getPervArea ( int j)

Retrieves amount of pervious LID area in a subcatchment.

Parameters
[in]jSubcatchment index.
Returns
Amount of pervious LID area (ft2).
Here is the caller graph for this function:

◆ lid_getRunoff()

void lid_getRunoff ( int j,
double tStep )

Advance LID units and compute runoff, drain and return flows.

Parameters
[in]jValid subcatchment index with initialized runoff state.
[in]tStepPositive runoff interval in seconds.
Postcondition
Updates LID states, group newDrainFlow/flowToPerv, and shared evaporation, infiltration, inflow, runoff, drain and return volumes. Flow rates use cfs and interval volumes use cubic feet. Missing groups or lists return unchanged.
Note
Operates on shared current-subcatchment flux state and is not reentrant.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lid_getStoredVolume()

double lid_getStoredVolume ( int j)

Computes stored volume of water for all LIDs grouped within a subcatchment.

Parameters
[in]jSubcatchment index.
Returns
Stored volume of water (ft3).
Here is the caller graph for this function:

◆ lid_initState()

void lid_initState ( void )

Initializes the internal state of each LID in a subcatchment.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lid_readGroupParams()

int lid_readGroupParams ( char * toks[],
int ntoks )

Reads input data for a LID unit placed in a subcatchment.

Parameters
toksArray of string tokens.
[in]ntoksNumber of tokens.
Returns
Error code Format of input data line is: Subcatch_ID LID_ID Number Area Width InitSat FromImp ToPerv (RptFile DrainTo FromPerv) where: Subcatch_ID = name of subcatchment LID_ID = name of LID process Number (n) = number of replicate units Area (x[0]) = area of each unit Width (x[1]) = outflow width of each unit InitSat (x[2]) = % that LID is initially saturated FromImp (x[3]) = % of impervious runoff sent to LID ToPerv (x[4]) = 1 if outflow goes to pervious sub-area; 0 if not RptFile = name of detailed results file (optional) DrainTo = name of subcatch/node for drain flow (optional) FromPerv (x[5]) = % of pervious runoff sent to LID.
Here is the call graph for this function:

◆ lid_readProcParams()

int lid_readProcParams ( char * toks[],
int ntoks )

Reads LID process information from line of input data file.

Parameters
toksArray of string tokens.
[in]ntoksNumber of tokens.
Returns
Error code Format for first line that defines a LID process is: LID_ID LID_Type Followed by some combination of lines below depending on LID_Type: LID_ID SURFACE parameters LID_ID PAVEMENT parameters LID_ID SOIL parameters LID_ID STORAGE parameters LID_ID DRAIN parameters LID_ID DRAINMAT parameters LID_ID REMOVALS parameters.
Here is the call graph for this function:

◆ lid_setDrainParams()

int lid_setDrainParams ( int lidIndex,
double coeff,
double expon,
double offset )

Updates the underdrain flow parameters of a LID process at runtime (API support). The drain parameters are read live each step (lidproc.c), so an edit takes effect on the next step.

Parameters
[in]lidIndexLID process index.
[in]coeffUnderdrain flow coeff. (in/hr or mm/hr).
[in]exponUnderdrain head exponent.
[in]offsetOffset height of underdrain (in or mm).
Returns
0 if successful, 1 for a bad index, 2 for a bad value (units match readDrainData; the API wrapper maps the codes).
Here is the call graph for this function:

◆ lid_setOldGroupState()

void lid_setOldGroupState ( int j)

Saves the current drain flow rate for the LIDs in a subcatchment.

Parameters
[in]jSubcatchment index.
Here is the caller graph for this function:

◆ lid_validate()

void lid_validate ( void )

Validates LID process and group parameters.

Here is the caller graph for this function:

◆ lid_writeSummary()

void lid_writeSummary ( void )

Writes summary of LID processes used to report file.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lid_writeWaterBalance()

void lid_writeWaterBalance ( void )

Writes a LID performance summary table to the project's report file.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lidproc_getOutflow()

double lidproc_getOutflow ( TLidUnit * lidUnit,
TLidProc * lidProc,
double inflow,
double evap,
double infil,
double maxInfil,
double tStep,
double * lidEvap,
double * lidInfil,
double * lidDrain )

Computes runoff outflow from a single LID unit.

Parameters
lidUnitPtr. to specific LID unit being analyzed.
lidProcPtr. to generic LID process of the LID unit.
[in]inflowRunoff rate captured by LID unit (ft/s).
[in]evapPotential evaporation rate (ft/s).
[in]infilInfiltration rate to native soil (ft/s).
[in]maxInfilMax. infiltration rate to native soil (ft/s).
[in]tStepTime step (sec).
[out]lidEvapEvaporation rate for LID unit (ft/s).
[out]lidInfilInfiltration rate for LID unit (ft/s).
[out]lidDrainDrain flow for LID unit (ft/s).
Returns
Surface runoff rate from the LID unit (ft/s).

For debugging only ******************************************** if (i == 0) { fprintf(Frpt.file, "\n WARNING 09: integration failed to converge at %s %s", theDate, theTime); fprintf(Frpt.file, "\n for LID %s placed in subcatchment %s.", theLidProc->ID, theSubcatch->ID); }

Here is the call graph for this function:

◆ lidproc_initWaterBalance()

void lidproc_initWaterBalance ( TLidUnit * lidUnit,
double initVol )

Initializes the water balance components of a LID unit.

Parameters
lidUnitA particular LID unit.
[in]initVolInitial water volume stored in the unit (ft).
Here is the caller graph for this function:

◆ lidproc_saveResults()

void lidproc_saveResults ( TLidUnit * lidUnit,
double ucfRainfall,
double ucfRainDepth )

Update LID water balance and optionally emit detailed report results.

Parameters
[in,out]lidUnitNon-null borrowed current LID unit; its report-file state and saved result string may be updated.
[in]ucfRainfallRate conversion from ft/s to authored in/hr or mm/hr.
[in]ucfRainDepthDepth conversion from feet to authored inches or millimeters.
Precondition
theLidUnit identifies the same active unit as lidUnit, and shared current fluxes/volumes were set by the immediately preceding evaluation.
Postcondition
Updates its water balance, HasWetLids and dry-period report tracking. Does not close report streams or check fprintf failures.
Here is the call graph for this function: