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); }
internal BandwidthController() { _pidController = new PidController(); _setpoint = Int32.MaxValue; _accumulatedBytes = Int32.MaxValue; }