示例#1
0
        public void ItMustConvege()
        {
            var rand = new Random();
            var desired = 100 * rand.NextDouble();
            var measured = 100 * rand.NextDouble();

            var controller = new PidController(0.6, 0.4);
            for(int i = 0; i < 35 ; i++)
            {
                var error = desired - measured;
                Debug.WriteLine("{0} e: {1}",i, error);
                var output = controller.Control(error, 1);

                desired += 10;
                measured = measured + output;
            }

            Assert.IsTrue(Math.Abs(desired - measured) <= 1e-5);
        }
示例#2
0
 internal BandwidthController()
 {
     _pidController    = new PidController();
     _setpoint         = Int32.MaxValue;
     _accumulatedBytes = Int32.MaxValue;
 }
示例#3
0
 internal BandwidthController()
 {
     _pidController = new PidController();
     _setpoint = Int32.MaxValue;
     _accumulatedBytes = Int32.MaxValue;
 }