Exemplo n.º 1
0
        private FilterState CreateInitialConditions(DigitalFilter filter, double value)
        {
            int         ex      = 100000;
            FilterState updated = new FilterState()
            {
                StateValue = new double[] { }
            };

            double[] f = new double[ex];
            for (int i = 0; i < ex; i++)
            {
                f[i] = filter.Filt(value, updated, out updated);
            }
            return(updated);
        }
Exemplo n.º 2
0
        public override ITimeSeriesValue[] Compute(IFrame frame, IFrame[] prev, IFrame[] future)
        {
            double value = frame.Measurements["Original"].Value;

            if (double.IsNaN(value))
            {
                return(new ITimeSeriesValue[0]);
            }

            if (m_state == null)
            {
                m_state = CreateInitialConditions(m_filter, value);
            }

            FilterState updated;
            double      filtered = m_filter.Filt(value, m_state, out updated);

            m_state = updated;

            return(new AdaptValue[] { new AdaptValue("Filtered", filtered, frame.Timestamp) });
        }