コード例 #1
0
 /// <summary>
 /// 値のコピーを作成する
 /// </summary>
 /// <param name="running">DRunning</param>
 public DRunning(DRunning running)
 {
     acceleration = new DAcceleration(running.acceleration);
     v_optimal    = new DIC(running.v_optimal);
     v_difference = new DVDifference(running.v_difference);
     gap          = new DGap(running.gap);
     delta        = new DDelta(running.delta);
     RR           = new Recognition_Rate(running.RR);
     pedal        = new Pedal(running.pedal);
 }
コード例 #2
0
        public Pedal pedal;                 //ペダルの踏みかえ関係

        /// <summary>
        /// 実態を持たせる
        /// </summary>
        public DRunning()
        {
            acceleration = new DAcceleration();
            v_optimal    = new DIC();
            v_difference = new DVDifference();
            gap          = new DGap();
            delta        = new DDelta();
            RR           = new Recognition_Rate();
            pedal        = new Pedal();
        }
コード例 #3
0
 /// <summary>
 /// ドライバーの特徴を初期化
 /// </summary>
 private void _initialize_driver_eigenvalue()
 {
     driver = new List <Driver_Structure>(N);
     for (int i = 0; i < N; i++)
     {
         Change_Unit change = new Change_Unit();
         DVelocity   DV     = new DVelocity();
         DV.cruise       = change.km_h__to__m_s(100);
         DV.c_difference = change.km_h__to__m_s(15);
         DV.s_difference = change.km_h__to__m_s(1);
         Pedal pedal = new Pedal();
         pedal.foot_position = FootPosition.accel_pedal;
         pedal.time_elapsed  = pedal.time_required = 0;
         DGap dg = new DGap();
         dg.closest = dg.cruise = dg.influenced = 0;
         DEGap  deg = new DEGap();
         double operation_time;
         if (Driver_Mode == DriverMode.Human)
         {
             operation_time = 0.75;
             deg.stop       = 3;
             deg.move       = 6;
         }
         else
         {
             operation_time = 0.05;
             deg.stop       = 1;
             deg.move       = 1.1;
         }
         Driver_Structure DS = new Driver_Structure();
         DS.eigenvalue.acceleration.acceleration = change.km_h__to__m_s(60) / 10;
         DS.eigenvalue.acceleration.deceleration = Math.Pow(change.km_h__to__m_s(100), 2) / 2 / 60;
         DS.eigenvalue.operation_time            = operation_time;
         DS.eigenvalue.velocity      = new DVelocity(DV);
         DS.eigenvalue.gap           = new DEGap(deg);
         DS.running.pedal            = new Pedal(pedal);
         DS.running.gap              = new DGap(dg);
         DS.running.v_optimal        = new DIC(0, 0);
         DS.running.RR.random_value  = new Random_Value(0, 0);
         DS.running.RR.effectiveness = true;
         DS.running.v_difference     = new DVDifference(deg.stop, deg.stop);
         driver.Add(DS);
     }
 }
コード例 #4
0
        /// <summary>
        /// ペダルの踏みかえ
        /// </summary>
        /// <param name="ID">車両ID</param>
        private void _pedal_judgement(int ID)
        {
            //踏みかえ中なら判定を,そうでないなら今の加速度を保持
            Pedal pedal = driver[ID].running.pedal;
            bool  put_on;   //足がペダルに置いてあるかどうか

            if (pedal.foot_position == FootPosition.accel_to_brake || pedal.foot_position == FootPosition.brake_to_accel)
            {
                //現在ペダル踏みかえ中
                if (pedal.time_elapsed >= pedal.time_required)
                {
                    //踏みかえが終了
                    if (pedal.foot_position == FootPosition.accel_to_brake)
                    {
                        pedal.foot_position = FootPosition.brake_pedal;
                    }
                    else
                    {
                        pedal.foot_position = FootPosition.accel_pedal;
                    }
                    put_on = true;
                }
                else
                {
                    //まだ踏みかえ中
                    pedal.time_elapsed += parameter.t;
                    put_on              = false;
                }
            }
            else
            {
                put_on = true;
            }
            if (put_on)
            {
                //足がペダルにあるので,加減速を調節できる
                car[ID].running.acceleration = driver[ID].running.acceleration.value;
                pedal.time_elapsed           = pedal.time_required = 0;
            }
            else
            {
                car[ID].running.acceleration = -car[ID].eigenvalue.acceleration.resistance;
            }
        }
コード例 #5
0
 /// <summary>
 /// 値のコピーを作成する
 /// </summary>
 /// <param name="pedal">Pedal</param>
 public Pedal(Pedal pedal)
 {
     foot_position = pedal.foot_position;
     time_elapsed  = pedal.time_elapsed;
     time_required = pedal.time_required;
 }
コード例 #6
0
        /// <summary>
        /// 速度の調節をペダルで行う
        /// </summary>
        /// <param name="ID">車両ID</param>
        private void __pedal_changing(int ID)
        {
            Pedal  pedal  = driver[ID].running.pedal;
            double deltaV = driver[ID].running.delta.velocity;

            if (deltaV <= 0)
            {
                //加速するとき
                driver[ID].running.acceleration.sign = SignAcceleration.acceleration;
                if (pedal.foot_position == FootPosition.brake_pedal)
                {
                    //ブレーキペダルからアクセルペダルへ
                    pedal.foot_position = FootPosition.brake_to_accel;
                    pedal.time_required = driver[ID].eigenvalue.operation_time;
                }
                else if (pedal.foot_position == FootPosition.accel_to_brake)
                {
                    //ブレーキしようと思ったけどやっぱり加速
                    pedal.foot_position = FootPosition.brake_to_accel;
                    pedal.time_required = driver[ID].running.pedal.time_elapsed;
                    pedal.time_elapsed  = 0;
                }
            }
            else
            {
                //減速するとき
                driver[ID].running.acceleration.sign = SignAcceleration.deceleration;
                if (driver[ID].running.acceleration.value >= -car[ID].eigenvalue.acceleration.resistance)
                {
                    //この時はアクセルペダルで調節する
                    if (pedal.foot_position == FootPosition.brake_pedal)
                    {
                        //ブレーキペダルからアクセルペダルへ
                        pedal.foot_position = FootPosition.brake_to_accel;
                        pedal.time_required = driver[ID].eigenvalue.operation_time;
                    }
                    else if (pedal.foot_position == FootPosition.accel_to_brake)
                    {
                        //ブレーキしようと思ったけどやっぱり加速
                        pedal.foot_position = FootPosition.brake_to_accel;
                        pedal.time_required = driver[ID].running.pedal.time_elapsed;
                        pedal.time_elapsed  = 0;
                    }
                }
                else
                {
                    if (pedal.foot_position == FootPosition.accel_pedal)
                    {
                        //アクセルペダルからブレーキペダルへ
                        pedal.foot_position = FootPosition.accel_to_brake;
                        pedal.time_required = driver[ID].eigenvalue.operation_time;
                    }
                    else if (pedal.foot_position == FootPosition.brake_to_accel)
                    {
                        //加速しようと思ったけどやっぱりブレーキ
                        pedal.foot_position = FootPosition.accel_to_brake;
                        pedal.time_required = driver[ID].running.pedal.time_elapsed;
                        pedal.time_elapsed  = 0;
                    }
                }
            }
        }