Show
Ignore:
Timestamp:
03/08/10 19:17:16 (15 years ago)
Author:
prikryl
Message:

New global varibles IntersectionIDs and NumIntersections.
Measured RV has two dimensions, which allows us to unify IntensityOffsets and OccupancyOffests into MeasurementOffsets.
Use DLL_PATH to tell us the location of the global DLL directory.
Do not call set_log_level().
Corrected the measured data processing loops in getdata().

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • applications/doprava/aimsun_bdm/aimsun_ds.cpp

    r855 r860  
    2222const TCHAR * ControllerList[NUM_CONTROLLERS] = { TEXT("K_5_495"), TEXT("K_5_601") }; 
    2323const TCHAR * WindowStr[NUM_CONTROLLERS]      = { TEXT("els3@5.495"), TEXT("els3@5.601") }; 
     24const int IntersectionIDs[] = { 495, 601 };  
     25const int NumIntersections = sizeof ( IntersectionIDs ); 
    2426 
    2527/* Entrance sections are hardwired for Aimsun scenario `zlicin_495_601.sce` */ 
     
    4345   values of all measurements for all intersections in the system). */ 
    4446const int SignalPlanOffsets[] = {  0, 36 }; 
    45 const int IntensityOffsets[]  = {  6, 42 }; 
    46 const int OccupancyOffsets[]  = { 21, 60 }; 
     47const int MeasurementOffsets[]  = {  6, 42 }; 
    4748 
    4849AimsunDS::AimsunDS() : DS() 
     
    7374        StringCbCopy ( szBasePath, MAX_PATH_BYTES, BASE_PATH ); 
    7475 
    75         /* Create the path to DLL directory. 
     76        /* Create the path to DLL directory. The path is defined externally 
     77           in  "CMakeLists.txt". 
    7678           The path will be used to inject the appropriate location of 
    7779           Getram extensions into the selected Aimsun scenario and also 
    7880           to modify PATH variable of executed processes in order to 
    7981           provide access to API DLLs. */ 
    80         StringCbCopy ( szDllPath, MAX_PATH_BYTES, szBasePath ); 
    81         StringCbCat ( szDllPath, MAX_PATH_BYTES, TEXT("\\dlls") ); 
     82        StringCbCopy ( szDllPath, MAX_PATH_BYTES, DLL_PATH ); 
    8283 
    8384        /* Add the DLL directory to the PATH used by this process. 
     
    360361        } 
    361362 
    362         /* Loop over all measurement sets (currently we will deliver 
    363         just the last one, but this will surely change. */ 
     363        /* Loop over all controllers in the measurement set. */ 
    364364        for ( int i = 0; i < p_rsp->count; i++) 
    365365        { 
    366                 det_stats * ds_ptr = p_rsp->dets + i; 
    367                 sp_stats *  sp_ptr = p_rsp->sps  + i; 
     366                det_stats * ds_ptr  = p_rsp->dets + i; 
     367                sp_stats *  sp_ptr  = p_rsp->sps  + i; 
    368368 
    369369                printf ( "\tRealised signal plans:\n" ); 
    370370 
    371                 /* Loop over all intersections and fill in signal plan 
    372                 data. */ 
     371                /* Loop over all measurement sets. We will deliver just 
     372                   the last one. */ 
    373373                for ( int j = 0; j < sp_ptr->count ; j++ ) 
    374374                { 
    375375                        sp_stattab * dat_ptr = sp_ptr->splans + j; 
    376                         int          offset  = SignalPlanOffsets[j]; 
     376                        int          pos     = _search_index ( IntersectionIDs, NumIntersections, dat_ptr->its_id ); 
     377                        int          offset  = SignalPlanOffsets[pos]; 
    377378 
    378379                        printf ( "\t[%3d] t=%6ds ", j, dat_ptr->global_time ); 
    379380 
     381                        /* Copy particular signals. */ 
    380382                        for ( int k = 0 ; k < dat_ptr->num_siggroups ; k++ ) 
    381383                        { 
     
    388390                printf ( "\n\tDetector data:\n" ); 
    389391 
    390                 /* Loop over all intersections and fill in the 
    391                 detector measurements. */ 
     392                /* Loop over all mesurement records with intensities and 
     393                   occupancies. */ 
    392394                for ( int j = 0 ; j < ds_ptr->count ; j++ ) 
    393395                { 
    394396                        det_aggreg_table * dat_ptr = ds_ptr->stats + j; 
    395                         int                ioffset  = IntensityOffsets[j]; 
    396                         int                ooffset  = OccupancyOffsets[j]; 
     397                        int  pos     = _search_index ( IntersectionIDs, NumIntersections, dat_ptr->its_id ); 
     398                        int  moffset = MeasurementOffsets[pos]; 
    397399 
    398400                        printf ( "\t[%3d] t=%6ds ", j, dat_ptr->global_time ); 
     
    400402                        for ( int k = 0 ; k < dat_ptr->num_det ; k++ ) 
    401403                        { 
    402                                 dt[k+ioffset] = dat_ptr->dt_intensity[k]; 
    403                                 dt[k+ooffset] = dat_ptr->dt_occupancy[k]; 
     404                                dt[2*k+moffset]  = dat_ptr->dt_intensity[k]; 
     405                                dt[2*k+moffset+1] = dat_ptr->dt_occupancy[k]; 
    404406                                printf ( "{%2d/%2d} ", 
    405407                                        dat_ptr->dt_intensity[k], dat_ptr->dt_occupancy[k] ); 
     
    408410                } 
    409411        } 
     412 
    410413        printf ( "\tAimsunDS::getdata() finished\n" ); 
     414        cout << dt ; 
    411415} 
    412416