Exemplo n.º 1
0
        //---------------------------------------------------------------------
        /// <summary>
        /// A filter that performs dead band compression.
        /// </summary>
        /// <param name="data">Input data</param>
        /// <param name="instrumentPrecision">(Absolut) precision of the instrument</param>
        /// <param name="maxTime">Length of time before for sure a value gets recoreded</param>
        /// <param name="minTime">Length of time within no value gets recorded (after the last archived value)</param>
        /// <returns>Dead band compressed / filtered data.</returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="data" /> is <c>null</c>
        /// </exception>
        public static DataPointIterator DeadBandCompressionAsync(this IAsyncEnumerable <DataPoint>?data, double instrumentPrecision, TimeSpan maxTime, TimeSpan?minTime = null)
        {
            if (data is null)
            {
                ThrowHelper.ThrowArgumentNull(ThrowHelper.ExceptionArgument.data);
            }

            var compression = new DeadBandCompression(instrumentPrecision, maxTime, minTime);

            return(compression.ProcessAsync(data));
        }
Exemplo n.º 2
0
        //---------------------------------------------------------------------
        /// <summary>
        /// A filter that performs dead band compression.
        /// </summary>
        /// <param name="data">Input data</param>
        /// <param name="instrumentPrecision">(Absolut) precision of the instrument</param>
        /// <param name="maxDeltaX">
        /// Length of x before for sure a value gets recoreded. See <see cref="Compression.MaxDeltaX" />.
        /// </param>
        /// <param name="minDeltaX">
        /// Length of x/time within no value gets recorded (after the last archived value).
        /// See <see cref="Compression.MinDeltaX" />.
        /// </param>
        /// <returns>Dead band compressed / filtered data.</returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="data" /> is <c>null</c>
        /// </exception>
        public static DataPointIterator DeadBandCompressionAsync(this IAsyncEnumerable <DataPoint> data, double instrumentPrecision, double?maxDeltaX = null, double?minDeltaX = null)
        {
            if (data is null)
            {
                ThrowHelper.ThrowArgumentNull(ThrowHelper.ExceptionArgument.data);
            }

            var compression = new DeadBandCompression(instrumentPrecision, maxDeltaX, minDeltaX);

            return(compression.ProcessAsync(data));
        }