Skip to main content

WritableSimulation

Trait WritableSimulation 

Source
pub trait WritableSimulation {
    // Required methods
    fn net(&self) -> &Network;
    fn snapshots(&self) -> &[HydSnapshot];
    fn pump_energy_at(&self, link_index: usize) -> Option<&PumpEnergy>;
    fn peak_demand_kw(&self) -> f64;
    fn mass_balance(&self) -> Option<&MassBalance>;
    fn warnings(&self) -> &[SimWarning];
    fn pump_energy_by_id(&self, pump_id: &str) -> Option<&PumpEnergy>;
    fn analysis_times(&self) -> (Option<SystemTime>, Option<SystemTime>);
    fn flow_balance(&self) -> Option<&FlowBalance>;
    fn flow_balance_summary(&self) -> Option<FlowBalanceSummary>;
}
Expand description

Read-only view of a completed (or in-progress) simulation that the writers need. Implemented by crate::simulation::Simulation.

The trait is intentionally narrow — it exposes only what the writers actually access, avoiding leaking internal solver state into the public API.

Required Methods§

Source

fn net(&self) -> &Network

The Network data model for this simulation.

Source

fn snapshots(&self) -> &[HydSnapshot]

All hydraulic snapshots stored during the simulation.

Source

fn pump_energy_at(&self, link_index: usize) -> Option<&PumpEnergy>

Pump energy record at link_index, or None if no accounting state is available (e.g. hydraulics not yet run).

Source

fn peak_demand_kw(&self) -> f64

Peak simultaneous electrical demand across all pumps (kW).

Source

fn mass_balance(&self) -> Option<&MassBalance>

Mass balance from the quality engine. None if quality not yet run.

Source

fn warnings(&self) -> &[SimWarning]

Non-fatal diagnostics emitted during the simulation.

Source

fn pump_energy_by_id(&self, pump_id: &str) -> Option<&PumpEnergy>

Look up a pump’s energy record by its string ID. Returns None if the ID is unknown or the link is not a pump.

Source

fn analysis_times(&self) -> (Option<SystemTime>, Option<SystemTime>)

The hydraulic and quality analysis start and finish wall-clock times.

Source

fn flow_balance(&self) -> Option<&FlowBalance>

Flow balance from accounting. None if hydraulics not yet run.

Source

fn flow_balance_summary(&self) -> Option<FlowBalanceSummary>

Derived flow balance summary. None if hydraulics not yet run or if the simulation lacks the data needed to compute final tank volume.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§