[31] | 1 | /************************************************************************************ |
---|
| 2 | * Copyright (C) 2008 by Politehnica University of Bucharest and Rutgers University |
---|
| 3 | * All rights reserved. |
---|
| 4 | * Refer to LICENSE for terms and conditions of use. |
---|
| 5 | ***********************************************************************************/ |
---|
| 6 | package vnsim.map.object; |
---|
| 7 | |
---|
| 8 | /** |
---|
| 9 | * @author Victor-Radu |
---|
| 10 | * |
---|
| 11 | */ |
---|
| 12 | |
---|
| 13 | |
---|
| 14 | import java.io.File; |
---|
| 15 | import java.io.PrintWriter; |
---|
| 16 | import java.util.ArrayList; |
---|
| 17 | |
---|
| 18 | import vnsim.applications.adaptiveTL.WirelessTrafficLight; |
---|
| 19 | import vnsim.applications.trafficview.SimulatedCarInfo; |
---|
| 20 | import vnsim.core.*; |
---|
| 21 | import vnsim.gui.Display; |
---|
| 22 | import vnsim.vehicular.routePlan.RoutingConstants; |
---|
| 23 | import vnsim.vehicular.routePlan.cityRouting.WeekCongestion; |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | |
---|
| 27 | |
---|
| 28 | public class Globals { |
---|
| 29 | public static int MAXCROSS = 8; |
---|
| 30 | |
---|
| 31 | public static int RT1_length = 230; //Tiger Record Type 1 length = 228 + 2 (crlf) |
---|
| 32 | public static int RT2_length = 210; //Tiger Record Type 2 length = 208 + 2 (crlf) |
---|
| 33 | public static int LOG_LINE_LEN = 55; //GARMIN Text Output Protocol |
---|
| 34 | |
---|
| 35 | public static double MAXSEGLEN=0.006; //maximum distance between consecutive points on a road |
---|
| 36 | |
---|
| 37 | public static Map map; |
---|
| 38 | |
---|
| 39 | // last week congestions |
---|
| 40 | // first is the crossroad index then the road segment index |
---|
| 41 | public static ArrayList<ArrayList<WeekCongestion>> lastWeekCongestions; |
---|
| 42 | |
---|
| 43 | public static String scenarioName; |
---|
| 44 | |
---|
| 45 | public static Point minPoint, maxPoint; |
---|
| 46 | |
---|
| 47 | // Given the peano key of your gps location and the position in the sorted PeanoKey |
---|
| 48 | // vector where it would fit, for finding the closest point on a road |
---|
| 49 | // you need to find the minimum distance to a point (PeanoKey) in a certain range |
---|
| 50 | // from that position. |
---|
| 51 | public static int PEANOKEY_SEARCH_RANGE = 10000; |
---|
| 52 | |
---|
| 53 | //If the minimum distance to a point on a roads is greater than a certain |
---|
| 54 | //constant, the gps location should be considered out of the map |
---|
| 55 | public static double CLOSEST_PEANOKEY_MAXDIST = 0.06; |
---|
| 56 | |
---|
| 57 | public static int FPS = 10; //iterations per second (mobility simulator) |
---|
| 58 | |
---|
| 59 | public static int executionFPS = 100; //iterations per second (simulation) |
---|
| 60 | |
---|
| 61 | public final static int SECOND = executionFPS; |
---|
| 62 | public final static int MINUTE = 60 * SECOND; |
---|
| 63 | public final static int HOUR = 60 * MINUTE; |
---|
| 64 | |
---|
| 65 | public static long NEIGHBOR_EXPIRES = 2 * SECOND; |
---|
| 66 | public static long PROMISCUOUS_NEIGHBOR_EXPIRES = 1 * MINUTE; |
---|
| 67 | public static long TRAFFICLIGHT_NEIGHBOR_EXPIRES //= 30 * SECOND; |
---|
| 68 | = 10 * Globals.MINUTE; |
---|
| 69 | |
---|
| 70 | //public static String inFile = System.getProperty("user.home")+File.separatorChar+"traces.dat"; |
---|
| 71 | public static String inFile="traces.dat"; |
---|
| 72 | public static Display demo; |
---|
| 73 | public static Engine engine; |
---|
| 74 | |
---|
| 75 | public static Integer mutex = new Integer(0); |
---|
| 76 | public static int flag = 1; |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | // Protocol codes (message types) |
---|
| 80 | public final static byte PROT_NEIGHBOR_DISCOVERY = 0; |
---|
| 81 | public final static byte PROT_SIMPLE_TEXT = 2; |
---|
| 82 | public final static byte PROT_SETOFCARS = 1; |
---|
| 83 | public final static byte PROT_TL_FEEDBACK = 3; |
---|
| 84 | public final static byte PROT_TL_LSA = 4; |
---|
| 85 | public final static byte VITP_PROT = 5; |
---|
| 86 | public final static byte ROAD_PLANNING_PROT = 6; |
---|
| 87 | public final static byte ROAD_METRICS_PROT = 11; |
---|
| 88 | |
---|
| 89 | //ezcab |
---|
| 90 | public final static byte PROT_EZCAB = 13; |
---|
| 91 | public final static int TYPE_EZCAB = -10; //nush ce sa pun |
---|
| 92 | |
---|
| 93 | public static boolean probabilisticModel = true; |
---|
| 94 | public static final int NONAGG_RECORD_SIZE = 27; |
---|
| 95 | public static final int TL_FEEDBACK_SIZE = 400; |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | public final static int WIRELESS_TRANSMISSION_TIME = 8; // ms |
---|
| 99 | public static int WIRELESS_TRANSMISSION_FRAMES; // ms |
---|
| 100 | |
---|
| 101 | public final static int MTU_SIZE = 2300; |
---|
| 102 | |
---|
| 103 | public static int PERCENT_EQUIPPED_VEHICLES=60; |
---|
| 104 | public final static int MESSAGE_PROCESSING_TIME=4; //ms |
---|
| 105 | |
---|
| 106 | |
---|
| 107 | //Traffic engineering parameters |
---|
| 108 | public final static double LANE_WIDTH = 2.5; // meters |
---|
| 109 | public final static double PEDESTRIAN_SPEED = 1; // m/sec |
---|
| 110 | public final static int MIN_WALK_LIGHT_TIME = 4 * SECOND; |
---|
| 111 | public final static int PEDESTRIAN_STARTUP_TIME = 4 * SECOND; |
---|
| 112 | |
---|
| 113 | public final static int ANALYSIS_PERIOD = 3 * MINUTE; // m/sec |
---|
| 114 | |
---|
| 115 | public final static int MAXIMUM_CYCLE_LENGTH = 120; //s |
---|
| 116 | public final static double VEHICLE_LENGTH = 6; // meters |
---|
| 117 | public final static int SATURATION_FLOW = 1500; // veh/sec/lane |
---|
| 118 | |
---|
| 119 | public static int SOCIALNETWORK = 0; |
---|
| 120 | |
---|
| 121 | public final static int DEFAULT_YELLOW_TIME = 3; //s |
---|
| 122 | public final static int DEFAULT_ALL_RED = 2; //s |
---|
| 123 | |
---|
| 124 | // the operational flow. Xc = 1 => intersection works at full capacity |
---|
| 125 | public static double Xc = 1.0 / 0.95; |
---|
| 126 | |
---|
| 127 | public static final int RED = 1; |
---|
| 128 | public static final int YELLOW = 2; |
---|
| 129 | public static final int GREEN = 3; |
---|
| 130 | |
---|
| 131 | public static final double QUEUEDISCHARGEFLOW = 0.45; |
---|
| 132 | public static final double CARSPERKM = 1.0 / 0.010 ; |
---|
| 133 | public static double DEMAND_DISTANCE_ON_FREE_FLOW = 0.1; |
---|
| 134 | |
---|
| 135 | public static WirelessTrafficLight monitorWTL = null; |
---|
| 136 | public static ArrayList<SimulatedCarInfo> monitoredCars = new ArrayList<SimulatedCarInfo>(); |
---|
| 137 | public static long volume = 0; |
---|
| 138 | public static long demand = 0; |
---|
| 139 | |
---|
| 140 | |
---|
| 141 | |
---|
| 142 | static String pwname = "Adaptive5Var"+System.currentTimeMillis()+".txt"; |
---|
| 143 | //public static String variationsFile = "variations5.txt"; |
---|
| 144 | public static String variationsFile = ".//variations//variations5.txt"; |
---|
| 145 | public static PrintWriter pw = null; |
---|
| 146 | public static PrintWriter pwxc = null; |
---|
| 147 | static{ |
---|
| 148 | try{ |
---|
| 149 | pw = new PrintWriter(System.out); |
---|
| 150 | pwxc = new PrintWriter(System.out); |
---|
| 151 | // pw = new PrintWriter(new FileWriter(pwname)); |
---|
| 152 | // pwxc = new PrintWriter(new FileWriter("X"+pwname)); |
---|
| 153 | // pwxc.println("Ciurel Xc = 0.95; cycle 120; carry- Colisiuni"); |
---|
| 154 | }catch(Exception e){ |
---|
| 155 | } |
---|
| 156 | } |
---|
| 157 | |
---|
| 158 | |
---|
| 159 | public static boolean comView = false; |
---|
| 160 | |
---|
| 161 | public static RoutingConstants routePlanConstants = new RoutingConstants(); |
---|
| 162 | |
---|
| 163 | public static long packets = 0; |
---|
| 164 | public static long collided = 0; |
---|
| 165 | public static long lost = 0; |
---|
| 166 | public static long interfered = 0; |
---|
| 167 | public static double maxRange = 10000; |
---|
| 168 | |
---|
| 169 | //Petroaca - emergency vehicle protocol code |
---|
| 170 | public final static byte PROT_EMERGENCY=7; |
---|
| 171 | |
---|
| 172 | //Serban - SCFT protocol |
---|
| 173 | public final static int PROT_SCFT = 9; |
---|
| 174 | |
---|
| 175 | // the 2 types of protocol simulation |
---|
| 176 | public static int PROTOCOL_80211=100; |
---|
| 177 | public static int PROTOCOL_DSRC=101; |
---|
| 178 | |
---|
| 179 | //the 2 types of propagation model |
---|
| 180 | public static final int TWO_RAY_GROUND=200; |
---|
| 181 | public static final int SHADOWING=201; |
---|
| 182 | public static final int RICEAN=202; |
---|
| 183 | |
---|
| 184 | //Petroaca - the SINRThreshold for BPSK modulation ( in dBs) |
---|
| 185 | public static double SINRThresholdBPSK_80211=0.01; |
---|
| 186 | |
---|
| 187 | public static double SINRThresholdBPSK_DSRC=0.016; |
---|
| 188 | |
---|
| 189 | //Petroaca - the thermalNoise that every station receives (in dBms) |
---|
| 190 | public static double ThermalNoise=-92; |
---|
| 191 | |
---|
| 192 | //Petroaca - the limit of power received a frame must have to not be ignored by the NoiseMonitor -in W |
---|
| 193 | public static double CS_THRESHOLD_TRG=5.011872*Math.pow(10,-16); |
---|
| 194 | |
---|
| 195 | //the collision threshold |
---|
| 196 | public static double CP_THRESHOLD=4.0; |
---|
| 197 | |
---|
| 198 | //the received power threshold in W for tworayforund prop |
---|
| 199 | public static double RX_THRESHOLD_TRG=5.82587*Math.pow(10,-14); |
---|
| 200 | |
---|
| 201 | public static double CS_THRESHOLD_S=3.1622777*Math.pow(10,-15); |
---|
| 202 | |
---|
| 203 | public static double RX_THRESHOLD_S=3.1622777*Math.pow(10,-14); |
---|
| 204 | |
---|
| 205 | //variables for Ricean fading |
---|
| 206 | public static double RICEAN_K=20; //in dB |
---|
| 207 | public static double RICEAN_MAX_VELOCITY_FREE=27.77; //in m/s |
---|
| 208 | public static double RICEAN_MAX_VELOCITY_URBAN=11.11; //in m/s |
---|
| 209 | public static String RICEAN_FILE_NAME="rice_table.txt"; |
---|
| 210 | |
---|
| 211 | //Petroaca - the system loss for the propagation classes |
---|
| 212 | public static double SYSTEM_LOSS=1.0; |
---|
| 213 | |
---|
| 214 | public static final long LIGHT_SPEED = 299792458; |
---|
| 215 | |
---|
| 216 | public static final long DSRC_FREQUENCY = 5900000000L; |
---|
| 217 | |
---|
| 218 | //Petroaca - the wavelength of the signal for the propagation modules |
---|
| 219 | public static double DSRC_LAMBDA=(double)LIGHT_SPEED/DSRC_FREQUENCY; // L= speed_of_light * 1/frequency |
---|
| 220 | |
---|
| 221 | //Petroaca - the gain of the antenna used on the station |
---|
| 222 | public static double ANTENNA_GAIN=1.0; //in dB |
---|
| 223 | |
---|
| 224 | // height of the antenna in metres |
---|
| 225 | public static double AH=1.5; |
---|
| 226 | |
---|
| 227 | //the power of the signal at the transmitter 0.031622777 |
---|
| 228 | public static double TRANSMITTER_POWER_80211=0.031622777; |
---|
| 229 | |
---|
| 230 | public static double TRANSMITTER_POWER_DSRC=3.1622777; |
---|
| 231 | |
---|
| 232 | //signal spread = half-width of the signal ( in Hz) |
---|
| 233 | public static double DSRC_SIGNAL_SPREAD=5.0*Math.pow(10,6); |
---|
| 234 | |
---|
| 235 | //data rate ( Mbps ) |
---|
| 236 | public static double DSRC_DATA_RATE=6000000; |
---|
| 237 | |
---|
| 238 | //pclp transmission rate in Mbps |
---|
| 239 | public static double DSRC_PCLP_RATE=1000000; |
---|
| 240 | //packet error rate threshold |
---|
| 241 | public static double DSRC_PER_THRESHOLD=Math.pow(10,-15); |
---|
| 242 | |
---|
| 243 | public static int DSRC_PREAMBLE_LENGTH=12; //in bytes |
---|
| 244 | |
---|
| 245 | public static int DSRC_PHYHEADER_LENGHT=3; //in bytes |
---|
| 246 | |
---|
| 247 | public static int DSRC_MACHEADER_LENGHT=32; //in bytes |
---|
| 248 | |
---|
| 249 | //Petroaca - variables used in the shadowing propagation model to calculate the received power of a frame |
---|
| 250 | public static double PATH_LOSS_EXPONENT_FREE=2.0; //with no to little obstruction |
---|
| 251 | public static double PATH_LOSS_EXPONENT_URBAN=2.3; //with considerable obstruction |
---|
| 252 | public static double SHADOWING_DEVIATION=4.0; // in dB |
---|
| 253 | public static double REFERENCE_DISTANCE=1.0; //in metres |
---|
| 254 | public static long RANDOM_SEED=0; |
---|
| 255 | |
---|
| 256 | // the 3 states in which the state machine of the physical layer can be at any one time |
---|
| 257 | public static final int IDLE=0; |
---|
| 258 | public static final int TXing=1; |
---|
| 259 | public static final int RXing=2; |
---|
| 260 | //the 2 states of the carrier sense status of the mac layer |
---|
| 261 | public static final int CCA_BUSY=300; |
---|
| 262 | public static final int CCA_IDLE=301; |
---|
| 263 | |
---|
| 264 | //Petroaca - the RX ,TX states of the MAC layer |
---|
| 265 | public static final int RX_RECV=5; |
---|
| 266 | public static final int RX_IDLE=6; |
---|
| 267 | public static final int TX_RECV=7; |
---|
| 268 | public static final int TX_IDLE=8; |
---|
| 269 | |
---|
| 270 | public static long DSRC_PACKETS_LOST_WEAK=0; |
---|
| 271 | public static long DSRC_PACKETS_LOST_CORRUPTED=0; |
---|
| 272 | public static long DSRC_PACKETS_LOST_COLLISION=0; |
---|
| 273 | public static long DSRC_PACKETS_LOST_TX=0; |
---|
| 274 | public static long DSRC_PACKETS_LOST_RX=0; |
---|
| 275 | public static long DSRC_PACKETS_LOST_PER=0; |
---|
| 276 | public static long DSRC_PACKETS_RECEIVED_OK=0; |
---|
| 277 | public static long DSRC_PACKETS_TOTAL=0; |
---|
| 278 | public static long DSRC_PACKETS_SEND_FALIURE_RX=0; |
---|
| 279 | public static long DSRC_PACKETS_SEND_FALIURE_NOISE=0; |
---|
| 280 | public static long DSRC_SEND=0; |
---|
| 281 | public static long p80211_SEND=0; |
---|
| 282 | |
---|
| 283 | public static double TEST_DIST=200; //in m |
---|
| 284 | |
---|
| 285 | public static double RECEPTION_RATE_THRESHOLD=50; |
---|
| 286 | |
---|
| 287 | //Petroaca - FCW crash speed thresholds |
---|
| 288 | public static double SPEED_DIFFERENCE=40; //in km/h |
---|
| 289 | |
---|
| 290 | //Petroaca Cooperative Colision Warning application information refresh time |
---|
| 291 | public static double CCW_REFRESH_TIME=10; |
---|
| 292 | |
---|
| 293 | //Petroaca - CCW application statistical parameters |
---|
| 294 | public static long CUMMULATIVE_PACKETS_FV=0; |
---|
| 295 | public static long CUMMULATIVE_PACKETS_NFV=0; |
---|
| 296 | public static long CUMMULATIVE_PACKETS_LAV=0; |
---|
| 297 | public static long CUMMULATIVE_PACKETS_RAV=0; |
---|
| 298 | |
---|
| 299 | public static double IRT_FV=0; |
---|
| 300 | public static double IRT_NFV=0; |
---|
| 301 | public static double IRT_LAV=0; |
---|
| 302 | public static double IRT_RAV=0; |
---|
| 303 | |
---|
| 304 | public static double PSP_FV=0; |
---|
| 305 | public static double PSP_NFV=0; |
---|
| 306 | public static double PSP_LAV=0; |
---|
| 307 | public static double PSP_RAV=0; |
---|
| 308 | |
---|
| 309 | public static long EMERGENCY_RECEIVED=0; |
---|
| 310 | public static long EMERGENCY_SENT=0; |
---|
| 311 | |
---|
| 312 | public static double TRANSMITTER_POWER=TRANSMITTER_POWER_DSRC; |
---|
| 313 | public static double SINRThresholdBPSK=SINRThresholdBPSK_DSRC; |
---|
| 314 | public static boolean DIFFERENTIAL_CW=true; |
---|
| 315 | public static boolean MULTI_CHANNEL=true; |
---|
| 316 | } |
---|