suido 0.1.0

Typed water-supply balance and pipe-flow calculations
Documentation
  • Coverage
  • 100%
    48 out of 48 items documented0 out of 38 items with examples
  • Size
  • Source code size: 18.9 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 566.3 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 2s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • hidenoriuehara-art

suido

suido (水道) is a dependency-free Rust library for reasoning about a small water-supply plan. It keeps units explicit and applies two simple principles:

  1. water is conserved, so supply, demand, and storage must balance;
  2. the same flow moves faster through a smaller circular pipe.

The library reports whether instantaneous supply has a surplus, is balanced, or has a deficit. For a deficit, it also estimates how long stored water can cover the gap. Pipe velocity is calculated from volumetric flow and internal diameter.

Example

use suido::{
    FixtureDemand, FlowRate, PipeDiameter, SupplyState, Volume, WaterSupplyPlan,
};

let mut plan = WaterSupplyPlan::new(
    FlowRate::liters_per_minute(18.0)?,
    Volume::liters(120.0)?,
    PipeDiameter::millimeters(20.0)?,
);
plan.add_demand(FixtureDemand::new(
    "wash basin",
    FlowRate::liters_per_minute(6.0)?,
    2,
)?)?;
plan.add_demand(FixtureDemand::new(
    "shower",
    FlowRate::liters_per_minute(10.0)?,
    1,
)?)?;

let report = plan.evaluate()?;
assert_eq!(report.state(), SupplyState::Deficit);
assert_eq!(report.margin().as_liters_per_minute(), -4.0);
assert_eq!(report.storage_endurance_minutes(), Some(30.0));

# Ok::<(), suido::SuidoError>(())

Run the bundled example:

cargo run --example household

Scope and safety

This crate provides transparent arithmetic, not a building-code compliance check or a substitute for a licensed plumbing engineer. Real systems also depend on pressure, elevation, friction loss, water quality, local rules, diversity assumptions, fire demand, pipe material, and equipment data.

License

MIT