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: StringC186 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: StringThe 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
impl Quantity
Sourcepub fn energy_kwh(&self) -> Option<Decimal>
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.
Sourcepub fn status_code(&self) -> Option<&str>
pub fn status_code(&self) -> Option<&str>
The first STS DE 9015 code attached to this quantity, if any.