root/applications/doprava/aimsun_bdm/aimsun_ds.h @ 1191

Revision 1134, 1.7 kB (checked in by prikryl, 14 years ago)

Remember the process handle of the Aimsun process.
Use the class destructor to terminate Aimsun and the waiting controllers.

Line 
1/*!
2  \file
3  \brief DataSource for experiments with Aimsun
4  \author Jan Prikryl.
5
6*/
7
8/* WIN32 stuff */
9#include <windows.h>
10#include <stdio.h>
11#include <tchar.h>
12
13#include <base/loggers.h>
14
15extern "C" {
16  #include "eh_hrd.h"
17  #include "vgs_hrd.h"
18}
19
20using namespace bdm;
21
22//! Simulator of traffic - AIMSUN
23class AimsunDS : public DS
24{
25
26protected:
27        //! Pointer to realised signal plans stored in local data space of eh_api.
28        eh_els3hrd * p_rsp;
29
30        //! Target buffer when querying VGS for last section statistics data.
31        vgs_sections_stats sections_stats;
32
33public:
34    //! Constructor with fixed sampling period
35    AimsunDS ();
36
37        //! Destructor
38        ~AimsunDS ();
39
40    //! Get measurements and signal plans from ELS3 controllers
41    void getdata ( vec &dt ) const;
42
43    //! Write new signal plans to ELS3
44    void write ( vec &ut );
45
46    //! Wait for new data and copy them out to local buffers
47    void step();
48       
49        //! number of steps
50        int max_length() {return stopCycle;}
51
52        //! converts i to string, if i has only one digit, adds 0 before it
53        string int_to_string(int const i);
54
55        virtual void from_setting ( const Setting &cfg );
56        virtual void validate ( void );
57       
58    // TODO dodelat void to_setting( Setting &root ) const;
59private:
60        //! Handle of the Aimsun process. Used to terminate Aimsun after simulation.
61        intptr_t hPid;
62       
63        //! File name containing vehicle entrances into the network
64        string entranceFileName;
65       
66        //! Stop time of the simulation
67        string stopTime;
68
69        //! Number of cycles of the simulation
70        int stopCycle;
71       
72        void AimsunDS::initVGS (
73                const vgs_headway_mode headway,
74                const string &entrancePath,
75                const string &sectionStatsPath,
76                const string &globalStatsPath
77        );
78
79};
80UIREGISTER(AimsunDS);
Note: See TracBrowser for help on using the browser.