Ejemplo n.º 1
0
        public static void Receive(DataAggregatorTuple daTuple)
        {
            int newGroupIndex = AxesBuilder.GroupFunction(daTuple.NewFeatures);
            int oldGroupIndex = AxesBuilder.GroupFunction(daTuple.OldFeatures);

            if (newGroupIndex != oldGroupIndex)
            {
                if (daTuple.NewFeatures.HasValue)
                {
                    if (newGroupIndex != 0)
                    {
                        Groups[newGroupIndex].AddCluster(daTuple.SourceCluster);
                    }
                }
                if (daTuple.OldFeatures.HasValue && Groups[oldGroupIndex].Clusters.Count > 0)
                {
                    if (oldGroupIndex != 0)
                    {
                        Groups[oldGroupIndex].RemoveCluster(daTuple.SourceCluster);
                    }
                }
            }

            int sumRatio = Groups.Sum(x => x.Clusters.Count);

            foreach (var group in Groups)
            {
                group.Rc = (double)group.Clusters.Count / sumRatio;
            }


            for (int i = 0; i < 8; i++)
            {
                if (Math.Abs(Groups[i].Rc - Groups[i].Re) > ApplicationSettings.Instance.AlarmTolerance)
                {
                    Alarm(i, Groups[i].Rc, Groups[i].Re, ApplicationSettings.Instance.AlarmTolerance);
                }
            }

            AxesBuilder.Add(daTuple.SourceCluster);
        }
Ejemplo n.º 2
0
        public void AddTuple(DataSetTuple dataSetTuple)
        {
            _lifeTime  = 0;
            _weight    = 0;
            _frequency = 0;

            DataAggregatorTuple tuple = new DataAggregatorTuple();

            tuple.OldFeatures.Frequency = this.Frequency;
            tuple.OldFeatures.Weight    = this.Weight;
            tuple.OldFeatures.LifeTime  = this.LifeTime;

            this.DataSetTuples.Add(dataSetTuple);

            tuple.NewFeatures.Frequency = this.Frequency;
            tuple.NewFeatures.Weight    = this.Weight;
            tuple.NewFeatures.LifeTime  = this.LifeTime;

            tuple.SourceCluster = this;
            tuple.StartTime     = this.StartTime;
            DCC.Receive(tuple);
        }
Ejemplo n.º 3
0
        public void Purge(double newT0)
        {
            _lifeTime  = 0;
            _weight    = 0;
            _frequency = 0;

            DataAggregatorTuple tuple = new DataAggregatorTuple();

            tuple.OldFeatures.Frequency = this.Frequency;
            tuple.OldFeatures.Weight    = this.Weight;
            tuple.OldFeatures.LifeTime  = this.LifeTime;

            this.DataSetTuples.RemoveAll(x => x.StartTime < newT0);

            tuple.NewFeatures.Frequency = this.Frequency;
            tuple.NewFeatures.Weight    = this.Weight;
            tuple.NewFeatures.LifeTime  = this.LifeTime;

            tuple.SourceCluster = this;
            tuple.StartTime     = this.StartTime;

            DCC.Receive(tuple);
        }