Ejemplo n.º 1
0
        /// <summary>
        /// Formロード時に,画面中央に横幅最大で表示する
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form1_Load(object sender, EventArgs e)
        {
            Width = Screen.PrimaryScreen.Bounds.Width;
            Top   = (Screen.PrimaryScreen.Bounds.Height - Height) / 2;
            Left  = 0;
            CMBClass mM1 = new CMBClass(SimulationMode.RandomMode, "ランダムモード");
            CMBClass mM2 = new CMBClass(SimulationMode.EqualMode, "均等モード");
            CMBClass mM3 = new CMBClass(SimulationMode.PolarizationInitialMode, "偏極初期配置モード");
            CMBClass mD1 = new CMBClass(DriverMode.Human, "手動運転モード");
            CMBClass mD2 = new CMBClass(DriverMode.Auto, "自動運転モード");
            CMBClass MM1 = new CMBClass(0, "CHPTモデル");
            CMBClass MM2 = new CMBClass(1, "Revised-SBFSモデル");

            CMB_Mode.Items.Add(mM1);
            CMB_Mode.Items.Add(mM2);
            CMB_Mode.Items.Add(mM3);
            CMB_Mode.Text = mM1.ToString();
            CMB_DriverSelect.Items.Add(mD1);
            CMB_DriverSelect.Items.Add(mD2);
            CMB_DriverSelect.Text = mD1.ToString();
            CMB_ModelMode.Items.Add(MM1);
            CMB_ModelMode.Items.Add(MM2);
            CMB_ModelMode.Text = MM1.ToString();
            z = 0;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 初期配置ボタンクリック
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BTN_Set_Click(object sender, EventArgs e)
 {
     Length            = 1000;
     CarNum            = 1;
     time              = 0.05;
     Bai               = 1;
     BTN_Start.Text    = "Start";
     BTN_Start.Enabled = false;
     BTN_Reset.Enabled = false;
     if (Check_TextBox_TXT(TXT_Length, ref Length, "全周"))
     {
         if (Check_TextBox_TXT(TXT_CarNum, ref CarNum, "車両台数"))
         {
             if (Check_TextBox_TXT(TXT_time, ref time, "時間解像度"))
             {
                 if (Check_TextBox_TXT(TXT_Bai, ref Bai, "倍速"))
                 {
                     CMBClass mM = (CMBClass)CMB_Mode.SelectedItem;
                     CMBClass mD = (CMBClass)CMB_DriverSelect.SelectedItem;
                     if (CMB_ModelMode.Text == "CHPTモデル")
                     {
                         CHPT       = true;
                         v1         = new CHPT_rebuild_v1(Length, CarNum, time, mM.Key, mD.Key);
                         Acceptable = v1.initialize();
                     }
                     else
                     {
                         CHPT       = false;
                         revised    = new Revised((int)(Length + 0.5), CarNum, mM.Key);
                         Acceptable = revised.initialize_position();
                         pposition  = new List <float>(revised.N);
                         if (Acceptable)
                         {
                             for (int i = 0; i < revised.N; i++)
                             {
                                 pposition.Add(revised.car.position.previous[i]);
                             }
                         }
                     }
                     if (Acceptable)
                     {
                         DrawCarsFlag = true;
                         GetCarSize();
                         BTN_Start.Enabled = true;
                         n = 0;
                         z = 0;
                     }
                 }
             }
         }
     }
     Invalidate();
     Refresh();
 }