#[non_exhaustive]pub enum CommodityQuantity {
ElectricPowerL1,
ElectricPowerL2,
ElectricPowerL3,
ElectricPower3PhaseSymmetric,
NaturalGasFlowRate,
HydrogenFlowRate,
HeatTemperature,
HeatFlowRate,
HeatThermalPower,
OilFlowRate,
}Expand description
A commodity combined with the quantity and unit its power is expressed in, and — for electricity — the phase.
The unit is not always watts: unit is what a diagnostic should use.
Note that HEAT.TEMPERATURE is in this list although a temperature is not a power.
The standard puts it here; the model follows.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ElectricPowerL1
Electric power in watts on phase 1. A single-phase device always uses L1.
ElectricPowerL2
Electric power in watts on phase 2. Three-phase devices only.
ElectricPowerL3
Electric power in watts on phase 3. Three-phase devices only.
ElectricPower3PhaseSymmetric
Electric power in watts, shared equally across three phases.
NaturalGasFlowRate
Gas flow rate in litres per second.
HydrogenFlowRate
Hydrogen flow rate in grams per second.
HeatTemperature
Heat in degrees Celsius.
HeatFlowRate
Flow rate of a heat-carrying gas or liquid, in litres per second.
HeatThermalPower
Thermal power in watts.
OilFlowRate
Oil flow rate in litres per hour.
Implementations§
Source§impl CommodityQuantity
impl CommodityQuantity
Sourcepub const fn is_per_phase_electric(self) -> bool
pub const fn is_per_phase_electric(self) -> bool
Whether this is one of the per-phase electric quantities.
Sourcepub const fn is_power(self) -> bool
pub const fn is_power(self) -> bool
Whether this quantity is a power at all.
HEAT.TEMPERATURE is the one that is not, and treating it as one is a mistake
the enum cannot otherwise stop.
Sourcepub const fn unit(self) -> &'static str
pub const fn unit(self) -> &'static str
The unit a value of this quantity is expressed in.
Four of the ten are not watts (S2J schemas/CommodityQuantity: litres per second,
grams per second, degrees Celsius, litres per hour), so any log line, diagnostic or
user interface that appends "W" to a PowerValue is wrong four times out of ten
— including for the one quantity that is not a power at all.
use s2_kit::types::common::CommodityQuantity;
assert_eq!(CommodityQuantity::ElectricPowerL1.unit(), "W");
assert_eq!(CommodityQuantity::HeatTemperature.unit(), "°C");
assert_eq!(CommodityQuantity::OilFlowRate.unit(), "l/h");Trait Implementations§
Source§impl Clone for CommodityQuantity
impl Clone for CommodityQuantity
impl Copy for CommodityQuantity
Source§impl Debug for CommodityQuantity
impl Debug for CommodityQuantity
Source§impl<'de> Deserialize<'de> for CommodityQuantity
impl<'de> Deserialize<'de> for CommodityQuantity
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for CommodityQuantity
Source§impl Hash for CommodityQuantity
impl Hash for CommodityQuantity
Source§impl Ord for CommodityQuantity
impl Ord for CommodityQuantity
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for CommodityQuantity
impl PartialEq for CommodityQuantity
Source§impl PartialOrd for CommodityQuantity
impl PartialOrd for CommodityQuantity
Source§impl Serialize for CommodityQuantity
impl Serialize for CommodityQuantity
impl StructuralPartialEq for CommodityQuantity
Auto Trait Implementations§
impl Forget for CommodityQuantity
impl Freeze for CommodityQuantity
impl Move for CommodityQuantity
impl RefUnwindSafe for CommodityQuantity
impl Send for CommodityQuantity
impl Sync for CommodityQuantity
impl Unpin for CommodityQuantity
impl UnsafeUnpin for CommodityQuantity
impl UnwindSafe for CommodityQuantity
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.