Changeset 842 for applications/doprava

Show
Ignore:
Timestamp:
02/27/10 10:52:01 (14 years ago)
Author:
smidl
Message:

doprava is now working

Location:
applications/doprava
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • applications/doprava/Zlicin.cfg

    r840 r842  
    1717  input = ( // remote detectors  
    1818    { 
    19       name = "601_DVA1"; 
     19      name = "601_DVAa"; 
    2020                distance = 100; 
    2121      to_sg = ("VC","VD"); 
     
    2929  output = ( //  
    3030     { 
    31       from = ("VC"); 
    32                 detector = "495_DVC"; 
     31                detectors = ("495_DVC"); 
    3332      to = "601"; 
    3433      } 
     
    5554  offset = 60; //s 
    5655        input = (); 
    57         output = (); 
     56        output = ({to="495"; detectors=("601_DVAa","601_DVA");}); 
    5857} 
    5958); 
     59logger = {class="memlog"; filename = "zlicin"; maxlen = 1000;}; 
  • applications/doprava/traffic_agent.cpp

    r840 r842  
    3232                output_rv.add(request_handler(i).rv); 
    3333        } 
    34         // connect 
    35         for(int i=0;i<requests.length();i++){ 
    36                 request_handler(i).outdata2out.set_connection(request_handler(i).rv, output_rv); 
    37                 // search teh right section == probably inefficient 
    38 /*              int j; 
    39                 for (j=0;j<sg.length();j++){ 
    40                         if (sg(i).name==requests(i).from){ 
    41                                 sgh(i).data2out.set_connection(output_rv, sgh(i).det_data); 
    42                                 break; 
    43                         } 
    44                 }*/ 
    45         } 
    46          
     34 
    4735        // process DetIn - create input 
    4836        for (int i=0; i<det_in.length(); i++){ 
  • applications/doprava/traffic_agent.h

    r840 r842  
    4141        public: 
    4242        string to; // agent 
    43         Array<string> from; //detectors 
     43        Array<string> detectors; //detectors 
    4444        void from_setting(const Setting &set){ 
    45                 UI::get(from,set,"from",UI::compulsory); 
     45                UI::get(detectors,set,"detectors",UI::compulsory); 
    4646                UI::get(to, set, "to", UI::compulsory); 
    4747        } 
     
    7272                //! link from global measured data  
    7373                datalink ds2data; 
    74                 //! link from data to global out_data 
    75                 datalink data2out; 
    7674        public: 
    7775                void connect_sg(SignalGroup &sg0, const string &agent_name){ 
     
    9896        public: 
    9997                RV rv; 
    100                 datalink outdata2out; 
    10198        public: 
    10299                void connect_request(RequestOut &rq0, const string &agent_name){ 
    103100                        rq=&rq0; 
    104                         for (int i=0;i<rq->from.length();i++){ 
    105                                 rv.add(RV(agent_name +"_"+ rq->from(i), 2)); //TODO intensity occupancy 
     101                        for (int i=0;i<rq->detectors.length();i++){ 
     102                                rv.add(RV(rq->detectors(i), 2)); //TODO intensity occupancy 
    106103                        } 
    107104                } 
     
    130127                //! description of broadcast dataind 
    131128                RV output_rv; 
     129                 
     130                //! datalink from DS to output variables 
     131                datalink ds2output; 
    132132                                         
    133133                //! output recepient 
     
    193193                                // copy from create message 
    194194                                // create msg with fields {to=..., what=data, rv=..., value = ...} 
    195                                 Setting &m_to=msg.add("to",Setting::TypeString); 
    196                                 m_to=requests(i).to; 
    197                                 Setting &m_what=msg.add("what",Setting::TypeString); 
    198                                 m_what="data"; 
    199                                 //Setting &m_data=msg.add("data",Setting::TypeGroup); 
    200                                 Setting &m_rv=msg.add("rv",Setting::TypeGroup); 
    201                                 R.rv.to_setting(m_rv); 
    202                                 Setting &m_val=msg.add("value",Setting::TypeGroup); 
    203                                 vec val =R.outdata2out.pushdown(output_data); 
    204                                 UI::save(val, m_val); 
     195                                UI::save ( requests(i).to, msg, "to"); 
     196                                UI::save ( (string)"data", msg, "what"); 
     197                                UI::save ( &R.rv, msg, "rv"); 
     198                                UI::save(output_data, msg, "value"); 
    205199                        } 
    206200                } 
     
    210204                                sgh(i).ds2data.filldown(glob_dt, sgh(i).det_data); 
    211205                        } 
     206                        //copy data fro neighbours 
     207                        ds2output.filldown(glob_dt, output_data); 
    212208                        // copy sg_length ... and others... 
    213209                } 
     
    222218                 
    223219                void ds_register(const DS &ds){ 
     220                        //register ds2output 
     221                        ds2output.set_connection(output_rv, ds._drv()); 
     222                        output_data.set_size(output_rv._dsize()); 
    224223                        for (int i=0; i<sgh.length(); i++){ 
    225224                                sgh(i).ds2data.set_connection(sgh(i).rv_det_data, ds._drv());