Skip to main content

Quantity

Struct Quantity 

Source
pub struct Quantity {
    pub qualifier: String,
    pub value: Option<Decimal>,
    pub raw_value: String,
    pub unit: Option<String>,
    pub period: Option<DvgwPeriod>,
    pub status: Vec<String>,
}
Expand description

A QTY segment together with the period and status that qualify it.

Fields§

§qualifier: String

C186 DE 6063 quantity qualifier — Z02 (Einspeisung), Z03 (Ausspeisung).

§value: Option<Decimal>

C186 DE 6060 value, parsed exactly.

Gas quantities are settled to at least three decimal places, so this is a Decimal; binary floating point cannot hold those fractions exactly. None when the wire value is not a number — the raw text is kept in raw_value so the defect is reportable.

§raw_value: String

The value exactly as it appeared on the wire.

§unit: Option<String>

C186 DE 6411 measurement unit — KW1 (kWh/h), KW2 (kWh/d) or KWH; see unit.

§period: Option<DvgwPeriod>

The period from the DTM+2 in effect for this quantity.

None only when the message omitted it, which the Segmentlayout does not permit — DVGW marks the DTM inside the LOC group R (Erforderlich). It is not defaulted to the message’s DTM+Z01: a quantity is a rate, so substituting the whole Gültigkeitszeitraum for a missing hourly period would multiply that hour’s rate across the entire gas day. DVGW-DTM-2-REQUIRED reports the omission instead.

§status: Vec<String>

STS DE 9015 codes attached to this quantity — the Zeitreihentyp of an ALOCAT (09G SLP synthetisch, 14G RLM, …), the Verfahren of a SSQNOT (A1G SLP, A2G RLM); see sts.

Implementations§

Source§

impl Quantity

Source

pub fn energy_kwh(&self) -> Option<Decimal>

The energy this quantity represents, in kWh.

A KW1 (kWh/h) or KW2 (kWh/d) QTY is a rate over the period its own DTM+2 names, so the energy is rate × duration; summing the raw values of a profile adds rates together and yields a number in no unit at all — the single most tempting way to get a gas quantity wrong. A KWH QTY is the energy itself.

Returns None when the value is not numeric, when a rate has no period to integrate over, or when the unit is not one this can convert.

Source

pub fn status_code(&self) -> Option<&str>

The first STS DE 9015 code attached to this quantity, if any.

Trait Implementations§

Source§

impl Clone for Quantity

Source§

fn clone(&self) -> Quantity

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 Quantity

Source§

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

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

impl PartialEq for Quantity

Source§

fn eq(&self, other: &Quantity) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Quantity

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> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.