Changeset 825 for applications/doprava

Show
Ignore:
Timestamp:
02/23/10 11:06:09 (14 years ago)
Author:
prikryl
Message:

Initial commit of Aimsun data source and support tools.

Location:
applications/doprava/aimsun_bdm
Files:
3 added
1 modified

Legend:

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

    r814 r825  
    22  \file 
    33  \brief DataSource for experiments with Aimsun 
    4   \author Jan prikryl. 
     4  \author Jan Prikryl. 
    55 
    66*/ 
     
    2828    bool opt_modu; 
    2929    //! options for logging, - 
     30        eh_els3hrd * p_rsp; 
     31        //! pointer to realised signal plans stored in local data space of eh_api */ 
     32 
    3033public: 
    3134    //! Constructor with fixed sampling period 
    32     AimsunDS () : DS() 
    33     { 
    34         Dt=125; 
    35         Yrv=RV ( "{o_ua o_ub o_ia o_ib t_ua t_ub o_om o_th Mz }" ); 
    36                 ytsize = Yrv._dsize(); 
    37                 Drv = Yrv; 
    38     } 
    39     void set_parameters ( double Rs0, double Ls0, double Fmag0, double Bf0, double p0, double kp0, double J0, double Uc0, double DT0, double dt0 ) 
    40     { 
    41         pmsmsim_set_parameters ( Rs0, Ls0, Fmag0, Bf0, p0, kp0, J0, Uc0, DT0, dt0 ); 
    42     } 
    43     //! parse options: "modelu" => opt_modu=true; 
    44     void set_options ( string &opt ) 
    45     { 
    46         opt_modu = ( opt.find ( "modelu" ) !=string::npos ); 
    47     } 
    48     void getdata ( vec &dt ) const 
    49     { 
    50         dt.set_subvector(0,vec ( KalmanObs,6 )); 
    51         dt(6)=x[2]; 
    52         dt(7)=x[3]; 
    53         dt(8)=x[8]; 
    54     } 
    55     void write ( vec &ut ) {} 
     35    AimsunDS (); 
    5636 
    57     void step() 
    58     { 
    59         static int ind=0; 
    60         static double dW; // increase of W 
    61         static double Ww; // W 
    62         static double Mz; // W 
    63         if ( t>=dt_prof*ind ) 
    64         { 
    65             ind++; 
    66             // check omega profile and set dW 
    67                         if ( ind <2 && profileWw.length() ==1 ) 
    68                         { 
    69                                 Ww=profileWw ( 0 ); 
    70                                 dW=0.0; 
    71                         } 
    72                         if ( ind<profileWw.length() ) 
    73             { 
    74                     dW = profileWw ( ind )-profileWw ( ind-1 ); 
    75                     dW *=125e-6/dt_prof; 
    76             } 
    77             else 
    78             { 
    79                 dW = 0; 
    80             } 
    81             // Check Mz profile and set Mz 
    82             if ( ind<profileMz.length() ) 
    83             { 
    84                 //sudden increase 
    85                 Mz = profileMz(ind); 
    86             } 
    87             else 
    88             { 
    89                 Mz = 0; 
    90             } 
    91         } 
    92         Ww += dW; 
    93         //Simulate Dt seconds! 
    94         for ( int i=0; i<Dt; i++ ) 
    95         { 
    96             pmsmsim_step ( Ww , Mz); 
    97         } 
    98 //              for ( int i=0;i<Dt;i++ ) {      pmsmsim_noreg_step ( Ww , Mz);} 
     37    //! Get measurements and signal plans from ELS3 controllers 
     38    void getdata ( vec &dt ) const; 
    9939 
    100         //discretization 
    101         double ustep=1.2; 
    102         KalmanObs [ 0 ] = ustep*itpp::round( KalmanObs [ 0 ]/ ustep) ; 
    103         KalmanObs [ 1 ] = ustep*itpp::round(KalmanObs [ 1 ]/ ustep); 
    104         double istep=0.085; 
    105         KalmanObs [ 2 ] = istep*itpp::round( KalmanObs [ 2 ]/ istep) ; 
    106         KalmanObs [ 3 ] = istep*itpp::round(KalmanObs [ 3 ]/ istep); 
     40    //! Write new signal plans to ELS3 
     41    void write ( vec &ut ); 
    10742 
    108     }; 
    109  
    110   
     43    //! Wait for new data and copy them out to local buffers 
     44    void step(); 
    11145 
    11246    // TODO dodelat void to_setting( Setting &root ) const; 
     47private: 
     48        void AimsunDS::initVGS ( 
     49                const vgs_headway_mode headway, 
     50                const TCHAR * entrancePath, 
     51                const TCHAR * sectionStatsPath, 
     52                const TCHAR * globalStatsPath 
     53        ); 
    11354};