Microscopic Traffic Simulator
CellularTopologyParameters.cs
Go to the documentation of this file.
1 using System;
2 
3 namespace Microscopic_Traffic_Simulator___Model.CellularTopologyObjects.GeneralParameters
4 {
8  [Serializable]
10  {
14  public double P1_CellLength { get; set; }
15 
19  public TimeSpan P2_SimulationStepInterval { get; set; }
20 
24  private const double MetersInKilometer = 1000.0;
25 
29  private const double SecondsInHour = 3600.0;
30 
36  internal int FromKphSpeedToSimSpeed(double kph)
37  {
38  return (int)Math.Round(kph *
39  (MetersInKilometer * P2_SimulationStepInterval.TotalSeconds) /
40  (SecondsInHour * P1_CellLength));
41  }
42 
48  internal double FromSimSpeedToKphSpeed(int simSpeed)
49  {
50  return simSpeed *
51  (SecondsInHour * P1_CellLength) /
52  (MetersInKilometer * P2_SimulationStepInterval.TotalSeconds);
53  }
54  }
55 }