Scalability of car - Following and lane-changing models in

First of all, I would like to give mydeepest and sincerest thanks to myadvisor, Dr. Sherif Ishak, for his brilliant guidance, encouragement and support. Thank you for always being there to help meand support my study. I am also grateful to Dr. Ishak for funding methroughout my study for a Master’s degree. I would like to give myspecial thanks to Dr. Chester Wilmot and Dr. Brian Wolshon for their suggestions and advice. Deep appreciation goes to mycolleague, Ciprian Alecsandru, who developed the programcode much needed for this study. Thank you for your unselfishand timely help. I also want to acknowledge Srikanth Chakravarthy for his precious assistance. Thanks are due also to all myfriends, Jiao, Hong, Xuyong and Erick. Thank you for listening to meand for your words of encouragement. Your support meant the world to me

pdf157 trang | Chia sẻ: banmai | Lượt xem: 1888 | Lượt tải: 0download
Bạn đang xem trước 20 trang tài liệu Scalability of car - Following and lane-changing models in, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
vph 1.007791 4.459921 9.732963 111 Table 5-8 Difference in RADE (%) Between the Sub-Optimal and Optimal Conditions (GM3) Downsampling Ratio Flow Rate( ) pq 100=pN 200=pN 300=pN pq =500 vph 2.14373 1.93592 1.73916 pq =1000 vph 0.07148 0.36328 0.67487 pq =1500 vph 0.06835 0.33390 0.59805 r = 2 1 pq =2000 vph 0.06688 0.32092 0.56584 pq =500 vph 2.90725 2.65144 2.42068 pq =1000 vph 0.04729 0.09194 0.10567 pq =1500 vph 0.04522 0.08450 0.09364 r = 3 1 pq =2000 vph 0.04425 0.08122 0.08860 pq =500 vph 2.93205 1.36536 1.36976 pq =1000 vph 0.07705 0.12655 0.13278 pq =1500 vph 0.07367 0.11632 0.11766 r = 4 1 pq =2000 vph 0.07209 0.11180 0.11133 pq =500 vph 3.58337 1.06436 1.11337 pq =1000 vph 0.11192 0.16236 0.18468 pq =1500 vph 0.10701 0.14923 0.16366 r = 5 1 pq =2000 vph 0.10472 0.14343 0.15484 112 Table 5-9 Difference in RADE (%) Between the Sub-Optimal and Optimal Conditions (NETSIM) Downsampling Ratio Flow Rate( ) pq 100=pN 200=pN 300=pN pq =500 vph 0.040146 1.866038 1.492833 pq =1000 vph 0.033422 1.870139 3.851581 pq =1500 vph 0.031654 1.813345 3.366434 r = 2 1 pq =2000 vph 0.030839 1.860245 3.259776 pq =500 vph 0.035817 3.119727 2.175121 pq =1000 vph 0.029818 2.510704 7.096332 pq =1500 vph 0.028241 2.401876 6.016322 r = 3 1 pq =2000 vph 0.027513 2.276815 5.548989 pq =500 vph 0.033326 2.229266 1.226555 pq =1000 vph 0.027744 2.487014 7.217328 pq =1500 vph 0.026277 2.396912 6.35734 r = 4 1 pq =2000 vph 0.0256 2.50879 6.154581 pq =500 vph 0.043291 1.766006 0.588678 pq =1000 vph 0.03604 2.21534 4.604711 pq =1500 vph 0.034134 2.358581 3.829099 r = 5 1 pq =2000 vph 0.033254 2.235774 3.663914 113 Table 5-10 Difference in RADE (%) Between the Sub-Optimal and Optimal Conditions (FRESIM) Downsampling Ratio Flow Rate( ) pq 100=pN 200=pN 300=pN pq =500 vph 1.791775 5.009369 5.489826 pq =1000 vph 1.22289 1.822739 2.61554 pq =1500 vph 1.014391 2.403917 3.393606 r = 2 1 pq =2000 vph 0.883935 3.169654 4.934439 pq =500 vph 0.34333 2.26227 2.258947 pq =1000 vph 0.133655 1.894196 3.997258 pq =1500 vph 0.022709 1.691904 3.44029 r = 3 1 pq =2000 vph 0.010139 1.608808 3.616812 pq =500 vph 0.013341 2.424764 2.409173 pq =1000 vph 0.011114 1.832118 4.780815 pq =1500 vph 0.010528 1.632683 3.987672 r = 4 1 pq =2000 vph 0.010258 1.548408 3.682229 pq =500 vph 0.013969 1.484109 1.474577 pq =1000 vph 0.011638 1.205125 3.447919 pq =1500 vph 0.011024 1.073942 2.875905 r = 5 1 pq =2000 vph 0.010741 1.018507 2.65562 114 work for the FRESIM car-following model. This table suggests that using the linear downsampling procedure will cause a range of 0.010139% to 5.489826% accuracy loss, in terms of RADE, comparing to the optimal solutions. Generally seeking for a balance between simulation performance and computational resources, the linear downsampling procedure can be used instead of the optimal solutions for the three car-following models. The level of accuracy loss varies according to the different models. Figure 5-24 shows the overall sub-optimal downsampling performance of each car-following model discussed above. In this figure, the upper and lower bounds of RADE (%) for each downsampling ratio r=1/2, 1/3, 1/4, and 1/5 cases. From all the three car-following models’ observations, the sub-optimal downsampling performance improves with the increase of the downsampling ratio. And the difference between the upper and lower bounds decrease with the increase of the downsampling ratio. This observation confirms that lower downsampling ratios lead to more information loss. And it is consistent with all the three models results. In terms of the lowest relative average vehicular delay error (%), the GM3 car-following model results in a best sub-optimal downsampling performance, while the FRESIM car-following model gets a highest relative error. More research needs to conduct on the downsampling performance in the CORSIM (NESTIM and FRESIM) model with more operation parameters, like more number of vehicles, more flow rate, and a more accurate and wider range of sensitivity and adaptation parameters in microcosm 115 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 0.2 0.25 0.33 0.5r R AD E (% ) (a) GM3 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 0.2 0.25 0.33 0.5 r R A D E (% ) (b) NETSIM 0 1 2 3 4 5 6 7 8 9 10 11 12 13 0.2 0.25 0.33 0.5 r R A D E (% ) (d) FRESIM Figure 5-24: Overall Sub-Optimal Downsampling Performance 116 environment ( andmα mT∆ ). 5.5. COMPUTATIONAL EFFICIENCY The approach presented in this research attempts to gain computational efficiency of microscopic traffic simulation processes through reducing the network size and the number of simulated entities; as opposed to increasing the system updating time in the prototype environment. Although the latter approach is feasible, it has limitations and consequences as well. This is because the simulated entities maintain the same state during the system scan time (e.g. vehicle accelerations or decelerations). Therefore, the drivers are assumed to have no response to any stimulus in the driving environment that might be triggered within the system scan time. This imposes a limitation on the maximum feasible system scan time. Also, of particular concern is the impact of increasing the system scan time on local and asymptotic traffic stability. Based on some preliminary results, the downsampling procedure led to an equivalent adaptation time in the microcosm environment that is larger than that in the prototype environment (i.e. 10 m rT∆ ≈ ∆ pT ). If the maximum system scan time is set equal to the driver adaptation time, then the downsampling procedure will allow the maximum system scan time in the microcosm environment to increase by the ratio 1r . As a result of increasing the system scan time by 1r , and simultaneously decreasing the number of simulated entities by the ratio , the computational savings could potentially increase by the ratio . Mathematically, if we are simulating vehicles in the prototype r 2r pN 117 environment for time period T with system update time t , then the number of computations used to update one parameter (e.g. acceleration) can be roughly estimated as p p p p p N T t . In the downsampled network, that number of computations can be estimated similarly from m m m N T t . Since m pN rN= , 1mt r= pt p, and mT T= , the ratio between the number of computations in both environments will be equal to . Since the product of 2r the optimal sensitivity parameter and the adaptation time in the microcosm environment will not change, local and asymptotic stability in the downsampled network will be preserved. 118 6. SUMMARY AND CONCLUSIONS 6.1. STUDY SUMMARY This study presented an approach to reduce the computational requirements of car-following and lane-changing models in microscopic traffic simulation systems. To achieve this goal, a downsampling procedure was developed to create a geometrically, kinematically, and behaviorally representative microcosm environment. A methodology was developed to optimize the behavior of vehicles in the microcosm environment by minimizing the trajectory errors and relative average vehicular delay errors. The mathematical formulation was derived exclusively for one-lane operation and deterministic driving conditions to seek optimal solutions that would facilitate optimization under stochastic conditions in subsequent research studies. Experimental work was conducted to examine the behavioral scalability for one-lane freeway segment under different operating conditions. The Microscopic Traffic Simulation (SMTS) module was developed to perform the experimental work. The experimental work was carried out under different traffic flow conditions and downsampling ratios for the GM-3, NETSIM and FRESIM car-following models. Trajectory based RMSE and relative average vehicular delay error (RADE) were used as the performance measures to assess the efficiency of the downsampling process. The experimental work based on GM3was conducted to determine an optimal solution for the two behavioral parameters (sensitivity and adaptation time) in the microcosm environment. 119 For each performance measure, trajectory based RMSE and RADE, the experimental work includes a total of 48*3=144 cases under different traffic flow conditions and downsampling ratios, in three scenarios respectively. The experiment conducted on the NETSIM and FRESIM car-following models used the same operation conditions to determine the optimal solution for the two behavioral parameters (sensitivity and adaptation time) in the microcosm environment. The experimental work was conducted under trajectory scenario 3 only for NETSIM and FRESIM. And the performance was measured by RADE for NETSIM and FRESIM. Finally, the over all sub-optimal downsampling performance including all the car-following models used in this study was discussed. 6.2. CONCLUSIONS A mathematical approach was developed to simulate a reduced scale system (microcosm environment) with fewer entities to improve the computational efficiency of microscopic simulation of large transportation networks. An objective function with a set of constraints was defined to explain the behavioral scalability of traffic simulation processes. Experimental analysis was conducted on the three car-following models: GM3, NETSIM and FRESIM to test the approach performance under different traffic conditions. The results of the GM3 experimental work show that for each downsampling ratio (r=1/2, 1/3, 1/4, and 1/5), the optimal values of the sensitivity parameter, in terms of RMSE, are 120 consistent with the corresponding downsampling ratios, which confirms that p m α α0 =r. The optimal values of adaptation time, however, increased by their corresponding protype values and the gets an approximate relationship 5553.00315.3 rT T p m ≈∆∆ . Also, the ratio of the average vehicular delays in the microcosm and the prototype environments for each case was very close to 1.0, which suggests that the effect of information loss caused by downsampling was relatively insignificant and also that the optimization procedure was successful in preserving one of the most important macroscopic characteristics in simulation processes. The results of the experimental work based on NETSIM and FRESIM were shown in terms of RADE. The optimal values in this work were not exactly consistent with their corresponding downsampling ratios as results in the GM3 work. But the over all sub-optimal downsampling performance shows that the range of the relative average vehicular delay errors in NESIM and FRESIM car-following models are only 0.600996% to 7.951548% and 0.804925% to 12.04206%. This suggests that the linear scalability of NETSIM and FRESIM car-following models can exist by scarifying a range of accuracy in terms of RADE. The ratio of the average vehicular delays in the microcosm and the prototype environments for each model was also very close to 1.0, which is consistently with the result in GM3 car-following model. The over all sub-optimal downsampling performance including all the car-following models used in this study was expressed at the end. The sub-optimal downsampling performance 121 improves with the increase of the downsampling ratio in all of the three car-following models. This observation confirms that lower downsampling ratios lead to more information loss. Microscopic simulation of the reduced scale system (microcosm environment) ensures higher computational efficiency and quicker results that are extremely useful while evaluating large scale transportation network systems in real-time. The developed approach also finds applications in emergency evacuation procedures and in coarse analysis, such as planning. The success of this approach will have a tremendous impact on the capabilities of next generation traffic simulation models. Further research is necessary to test this approach in stochastic conditions along with more different car-following and lane-changing models. 6.3. FUTURE RESEARCH In this research, GM-3 and CORSIM car-following models were used to test the ability to downsample large-scale simulation systems while preserving most of the behavioral characteristics. The findings of this basic research will have cross-disciplinary impact since the concept of simulation scalability may be applicable to areas beyond transportation applications where microsimulation modeling is of particular relevance. Different car-following models can be used to inform the applicability of this research. A wider range of operation conditions can be selected to conduct the experimental work in CORSIM car-following model to get more accurate and realistic results. 122 REFERENCES Ahmed. A, R. Khanal, and P. Rust (2002) “Evaluation of Freeway Diversion Route Plans Using Microscopic Simulation and Real-Time Data: The Case of Idaho’s Treasure Valley Corridor.” Transportation Research Board Annual Meeting in Washington D.C. Ahmed K.I., Ben-Akiva M., Koutsopoulos H.N. and Mishalani R.G. (1996) “Models of Freeway Lane Changing and Gap Acceptance Behavior”, in Proceedings of the 13th International Symposium on the Theory of Traffic Flow and Transportation, pp. 501-515. Ahmed K.I. (1999) “Modeling Drivers’ Acceleration and Lane Changing Behavior”, PhD Dissertation, Department of Civil and Environmental Engineering, MIT. Aycin, M., and R. Benekohal (1999) “Comparison of Car-Following Models for Simulation”, Transportation Research Record 1678, pp. 116-127 Aycin, M. F., and R. F. Benekohal. Linear Acceleration Car-Following Model Development and Validation. Transportation Research Record 1644, TRB, National Research Council, Washington, D.C., 1998, Benekohal R.F., Treiterer J. CARSIM:Car-following Model fro Simulation of Traffic in Normal and Stop-and-Go Conditions. Transportation Research Record 1194, 1988 Brackstone, M. and M. McDonald (1999) “Car-following: A Historical Review”, Transportation Research Part F, Vol.2, Issue 4, pp 181-196. Bullock, D., and A. Catarella (1998) “A real-time simulation environment for evaluating traffic signal systems”, Transportation Research Record 1634, pp 130-135. Chakravarthy S. (2003) “Exploring Geometric, Kinematic, and Behavioral Scalability of Microscopic Traffic Simulation Systems”, Master’s thesis, Department of Civil and Environmental Engineering , Louisiana State University. Chandler, R.E, R. Herman and E. W. Montroll (1958) “Traffic Dynamics: Studies in Car-Following”, Operations Research, 6, 165-184. Cheu,R., Recker W., Ritchie S., ‘‘Calibration of INTRAS for Simulation of 30-sec Loop Detector Output’’, TRR 1457, 1994 pp 208-215. 123 Chundury, S., and B. Wolshon (2000) “Evaluation of the CORSIM Car-Following Model Using GPS Field Data” Transportation Research Record, No. 1710. Chung, J., and K. Goulias (1997) “Travel Demand Forecasting Using Microsimulation: Initial Results from Case Study in Pennsylvania”, Transportation Research Record 1607, pp 24-30 Daganzo, C. (1994). "Cell Transmission Model: A Dynamic Representation of Highway Traffic Consistent with the Hydrodynamic Theory", Transportation Research, Vol. 28B, No. 4, pp. 269-287. Dia, H. (2002) “An Agent-Based Approach to Modeling Driver Route Choice Behavior Under the Influence of Real-Time Information”, Transportation Research Part C, pp 331-349. FHWA (1998) “CORSIM User Manual (1.04 ed.)”, Federal Highway Administration, US Department of Transportation, McLean, Virginia. Gartner, N.,C. Messer, and A. Rathi (eds.), “Traffic Flow Theory”, Transportation Research Board Special Report 165. Gipps, P.G. (1986) “A Model For The Structure of Lane-Changing Decisions,” Transportation research, Vol. 20 B, No. 5, 1986, pp. 403-414. Greenburg,H. , ‘‘An Analysis of Traffic Flow’’, Operations Research 7(I),pp,255-275. Hasan. M, M. Jha, and M. Ben-Akiva, “Evaluation of Ramp Control Algorithms Using Microscopic Traffic Simulation”, Transportation Research Part C, 2002, Vol. 10, Issue 3, pp 229-256. Hatipkarasulu, Y., B. Wolshon, and C. Quiroga (2000) “A GPS Based Approach for the Analysis of Car Following Behavior.” ASCE Journal of Transportation Engineering, Vol. 126. No. 4, p 324-331. Hawas, Y. (2002) “Calibrating Simulation Models for Advanced Traveler Information Systems/Advanced Traffic Management Systems Applications”, ASCE Journal of Transportation Engineering, Vol. 128, No. 1, pp. 80-88 Hidas, Peter (2002) “A Microscopic Study of Lane Changing Behavior”, paper presented 124 at the 24th CAITR conference Ishak, S. (2003) "A Methodology for Downsampling Microscopic Simulation Processes of Large-Scale Transportation Networks", Submitted for publication in Transportation Research Part B, 2003. Ishak, S., C. Alecsandru and S. Chakravarthy (2004) "Exploring Geometric, Kinematic, and Behavioral Scalability of Microscopic Traffic Simulation Systems: A Case Study" Submitted for publication in the IEEE Transactions on ITS 2004. Ishak, S., S. Chakravarthy and C. Alecsandru (2004) "Performance versus Scalability of Microscopic Traffic Simulation Systems." Preprint CD-ROM of the 83rd Annual Meeting of TRB, National Research Council, Washington D.C., 2004. Ishak, S., C. Alecsandru, and S. Chakravarthy. (2004) "Scalability Concepts of Microscopic Traffic Simulation Processes" Submitted for publication in the ASCE Journal of Transportation Engineering. Jayakrishnan, R., J. Oh and A. Sahraoui (2001) "Calibration and Path Dynamics Issues in Microscopic Simulation for Advanced Traffic Management and Information Systems," Transportation Research Record 1771 pp. 9-17 Kwon, E., B. Choi, B, and H. Park (1999) “A Personal Computer-Based Parallel Simulation System for On-Line Assessement of Freeway Operational Strategies.” Transportation Research Board Annual Meeting in Washington D.C. Lahiri, S., A. C. Gan, and Q. Shen (2002) “Using Simulation to Estimate Speed Improvements from Simple Ramp Metering at On-Ramp Junctions.” Transportation Research Board Annual Meeting in Washington D.C. Levison, W. (1998) “Interactive Highway Safety Design Model Issues Related to Driver Modeling”, Transportation Research Record 1631, pp 20-27 Levison, W., O. Simsek, A. Bittner, Jr., and S. Hunn (2001) “Computational Techniques Used in the Driver Performance Model of the Interactive Highway Safety Design Model”, Transportation Research Record 1779, pp. 17-15 Leonard II, J., “An Overview of Simulation Models in Transportation”, Simulation Technology, Vol. 5, No. 1b, September 2001. 125 Logi, Filippo, Craig R. Rindt, Michael G. McNally and Stephen G. Ritchie. "TRICEPS-CARTESIUS: Advanced Transportation Management System Test Bed for Evaluation of Interjurisdictional Traffic Management Strategies," Transportation Research Record 1748, 2001, pp. 125-131. May, A. (1990) “Traffic Flow Fundamentals”, Prentice Hall, Englewood Cliffs, New Jersey. Narupiti, S., Taylor W. C., Abdel-Rahim, A. S. (1996) “Impact of ATMS and ATIS Control Strategies on Incident Congestion: A Simulation Study.” ITS world congress conference proceedings. Nakayama, S., R. Kitamura, and S Fujii (1999) “Drivers’ Learning and Network Behavior: Dynamic Analysis of the Driver-Network System as a Complex System”, Transportation Research Record 1676, pp 30-36 Nilson, L.B. (1998) Teaching at its Best. Anker Publishing Company, Inc., Bolton, MA. Park, B., N. Rouphail, and J. Sacks (2001) “Assessment of Stochastic Signal Optimization Method Using Microsimulation”, Transportation Research Record 1748, pp 40-45. Rakha, H., M. Van Aerde, L. Bloomberg, and X. Huang (1998) “Construction and calibration of Large-Scale Microsimulation Model of the Salt Lake Area”, Transportation Research Record 1644, pp 93-102. Revised Monograph on Traffic Flow Theory (1997) Special Report by the Transportation Research Board. Rilett, L. (2001) “Transportation Planning and TRANSIMS Microsimulation Model: Preparing for the Transition”, Transportation Research Record 1777, pp 84-92 Rilett, L., K. Kim, and B. Raney (2000) “Comparison of Low-Fidelity TRANSIMS and High-Fidelity CORSIM Highway Simulation Models with Intelligent Transportation System Data”, Transportation Research Record 1739-0678 Sarosh Khan, Pawan Maini, and Kittichai Thanasupsin (2000) “Car-Following and Collision Constraint Models for Uninterrupted Traffic: Reexamination Using High-Precision Global Positioning System Data”, Transportation Research Record 1710, 126 pp. 37-46 Sarvi, M., M. Kuwahara, and A. Ceder (2002) “Developing Control Strategies for Freeway Merging Points under Congested Traffic Situations Using Modeling and a Simulation Approach.” Transportation Research Board Annual Meeting in Washington D.C. Trapp, R. (2002) “Microscopic Traffic Flow Modeling of Large Urban Networks.” Transportation Research Board Annual Meeting in Washington D.C. Velan, S. M., and M. Van Aerde (1996) “Gap Acceptance and Approach Capacity at Unsignalized Intersections”, ITE Journal, Vol. 66, No. 3, pp. 40-45. Wang, Y. and P. Prevedouros (1998) “Comparison of INTEGRATION, TSIS/CORSIM and WATSim in Replicating Volumes and Speeds on Three Small Networks” Transportation Research Board Annual Meeting in Washington D.C. Wicks, D.A., Andrews B.J. ‘‘Development and Testing of INTRAS, a Microscopic Freeway Simulation Model’’, Vol. 1: Pregram Design, Parameter Calibration and Freeway Dynamics Component Development. Report FHWA/RD-80/106. FHA, U.S. Department of Transportation, 1980. Wolshon, B., and Y. Hatipkarasulu (2000) “Results of Car Following Analyses Using Global Positioning System” ASCE Journal of Transportation Engineering, Vol. 126, No. 4, pp 324-331 Yang, Q., H. Koutsopoulos, and M. Ben-Akiva (2000) “A Simulation Laboratory for Evaluating Dynamic Traffic Management Systems.” Transportation Research Board Annual Meeting in Washington D.C. Zhang, Y, L. Owen, and J. Clark (1998) “Multiregime Approach for Microscopic Traffic Simulation”, Transportation Research Record 1631, pp. 103-112 Ziliaskopoulos, A.K. and Lee, S. (1997). "A Cell Transmission Based Assignment-Simulation Model for Integrated Freeway/Surface Street Systems", Transportation Research Record, No.1701, pp. 12-23. Ziliaskopoulos, A.K. and Waller, S.T. (2000). "An Internet-based Geographical Information System that Integrates Data, Models and Users for Transportation Applications", Transportation Research, Vol. 8C, No. 1, pp. 427-444. 127 APPENDIX – SIMULATION PROGRAM MODULE // CarFollowModel.h: interface for the CCarFollowModel class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_CARFOLLOWMODEL_H__8C3D3347_D8FC_4E4B_913E_F748BA 948453__INCLUDED_) #define AFX_CARFOLLOWMODEL_H__8C3D3347_D8FC_4E4B_913E_F748BA948453__IN CLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "Vehicle.h" #include ////////////////// #define PI 3.1415926535 #define LOOP_LENGTH 264000.//165876.09211//2.*PI*5*5280. // 5 miles radius [ft]741 #define DETECTOR_SIZE 150 // [ft] #define MIN_SPEED 0 //[ft/sec] #define MAX_SPEED 110.//(75mph*5280ft/mile/3600sec/hour) //[ft/sec] #define MIN_ACC -10. //[ft/sec2] #define MAX_ACC 10. //[ft/sec2] #define MAX_ACC_CHANGE_RATE 15. //[ft/sec/sec] #define CRUISE_ACC 2 //acceleration used to get to the cruise(free flow, max) speed #define VEH_LENGTH 24. //[ft] - vehicle length #define MAX_DISTANCE 396000.//5280.*75. //(75 miles )[ft] max distance for the space snap-shot to check point densities #define DELAY_SPACE_INTERVAL 39600. //(100-th of a mile) [ft] distance interval for the space snap-shot to check point delays ('energies') #define DENSITY_SPACE_INTERVAL 5280. //(10-th of a mile) [ft] distance interval for the space snap-shot to check point densities #define DENSITY_TIME_INTERVAL 60. //(1min)[sec] time interval to take density 128 snap-shots #define FEET_INA_MILE 5280. #define INFLUENCE_ZONE 200. // limit for which the car-following model is engaged //#define DENSITY_TIME_SLICE 60 // [sec] - for density measures computation along the specified //#define DENSITY_SECTION_LENGTH 20 //DENSITY_SECTION_LEGTH //calculate different errors (delay, trajectory, etc.) for microcosm validation #define AVG_DELAY 0x0001 #define AVG_DEL 0x1000 #define AVG_DENSITY 0x0002 #define AVG_TRAJECT 0x0004 #define REC_TRAJECT 0x0008 class CCarFollowModel { protected: public: CCarFollowModel(); //CCarFollowModel(paramSMTS *params); virtual ~CCarFollowModel(); // offset=0 works for prototype by default static void ComputeNextVehicle(int carfol_model, paramSMTS params, CVehicle* leader, CVehicle* follower, double **density, double *delay, int idx, int lag, double headway, int id, double alphaVal, double ratio) { switch (carfol_model) { case CARFOLLOW_GM1: ComputeNextVehicleGM1(params, leader, follower, density, delay, idx, lag, headway, id, alphaVal, ratio); break; case CARFOLLOW_GM3: ComputeNextVehicleGM3(params, leader, follower, density, delay, idx, lag, headway, id, alphaVal, ratio); break; 129 case CARFOLLOW_NETSIM: ComputeNextVehicleNETSIM(params, leader, follower, density, delay, idx, lag, headway, id, alphaVal, ratio); break; case CARFOLLOW_FRESIM: ComputeNextVehicleFRESIM(params, leader, follower, density, delay, idx, lag, headway, id, alphaVal, ratio); break; } } //lagOffset - to accomodate the same function for the variation of lag in microcosm //ratio is always less than 1, so we can also distinguish between vehicles in prototype and microcosm static void ComputeNextVehicleGM1(paramSMTS params, CVehicle* leader, CVehicle* follower, double **density, double *delay, int idx, int lag, double headway, int id, double alphaVal, double ratio) { //pick the random variables of the vehicle //stochastic components if their variance is > 0 if (params.alphaVar >0) { alphaVal = follower->GetAlpha(); } if (params.deltaTVar >0) { lag = follower->GetLag(); } //do not apply the model yet, if the vehicle didn' enter the system //- an equal(for the beginning) arrival headway is assumed if (idx*params.updatingTime <= id*headway) { idx = (idx > params.maxlag) ? params.maxlag : idx; follower->SetPosition(0, idx); follower->SetSpeed(0, idx); follower->SetAcceleration(0, idx); } else { //lv, fv - leading/follower vehicle 130 //Lag - value at some lag ago //Crt - current value //Prv - last(previous) values double lvLagS; double fvLagS; double lvCrtS, lvCrtP, lvPrvP; double fvCrtA, fvCrtS, fvCrtP; double fvPrvA, fvPrvS, fvPrvP; //get previouslyc computed values for leading car lvLagS = leader->GetSpeed(params.maxlag - leader->GetLag()); lvCrtS = leader->GetSpeed(params.maxlag); lvCrtP = leader->GetPosition(params.maxlag); lvPrvP = leader->GetPosition(params.maxlag-1); //get previously computed values for following car fvLagS = follower->GetSpeed(params.maxlag - lag); fvPrvS = follower->GetSpeed(params.maxlag - 1); fvPrvA = follower->GetAcceleration(params.maxlag - 1); fvPrvP = follower->GetPosition(params.maxlag - 1); /*** loop trajectory not implemented yet ********* //adjust the vehicle position for the loop case // if the vehicle previously passed the loop (2*PI*R) // then add loop lenght to its current position if (leader->GetLoopFlag()) { if (lvPrvP > lvCrtP) { lvPrvP += LOOP_LENGTH; } lvCrtP += LOOP_LENGTH; } //use gm1 model if in the influence zone //if (1 || (lvPrvP - fvPrvP) <= INFLUENCE_ZONE*ratio) { if (1 || (lvPrvP - fvPrvP) GetInfluenceZone()*ratio) { fvCrtA = alphaVal* (lvLagS - fvLagS); } 131 else { // fvCrtA = fvPrvA; fvCrtA = follower->GetAcc2CruiseSpeed(); } **************/ //use CF gm1 model fvCrtA = alphaVal* (lvLagS - fvLagS); //CHECK AGAINST MAX RATE OF CHANGE IN ACCELERATION (SAY MAX 15 FT/SEC/SEC => [e.g. 1.5FT/SEC/0.1SEC]) if (abs(fvPrvA-fvCrtA) > MAX_ACC_CHANGE_RATE*params.updatingTime) { fvCrtA = fvPrvA + ( fvCrtA<fvPrvA ?(-1):(+1))*MAX_ACC_CHANGE_RATE*params.updatingTime; } //to be on the safe side constraint for acceleration fvCrtA = (fvPrvS >= MAX_SPEED*ratio && fvCrtA > 0) ? 0 : fvCrtA; //acc boundary check could be redundant for GM1 fvCrtA = (fvCrtA = MIN_ACC*ratio) ? fvCrtA : MIN_ACC*ratio) : MAX_ACC*ratio; fvCrtS = fvPrvS + 0.5*params.updatingTime*(fvPrvA + fvCrtA); //speed boundary check could be redundant for GM1 fvCrtS = (fvCrtS = MIN_SPEED*ratio) ? fvCrtS : MIN_SPEED*ratio) : MAX_SPEED*ratio; /*** loop trajectory not implemented yet ********* // reset the flag for the leading veh // if the following veh passed the loop too // also, set the flag for the following vehicle if (fvPrvP > LOOP_LENGTH) { leader->SetLoopFlag(false); fvPrvP -= LOOP_LENGTH; follower->SetLoopFlag(true); } //check against minimum spacing 132 if (0 && fvCrtP+VEH_LENGTH > lvCrtP) { fvCrtP = lvCrtP - VEH_LENGTH; fvCrtS = (fvCrtP-fvPrvP)/(0.5*params.updatingTime) - fvPrvS; fvCrtA = (fvCrtS-fvPrvS)/(0.5*params.updatingTime) - fvPrvA; } ***************/ fvCrtP = fvPrvP + 0.5*params.updatingTime*(fvPrvS + fvCrtS); //position boundary check could be redundant for GM1 fvCrtP = (fvCrtP < 0) ? 0 : fvCrtP; //set the vehicular parameters for the following veh follower->SetPosition(fvCrtP, params.maxlag); follower->SetSpeed(fvCrtS, params.maxlag); follower->SetAcceleration(fvCrtA, params.maxlag); //check for a snap-shot density if ((idx % (long)(DENSITY_TIME_INTERVAL / params.updatingTime)) == 0) { computeDensity(fvCrtP, int(idx/(DENSITY_TIME_INTERVAL / params.updatingTime)), density, ratio); } //check for a snap-shot delay //but first get the updated position of the vehicle fvCrtP = follower->GetPosition(params.maxlag); if (fvCrtP >= follower->GetDelaySnapCount()*DELAY_SPACE_INTERVAL*ratio || (idx+1) == params.endSimTime) { if (follower->GetDelaySnapCount() > 10) { //not good AfxMessageBox("known error, please let me know (GM1)! -- ciprian"); exit(0); idx += 0; } delay[follower->GetDelaySnapCount()] = idx*params.updatingTime - fvCrtP/(MAX_SPEED*ratio) - id*headway; 133 follower->AddDelaySnapCount(); } } } //// END OF gm1 CAR-FOLLOWING MODEL //lagOffset - to accomodate the same function for the variation of lag in microcosm //ratio is always less than 1, so we can also distinguish between vehicles in prototype and microcosm static void ComputeNextVehicleGM3(paramSMTS params, CVehicle* leader, CVehicle* follower, double **density, double *delay, int idx, int lag, double headway, int id, double alphaVal, double ratio) { //pick the random variables of the vehicle //stochastic components if their variance is > 0 if (params.alphaVar >0) { alphaVal = follower->GetAlpha(); } if (params.deltaTVar >0) { lag = follower->GetLag(); } //do not apply the model yet, if the vehicle didn' enter the system //- an equal(for the beginning) arrival headway is assumed if (idx*params.updatingTime <= id*headway) { idx = (idx > params.maxlag) ? params.maxlag : idx; follower->SetPosition(0, idx); follower->SetSpeed(0, idx); follower->SetAcceleration(0, idx); } else { //lv, fv - leading/follower vehicle //Lag - value at some lag ago //Crt - current value //Prv - last(previous) values double lvLagS, lvLagP; double fvLagS, fvLagP; 134 double lvCrtS, lvCrtP, lvPrvP; double fvCrtA, fvCrtS, fvCrtP; double fvPrvA, fvPrvS, fvPrvP; //get previouslyc computed values for leading car lvLagS = leader->GetSpeed(params.maxlag - leader->GetLag()); lvLagP = leader->GetPosition(params.maxlag - leader->GetLag()); lvCrtS = leader->GetSpeed(params.maxlag); lvCrtP = leader->GetPosition(params.maxlag); lvPrvP = leader->GetPosition(params.maxlag-1); //get previously computed values for following car fvLagS = follower->GetSpeed(params.maxlag - lag); fvLagP = follower->GetPosition(params.maxlag - lag); fvPrvS = follower->GetSpeed(params.maxlag - 1); fvPrvA = follower->GetAcceleration(params.maxlag - 1); fvPrvP = follower->GetPosition(params.maxlag - 1); /*** loop trajectory not implemented yet ********* //adjust the vehicle position for the loop case // if the vehicle previously passed the loop (2*PI*R) // then add loop lenght to its current position if (leader->GetLoopFlag()) { if (lvPrvP > lvCrtP) { lvPrvP += LOOP_LENGTH; } lvCrtP += LOOP_LENGTH; } //use gm1 model if in the influence zone //if (1 || (lvPrvP - fvPrvP) <= INFLUENCE_ZONE*ratio) { if (1 || (lvPrvP - fvPrvP) GetInfluenceZone()*ratio) { fvCrtA = alphaVal* (lvLagS - fvLagS); } else { // fvCrtA = fvPrvA; fvCrtA = follower->GetAcc2CruiseSpeed(); 135 } **************/ //use gm3 model if (lvLagP - fvLagP > 3*VEH_LENGTH) { fvCrtA = (alphaVal/(lvLagP - fvLagP))*(lvLagS - fvLagS); } else { fvCrtA = 0; } /*/CHECK AGAINST MAX RATE OF CHANGE IN ACCELERATION (SAY MAX 15 FT/SEC/SEC => [e.g. 1.5FT/SEC/0.1SEC]) if (abs(fvPrvA-fvCrtA) > MAX_ACC_CHANGE_RATE*params.updatingTime) { fvCrtA = fvPrvA + ( fvCrtA<fvPrvA ?(-1):(+1))*MAX_ACC_CHANGE_RATE*params.updatingTime; }*/ //to be on the safe side constraint for acceleration fvCrtA = (fvPrvS >= MAX_SPEED*ratio && fvCrtA > 0) ? 0 : fvCrtA; //acc boundary check could be redundant for GM1 fvCrtA = (fvCrtA = MIN_ACC*ratio) ? fvCrtA : MIN_ACC*ratio) : MAX_ACC*ratio; fvCrtS = fvPrvS + 0.5*params.updatingTime*(fvPrvA + fvCrtA); //speed boundary check could be redundant for GM1 fvCrtS = (fvCrtS = MIN_SPEED*ratio) ? fvCrtS : MIN_SPEED*ratio) : MAX_SPEED*ratio; /*** loop trajectory not implemented yet ********* // reset the flag for the leading veh // if the following veh passed the loop too // also, set the flag for the following vehicle if (fvPrvP > LOOP_LENGTH) { leader->SetLoopFlag(false); fvPrvP -= LOOP_LENGTH; follower->SetLoopFlag(true); 136 } //check against minimum spacing if (0 && fvCrtP+VEH_LENGTH > lvCrtP) { fvCrtP = lvCrtP - VEH_LENGTH; fvCrtS = (fvCrtP-fvPrvP)/(0.5*params.updatingTime) - fvPrvS; fvCrtA = (fvCrtS-fvPrvS)/(0.5*params.updatingTime) - fvPrvA; } ***************/ fvCrtP = fvPrvP + 0.5*params.updatingTime*(fvPrvS + fvCrtS); //position boundary check could be redundant for GM1 fvCrtP = (fvCrtP < 0) ? 0 : fvCrtP; //set the vehicular parameters for the following veh follower->SetPosition(fvCrtP, params.maxlag); follower->SetSpeed(fvCrtS, params.maxlag); follower->SetAcceleration(fvCrtA, params.maxlag); //check for a snap-shot density if ((idx % (long)(DENSITY_TIME_INTERVAL / params.updatingTime)) == 0) { computeDensity(fvCrtP, int(idx/(DENSITY_TIME_INTERVAL / params.updatingTime)), density, ratio); } //check for a snap-shot delay //but first get the updated position of the vehicle fvCrtP = follower->GetPosition(params.maxlag); if (fvCrtP >= follower->GetDelaySnapCount()*DELAY_SPACE_INTERVAL*ratio || (idx+1) == params.endSimTime) { if (follower->GetDelaySnapCount() > 10) { //not good AfxMessageBox("known error, please let me know(GM3)! -- ciprian"); exit(0); idx += 0; } 137 delay[follower->GetDelaySnapCount()] = idx*params.updatingTime - fvCrtP/(MAX_SPEED*ratio) - id*headway; follower->AddDelaySnapCount(); } } } //// END OF gm3 CAR-FOLLOWING MODEL //lagOffset - to accomodate the same function for the variation of lag in microcosm //ratio is always less than 1, so we can also distinguish between vehicles in prototype and microcosm static void ComputeNextVehicleNETSIM(paramSMTS params, CVehicle* leader, CVehicle* follower, double **density, double *delay, int idx, int lag, double headway, int id, double alphaVal, double ratio) { //pick the random variables of the vehicle //stochastic components if their variance is > 0 if (params.alphaVar >0) { alphaVal = follower->GetAlpha(); } if (params.deltaTVar >0) { lag = follower->GetLag(); } //do not apply the model yet, if the vehicle didn' enter the system //- an equal(for the beginning) arrival headway is assumed if (idx*params.updatingTime <= id*headway) { idx = (idx > params.maxlag) ? params.maxlag : idx; follower->SetPosition(0, idx); follower->SetSpeed(0, idx); follower->SetAcceleration(0, idx); } else { //lv, fv - leading/follower vehicle //Lag - values at some time lag ago //Crt - current values (to be set) //Prv - previously(one updatimg time step ago) calculated values 138 double lvLagS; double fvLagS; double lvCrtS, lvCrtP, lvPrvP; double fvCrtA, fvCrtS, fvCrtP; double fvPrvA, fvPrvS, fvPrvP; //get previouslyc computed values for leading car lvLagS = leader->GetSpeed(params.maxlag - leader->GetLag()); lvCrtS = leader->GetSpeed(params.maxlag); lvCrtP = leader->GetPosition(params.maxlag); lvPrvP = leader->GetPosition(params.maxlag-1); //get previously computed values for following car fvLagS = follower->GetSpeed(params.maxlag - lag); fvPrvS = follower->GetSpeed(params.maxlag - 1); fvPrvA = follower->GetAcceleration(params.maxlag - 1); fvPrvP = follower->GetPosition(params.maxlag - 1); /*** loop trajectory not implemented yet ********* //adjust the vehicle position for the loop case // if the vehicle previously passed the loop (2*PI*R) // then add loop lenght to its current position if (leader->GetLoopFlag()) { if (lvPrvP > lvCrtP) { lvPrvP += LOOP_LENGTH; } lvCrtP += LOOP_LENGTH; } //use gm1 model if in the influence zone //if (1 || (lvPrvP - fvPrvP) <= INFLUENCE_ZONE*ratio) { if (1 || (lvPrvP - fvPrvP) GetInfluenceZone()*ratio) { fvCrtA = alphaVal* (lvLagS - fvLagS); } else { // fvCrtA = fvPrvA; fvCrtA = follower->GetAcc2CruiseSpeed(); 139 } **************/ //use NETSIMs model double lvDecel = alphaVal;//leader->GetAlpha()*ratio; double fvDecel = alphaVal;//follower->GetAlpha()*ratio; double s = lvCrtP-fvPrvP - VEH_LENGTH;//<0)? 1:(lvCrtP-fvPrvP - VEH_LENGTH); if (s<0) { fvCrtA = fvPrvA; } else { double F1 = 2*(s - fvPrvS*(1+lag*params.updatingTime))*fvDecel*ratio+pow(lvCrtS,2.)*fvDecel/lvDecel-p ow(fvPrvS,2.); double F2 = fvDecel*ratio*(2*lag*params.updatingTime+1)+2*fvPrvS; fvCrtA = F1/(F2);//*params.updatingTime); } /*/CHECK AGAINST MAX RATE OF CHANGE IN ACCELERATION (SAY MAX 15 FT/SEC/SEC => [e.g. 1.5FT/SEC/0.1SEC]) if (abs(fvPrvA-fvCrtA) > MAX_ACC_CHANGE_RATE*params.updatingTime) { fvCrtA = fvPrvA + ( fvCrtA<fvPrvA ?(-1):(+1))*MAX_ACC_CHANGE_RATE*params.updatingTime; }*/ //to be on the safe side constraint for acceleration fvCrtA = ((fvPrvS >= MAX_SPEED*ratio && fvCrtA > 0) || (fvPrvS <= 1e-6 && fvCrtA < 0)) ? 0 : fvCrtA; //acc boundary check could be redundant for GM1 fvCrtA = (fvCrtA = MIN_ACC*ratio) ? fvCrtA : MIN_ACC*ratio) : MAX_ACC*ratio; fvCrtS = fvPrvS + 0.5*params.updatingTime*(fvPrvA + fvCrtA); //speed boundary check could be redundant for GM1 fvCrtS = (fvCrtS = MIN_SPEED*ratio) ? fvCrtS : MIN_SPEED*ratio) : MAX_SPEED*ratio; // need to check for speed constraints (if the lv stops then we force stopping 140 the fv // after the default time lag (adaptation time) // speed should be zeor if no pozitive accelearation is currently employed fvCrtS = (lvLagS == 0 && fvCrtA>=0) ? 0 : fvCrtS; /*** loop trajectory not implemented yet ********* // reset the flag for the leading veh // if the following veh passed the loop too // also, set the flag for the following vehicle if (fvPrvP > LOOP_LENGTH) { leader->SetLoopFlag(false); fvPrvP -= LOOP_LENGTH; follower->SetLoopFlag(true); } //check against minimum spacing if (0 && fvCrtP+VEH_LENGTH > lvCrtP) { fvCrtP = lvCrtP - VEH_LENGTH; fvCrtS = (fvCrtP-fvPrvP)/(0.5*params.updatingTime) - fvPrvS; fvCrtA = (fvCrtS-fvPrvS)/(0.5*params.updatingTime) - fvPrvA; } ***************/ fvCrtP = fvPrvP + 0.5*params.updatingTime*(fvPrvS + fvCrtS); //position boundary check fvCrtP = (fvCrtP < 0) ? 0 : fvCrtP; fvCrtP = (fvCrtP < fvPrvP) ? fvPrvP : fvCrtP; //set the vehicular parameters for the following veh follower->SetPosition(fvCrtP, params.maxlag); follower->SetSpeed(fvCrtS, params.maxlag); follower->SetAcceleration(fvCrtA, params.maxlag); //check for a snap-shot density if ((idx % (long)(DENSITY_TIME_INTERVAL / params.updatingTime)) == 0) { computeDensity(fvCrtP, int(idx/(DENSITY_TIME_INTERVAL / 141 params.updatingTime)), density, ratio); } //check for a snap-shot delay //but first get the updated position of the vehicle fvCrtP = follower->GetPosition(params.maxlag); if (fvCrtP >= follower->GetDelaySnapCount()*DELAY_SPACE_INTERVAL*ratio || (idx+1) == params.endSimTime) { if (follower->GetDelaySnapCount() > 10) { //not good AfxMessageBox("known error, please let me know(NETSIM)! -- ciprian"); exit(0); idx += 0; } delay[follower->GetDelaySnapCount()] = idx*params.updatingTime - fvCrtP/(MAX_SPEED*ratio) - id*headway; follower->AddDelaySnapCount(); } } } //// END OF netsim CAR-FOLLOWING MODEL //lagOffset - to accomodate the same function for the variation of lag in microcosm //ratio is always less than 1, so we can also distinguish between vehicles in prototype and microcosm static void ComputeNextVehicleFRESIM(paramSMTS params, CVehicle* leader, CVehicle* follower, double **density, double *delay, int idx, int lag, double headway, int id, double alphaVal, double ratio) { //pick the random variables of the vehicle //stochastic components if their variance is > 0 if (params.alphaVar >0) { alphaVal = follower->GetAlpha(); } if (params.deltaTVar >0) { 142 lag = follower->GetLag(); } //do not apply the model yet, if the vehicle didn' enter the system //- an equal(for the beginning) arrival headway is assumed if (idx*params.updatingTime <= id*headway) { idx = (idx > params.maxlag) ? params.maxlag : idx; follower->SetPosition(0, idx); follower->SetSpeed(0, idx); follower->SetAcceleration(0, idx); } else { //lv, fv - leading/follower vehicle //Lag - value at some lag ago //Crt - current value //Prv - last(previous) values double lvLagS; double fvLagS; double lvCrtS, lvCrtP, lvPrvP, lvPrvS; double fvCrtA, fvCrtS, fvCrtP; double fvPrvA, fvPrvS, fvPrvP; //get previouslyc computed values for leading car lvLagS = leader->GetSpeed(params.maxlag - leader->GetLag()); lvCrtS = leader->GetSpeed(params.maxlag); lvCrtP = leader->GetPosition(params.maxlag); lvPrvP = leader->GetPosition(params.maxlag-1); lvPrvS = leader->GetSpeed(params.maxlag-1); //get previously computed values for following car fvLagS = follower->GetSpeed(params.maxlag - lag); fvPrvS = follower->GetSpeed(params.maxlag - 1); fvPrvA = follower->GetAcceleration(params.maxlag - 1); fvPrvP = follower->GetPosition(params.maxlag - 1); /*** loop trajectory not implemented yet ********* //adjust the vehicle position for the loop case 143 // if the vehicle previously passed the loop (2*PI*R) // then add loop lenght to its current position if (leader->GetLoopFlag()) { if (lvPrvP > lvCrtP) { lvPrvP += LOOP_LENGTH; } lvCrtP += LOOP_LENGTH; } //use gm1 model if in the influence zone //if (1 || (lvPrvP - fvPrvP) <= INFLUENCE_ZONE*ratio) { if (1 || (lvPrvP - fvPrvP) GetInfluenceZone()*ratio) { fvCrtA = alphaVal* (lvLagS - fvLagS); } else { // fvCrtA = fvPrvA; fvCrtA = follower->GetAcc2CruiseSpeed(); } **************/ //use FRESIMs model double b=0.1; if (lvPrvS-fvPrvS > 10*ratio) { b=0; } double s = (lvCrtP-fvPrvP - VEH_LENGTH - 10*ratio);//relative spacing double F1 = 2*(s - fvPrvS*(alphaVal+lag*params.updatingTime) - b*alphaVal*pow((lvCrtS-fvPrvS),2)); double F2 = (pow(lag*params.updatingTime,2) + 2*alphaVal*lag*params.updatingTime); fvCrtA = F1/F2; //CHECK AGAINST MAX RATE OF CHANGE IN ACCELERATION (SAY MAX 15 FT/SEC/SEC => [e.g. 1.5FT/SEC/0.1SEC]) /* if (abs(fvPrvA-fvCrtA) > MAX_ACC_CHANGE_RATE*params.updatingTime) { fvCrtA = fvPrvA + 144 ( fvCrtA<fvPrvA ?(-1):(+1))*MAX_ACC_CHANGE_RATE*params.updatingTime; }*/ //to be on the safe side constraint for acceleration fvCrtA = ((fvPrvS >= MAX_SPEED*ratio && fvCrtA > 0) || (fvPrvS <=1e-6 && fvCrtA < 0)) ? 0 : fvCrtA; fvCrtA = (fvCrtA = MIN_ACC*ratio) ? fvCrtA : MIN_ACC*ratio) : MAX_ACC*ratio; fvCrtS = fvPrvS + 0.5*params.updatingTime*(fvPrvA + fvCrtA); //speed boundary check could be redundant for GM1 fvCrtS = (fvCrtS = MIN_SPEED*ratio) ? fvCrtS : MIN_SPEED*ratio) : MAX_SPEED*ratio; /*** loop trajectory not implemented yet ********* // reset the flag for the leading veh // if the following veh passed the loop too // also, set the flag for the following vehicle if (fvPrvP > LOOP_LENGTH) { leader->SetLoopFlag(false); fvPrvP -= LOOP_LENGTH; follower->SetLoopFlag(true); } //check against minimum spacing if (0 && fvCrtP+VEH_LENGTH > lvCrtP) { fvCrtP = lvCrtP - VEH_LENGTH; fvCrtS = (fvCrtP-fvPrvP)/(0.5*params.updatingTime) - fvPrvS; fvCrtA = (fvCrtS-fvPrvS)/(0.5*params.updatingTime) - fvPrvA; } ***************/ fvCrtP = fvPrvP + 0.5*params.updatingTime*(fvPrvS + fvCrtS); //position boundary check fvCrtP = (fvCrtP < 0) ? 0 : fvCrtP; fvCrtP = (fvCrtP < fvPrvP) ? fvPrvP : fvCrtP; //set the vehicular parameters for the following veh 145 follower->SetPosition(fvCrtP, params.maxlag); follower->SetSpeed(fvCrtS, params.maxlag); follower->SetAcceleration(fvCrtA, params.maxlag); //check for a snap-shot density if ((idx % (long)(DENSITY_TIME_INTERVAL / params.updatingTime)) == 0) { computeDensity(fvCrtP, int(idx/(DENSITY_TIME_INTERVAL / params.updatingTime)), density, ratio); } //check for a snap-shot delay //but first get the updated position of the vehicle fvCrtP = follower->GetPosition(params.maxlag); if (fvCrtP >= follower->GetDelaySnapCount()*DELAY_SPACE_INTERVAL*ratio || (idx+1) == params.endSimTime) { if (follower->GetDelaySnapCount() > 10) { //not good AfxMessageBox("known error, please let me know(FRESIM)! -- ciprian"); exit(0); idx += 0; } delay[follower->GetDelaySnapCount()] = idx*params.updatingTime - fvCrtP/(MAX_SPEED*ratio) - id*headway; follower->AddDelaySnapCount(); } } } //// END OF fresim CAR-FOLLOWING MODEL static void computeDensity (double pos, int idx, double **density, double ratio) { for (double i = 0; i <= (int)(MAX_DISTANCE*ratio); i += DENSITY_SPACE_INTERVAL*ratio) { if (pos > i && pos <= i+DENSITY_SPACE_INTERVAL*ratio) { /*this becomes to big, trajectory too long*/ 146 density[(int)(i/(DENSITY_SPACE_INTERVAL*ratio))][idx-1] += 1; } } } /*private static void computeDensityP { my ($position, $t, $scenario, $k_p) = @_; for (my $i = 0; $i<=$::maxDistance; $i += $::densitySpaceInterval) { if ($position > $i && $position <= $i+$::densitySpaceInterval) { $$k_p[$scenario][($i/$::densitySpaceInterval)][$t-1] += 1; } } } private static void computeDensityM { my ($position, $t, $config, $scenario, $k_m) = @_; for (my $i = 0; $i<=$::maxDistance; $i += $::densitySpaceInterval*$::ratio) { if ($position > $i && $position <= $i+$::densitySpaceInterval*$::ratio) { $$k_m[$scenario][$config][($i/($::densitySpaceInterval*$::ratio))][$t-1] += 1; } } }*/ }; #endif // !defined(AFX_CARFOLLOWMODEL_H__8C3D3347_D8FC_4E4B_913E_F748BA9 48453__INCLUDED_) 147 148 VITA Yan Zhang is from Nanjing, Jiangsu, People’s Republic of China. She completed her bachelor’s degree in transportation engineering in June 2002 from Southeast University, Nanjing, Jiangsu, People’s Republic of China. She joined the master’s program in civil engineering at Louisiana State University in August 2002. In August 2004, she will receive the degree of Master of Science in Civil Engineering under the guidance of Dr. Sherif Ishak.

Các file đính kèm theo tài liệu này:

  • pdf111.pdf
Tài liệu liên quan