/// <summary> /// 車間距離を-1から1正規化にする /// </summary> /// <param name="ID">車両ID</param> /// <param name="sign">車間距離の場合分け</param> /// <returns>正規化された値</returns> private double __calculate_NG(int ID) { double NG; DGap DG = driver[ID].running.gap; double G = car[ID].running.gap; double deltaG = driver[ID].running.delta.gap; if (G <= DG.influenced) { driver[ID].running.RR.effectiveness = true; } if (deltaG <= 0) { NG = -2 * (G - DG.closest) / (DG.cruise - DG.closest) + 1; } else { NG = 2 * (G - DG.cruise) / (DG.influenced - DG.cruise) - 1; } if (NG < -1) { NG = -1; } else if (NG > 1) { NG = 1; } return(NG); }
/// <summary> /// 車間距離シリーズを計算する /// </summary> /// <param name="ID">車両ID</param> /// <returns>true -> 内側,false -> 外側</returns> private double _calculate_Gseries(int ID) { DGap DG = driver[ID].running.gap; DEGap DEG = driver[ID].eigenvalue.gap; int front = car[ID].running.around.front; double v = car[ID].running.velocity.current; double v_f = car[front].running.velocity.current; double T = driver[ID].eigenvalue.operation_time; double Ab = car[ID].eigenvalue.acceleration.braking; double Ab_f = car[front].eigenvalue.acceleration.braking; double Abs = driver[ID].eigenvalue.acceleration.deceleration; double Didling = v * T; double Dbrake = v * v / (2 * Ab); double Dbrake_f = v_f * v_f / (2 * Ab_f); DG.closest = Didling + Dbrake - Dbrake_f; if (DG.closest < DEG.stop) { DG.closest = DEG.stop; } else { DG.closest += DEG.stop; } DG.cruise = Didling + v * v / (2 * Abs) + (DEG.stop + DEG.move) / 2; if (DG.cruise - 10 > DG.closest) { DG.cruise = DG.closest + 10; } DG.influenced = 2 * DG.cruise - DG.closest; return(car[ID].running.gap - DG.cruise); }
/// <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); }
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(); }
/// <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); } }
public double A; //代表面積 /// <summary> /// 車間距離の認識確率 /// </summary> /// <param name="ID">車両ID</param> /// <returns>車間距離の認識率</returns> public double calculate_Rerecognition_Rate(int ID) { double P; calculate_optimal_velocity(ID); int front = car[ID].running.around.front; double V = car[ID].running.velocity.current; double V_f = car[front].running.velocity.current; double NG = driver[ID].running.RR.fg.normalized; if (NG < -1) { NG = -1; } else if (NG > 1) { NG = 1; } DGap DG = driver[ID].running.gap; double Ag = (DG.influenced - DG.closest) * A; double delta_G = driver[ID].running.delta.gap; if (delta_G <= 0) { P = (DG.cruise - DG.closest) / Ag * Math.Log((1 + Math.Exp(-NG / 0.1)) / (1 + Math.Exp(-1 / 0.1))); } else { P = ((DG.cruise - DG.closest) * Math.Log((1 + Math.Exp(1 / 0.1)) / (1 + Math.Exp(-1 / 0.1))) + (DG.influenced - DG.cruise) * Math.Log((1 + Math.Exp(1 / 0.1)) / (1 + Math.Exp(-NG / 0.1)))) / Ag; } if (V > V_f) { P = 1 - P; } return(P); }
/// <summary> /// 値のコピーを作成する /// </summary> /// <param name="gap"></param> public DGap(DGap gap) { closest = gap.closest; cruise = gap.cruise; influenced = gap.influenced; }