static void Main(string[] args) { float Ts = 0.0002f; //Sample Time float Vs = 2f; //Gain Constant for Route float T1 = 0.005f; //Time Constant for Route Controller_I I1= new Controller_I(0f); Step Step1 = new Step(0.02f, 0.0f); PT1 PT11 = new PT1(Vs, T1); Simulator Simulator1 = new Simulator(I1,Step1,PT11); Optimize.Controller(PT11, I1); float[,] result = Simulator1.simulate(Ts, 300 * Ts); for (int i = 0; i < (result.Length/2); ++i) { Console.WriteLine("[ " + result[0,i] + " , " + result[1,i] + " ]"); } Console.Read(); }
/// <summary> /// Initializes a new instance of a Simulator of a standard Controller Schematic /// </summary> /// <param name="Controller">The Controller of your Schematic</param> /// <param name="Jamming">The Jamming of your Schematic</param> /// <param name="Control_loop">The Control-Loop of your Schematic</param> public Simulator(ISimulatable Controller, Step Jamming, ISimulatable Control_loop) { _Schematic = new ISimulatable[] { new Adder(new string[] { "+1", "-1" }), Controller, Jamming ,Control_loop }; _Schematic[1].connect_this_Input_with(_Schematic[0]); _Schematic[2].connect_this_Input_with(_Schematic[1]); _Schematic[3].connect_this_Input_with(_Schematic[2]); _Schematic[0].connect_this_Input_with(_Schematic[3]); }