Changeset 1071

Show
Ignore:
Timestamp:
06/10/10 00:41:54 (14 years ago)
Author:
ondrak
Message:

compatibility with new config file, many other changes, but yet untested

Location:
applications/doprava
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • applications/doprava

    • Property svn:ignore set to
      ALL_BUILD.vcproj
      ALL_BUILD.vcproj.GUYBRUSH.Kamil.user
      CMakeCache.txt
      CMakeFiles
      Debug
      Release
      ZERO_CHECK.dir
      ZERO_CHECK.vcproj
      ZERO_CHECK.vcproj.GUYBRUSH.Kamil.user
      bin
      cmake_install.cmake
      doprava.ncb
      doprava.sln
      doprava.suo
      experiments
      graphs
      main_loop.dir
      main_loop.vcproj
      main_loop.vcproj.GUYBRUSH.Kamil.user
      run_cmake.bat
      traffic_agents.dir
      traffic_agents.vcproj
      traffic_agents.vcproj.GUYBRUSH.Kamil.user
      xxx
  • applications/doprava/Zlicingw.cfg

    r1067 r1071  
    1313        neighbours = ("601"); 
    1414        offset = 60; //s 
    15         sgs=("VA","VB","VC","VD","VE","VF"); 
    16         green_starts=[72,4,5,35,36,71]; 
    17         moje_special=14; 
    18 }, 
     15  green_names = ("495_VA","495_VB","495_VC","495_VD","495_VE","495_VF"); 
     16  green_starts=[72,4,5,35,36,71]; 
     17  green_times = [0.2,0.2,0.1,0.1,0.2,0.2];// ratios of green of 80s 
     18  stage_names = ("495_F1","495_F2","495_F3"); 
     19  stage_times = [30,30,20];}, 
    1920{ //agent 2 
    2021        class = "GreenWaveTrafficAgent"; 
     
    3233        neighbours = ("495"); 
    3334        offset = 40; 
    34         sgs=("VA","VB","VC","VD","VE","SE"); 
    35         green_starts=[54,9,26,25,9,9]; 
     35        green_names = ("601_VA","601_VB","601_VC","601_VD","601_VE","601_SE"); 
     36        green_starts=[54,9,26,25,9,9]; 
     37        green_times = [0.2,0.2,0.1,0.1,0.2,0.2];// ratios of green of 80s 
     38        stage_names = ("601_F1","601_F2","601_F3"); 
     39        stage_times = [30,30,20]; 
    3640} 
    37  
    3841); 
    3942 
    4043logger = {class="memlog"; filename = "mujzlicin"; maxlen = 1000;}; 
    41  
    42  
    43  
    4444 
    4545system = { 
     
    5454        // simulation in our case starts always at 00:00:00. Default simulation 
    5555        // length is 24 hours (24:00:00). 
    56         stop_time = "01:00:00"; 
     56        stop_time = "00:05:00"; 
    5757         
    5858}; 
  • applications/doprava/main_loop.cpp

    r1026 r1071  
    5959        // INITIALISATION OF UT 
    6060        glob_ut[ 0] = 80; // cycle time 
    61         glob_ut[ 1] = 40; // offset 495 
     61        glob_ut[ 1] = 60; // offset 495 
    6262        glob_ut[ 2] = 30; // ut[2]+ut[3]+ut[4] has to sum up to ut[0] 
    6363        glob_ut[ 3] = 30; 
    6464        glob_ut[ 4] = 20; 
    65     glob_ut[ 8] = 20; // offset 601 
     65    glob_ut[ 8] = 40; // offset 601 
    6666        glob_ut[ 9] = 30; // ut[9]+ut[10]+ut[11] has to sum up to ut[0] 
    6767        glob_ut[10] = 30; 
  • applications/doprava/traffic_agent_offset.h

    r1026 r1071  
    11#include "traffic_agent.h" 
    22#include <list> 
     3#include <fstream> 
    34 
    45class GreenWaveTrafficAgent : public BaseTrafficAgent { 
     
    78        int negot_offset; 
    89 
     10        int actual_time; 
     11 
     12        RV rv_outputs; 
     13        vec outputs; 
     14 
    915        RV rv_change_request; 
    1016        vec change_request; 
     
    1218        RV rv_recieved_exps; 
    1319        vec recieved_exps; 
     20 
     21        RV rv_next_exps; 
     22        vec next_exps; 
    1423 
    1524        RV rv_recieved_changes; 
     
    3039 
    3140        //! counts all expected cars going from each lane, saves to outputs and rv_outputs 
    32         void expected_cars(/*const string dest*/) { 
     41        void expected_cars() { 
    3342                double start_time; 
     43                ivec ind; 
     44                RV rv_exp; 
     45                datalink exp2outputs; 
     46                vec exp; 
    3447 
    3548                for (int i=0;i<lanes.length();i++) { 
    3649                        for (int j=0;j<lanes(i).outputs.length();j++) { 
    37                                 string group = name+"_"+lanes(i).sg;            //e.g. 495_VA 
    38                                 ivec index=rv_inputs.dataind(RV(group,1)); 
    39                                 vec green_time=inputs(index); 
    40  
    41                                 rv_outputs.add(RV(lanes(i).outputs(j)+"-"+group,3)); 
    42                                 outputs.set_size(rv_outputs._dsize()); 
    43  
    44                                 ivec ind = rv_outputs.dataind(RV(lanes(i).outputs(j)+"-"+group,3)); 
    45  
    46                                 //Number of cars 
    47                                 outputs(ind(0))=lanehs(i)->expected_output(green_time(0));       
    48  
    49                                 start_time = green_starts(sg_index(lanes(i).sg)) + lanes(i).output_distances(j)/VP + planned_offset; 
    50                                 //first car arrive time 
    51                                 outputs(ind(1))=start_time;                                                                      
    52                                 //last car arrive time 
    53                                 outputs(ind(2))= start_time + green_time(0); 
     50                                if (lanes(i).outputs(j)!="DUMMY_DET") { 
     51                                        string group = name+"_"+lanes(i).sg;            //e.g. 495_VA 
     52                                         
     53                                        int index=group_index(group); 
     54                                         
     55                                        double green_time=green_times(index)*cycle_length; 
     56 
     57                                        //ivec green_index=rv_inputs.dataind(RV(group,1)); 
     58                                        //vec green_time=inputs(green_index); 
     59 
     60                                        //cout << "Green time "<<green_time<<endl; 
     61 
     62                                        rv_exp=RV(lanes(i).outputs(j)+"-"+name+"_"+to_string(i),3); 
     63 
     64                                        exp.set_size(rv_exp._dsize()); 
     65                                        exp2outputs.set_connection(rv_exp,rv_outputs); 
     66 
     67                                        //Number of cars 
     68                                        exp(0)=lanehs(i)->expected_output(green_time)*lanes(i).alpha(j);         
     69 
     70                                        start_time = green_starts(group_index(name+"_"+lanes(i).sg)) + lanes(i).output_distances(j)/VP + planned_offset; 
     71                                        //first car arrive time 
     72                                        exp(1)=start_time; 
     73                                        //last car arrive time 
     74                                        exp(2)=start_time + green_time; 
     75                                        //TODO pushup az na konec 
     76                                        exp2outputs.pushup(outputs,exp); 
     77 
     78                                }                        
    5479                        } 
    5580                } 
     
    5984        double count_rating(const int offset) { 
    6085                double virtual_queue; 
    61                 double t_emptiyng; 
    6286                double t_green_begin; 
    6387                double t_green_end; 
    64                 double t_cars_begin; 
    65                 double t_cars_end; 
    66 //              vec t_cars_begin; 
    67 //              vec t_cars_end; 
    68                 double t_mixing; 
     88                vec cars_count; 
     89                vec t_cars_begin; 
     90                vec t_cars_end; 
    6991                bool found; 
    7092 
    7193                double rating=0.0; 
     94 
     95                RV rv_vector; 
     96                vec vector; 
     97                datalink exps2vector; 
    7298 
    7399                for (int i=0;i<lanes.length();i++) { 
     
    75101                        //Finding, if we have some expectations 
    76102                        found=false; 
     103                         
    77104                        for (int k=0;k<lanes(i).inputs.length();k++) {  
    78 //                              t_cars_begin.set_size(lanes(i).inputs.length()); 
    79 //                              t_cars_end.set_size(lanes(i).inputs.length()); 
    80  
     105                                int l=0;                 
    81106                                for (int j=0;j<rv_recieved_exps.length();j++) { 
     107                                        t_cars_begin.set_size(l+1,true); 
     108                                        t_cars_end.set_size(l+1,true); 
     109                                        cars_count.set_size(l+1,true); 
     110                                 
    82111                                        int result=rv_recieved_exps.name(j).find(lanes(i).inputs(k)+"-"); 
    83112                                        if (result>=0) { 
    84                                                 ivec ind = rv_recieved_exps.dataind(RV(rv_recieved_exps.name(j),3)); 
    85  
    86                                                 t_cars_begin=recieved_exps(ind(1));             //TODO now using only last found exp. 
    87                                                 t_cars_end=recieved_exps(ind(2)); 
     113 
     114                                                rv_vector = RV(rv_recieved_exps.name(j),3); 
     115                                                ivec ind = rv_vector.dataind(rv_recieved_exps); 
     116 
     117                                                cars_count(l)=recieved_exps(ind(0)); 
     118                                                t_cars_begin(l)=recieved_exps(ind(1)); 
     119                                                t_cars_end(l)=recieved_exps(ind(2)); 
     120                                                l++; 
     121 
    88122                                                found=true; 
    89123                                        } 
    90124                                } 
    91                         } 
    92  
    93                         if (!found) { 
    94                                 t_cars_begin=0; 
    95                                 t_cars_end=cycle_length; 
    96                         } 
    97                         //counting rating 
    98                         t_green_begin=green_starts(sg_index(lanes(i).sg)) + offset; 
    99                         ivec ind = rv_inputs.dataind(RV(name+"_"+lanes(i).sg,1)); 
    100                         t_green_end=t_green_begin+inputs(ind(0)); 
    101  
    102                         //TODO use real queues lenghts 
    103                         if (t_green_begin<t_cars_begin) { 
    104                                 //virtual_queue=lanehs(i)->queue-(t_cars_begin-t_green_begin)/car_leaving; 
    105                                 //virtual_queue=(rand()%8)-(t_cars_begin-t_green_begin)/car_leaving; 
    106                                 virtual_queue=5-(t_cars_begin-t_green_begin)/car_leaving; 
    107                         }  
    108                         else if (t_green_begin>t_cars_begin) { 
    109                                 //virtual_queue=lanehs(i)->queue+(t_green_begin-t_cars_begin)*lanehs(i)->expected_density(); 
    110                                 //virtual_queue=(rand()%9)+(t_green_begin-t_cars_begin)*lanehs(i)->expected_density(); 
    111                                 virtual_queue=4+(t_green_begin-t_cars_begin)*lanehs(i)->expected_density(); 
    112                         } 
    113  
    114                         t_emptiyng=virtual_queue/(1/car_leaving - lanehs(i)->expected_density()); 
    115                         t_mixing=min(t_green_end,t_cars_end)-max(t_green_begin,t_cars_begin); 
    116  
    117                         rating+=max((t_mixing-t_emptiyng)*lanehs(i)->expected_density(),0.0);   
     125                                if (found) {                     
     126                                        //counting rating 
     127                                        string group = name+"_"+lanes(i).sg;            //e.g. 495_VA 
     128                                        int index=group_index(group); 
     129 
     130                                        t_green_begin=green_starts(index) + offset; 
     131                                        double green_time=green_times(index)*cycle_length; 
     132                                        t_green_end=t_green_begin+green_time; 
     133 
     134                                        /************** counting with all exps ****************/ 
     135 
     136                                        int k; 
     137                                        double t_act=t_green_begin; 
     138                                        virtual_queue=lanehs(i)->queue; 
     139 
     140                                        //cycle goes through all stopping points and counts queue lenght at these points 
     141                                        do { 
     142                                                k=min_i(t_cars_begin); 
     143 
     144                                                if (k!=-1) {                                             
     145                                                        double a=cars_count(k); 
     146                                                        double b=t_cars_begin(k); 
     147                                                        double c=t_cars_end(k); 
     148 
     149                                                        //in case there are cars comming before t_green begin 
     150                                                        if (t_cars_begin(k)<t_act) { 
     151                                                                if (t_cars_end(k)<=t_act) { 
     152                                                                        virtual_queue+=cars_count(k); 
     153                                                                        //jen prodlouzime, t_act zustava, odstranime k-ty predpoklad (mozna hned, mozna az na konci 
     154                                                                        cars_count.del(k); 
     155                                                                        t_cars_begin.del(k); 
     156                                                                        t_cars_end.del(k); 
     157 
     158                                                                } 
     159                                                                else { 
     160                                                                        //prodlouzujeme do casu t_green_begin,  
     161                                                                        //pak bud green_begin posuneme do t_act 
     162                                                                        double pomer=(t_cars_begin(k)-t_act)/(t_cars_end(k)-t_cars_begin(k)); 
     163                                                                        virtual_queue+=cars_count(k)*pomer; 
     164                                                                        t_cars_begin(k)=t_act; 
     165                                                                } 
     166                                                        } 
     167                                                        else if (t_cars_begin(k)==t_act) { 
     168                                                                //mixujeme az do t_cars_end nebo t_green_end 
     169                                                                //posuneme t_act na jeden z tech casu 
     170                                                                if (t_cars_end(k)<t_green_end) { 
     171                                                                        virtual_queue+=cars_count(k)-(t_cars_end(k)-t_act)/car_leaving; 
     172                                                                        t_act=t_cars_end(k); 
     173 
     174                                                                        cars_count.del(k); 
     175                                                                        t_cars_begin.del(k); 
     176                                                                        t_cars_end.del(k); 
     177                                                                } 
     178                                                                //t_cars_end>=t_green_end 
     179                                                                else { 
     180                                                                        virtual_queue+=cars_count(k)-(t_green_end-t_act)/car_leaving; 
     181                                                                        t_act=t_green_end; 
     182 
     183                                                                        cars_count.del(k); 
     184                                                                        t_cars_begin.del(k); 
     185                                                                        t_cars_end.del(k);                                                       
     186                                                                } 
     187 
     188 
     189                                                        } 
     190                                                        //t_cars_begin(k)>=t_act 
     191                                                        else { 
     192                                                                //zkracujeme frontu az do t_cars_end(k) nebo t_green_end a posuneme t_act 
     193                                                                if (t_cars_end(k)<t_green_end) { 
     194                                                                        virtual_queue-=(t_cars_end(k)-t_act)/car_leaving; 
     195                                                                        t_act=t_cars_end(k); 
     196                                                                } 
     197                                                                else { 
     198                                                                        virtual_queue-=(t_green_end-t_act)/car_leaving; 
     199                                                                        t_act=t_green_end; 
     200                                                                } 
     201                                                        } 
     202                                                } 
     203                                                else { 
     204                                                        virtual_queue-=(t_green_end-t_act)/car_leaving; 
     205                                                        t_act=t_green_end; 
     206                                                } 
     207                                                if (virtual_queue<0) { 
     208                                                        rating-=virtual_queue; 
     209                                                        virtual_queue=0; 
     210                                                } 
     211 
     212                                        } while (t_act<t_green_end); 
     213                                } 
     214                        } 
    118215                } 
    119216                return rating; 
     
    179276                        int res = rv_recieved_exps.name(j).find("-"+neighbour); 
    180277                        if (res>0) { 
    181                                 ivec ind = rv_recieved_exps.dataind(RV(rv_recieved_exps.name(j),3)); 
     278                                ivec ind = RV(rv_recieved_exps.name(j),3).dataind(rv_recieved_exps); 
     279 
    182280                                rating_n=count_rating(planned_offset); 
    183281 
     
    219317        } 
    220318 
    221         //! returns index of signal group sg 
    222         int sg_index(const string sg) { 
    223                 for (int i=0;i<sgs.length();i++) { 
    224                         if (sgs(i)==sg) { 
     319        // pravdepodobne s chybou, momentalne se nepouziva 
     320        void split_exps() { 
     321                ivec ind; 
     322                RV rv_exp; 
     323                datalink recieved2next; 
     324 
     325                rv_next_exps=RV(); 
     326                for (int i=0;i<rv_recieved_exps.length();i++) { 
     327                        if (rv_recieved_exps.size(i)==3) {               
     328                                rv_exp=RV(rv_recieved_exps.name(i),3); 
     329                                ind = rv_exp.dataind(rv_recieved_exps); 
     330                                //cout << "ind " << ind << endl; 
     331 
     332                                int next_cycle_end=2 * cycle_length - (actual_time % cycle_length); 
     333                                if (recieved_exps(ind(1))>next_cycle_end) { 
     334                                        rv_next_exps.add(rv_exp); 
     335                                        next_exps.set_size(rv_next_exps._dsize()); 
     336                                         
     337                                        if (actual_time==630) { 
     338                                                cout << "rv_next_exps " << rv_next_exps.to_string() << endl; 
     339                                                cout << "rv_recived_exps " << rv_recieved_exps.to_string() << endl; 
     340                                        } 
     341 
     342                                        recieved2next.set_connection(rv_next_exps,rv_recieved_exps); 
     343                                        recieved2next.filldown(recieved_exps,next_exps); 
     344                                        rv_recieved_exps=rv_recieved_exps.subt(rv_exp); 
     345                                } 
     346                                else if (recieved_exps(ind(2))>next_cycle_end) { 
     347                                        rv_next_exps.add(rv_exp); 
     348                                        next_exps.set_size(rv_next_exps._dsize()); 
     349 
     350                                        ivec ind2=rv_exp.dataind(rv_next_exps); 
     351                                        next_exps(ind2(0))=recieved_exps(ind(0)); //TODO to neni spravne 
     352                                        next_exps(ind2(1))=next_cycle_end;  
     353                                        next_exps(ind2(2))=recieved_exps(ind(2)); 
     354                                        recieved_exps(ind(2))=next_cycle_end; 
     355                                } 
     356                        } 
     357                } 
     358        } 
     359 
     360        //! returns index of signal group group 
     361        int group_index(const string group) { 
     362                for (int i=0;i<green_names.length();i++) { 
     363                        if (green_names(i)==group) { 
    225364                                return i; 
    226365                        } 
     
    231370        //! returns offset value shifted to fit interval <0;cycle_length> 
    232371        int normalize_offset(int offset) { 
    233                 while (offset<0 && offset<cycle_length) { 
     372                while (offset<0 || offset>cycle_length) { 
    234373                        if (offset<0) { 
    235374                                offset+=cycle_length; 
     
    241380                return offset; 
    242381        } 
    243  
     382         
     383        //! returns value shifted to fit interval <0;cycle_length> 
     384        template<class T> T normalize(T time) { 
     385                while (time<0 && time<cycle_length) { 
     386                        if (time<0) { 
     387                                time+=cycle_length; 
     388                        } 
     389                        else { 
     390                                time-=cycle_length; 
     391                        } 
     392                } 
     393                return time; 
     394        } 
     395 
     396        template <class T> inline string to_string (const T& t) 
     397        { 
     398                std::stringstream ss; 
     399                ss << t; 
     400                return ss.str(); 
     401        } 
    244402 
    245403        //! returns index of maximum of entered values 
     
    256414        } 
    257415 
     416        //! returns index of smallest element in vectorsx 
     417        int min_i(vec vector) { 
     418                if (vector.length()>0) { 
     419                        double min=vector(0); 
     420                        int index=0; 
     421                        for (int i=1;i<vector.length();i++) { 
     422                                if (vector(i)<min) { 
     423                                        min=vector(i); 
     424                                        index=i; 
     425                                } 
     426                        } 
     427                        return index; 
     428                } 
     429                return -1; 
     430        } 
     431 
    258432public: 
    259433        //! offset set in last simulation step 
     
    261435        //! actual planned offset to set for next simulation step 
    262436        int planned_offset; 
     437        //! planned offset for cycle after next cycle 
     438        int planned_next_offset; 
    263439        //! rating of actual planned offset 
    264440        double planned_rating; 
     441        //! rating of planned next offset 
     442        double planned_next_rating; 
    265443         
    266         //! array of existing signal groups 
    267         Array<string> sgs; 
    268         //! relative starts of green for signal groups 
    269         ivec green_starts; 
    270  
    271444        //! avarage speed of cars 
    272445        int VP; 
     
    275448                rv_action = RV(name+"_offset", 1); // <======= example 
    276449 
    277                 for (int i=0; i<sgs.length();i++) { 
    278                         rv_inputs.add(RV(name+"_"+sgs(i),1)); 
     450                for (int i=0; i<green_names.length();i++) { 
     451                        rv_inputs.add(RV(green_names(i),1)); 
    279452                } 
    280453                inputs.set_size(rv_inputs._dsize()); 
     
    283456 
    284457                for (int i=0;i<lanehs.length();i++) { 
    285                         ivec index = rv_queues.dataind(RV(lanes(i).queue,1)); 
     458                        ivec index = RV(lanes(i).queue,1).dataind(rv_queues); 
    286459                        lanehs(i)->queue_index=index(0); 
    287460                } 
    288  
    289  
    290461        } 
    291462 
     
    323494                // broadcast expected cars 
    324495                if (!seznam.empty()) { 
     496                        double a; 
    325497                        expected_cars(); 
    326498                        do { 
     
    332504                                UI::save ( outputs, msg, "value"); 
    333505                                seznam.pop_back(); 
     506                                a=outputs (10); 
     507                                 
    334508                        } while (!seznam.empty());                       
    335509                } 
     
    375549                // reached final offset. Log value? 
    376550                if (final_state) { 
    377                          
    378                         //cout << "Jmenuji se "<<name<< " a skoncil jsem na offsetu " << planned_offset << " s hodnocenim " << planned_rating <<endl; 
     551                        cout << "Jmenuji se "<<name<< " a skoncil jsem na offsetu " << planned_offset << " s hodnocenim " << planned_rating <<endl; 
    379552                        final_state=false; 
    380553                } 
     
    401574                        rv_recieved_exps=*rv; 
    402575                        recieved_exps=value; 
     576                        //split_exps(); 
    403577                         
    404578                        last_offset=planned_offset; 
     
    411585                                reset_negot_offset=true; 
    412586                        }*/ 
     587 
    413588                        planned_rating=count_rating(planned_offset); 
    414589                        // we have new stable state to broadcast 
     
    418593                        rv_recieved_exps=*rv; 
    419594                        recieved_exps=value; 
     595                        //split_exps(); 
    420596                        planned_rating=count_rating(planned_offset); 
    421597 
     
    423599                                rv_change_request.add(RV(neighbours(i)+"_change",2)); 
    424600                                change_request.set_size(rv_change_request._dsize());  
    425                                 ivec ind=rv_change_request.dataind(RV(neighbours(i)+"_change",2)); 
     601                                ivec ind=RV(neighbours(i)+"_change",2).dataind(rv_change_request); 
    426602                                // offset change 
    427603                                change_request(ind(0))=find_best_exps(negot_offset,neighbours(i),rating_change); 
     
    446622                        for (int i=0;i<rv_recieved_changes.length();i++) { 
    447623 
    448                                 ivec ind=rv_recieved_changes.dataind(RV(rv_recieved_changes.name(i),2)); 
    449  
    450                                 final_rating_diff=-planned_rating+count_rating(planned_offset+(int)recieved_changes(ind(0)))-recieved_changes(ind(0)); 
    451                                 if (final_rating_diff>0) { 
     624                                ivec ind=RV(rv_recieved_changes.name(i),2).dataind(rv_recieved_changes); 
     625 
     626                                final_rating_diff=-planned_rating+count_rating(planned_offset+(int)recieved_changes(ind(0)))+recieved_changes(ind(1)); 
     627                                if (final_rating_diff>=0) { 
    452628                                        planned_offset+=(int)recieved_changes(ind(0)); 
     629                                        planned_offset=normalize_offset(planned_offset); 
    453630                                        planned_rating+=final_rating_diff; 
    454631                                        accepted_from=from; 
     
    473650        void from_setting(const Setting &set) { 
    474651                BaseTrafficAgent::from_setting(set); 
    475                  
    476                 srand(time(NULL)); 
     652 
     653                RV rv_exp; 
     654 
     655                std::ofstream ofile; 
     656                ofile.open("greentimes.txt"); 
     657                ofile.close(); 
    477658 
    478659                car_leaving=2; 
    479660                VP=45; 
     661                actual_time=0; 
    480662 
    481663                negot_offset=8; 
    482664                 
    483665                // load from file 
    484                 UI::get(sgs, set, "sgs", UI::compulsory);        
    485                 UI::get(green_starts, set, "green_starts", UI::compulsory); 
     666                //UI::get(sgs, set, "sgs", UI::compulsory);      
     667 
     668                //UI::get(green_starts, set, "green_starts", UI::compulsory); 
    486669                UI::get(last_offset, set, "offset", UI::compulsory); 
    487          
    488         } 
     670 
     671                for (int i=0;i<lanes.length();i++) { 
     672                        for (int j=0;j<lanes(i).outputs.length();j++) { 
     673                                if (lanes(i).outputs(j)!="DUMMY_DET") { 
     674                                        rv_exp=RV(lanes(i).outputs(j)+"-"+name+"_"+to_string(i),3); 
     675                                        rv_outputs.add(rv_exp); 
     676                                } 
     677                        } 
     678                } 
     679                outputs.set_size(rv_outputs._dsize());   
     680        } 
     681 
    489682        void act(vec &glob_ut){ 
    490683                vec action; 
    491684                action.set_size(rv_action._dsize()); 
    492  
     685                 
    493686                ivec index = rv_action.dataind(RV(name+"_offset",1)); 
     687 
    494688                action(index(0))=planned_offset; 
    495689                last_offset=planned_offset; 
    496  
    497690                action2ds.filldown(action,glob_ut); 
     691 
     692                actual_time+=step_length; 
    498693        } 
    499694