本文整理汇总了C#中IMeasurement类的典型用法代码示例。如果您正苦于以下问题:C# IMeasurement类的具体用法?C# IMeasurement怎么用?C# IMeasurement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMeasurement类属于命名空间,在下文中一共展示了IMeasurement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SignalReferenceMeasurement
/// <summary>
/// Constructs a new <see cref="SignalReferenceMeasurement"/> from the specified parameters.
/// </summary>
/// <param name="measurement">Source <see cref="IMeasurement"/> value.</param>
/// <param name="signalReference">Associated <see cref="SignalReference"/>.</param>
public SignalReferenceMeasurement(IMeasurement measurement, SignalReference signalReference)
: base(measurement.ID, measurement.Source, measurement.Value, measurement.Adder, measurement.Multiplier, measurement.Timestamp)
{
base.ValueQualityIsGood = measurement.ValueQualityIsGood;
base.TimestampQualityIsGood = measurement.TimestampQualityIsGood;
m_signalReference = signalReference;
}
示例2: SerializableMeasurement
/// <summary>
/// Creates a new <see cref="SerializableMeasurement"/> from an existing <see cref="IMeasurement"/> value.
/// </summary>
/// <param name="measurement">Source <see cref="IMeasurement"/> value.</param>
/// <param name="encoding">Character encoding used to convert strings to binary.</param>
public SerializableMeasurement(IMeasurement measurement, Encoding encoding)
: this(encoding)
{
Metadata = measurement.Metadata;
Value = measurement.Value;
Timestamp = measurement.Timestamp;
StateFlags = measurement.StateFlags;
}
示例3: SerializableMeasurement
/// <summary>
/// Initializes a new instance of the <see cref="SerializableMeasurement"/> class.
/// </summary>
/// <param name="measurement"><see cref="IMeasurement"/> from which <see cref="SerializableMeasurement"/> is to be initialized.</param>
public SerializableMeasurement(IMeasurement measurement)
{
m_sourceMeasurement = measurement;
Key = measurement.Key.ToString();
SignalID = measurement.ID.ToString();
Value = measurement.AdjustedValue;
Timestamp = ((DateTime)measurement.Timestamp).ToString("yyyy-MM-dd HH:mm:ss.fff");
SignalType = string.Empty;
Device = string.Empty;
}
示例4: SerializableMeasurement
/// <summary>
/// Creates a new <see cref="SerializableMeasurement"/> from an existing <see cref="IMeasurement"/> value.
/// </summary>
/// <param name="measurement">Source <see cref="IMeasurement"/> value.</param>
/// <param name="encoding">Character encoding used to convert strings to binary.</param>
public SerializableMeasurement(IMeasurement measurement, Encoding encoding)
: this(encoding)
{
Key = measurement.Key;
Value = measurement.Value;
Adder = measurement.Adder;
Multiplier = measurement.Multiplier;
Timestamp = measurement.Timestamp;
StateFlags = measurement.StateFlags;
}
示例5: PostMeasurement
public void PostMeasurement(IMeasurement measurement)
{
if (measurement == null)
{
return;
}
this.PostMeasurement(new IMeasurement[]
{
measurement
});
}
示例6: MeasurementWrapper
/// <summary>
/// Creates a new instance of the <see cref="MeasurementWrapper"/> class.
/// </summary>
/// <param name="measurement">The measurement to be wrapped by the wrapper.</param>
public MeasurementWrapper(IMeasurement measurement)
{
Adder = measurement.Adder;
SignalID = measurement.ID.ToString();
ID = unchecked((int)measurement.Key.ID);
Multiplier = measurement.Multiplier;
Source = measurement.Key.Source;
TagName = measurement.TagName;
Timestamp = measurement.Timestamp;
Value = measurement.Value;
}
示例7: TemporalMeasurement
/// <summary>
/// Constructs a new <see cref="TemporalMeasurement"/> given the specified parameters.
/// </summary>
/// <param name="measurement">Source <see cref="IMeasurement"/> value.</param>
/// <param name="lagTime">Past time deviation tolerance, in seconds - this becomes the amount of time to wait before publishing begins.</param>
/// <param name="leadTime">Future time deviation tolerance, in seconds - this becomes the tolerated +/- accuracy of the local clock to real-time.</param>
public TemporalMeasurement(IMeasurement measurement, double lagTime, double leadTime)
{
if (measurement != null)
{
Metadata = measurement.Metadata;
Value = measurement.Value;
Timestamp = measurement.Timestamp;
StateFlags = measurement.StateFlags;
}
if (lagTime <= 0)
throw new ArgumentOutOfRangeException(nameof(lagTime), "lagTime must be greater than zero, but it can be less than one");
if (leadTime <= 0)
throw new ArgumentOutOfRangeException(nameof(leadTime), "leadTime must be greater than zero, but it can be less than one");
m_lagTime = lagTime;
m_leadTime = leadTime;
}
示例8: TemporalMeasurement
/// <summary>
/// Constructs a new <see cref="TemporalMeasurement"/> given the specified parameters.
/// </summary>
/// <param name="measurement">Source <see cref="IMeasurement"/> value.</param>
/// <param name="lagTime">Past time deviation tolerance, in seconds - this becomes the amount of time to wait before publishing begins.</param>
/// <param name="leadTime">Future time deviation tolerance, in seconds - this becomes the tolerated +/- accuracy of the local clock to real-time.</param>
public TemporalMeasurement(IMeasurement measurement, double lagTime, double leadTime)
{
if (measurement != null)
{
Key = measurement.Key;
Value = measurement.Value;
Adder = measurement.Adder;
Multiplier = measurement.Multiplier;
Timestamp = measurement.Timestamp;
StateFlags = measurement.StateFlags;
}
if (lagTime <= 0)
throw new ArgumentOutOfRangeException("lagTime", "lagTime must be greater than zero, but it can be less than one");
if (leadTime <= 0)
throw new ArgumentOutOfRangeException("leadTime", "leadTime must be greater than zero, but it can be less than one");
m_lagTime = lagTime;
m_leadTime = leadTime;
}
示例9: ApplyStreamBackgroundAsync
public override void ApplyStreamBackgroundAsync(IDAQOutputStream s, IMeasurement background)
{
}
示例10: ProcessMeasurements
/// <summary>
/// Serializes measurements to data output stream.
/// </summary>
/// <remarks>
/// <para>
/// Derived classes must implement this function to process queued measurements.
/// For example, this function would "archive" measurements if output adapter is for a historian.
/// </para>
/// <para>
/// It is important that consumers "resume" connection cycle if processing fails (e.g., connection
/// to archive is lost). Here is an example:
/// <example>
/// <code>
/// protected virtual void ProcessMeasurements(IMeasurement[] measurements)
/// {
/// try
/// {
/// // Process measurements...
/// foreach (IMeasurement measurement in measurement)
/// {
/// ArchiveMeasurement(measurement);
/// }
/// }
/// catch (Exception)
/// {
/// // So long as user hasn't requested to stop, restart connection cycle
/// if (Enabled)
/// Start();
/// }
/// }
/// </code>
/// </example>
/// </para>
/// </remarks>
protected abstract void ProcessMeasurements(IMeasurement[] measurements);
示例11: QueueMeasurementForProcessing
/// <summary>
/// Queues a single measurement for processing. Measurement is automatically filtered to the defined <see cref="IAdapter.InputMeasurementKeys"/>.
/// </summary>
/// <param name="measurement">Measurement to queue for processing.</param>
public virtual void QueueMeasurementForProcessing(IMeasurement measurement)
{
QueueMeasurementsForProcessing(new IMeasurement[] { measurement });
}
示例12: CompactMeasurement
/// <summary>
/// Creates a new <see cref="CompactMeasurement"/> from an existing <see cref="IMeasurement"/> value.
/// </summary>
/// <param name="measurement">Source <see cref="IMeasurement"/> value.</param>
/// <param name="signalIndexCache">Signal index cache used to serialize or deserialize runtime information.</param>
/// <param name="includeTime">Set to <c>true</c> to include time in serialized packet; otherwise <c>false</c>.</param>
/// <param name="baseTimeOffsets">Base time offset array - set to <c>null</c> to use full fidelity measurement time.</param>
/// <param name="timeIndex">Time index to use for base offset.</param>
/// <param name="useMillisecondResolution">Flag that determines if millisecond resolution is in use for this serialization.</param>
public CompactMeasurement(IMeasurement measurement, SignalIndexCache signalIndexCache, bool includeTime, long[] baseTimeOffsets, int timeIndex, bool useMillisecondResolution)
{
ID = measurement.ID;
Key = measurement.Key;
Value = measurement.Value;
Adder = measurement.Adder;
Multiplier = measurement.Multiplier;
Timestamp = measurement.Timestamp;
StateFlags = measurement.StateFlags;
m_signalIndexCache = signalIndexCache;
m_includeTime = includeTime;
// We keep a clone of the base time offsets, if provided, since array contents can change at any time
if (baseTimeOffsets == null)
m_baseTimeOffsets = s_emptyBaseTimeOffsets;
else
m_baseTimeOffsets = new long[] { baseTimeOffsets[0], baseTimeOffsets[1] };
m_timeIndex = timeIndex;
m_useMillisecondResolution = useMillisecondResolution;
}
示例13: ProcessMeasurements
/// <summary>
/// Archives <paramref name="measurements"/> locally.
/// </summary>
/// <param name="measurements">Measurements to be archived.</param>
protected override void ProcessMeasurements(IMeasurement[] measurements)
{
if ((object)measurements != null)
{
foreach (IMeasurement measurement in measurements)
{
// Create the command string to insert the measurement as a record in the table.
StringBuilder commandString = new StringBuilder("INSERT INTO Measurement VALUES ('");
IDbCommand command = m_connection.CreateCommand();
commandString.Append(measurement.ID);
commandString.Append("','");
commandString.Append((long)measurement.Timestamp);
commandString.Append("',");
commandString.Append(measurement.AdjustedValue);
commandString.Append(')');
command.CommandText = commandString.ToString();
command.ExecuteNonQuery();
}
m_measurementCount += measurements.Length;
}
}
示例14: Clone
/// <summary>Creates a copy of the specified measurement using a new value and timestamp</summary>
public static Measurement Clone(IMeasurement measurementToClone, double value, long ticks)
{
return new Measurement(measurementToClone.ID, measurementToClone.Source, value, measurementToClone.Adder, measurementToClone.Multiplier, ticks);
}
示例15: ClearIfNotGreaterThan
// Indicates whether the given measurement is not greater
// than the set point, offset by the hysteresis.
private bool ClearIfNotGreaterThan(IMeasurement measurement)
{
return (measurement.Value <= m_setPoint - m_hysteresis);
}