//****************************************************************************************************** // IMeasurement.cs - Gbtc // // Copyright © 2012, Grid Protection Alliance. All Rights Reserved. // // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See // the NOTICE file distributed with this work for additional information regarding copyright ownership. // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may // not use this file except in compliance with the License. You may obtain a copy of the License at: // // http://www.opensource.org/licenses/MIT // // Unless agreed to in writing, the subject software distributed under the License is distributed on an // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the // License for the specific language governing permissions and limitations. // // Code Modification History: // ---------------------------------------------------------------------------------------------------- // 09/02/2010 - J. Ritchie Carroll // Generated original version of source code. // 04/14/2011 - J. Ritchie Carroll // Added received and published timestamps for measurements. // 12/20/2012 - Starlynn Danyelle Gilliam // Modified Header. // //****************************************************************************************************** using System; using System.Collections.Generic; namespace GSF.TimeSeries { /// /// Method signature for function used to apply a value filter over a sequence of values. /// /// Sequence of values over which to apply filter. /// Result of filter applied to sequence of values. public delegate double MeasurementValueFilterFunction(IEnumerable source); #region [ Enumerations ] /// /// Measurement state flags. /// [Flags] public enum MeasurementStateFlags : uint { /// /// Defines normal state. /// Normal = (uint)Bits.Nil, /// /// Defines bad data state. /// BadData = (uint)Bits.Bit00, /// /// Defines suspect data state. /// SuspectData = (uint)Bits.Bit01, /// /// Defines over range error, i.e., unreasonable high value. /// OverRangeError = (uint)Bits.Bit02, /// /// Defines under range error, i.e., unreasonable low value. /// UnderRangeError = (uint)Bits.Bit03, /// /// Defines alarm for high value. /// AlarmHigh = (uint)Bits.Bit04, /// /// Defines alarm for low value. /// AlarmLow = (uint)Bits.Bit05, /// /// Defines warning for high value. /// WarningHigh = (uint)Bits.Bit06, /// /// Defines warning for low value. /// WarningLow = (uint)Bits.Bit07, /// /// Defines alarm for flat-lined value, i.e., latched value test alarm. /// FlatlineAlarm = (uint)Bits.Bit08, /// /// Defines comparison alarm, i.e., outside threshold of comparison with a real-time value. /// ComparisonAlarm = (uint)Bits.Bit09, /// /// Defines rate-of-change alarm. /// ROCAlarm = (uint)Bits.Bit10, /// /// Defines bad value received. /// ReceivedAsBad = (uint)Bits.Bit11, /// /// Defines calculated value state. /// CalculatedValue = (uint)Bits.Bit12, /// /// Defines calculation error with the value. /// CalculationError = (uint)Bits.Bit13, /// /// Defines calculation warning with the value. /// CalculationWarning = (uint)Bits.Bit14, /// /// Defines reserved quality flag. /// ReservedQualityFlag = (uint)Bits.Bit15, /// /// Defines bad time state. /// BadTime = (uint)Bits.Bit16, /// /// Defines suspect time state. /// SuspectTime = (uint)Bits.Bit17, /// /// Defines late time alarm. /// LateTimeAlarm = (uint)Bits.Bit18, /// /// Defines future time alarm. /// FutureTimeAlarm = (uint)Bits.Bit19, /// /// Defines up-sampled state. /// UpSampled = (uint)Bits.Bit20, /// /// Defines down-sampled state. /// DownSampled = (uint)Bits.Bit21, /// /// Defines discarded value state. /// DiscardedValue = (uint)Bits.Bit22, /// /// Defines reserved time flag. /// ReservedTimeFlag = (uint)Bits.Bit23, /// /// Defines user defined flag 1. /// UserDefinedFlag1 = (uint)Bits.Bit24, /// /// Defines user defined flag 2. /// UserDefinedFlag2 = (uint)Bits.Bit25, /// /// Defines user defined flag 3. /// UserDefinedFlag3 = (uint)Bits.Bit26, /// /// Defines user defined flag 4. /// UserDefinedFlag4 = (uint)Bits.Bit27, /// /// Defines user defined flag 5. /// UserDefinedFlag5 = (uint)Bits.Bit28, /// /// Defines system error state. /// SystemError = (uint)Bits.Bit29, /// /// Defines system warning state. /// SystemWarning = (uint)Bits.Bit30, /// /// Defines measurement error flag. /// MeasurementError = (uint)Bits.Bit31 } #endregion /// /// Represents an interface for an abstract measurement value measured by a device at an exact time. /// /// /// This interface abstractly represents a measured value at an exact time interval. /// public interface IMeasurement : ITimeSeriesValue, IEquatable, IComparable, IComparable { /// /// Gets or sets associated metadata values for the . /// MeasurementMetadata Metadata { get; set; } /// /// Gets or sets the primary key of this . /// MeasurementKey Key { get; } /// /// Gets or sets the text based tag name of this . /// string TagName { get; } /// /// Gets the adjusted numeric value of this , taking into account the specified and offsets. /// /// /// Implementers need to account for and in return value, e.g.:
/// return * + ///
///
double AdjustedValue { get; } /// /// Defines an offset to add to the value. /// /// /// Implementers should make sure this value defaults to zero. /// double Adder { get; } /// /// Defines a multiplicative offset to apply to the value. /// /// /// Implementers should make sure this value defaults to one. /// double Multiplier { get; } /// /// Gets or sets associated with this . /// MeasurementStateFlags StateFlags { get; set; } /// /// Gets the life-span of this since its creation. /// ShortTime Lifespan { get; } /// /// Gets timestamp, in ticks, of when this was created. /// Ticks CreatedTimestamp { get; } /// /// Gets or sets function used to apply a down-sampling filter over a sequence of values. /// MeasurementValueFilterFunction MeasurementValueFilter { get; } } }