public override ITimeSeriesValue[] Compute(IFrame frame, IFrame[] prev, IFrame[] future) { ITimeSeriesValue numerator = frame.Measurements["Numerator"]; ITimeSeriesValue denominator = frame.Measurements["Denominator"]; return(new AdaptValue[] { new AdaptValue("Division", numerator.Value / denominator.Value, frame.Timestamp) }); }
public override ITimeSeriesValue[] Compute(IFrame frame, IFrame[] prev, IFrame[] future) { ITimeSeriesValue signal1 = frame.Measurements["Signal 1"]; ITimeSeriesValue signal2 = frame.Measurements["Signal 2"]; return(new AdaptValue[] { new AdaptValue("Addition", signal1.Value + signal2.Value, frame.Timestamp) }); }
/// <summary> /// Compares the <see cref="Measurement"/> with an <see cref="ITimeSeriesValue"/>. /// </summary> /// <param name="other">The <see cref="ITimeSeriesValue"/> to compare with the current <see cref="Measurement"/>.</param> /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns> /// <remarks>Measurement implementations should compare by hash code.</remarks> public int CompareTo(ITimeSeriesValue other) { if ((object)other != null) { return(GetHashCode().CompareTo(other.GetHashCode())); } return(1); }
/// <summary> /// Compares the <see cref="Measurement"/> with the specified <see cref="Object"/>. /// </summary> /// <param name="obj">The <see cref="Object"/> to compare with the current <see cref="Measurement"/>.</param> /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns> /// <exception cref="ArgumentException"><paramref name="obj"/> is not an <see cref="IMeasurement"/>.</exception> /// <remarks>Measurement implementations should compare by hash code.</remarks> public int CompareTo(object obj) { ITimeSeriesValue other = obj as ITimeSeriesValue; if ((object)other != null) { return(CompareTo(other)); } throw new ArgumentException("Measurement can only be compared with other measurements or time-series values"); }
private AdaptEvent processEvent(ITimeSeriesValue val) { try { return((AdaptEvent)val); } catch (Exception ex) { return(new AdaptEvent(val.ID, val.Timestamp, val.Value)); } }
/// <summary> /// Determines whether the specified <see cref="Object"/> is equal to the current <see cref="Measurement"/>. /// </summary> /// <param name="obj">The <see cref="Object"/> to compare with the current <see cref="Measurement"/>.</param> /// <returns> /// true if the specified <see cref="Object"/> is equal to the current <see cref="Measurement"/>; /// otherwise, false. /// </returns> public override bool Equals(object obj) { ITimeSeriesValue other = obj as ITimeSeriesValue; if ((object)other != null) { return(Equals(other)); } return(false); }
public override ITimeSeriesValue[] Compute(IFrame frame, IFrame[] prev, IFrame[] future) { ITimeSeriesValue original = frame.Measurements["Original"]; if (m_settings.Unit == AngleUnit.Degrees) { return new AdaptValue[] { new AdaptValue("Converted", (Math.PI / 180) * original.Value, frame.Timestamp) } } ; else { return new AdaptValue[] { new AdaptValue("Converted", (180 / Math.PI) * original.Value, frame.Timestamp) } }; }
public override ITimeSeriesValue[] Compute(IFrame frame, IFrame[] prev, IFrame[] future) { ITimeSeriesValue magnitude = frame.Measurements["Magnitude"]; ITimeSeriesValue phase = frame.Measurements["Phase"]; if (m_settings.Unit == AngleUnit.Degrees) { return(new AdaptValue[] { new AdaptValue("Imaginary", magnitude.Value * Math.Sin(phase.Value), frame.Timestamp) }); } else { return new AdaptValue[] { new AdaptValue("Imaginary", magnitude.Value * Math.Sin((180 / Math.PI) * phase.Value), frame.Timestamp) } }; }
public Complex GetComplex(IFrame frame) { ITimeSeriesValue magnitude = frame.Measurements["Magnitude"]; ITimeSeriesValue phase = frame.Measurements["Phase"]; if (m_settings.Unit == AngleUnit.Degrees) { return(new Complex(magnitude.Value * Math.Cos(phase.Value), magnitude.Value * Math.Sin(phase.Value))); } else { return(new Complex(magnitude.Value * Math.Cos((180 / Math.PI) * phase.Value), magnitude.Value * Math.Sin((180 / Math.PI) * phase.Value))); } }
public override ITimeSeriesValue[] Compute(IFrame frame, IFrame[] prev, IFrame[] future) { ITimeSeriesValue zeros = frame.Measurements["Original"]; if (zeros.Value == 0) { return new AdaptValue[] { new AdaptValue("Filtered", double.NaN, frame.Timestamp) } } ; else { return new AdaptValue[] { new AdaptValue("Filtered", zeros.Value, frame.Timestamp) } }; }
public override ITimeSeriesValue[] Compute(IFrame frame, IFrame[] prev, IFrame[] future) { ITimeSeriesValue original = frame.Measurements["Original"]; ITimeSeriesValue flag = frame.Measurements["Flag"]; if (!double.IsNaN(flag.Value) && flag.Value > 0.0D) { return new AdaptValue[] { new AdaptValue("Cleaned", double.NaN, frame.Timestamp) } } ; else { return new AdaptValue[] { new AdaptValue("Cleaned", original.Value, frame.Timestamp) } }; }
public override ITimeSeriesValue[] Compute(IFrame frame, IFrame[] prev, IFrame[] future) { ITimeSeriesValue s1 = frame.Measurements["Original 1"]; ITimeSeriesValue s2 = frame.Measurements["Original 2"]; if (!double.IsNaN(s1.Value) && !double.IsNaN(s2.Value)) { return new AdaptValue[] { new AdaptValue("Cleaned 1", s1.Value, frame.Timestamp), new AdaptValue("Cleaned 2", s2.Value, frame.Timestamp) } } ; else { return new AdaptValue[] { new AdaptValue("Cleaned 1", double.NaN, frame.Timestamp), new AdaptValue("Cleaned 2", double.NaN, frame.Timestamp) } }; }
public override ITimeSeriesValue[] Compute(IFrame frame, IFrame[] prev, IFrame[] future) { ITimeSeriesValue frequency = frame.Measurements["Original"]; double v = frequency.Value; if (v > m_settings.Max) { v = m_settings.Max; } if (v < m_settings.Min) { v = m_settings.Min; } return(new AdaptValue[] { new AdaptValue("Filtered", v, frame.Timestamp) }); }
private ITimeSeriesValue AdjustSignal(ITimeSeriesValue original, string key) { if (original.IsEvent) { try { AdaptEvent originalEvt = (AdaptEvent)original; return(new AdaptEvent(key, original.Timestamp, originalEvt.Value, originalEvt.ParameterNames .Select(item => new KeyValuePair <string, double>(item, originalEvt[item])).ToArray() )); } catch { return(new AdaptValue(key, original.Value, original.Timestamp)); } } return(new AdaptValue(key, original.Value, original.Timestamp)); }
public Complex GetComplex(IFrame frame) { ITimeSeriesValue voltage_mag = frame.Measurements["Voltage Magnitude"]; ITimeSeriesValue voltage_pha = frame.Measurements["Voltage Phase"]; ITimeSeriesValue current_mag = frame.Measurements["Current Magnitude"]; ITimeSeriesValue current_pha = frame.Measurements["Current Phase"]; if (m_settings.Unit == AngleUnit.Degrees) { Complex volt = new Complex(voltage_mag.Value * Math.Cos(voltage_pha.Value), voltage_mag.Value * Math.Sin(voltage_pha.Value)); Complex curr = new Complex(current_mag.Value * Math.Cos(current_pha.Value), current_mag.Value * Math.Sin(current_pha.Value)); return(Complex.Multiply(volt, Complex.Conjugate(curr))); } else { Complex volt = new Complex(voltage_mag.Value * Math.Cos((180 / Math.PI) * voltage_pha.Value), voltage_mag.Value * Math.Sin((180 / Math.PI) * voltage_pha.Value)); Complex curr = new Complex(current_mag.Value * Math.Cos((180 / Math.PI) * current_pha.Value), current_mag.Value * Math.Sin((180 / Math.PI) * current_pha.Value)); return(Complex.Multiply(volt, Complex.Conjugate(curr))); } }
private void CleanupEvent(ITimeSeriesValue Value) { m_isEvent = false; m_eventParameters = new List <string>(); if (!Value.IsEvent) { return; } try { m_isEvent = true; AdaptEvent evt = (AdaptEvent)Value; m_eventParameters = evt.ParameterNames; if (File.Exists($"{m_rootFolder}{Path.DirectorySeparatorChar}Root.config")) { File.Delete($"{m_rootFolder}{Path.DirectorySeparatorChar}Root.config"); } } catch (Exception ex) { m_isEvent = false; } }
/// <summary> /// Compares the <see cref="ChannelValueMeasurement{T}"/> with an <see cref="ITimeSeriesValue"/>. /// </summary> /// <param name="other">The <see cref="ITimeSeriesValue"/> to compare with the current <see cref="ChannelValueMeasurement{T}"/>.</param> /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns> /// <remarks>Measurement implementations should compare by hash code.</remarks> public int CompareTo(ITimeSeriesValue other) { return(GetHashCode().CompareTo(other.GetHashCode())); }
/// <summary> /// Determines whether the specified <see cref="ITimeSeriesValue"/> is equal to the current <see cref="SignalReferenceMeasurement"/>. /// </summary> /// <param name="other">The <see cref="ITimeSeriesValue"/> to compare with the current <see cref="SignalReferenceMeasurement"/>.</param> /// <returns> /// true if the specified <see cref="ITimeSeriesValue"/> is equal to the current <see cref="SignalReferenceMeasurement"/>; /// otherwise, false. /// </returns> public bool Equals(ITimeSeriesValue other) => m_measurement.Equals(other);
/// <summary> /// Adds a <see cref="ITimeSeriesValue"/> to be processed by this <see cref="SignalWritter"/> /// </summary> /// <param name="Value">The <see cref="ITimeSeriesValue"/> to be written to the Files</param> public async void AddPoint(ITimeSeriesValue Value) { await m_queue.Writer.WriteAsync(Value); }
/// <summary> /// Determines whether the specified <see cref="ITimeSeriesValue"/> is equal to the current <see cref="Measurement"/>. /// </summary> /// <param name="other">The <see cref="ITimeSeriesValue"/> to compare with the current <see cref="Measurement"/>.</param> /// <returns> /// true if the specified <see cref="ITimeSeriesValue"/> is equal to the current <see cref="Measurement"/>; /// otherwise, false. /// </returns> public bool Equals(ITimeSeriesValue other) { return(CompareTo(other) == 0); }
/// <summary> /// Compares the <see cref="SignalReferenceMeasurement"/> with an <see cref="ITimeSeriesValue"/>. /// </summary> /// <param name="other">The <see cref="ITimeSeriesValue"/> to compare with the current <see cref="SignalReferenceMeasurement"/>.</param> /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns> /// <remarks>Measurement implementations should compare by hash code.</remarks> public int CompareTo(ITimeSeriesValue other) { return(m_measurement.CompareTo(other)); }
/// <summary> /// Determines whether the specified <see cref="ITimeSeriesValue"/> is equal to the current <see cref="SignalReferenceMeasurement"/>. /// </summary> /// <param name="other">The <see cref="ITimeSeriesValue"/> to compare with the current <see cref="SignalReferenceMeasurement"/>.</param> /// <returns> /// true if the specified <see cref="ITimeSeriesValue"/> is equal to the current <see cref="SignalReferenceMeasurement"/>; /// otherwise, false. /// </returns> public bool Equals(ITimeSeriesValue other) { return(m_measurement.Equals(other)); }
public override ITimeSeriesValue[] Compute(IFrame frame, IFrame[] prev, IFrame[] future) { ITimeSeriesValue original = frame.Measurements["Original"]; return(new AdaptValue[] { new AdaptValue("Reversed", original.Value * -1, frame.Timestamp) }); }
/// <summary> /// Compares the <see cref="SignalReferenceMeasurement"/> with an <see cref="ITimeSeriesValue"/>. /// </summary> /// <param name="other">The <see cref="ITimeSeriesValue"/> to compare with the current <see cref="SignalReferenceMeasurement"/>.</param> /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns> /// <remarks>Measurement implementations should compare by hash code.</remarks> public int CompareTo(ITimeSeriesValue other) { return m_measurement.CompareTo(other); }
/// <summary> /// Determines whether the specified <see cref="ITimeSeriesValue"/> is equal to the current <see cref="SignalReferenceMeasurement"/>. /// </summary> /// <param name="other">The <see cref="ITimeSeriesValue"/> to compare with the current <see cref="SignalReferenceMeasurement"/>.</param> /// <returns> /// true if the specified <see cref="ITimeSeriesValue"/> is equal to the current <see cref="SignalReferenceMeasurement"/>; /// otherwise, false. /// </returns> public bool Equals(ITimeSeriesValue other) { return m_measurement.Equals(other); }
public override ITimeSeriesValue[] Compute(IFrame frame, IFrame[] prev, IFrame[] future) { ITimeSeriesValue original = frame.Measurements["Original"]; return(new AdaptValue[] { new AdaptValue("Exponential", Math.Pow(original.Value, m_settings.Exponent), frame.Timestamp) }); }
/// <summary> /// Compares the <see cref="SignalReferenceMeasurement"/> with an <see cref="ITimeSeriesValue"/>. /// </summary> /// <param name="other">The <see cref="ITimeSeriesValue"/> to compare with the current <see cref="SignalReferenceMeasurement"/>.</param> /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns> /// <remarks>Measurement implementations should compare by hash code.</remarks> public int CompareTo(ITimeSeriesValue other) => m_measurement.CompareTo(other);
public override ITimeSeriesValue[] Compute(IFrame frame, IFrame[] prev, IFrame[] future) { ITimeSeriesValue original = frame.Measurements["Original"]; return(new AdaptValue[] { new AdaptValue("Absolute Value", Math.Abs(original.Value), frame.Timestamp) }); }
/// <summary> /// Determines whether the specified <see cref="ITimeSeriesValue"/> is equal to the current <see cref="Measurement"/>. /// </summary> /// <param name="other">The <see cref="ITimeSeriesValue"/> to compare with the current <see cref="Measurement"/>.</param> /// <returns> /// true if the specified <see cref="ITimeSeriesValue"/> is equal to the current <see cref="Measurement"/>; /// otherwise, false. /// </returns> public bool Equals(ITimeSeriesValue other) { return CompareTo(other) == 0; }
public override ITimeSeriesValue[] Compute(IFrame frame, IFrame[] prev, IFrame[] future) { ITimeSeriesValue original = frame.Measurements["Original"]; return(new AdaptValue[] { new AdaptValue("Scaled", original.Value * m_settings.Multiplier, frame.Timestamp) }); }
/// <summary> /// Compares the <see cref="Measurement"/> with an <see cref="ITimeSeriesValue"/>. /// </summary> /// <param name="other">The <see cref="ITimeSeriesValue"/> to compare with the current <see cref="Measurement"/>.</param> /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns> /// <remarks>Measurement implementations should compare by hash code.</remarks> public int CompareTo(ITimeSeriesValue other) { if ((object)other != null) return GetHashCode().CompareTo(other.GetHashCode()); return 1; }