OpenSWMM Engine  6.0.0-alpha.3
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.3)
Loading...
Searching...
No Matches
openswmm::ucf Namespace Reference

Namespaces

namespace  detail
 

Classes

struct  DisplayUnits
 

Enumerations

enum  Quantity {
  RAINFALL = 0 ,
  RAINDEPTH = 1 ,
  EVAPRATE = 2 ,
  LENGTH = 3 ,
  LANDAREA = 4 ,
  VOLUME = 5 ,
  WINDSPEED = 6 ,
  TEMPERATURE = 7 ,
  MASS = 8 ,
  GWFLOW = 9 ,
  FLOW = 10
}
 

Functions

int getUnitSystem (int flow_units)
 Determine unit system (0=US, 1=SI) from flow units.
 
double UCF (int quantity, const SimulationOptions &opts)
 Get unit conversion factor for a quantity.
 
double UCF_inv (int quantity, const SimulationOptions &opts)
 Reciprocal of UCF — multiply display by this to get internal units.
 

Variables

constexpr std::array< std::array< double, 2 >, 10 > Ucf_inv = detail::makeUcfInv()
 Reciprocal of Ucf[quantity][unit_system] — multiply display by this → internal.
 
constexpr std::array< double, 6 > Qcf_inv = detail::makeQcfInv()
 Reciprocal of Qcf[flow_units] — multiply display flow by this → cfs.
 
constexpr const char * FlowUnitWords [6]
 Legacy FlowUnitWords — index by FlowUnits enum (CFS,GPM,MGD,CMS,LPS,MLD).
 

Enumeration Type Documentation

◆ Quantity

Enumerator
RAINFALL 

Divide in/hr (US) or mm/hr (SI) by this → ft/sec.

RAINDEPTH 

Divide in (US) or mm (SI) by this → ft.

EVAPRATE 

Divide in/day (US) or mm/day (SI) by this → ft/sec.

LENGTH 

Divide ft (US) or m (SI) by this → ft.

LANDAREA 

Divide ac (US) or ha (SI) by this → ft²

VOLUME 

Divide ft³ (US) or m³ (SI) by this → ft³

WINDSPEED 

Divide mph (US) or km/hr (SI) by this → mph.

TEMPERATURE 

Divide °F (US) or °C (SI) by this → °F.

MASS 

Divide lb (US) or kg (SI) by this → mg.

GWFLOW 

Divide cfs/ac (US) or cms/ha (SI) by this → ft/sec.

FLOW 

Divide display flow units by this → cfs.

Function Documentation

◆ getUnitSystem()

int openswmm::ucf::getUnitSystem ( int flow_units)

Determine unit system (0=US, 1=SI) from flow units.

CFS/GPM/MGD → US (0). CMS/LPS/MLD → SI (1).

Parameters
flow_unitsFlowUnits enum value.
Returns
0 for US, 1 for SI.
Here is the caller graph for this function:

◆ UCF()

double openswmm::ucf::UCF ( int quantity,
const SimulationOptions & opts )

Get unit conversion factor for a quantity.

For non-flow quantities, returns Ucf[quantity][unit_system]. For FLOW, returns Qcf[flow_units].

To convert FROM project/display units TO internal units: internal = display / UCF(quantity, opts)

To convert FROM internal units TO project/display units: display = internal * UCF(quantity, opts)

Parameters
quantityQuantity code (RAINFALL, LENGTH, FLOW, etc.)
optsSimulation options (for unit system and flow units).
Returns
Conversion factor.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ UCF_inv()

double openswmm::ucf::UCF_inv ( int quantity,
const SimulationOptions & opts )

Reciprocal of UCF — multiply display by this to get internal units.

internal = display * UCF_inv(quantity, opts). Equivalent to 1.0 / UCF(quantity, opts) but uses the precomputed reciprocal tables (no runtime division). For hot loops, prefer hoisting the factor (e.g. Ucf_inv[LENGTH][us]) out of the loop directly.

Parameters
quantityQuantity code (RAINFALL, LENGTH, FLOW, etc.)
optsSimulation options (for unit system and flow units).
Returns
Reciprocal conversion factor (display → internal).
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ FlowUnitWords

const char* openswmm::ucf::FlowUnitWords[6]
inlineconstexpr
Initial value:
=
{ "CFS", "GPM", "MGD", "CMS", "LPS", "MLD" }

Legacy FlowUnitWords — index by FlowUnits enum (CFS,GPM,MGD,CMS,LPS,MLD).

◆ Qcf_inv

std::array<double, 6> openswmm::ucf::Qcf_inv = detail::makeQcfInv()
inlineconstexpr

Reciprocal of Qcf[flow_units] — multiply display flow by this → cfs.

◆ Ucf_inv

std::array<std::array<double, 2>, 10> openswmm::ucf::Ucf_inv = detail::makeUcfInv()
inlineconstexpr

Reciprocal of Ucf[quantity][unit_system] — multiply display by this → internal.