root/applications/doprava/traffic_agent.cpp @ 840

Revision 840, 1.4 kB (checked in by smidl, 14 years ago)

aimsunDS minor correction + improvements in Agents

Line 
1#include "traffic_agent.h"
2
3void SignalGroup::from_setting(const libconfig::Setting& set)
4{
5UI::get(name,set, "name", UI::compulsory);
6UI::get(detectors, set, "detectors", UI::optional);
7//
8// TODO make some analysis of the detectors
9
10}
11
12void BaseTrafficAgent::from_setting(const Setting& set)
13{
14    bdm::Participant::from_setting(set);
15       
16        // load from file
17        UI::get(sg,set,"sg", UI::compulsory);
18        UI::get(requests,set,"output",UI::compulsory);
19        Array<DetectorIn> det_in;
20        UI::get(det_in, set, "input",UI::compulsory);
21       
22        // process sg == create handles
23        sgh.set_length(sg.length());
24        for(int i=0;i<sg.length();i++){
25                sgh(i).connect_sg(sg(i),name);
26        }
27       
28        // process output == handles
29        request_handler.set_length(requests.length());
30        for(int i=0;i<requests.length();i++){
31                request_handler(i).connect_request(requests(i),name);
32                output_rv.add(request_handler(i).rv);
33        }
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       
47        // process DetIn - create input
48        for (int i=0; i<det_in.length(); i++){
49                input_rv.add(RV(det_in(i).name,2));
50        }
51        input_data.set_size(input_rv._dsize());
52}
Note: See TracBrowser for help on using the browser.