pub struct DemandRegister {
logical_name: ObisCode,
current_average_value: Choice,
last_average_value: Choice,
scaler_unit: ScalerUnit,
status: Choice,
capture_time: DateTime,
start_time_current: DateTime,
period: u32,
number_of_periods: u16,
}Expand description
The DemandRegister interface class (class_id = 5) managing measured demand
quantities such as the maximum power over a period, with support for
measurement periods and capture time, per IEC 62056-6-2.
Attributes (IEC 62056-6-2, Table 10):
- attr 1: logical_name (octet-string) — OBIS code
- attr 2: current_average_value (CHOICE) — current period demand
- attr 3: last_average_value (CHOICE) — last completed period demand
- attr 4: scaler_unit (scal_unit_type) — {scaler, unit}
- attr 5: status (CHOICE) — measurement status
- attr 6: capture_time (octet-string) — date-time
- attr 7: start_time_current (octet-string) — date-time
- attr 8: period (double-long-unsigned) — integration period in seconds
- attr 9: number_of_periods (long-unsigned) — periods for sliding demand
Fields§
§logical_name: ObisCode§current_average_value: Choice§last_average_value: Choice§scaler_unit: ScalerUnit§status: Choice§capture_time: DateTime§start_time_current: DateTime§period: u32§number_of_periods: u16Implementations§
Source§impl DemandRegister
impl DemandRegister
Sourcepub fn new(config: DemandRegisterConfig) -> Self
pub fn new(config: DemandRegisterConfig) -> Self
Sourcefn reset(&mut self) -> Result<CosemDataType, String>
fn reset(&mut self) -> Result<CosemDataType, String>
Resets current_average_value and last_average_value to 0, and clears
the status, capture time and current-period start time.
Sourcefn next_period(&mut self) -> Result<CosemDataType, String>
fn next_period(&mut self) -> Result<CosemDataType, String>
Advances to the next measurement period, moving current_average_value
into last_average_value, resetting current_average_value, updating the
status and capture time, and setting a new period start time.
§Returns
Ok(CosemDataType::Null)- On a successful transition.Err(String)- If the value type does not support reset.
Trait Implementations§
Source§impl Clone for DemandRegister
impl Clone for DemandRegister
Source§fn clone(&self) -> DemandRegister
fn clone(&self) -> DemandRegister
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DemandRegister
impl Debug for DemandRegister
Source§impl<'de> Deserialize<'de> for DemandRegister
impl<'de> Deserialize<'de> for DemandRegister
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl InterfaceClass for DemandRegister
impl InterfaceClass for DemandRegister
Source§fn logical_name(&self) -> &ObisCode
fn logical_name(&self) -> &ObisCode
Returns the object’s logical name (OBIS code).
Source§fn attributes(&self) -> Vec<(u8, CosemDataType)>
fn attributes(&self) -> Vec<(u8, CosemDataType)>
Returns the class attributes as
(attribute_id, value) pairs.Source§fn serialize_ber(&self, buf: &mut Vec<u8>) -> Result<(), BerError>
fn serialize_ber(&self, buf: &mut Vec<u8>) -> Result<(), BerError>
Serializes the object into BER. Read more
Source§fn deserialize_ber(&mut self, data: &[u8]) -> Result<(), BerError>
fn deserialize_ber(&mut self, data: &[u8]) -> Result<(), BerError>
Deserializes the object from BER data. Read more
Source§fn set_attribute(
&mut self,
attribute_id: u8,
value: CosemDataType,
) -> Result<(), String>
fn set_attribute( &mut self, attribute_id: u8, value: CosemDataType, ) -> Result<(), String>
Writes the value of a writable attribute. The default implementation
rejects the write; classes with writable attributes override it. Read more
Source§fn invoke_method(
&mut self,
method_id: u8,
_params: Option<CosemDataType>,
) -> Result<CosemDataType, String>
fn invoke_method( &mut self, method_id: u8, _params: Option<CosemDataType>, ) -> Result<CosemDataType, String>
Invokes the object method with the given id. Read more
Auto Trait Implementations§
impl Freeze for DemandRegister
impl RefUnwindSafe for DemandRegister
impl Send for DemandRegister
impl Sync for DemandRegister
impl Unpin for DemandRegister
impl UnsafeUnpin for DemandRegister
impl UnwindSafe for DemandRegister
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
Mutably borrows from an owned value. Read more