예제 #1
0
 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>
        /// Init Main Window
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            //Set default Controller
            tab_Regler_I.IsEnabled = true;
            tab_Regler_P.IsEnabled = false;
            tab_Regler_PI.IsEnabled = false;
            tab_Regler_PID.IsEnabled = false;

            //init The Sliders
            Base_Slider_PT1_Vs.set_Base(2.0f);         //PT1 Vs
            Base_Slider_PT1_T1.set_Base(0.005f);       //PT1 T1
            Base_Slider_IT1_Ti.set_Base(2.0f);         //IT1 Ti
            Base_Slider_IT1_T2.set_Base(0.005f);       //IT1 T2
            Base_Slider_PT2_wdb1_Vs.set_Base(2.0f);    //PT2 Vs
            Base_Slider_PT2_wdb1_T1.set_Base(0.005f);  //PT2 T1
            Base_Slider_PT2_wdb1_T2.set_Base(0.001f);  //PT2 T2

            Base_Slider_PT2_wdse1_Vs.set_Base(2.0f);   //PT2 Vs
            Base_Slider_PT2_wdse1_d.set_Base(0.8f);    //PT2 d
            Base_Slider_PT2_wdse1_T.set_Base(0.005f);  //PT2 T

            Optimize.Controller(_IT1, _P);
            Base_Slider_P_Vr.set_Base(_P._Vr);         //P   Vr
            Optimize.Controller(_PT2_wdb1, _PI);
            Base_Slider_PI_Vr.set_Base(_PI._Vr);       //PI  Vr
            Base_Slider_PI_Tn.set_Base(_PI._Tn);       //PI  Tn

            //init Simulator
            Optimize.Controller(_PT1, _I);
            Base_Slider_I_Ti.set_Base(_I._Ti);
            _Simulator = new Simulator (_I,_Jamming,_PT1);
            _plot_on = true;
            plot_graph();

            //init Obj for FileManager
            Savable_WPF_Obj _savable_WPF_objects = new Savable_WPF_Obj(new List<ComboBox>() { combmBox_Zeit, combmBox_Zeit_Tend }, new List<TextBox>() { textBox_Ts, textBox_Tend, textbox_b, textbox_a, textBox_plot_count }, new List<TabControl>() { TabControl_Strecke, TabControl_Regler, TabControl_Infos }, new List<CheckBox>() { CheckBox_LivePlotOn });
            _savable_array = new List<Isavable>() { Base_Slider_PT1_Vs, Base_Slider_PT1_T1, Base_Slider_IT1_Ti, Base_Slider_IT1_T2, Base_Slider_PT2_wdb1_Vs, Base_Slider_PT2_wdb1_T1, Base_Slider_PT2_wdb1_T2, Base_Slider_PT2_wdse1_Vs, Base_Slider_PT2_wdb1_T1, Base_Slider_PT2_wdb1_T2, Base_Slider_PT2_wdse1_Vs, Base_Slider_PT2_wdse1_d, Base_Slider_PT2_wdse1_T, Base_Slider_P_Vr, Base_Slider_PI_Vr, Base_Slider_PI_Tn, Base_Slider_I_Ti, Base_Slider_St_Vz, Base_Slider_St_Tz, _savable_WPF_objects };
        }