Skip to main content

SimulationOptions

Struct SimulationOptions 

Source
pub struct SimulationOptions {
Show 49 fields pub duration: f64, pub hyd_step: f64, pub qual_step: f64, pub report_step: f64, pub report_start: f64, pub pattern_step: f64, pub pattern_start: f64, pub start_clocktime: f64, pub head_loss_formula: HeadLossFormula, pub demand_model: DemandModel, pub flow_units: FlowUnits, pub viscosity: f64, pub diffusivity: f64, pub specific_gravity: f64, pub demand_multiplier: f64, pub default_pattern: Option<String>, pub pda_min_pressure: f64, pub pda_required_pressure: f64, pub pda_pressure_exponent: f64, pub emitter_backflow: bool, pub quality_mode: QualityMode, pub trace_node: Option<String>, pub chem_name: String, pub chem_units: String, pub max_iter: u32, pub extra_iter: i32, pub head_tol: f64, pub flow_change_tol: f64, pub flow_tol: f64, pub head_error_limit: f64, pub flow_change_limit: f64, pub rq_tol: f64, pub damp_limit: f64, pub check_freq: u32, pub max_check: u32, pub bulk_order: f64, pub tank_order: f64, pub wall_order: WallOrder, pub bulk_coeff: f64, pub wall_coeff: f64, pub conc_limit: f64, pub energy_price: f64, pub energy_price_pattern: Option<String>, pub energy_efficiency: f64, pub peak_demand_charge: f64, pub roughness_reaction_factor: f64, pub rule_timestep: f64, pub quality_tolerance: f64, pub statistic: StatisticType,
}
Expand description

Global simulation parameters (§2.1). All fields are static after loading.

SimulationOptions::default() returns the canonical default values defined in §2.1. Callers typically construct this with ..SimulationOptions::default() and override only the fields that differ from the spec defaults.

Fields§

§duration: f64

Total simulation duration (s); 0 = single steady-state step.

§hyd_step: f64

Hydraulic time step Δt_h (s); default 3600.

§qual_step: f64

Quality time step δt_q (s); must satisfy 0 < δt_q ≤ hyd_step.

§report_step: f64

Interval at which results are written to the output file (s); default 3600.

§report_start: f64

Simulation time at which reporting begins (s); default 0.

§pattern_step: f64

Pattern time step Δt_p (s); default 3600.

§pattern_start: f64

Time offset for pattern evaluation (s from midnight); default 0.

§start_clocktime: f64

Wall-clock time of simulation t=0 (s from midnight).

§head_loss_formula: HeadLossFormula

Head-loss formula used for pipes.

§demand_model: DemandModel

Demand allocation model (DDA or PDA).

§flow_units: FlowUnits

Flow unit system used for input/output (does not affect internal solver).

§viscosity: f64

Kinematic viscosity of water (m²/s); default ≈ 1.022×10⁻⁶.

§diffusivity: f64

Molecular diffusivity of the tracer chemical (m²/s); default ≈ 1.208×10⁻⁹.

§specific_gravity: f64

Specific gravity of the fluid relative to water; default 1.0.

§demand_multiplier: f64

Global demand multiplier applied to all base demands; default 1.0.

§default_pattern: Option<String>

Pattern ID applied to demand categories with no explicit pattern; None means a multiplier of 1.0 is used.

§pda_min_pressure: f64

PDA minimum pressure — below this, delivered demand is 0 (m).

§pda_required_pressure: f64

PDA required pressure — at or above this, full demand is delivered (m).

§pda_pressure_exponent: f64

PDA pressure exponent n in the Wagner equation; default 0.5.

§emitter_backflow: bool

Whether emitters allow reverse flow (backflow into the network).

§quality_mode: QualityMode

Water quality simulation mode.

§trace_node: Option<String>

Node ID for source tracing; required when quality_mode = Trace.

§chem_name: String

Chemical species name (e.g. “Chlorine”); from QUALITY Chemical <name>.

§chem_units: String

Chemical concentration units (e.g. “mg/L”); from QUALITY Chemical <name> <units>.

§max_iter: u32

Maximum Newton-Raphson iterations; default 200.

§extra_iter: i32

Extra frozen-status iterations on non-convergence; −1 = halt; default −1.

§head_tol: f64

Head tolerance εH for link status transitions (m); default 1.524×10⁻⁴.

§flow_change_tol: f64

Absolute flow tolerance εQ for link status transition tests (m³/s); default 2.832×10⁻⁶. Distinct from flow_tol: flow_tol governs solver convergence (relative criterion); flow_change_tol governs link status transition conditions only.

§flow_tol: f64

Relative flow accuracy (Hacc) for solver convergence; default 0.001.

§head_error_limit: f64

Absolute per-link head balance error limit (m); 0 = disabled; default 0.

§flow_change_limit: f64

Absolute maximum flow change per iteration (m³/s); 0 = disabled; default 0.

§rq_tol: f64

Minimum gradient clamp for emitter/pump coefficient linearisation; default 1e-7.

§damp_limit: f64

Relative flow accuracy threshold below which damping activates; 0 = disabled.

§check_freq: u32

Status check interval (iterations); default 2.

§max_check: u32

Iteration count after which status checks stop; default 10.

§bulk_order: f64

Bulk reaction order for pipes; default 1.0.

§tank_order: f64

Bulk reaction order for tanks; default 1.0.

§wall_order: WallOrder

Wall reaction order (zero or first); default first.

§bulk_coeff: f64

Global bulk reaction rate coefficient (1/day for first-order).

§wall_coeff: f64

Global wall reaction rate coefficient (m/day for first-order).

§conc_limit: f64

Limiting concentration for reactions (mg/L); 0 = no limit.

§energy_price: f64

Global unit energy cost ($/kWh).

§energy_price_pattern: Option<String>

Pattern ID modulating the energy price over time.

§energy_efficiency: f64

Global default pump efficiency fraction.

§peak_demand_charge: f64

Global demand charge (cost per peak kW); 0 = disabled.

§roughness_reaction_factor: f64

Roughness–reaction correlation factor Rf; 0 = disabled.

§rule_timestep: f64

Rule evaluation sub-step duration (s).

§quality_tolerance: f64

Segment merge tolerance Ctol; default 0.01.

§statistic: StatisticType

Report statistic aggregation type (from TIMES STATISTIC).

Trait Implementations§

Source§

impl Clone for SimulationOptions

Source§

fn clone(&self) -> SimulationOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SimulationOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for SimulationOptions

Source§

fn default() -> SimulationOptions

Returns the canonical default values from §2.1.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.