00001 // Define constants for EvolveTraffic 00002 00003 #ifndef Constants_h 00004 #define Constants_h 00005 00006 #include "stdafx.h" // this is for the defs of WORD etc 00007 00008 /*************************************************************** 00009 *FUNDAMENTAL CONSTANTS - DO NOT VARY BETWEEN PROGRAM INSTANCES* 00010 ***************************************************************/ 00011 00012 // Supported Distributions 00013 const WORD DIST_EXPONENTIAL = 200U; 00014 const WORD DIST_LOGNORMAL = 201U; 00015 const WORD DIST_GAMMA = 202U; 00016 const WORD DIST_GUMBEL = 203U; 00017 const WORD DIST_POISSON = 204U; 00018 const WORD DIST_GEV = 205U; 00019 const WORD DIST_NORMAL = 206U; 00020 const WORD DIST_CONST = 207U; 00021 00022 // IDM Parameter IDs 00023 const WORD IDM_PARAM_T = 300U; 00024 const WORD IDM_PARAM_A = 301U; 00025 const WORD IDM_PARAM_B = 302U; 00026 const WORD IDM_PARAM_S0 = 303U; 00027 const WORD IDM_PARAM_S1 = 304U; 00028 const WORD IDM_PARAM_V0 = 305U; 00029 const WORD IDM_PARAM_DELTA = 306U; 00030 const WORD IDM_PARAM_POLITE = 307U; 00031 const WORD IDM_PARAM_BIAS = 308U; 00032 const WORD IDM_PARAM_DELTAATH = 309U; 00033 00034 // Vehicle types 00035 const WORD VEH_ID_CAR = 0; 00036 const WORD VEH_ID_SMALLTRUCK = 1; 00037 const WORD VEH_ID_LARGETRUCK = 2; 00038 const WORD VEH_ID_CRANE = 3; 00039 const WORD VEH_ID_LOWLOADER = 4; 00040 00041 // Road Features IDs 00042 const WORD FEAT_SPEEDLIMIT = 400U; 00043 const WORD FEAT_GRADIENT = 401U; 00044 00045 // Max number of axles in a CASTOR file 00046 const int CASTOR_MAX_AXLES = 9; 00047 00048 // Program Version for Serialization 00049 const UINT VERSION_NUMBER = 1; 00050 00051 // Conversion of metres per second to kilometres per hour 00052 const double M_PER_S_TO_KM_PER_H = 3.6; 00053 const double KM_PER_H_TO_M_PER_S = 0.27777778; 00054 00055 // Conversion of kg/100 to kN 00056 const double KG100_TO_KN = 0.981; 00057 00058 const int SECS_PER_HOUR = 3600; 00059 const int HOURS_PER_DAY = 24; 00060 const int MINS_PER_HOUR = 60; 00061 const int SECS_PER_MIN = 60; 00062 00063 // Fixed number of rows/columns 00064 const int FIXED_ROWS = 1; 00065 const int FIXED_COLUMNS = 1; 00066 00067 // Stat Detectors 00068 const WORD METRICS_VEH_ALL = 500U; 00069 const WORD METRICS_VEH_CAR = 501U; 00070 const WORD METRICS_VEH_SMALLTRUCK = 502U; 00071 const WORD METRICS_VEH_LARGETRUCK = 503U; 00072 const WORD METRICS_VEH_CRANE = 504U; 00073 const WORD METRICS_VEH_LOWLOADER = 505U; 00074 00075 const WORD METRICS_TYPE_FLOWDENSITY = 510U; 00076 const WORD METRICS_TYPE_HEADWAY = 511U; 00077 const WORD METRICS_TYPE_COMPOSITION = 512U; 00078 const WORD METRICS_TYPE_LANE_CHANGE = 513U; 00079 00080 // Input File Types 00081 const WORD SAFT = 100U; 00082 const WORD CASTOR = 101U; 00083 00084 // Input file buffer size 00085 const WORD INPUT_FILE_BUFFER_SIZE = 10U; 00086 00087 // The refresh rate for OnDraw 00088 const WORD DRAW_FRAMES_PER_SEC = 20U; 00089 00090 /*********************************************************** 00091 *VARIABLE CONSTANTS - CHANGEABLE BETWEEN PROGRAM INSTANCES* 00092 ***********************************************************/ 00093 /* 00094 // Colours for vehicles (which can change) 00095 const COLORREF VEH_COLOR_CAR = RGB(0,0,0); 00096 const COLORREF VEH_COLOR_SMALLTRUCK = RGB(0,0,255); 00097 const COLORREF VEH_COLOR_LARGETRUCK = RGB(255,0,0); 00098 const COLORREF VEH_COLOR_CRANE = RGB(0,255,0); 00099 const COLORREF VEH_COLOR_LOWLOADER = RGB(100,100,100); 00100 00101 // Colours for elements 00102 const COLORREF CLR_BACKGRND = RGB(255,255,255); 00103 const COLORREF CLR_ROAD_SURFACE = RGB(200,200,200); 00104 const COLORREF CLR_ROAD_LINES = RGB(0,0,0); 00105 const COLORREF CLR_RULER_LINES = RGB(0,0,0); 00106 const COLORREF CLR_RULER_TEXT = RGB(0,0,0); 00107 const COLORREF CLR_LEGEND_TEXT = RGB(0,0,0); 00108 const COLORREF CLR_DET_OUTPUT = RGB(255,255,0); 00109 const COLORREF CLR_DET_FLOWDENSITY = RGB(0,255,0); 00110 const COLORREF CLR_DET_HEADWAY = RGB(0,0,255); 00111 const COLORREF CLR_DET_COMPOSITION = RGB(0,0,0); 00112 const COLORREF CLR_FEAT_SPEEDLIMIT = RGB(255,0,0); 00113 const COLORREF CLR_FEAT_GRADIENT = RGB(0,255,0); 00114 00115 // Road End Buffer 00116 const int ROAD_END_BUFFER = 1000; 00117 00118 // Truck identification constants 00119 const int TRUCK_WEIGHT_THRESHOLD = 35; // in kg/100 00120 const int SMALL_TRUCK_NO_AXLES = 3; 00121 const double CRANE_MAX_SPACING = 4.5; // in m 00122 const double CRANE_AVERAGE_SPACING = 2.5; // in m 00123 const double LOWLOADER_MAX_SPACING = 7.5; // in m 00124 00125 // Viewing param 00126 const double MIN_VIEW_SCALE = 0.1; 00127 00128 // Max no of road features 00129 const int MAX_NO_FEATURES = 10; 00130 00131 // Constants for how Gradient affects vehicles 00132 const int SPEEDLIMIT_MAX = 200; // in km/h - the maximum possible speed limit 00133 const int GRADIENT_MAX = 15; // In % - the maximum gradient slope allowed 00134 const double GRADIENT_T_SLOPE = 10.0; // %gradient per second increase in T 00135 const double GRADIENT_V0_SLOPE = 0.2; // %gradient per km/h reduction in V0 00136 const double GRADIENT_V0_MIN = 0.1; // minimum V) in case gradient effect is too large 00137 const double GRADIENT_A_MIN = 0.1; // m/s^2 minimum m_A in case gradient effect is too large 00138 const bool GRADIENT_A_FLAG = true; // should we affect the mechanical property A? 00139 const bool GRADIENT_B_FLAG = true; // should we affect the mechanical property B? 00140 00141 // Time output constants 00142 const WORD MTS_PER_YR = 10; 00143 const WORD DAYS_PER_MT = 25; 00144 00145 // Some unusual constants to be queried, but as per Treiber's software 00146 const double SPACE_MIN = 27.0; 00147 const double SAFE_BRAKING = -12.0; 00148 const double MIN_GAP = 2.0; 00149 const double T_DELAY = 1.6; // what is this? 00150 00151 */ 00152 00153 #endif 00154 00155 // Supported Distributions 00156 00157 //0 - Exponential 00158 //1 - Log-normal 00159 //2 - Gamma 00160 //3 - Gumbel 00161 //4 - Poisson 00162 //5 - GEV 00163 //6 - Normal 00164 00165 // IDM Parameters 00166 00167 // m_T; // Safe time headway 00168 // m_a; // Maximum acceleration 00169 // m_b; // desired decceleration 00170 // m_s0; // Jam distance s0 00171 // m_s1; // Jam distance s1 00172 // m_v0; // desired velocity 00173 // m_delta; // Acceleration exponent 00174 // polite; // Politness factor 00175 // biasRight; // Bias factor for slow lane