Ejemplo n.º 1
0
        public void AverageOfNotChanging()
        {
            var ave = new WindowAverage(1f);

            ave.AddMeasurement(10f, 1f);
            ave.AddMeasurement(10f, 0.5f);
            AreClose(10f, ave.Value);
        }
Ejemplo n.º 2
0
        public void AverageAfterLongTime()
        {
            var ave = new WindowAverage(1f);

            for (var i = 0; i < 100; ++i)
            {
                ave.AddMeasurement(123f, 0.3f);
            }

            ave.AddMeasurement(20f, 1f);
            ave.AddMeasurement(8f, 0.5f);
            AreClose(14f, ave.Value);
        }
Ejemplo n.º 3
0
        public void AverageOverTwoIntervals()
        {
            var ave = new WindowAverage(1f, 20f);

            ave.AddMeasurement(8f, 0.5f);
            AreClose(14f, ave.Value);
        }
        public override void Update(float timeDelta)
        {
            UpdateImportantCPH();
            var surveyed = Surveyor.Survey();

            AttachedPowerConsumers = surveyed.Count();
            var transmission = Storage.Update(timeDelta, surveyed);

            PowerDelta    = transmission.Recieved - transmission.Delivered;
            PreviousPower = Storage.Power - PowerDelta;
            In.AddMeasurement(transmission.Recieved / timeDelta, timeDelta);
            Out.AddMeasurement(transmission.Delivered / timeDelta, timeDelta);
            Update(Storage.Power, transmission.Recieved, transmission.Delivered, timeDelta);
        }