예제 #1
0
        private double CalculateNextXSimple(Random rnd, DoubleSeries s, ARMASeriesConfig c)
        {
            var ar_part = 0.0;
            var ma_part = 0.0;

            // AR
            for (int j = 0, x_Count = s.X.Count; j < c.P.Length && j < s.X.Count; j++)
            {
                ar_part += c.P[j] * s.X[x_Count - 1 - j];
            }

            // MA
            for (int j = 0, e_Count = s.E.Count; j < c.Q.Length && j < s.E.Count; j++)
            {
                ma_part += c.Q[j] * s.E[s.E.Count - 1 - j];
            }

            var et = rnd.NextGaussian_BoxMuller(c.Mean, c.StdDev); // next noise/shock
            var xt = c.C + et + ar_part + ma_part;                 // next sensor value

            s.E.Add(et);
            s.X.Add(xt);

            return(xt);
        }
예제 #2
0
        private double CalculateNextX(Random rnd, DoubleSeries s, PFSeriesConfig c, Function f, string fHead, long i)
        {
            double t            = i / c.TimeQuotient;
            var    arg          = ConfigurationParser.ParseArgument("t", t);
            var    periodicPart = ConfigurationParser.ComputeFunction(fHead, f, arg);

            var ar_part_drivers = 0.0;
            var ma_part_drivers = 0.0;

            lock (seriesDict)
                CalculateDriverParts(c.Drivers, out ar_part_drivers, out ma_part_drivers);

            var et = rnd.NextGaussian_BoxMuller(c.Mean, c.StdDev); // next noise
            var xt = c.C + periodicPart + ar_part_drivers + ma_part_drivers + et;

            lock (seriesDict) {
                if (s.X.Count > MAX_BUFFER_SIZE)
                {
                    s.X.RemoveAt(0);
                }
                s.X.Add(xt);
            }

            return(xt);
        }
예제 #3
0
        private double CalculateNextXSimple(Random rnd, DoubleSeries s, PFSeriesConfig c, Function f, string fHead, long i)
        {
            double t   = i / c.TimeQuotient;
            var    arg = ConfigurationParser.ParseArgument("t", t);
            var    xt  = ConfigurationParser.ComputeFunction(fHead, f, arg);

            s.X.Add(xt);
            return(xt);
        }
예제 #4
0
 public DoubleSeriesGenerator(string group, GeneratorConfig generatorConfig, Dictionary <string, DoubleSeries> seriesDict, Random rnd, DoubleSeries series, SeriesConfig config)
 {
     this.group           = group;
     this.generatorConfig = generatorConfig;
     this.seriesDict      = seriesDict;
     this.rnd             = rnd;
     this.series          = series;
     this.config          = config;
 }
예제 #5
0
        private double CalculateNextX(Random rnd, DoubleSeries s, ARMASeriesConfig c)
        {
            var ar_part = 0.0;
            var ma_part = 0.0;

            // AR
            for (int j = 0, x_Count = s.X.Count; j < c.P.Length && j < s.X.Count; j++)
            {
                ar_part += c.P[j] * s.X[x_Count - 1 - j];
            }

            // MA
            for (int j = 0, e_Count = s.E.Count; j < c.Q.Length && j < s.E.Count; j++)
            {
                ma_part += c.Q[j] * s.E[s.E.Count - 1 - j];
            }


            // Drivers
            var ar_part_drivers = 0.0;
            var ma_part_drivers = 0.0;

            lock (seriesDict)
                CalculateDriverParts(c.Drivers, out ar_part_drivers, out ma_part_drivers);

            var et = rnd.NextGaussian_BoxMuller(c.Mean, c.StdDev);                     // next noise/shock
            var xt = c.C + et + ar_part + ma_part + ar_part_drivers + ma_part_drivers; // next sensor value

            lock (seriesDict) {
                if (s.X.Count > MAX_BUFFER_SIZE)
                {
                    s.X.RemoveAt(0);
                }
                if (s.E.Count > MAX_BUFFER_SIZE)
                {
                    s.E.RemoveAt(0);
                }
                s.E.Add(et);
                s.X.Add(xt);
            }

            return(xt);
        }