SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
Command_SaveTLSState.cpp
Go to the documentation of this file.
1
/****************************************************************************/
8
// Writes the state of the tls to a file (in each second)
9
/****************************************************************************/
10
// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
11
// Copyright (C) 2001-2014 DLR (http://www.dlr.de/) and contributors
12
/****************************************************************************/
13
//
14
// This file is part of SUMO.
15
// SUMO is free software: you can redistribute it and/or modify
16
// it under the terms of the GNU General Public License as published by
17
// the Free Software Foundation, either version 3 of the License, or
18
// (at your option) any later version.
19
//
20
/****************************************************************************/
21
// ===========================================================================
22
// included modules
23
// ===========================================================================
24
#ifdef _MSC_VER
25
#include <
windows_config.h
>
26
#else
27
#include <
config.h
>
28
#endif
29
30
#include "
Command_SaveTLSState.h
"
31
#include <
microsim/traffic_lights/MSTrafficLightLogic.h
>
32
#include <
microsim/MSEventControl.h
>
33
#include <
microsim/MSNet.h
>
34
#include <
utils/common/UtilExceptions.h
>
35
#include <
utils/common/MsgHandler.h
>
36
#include <
utils/iodevices/OutputDevice.h
>
37
38
#ifdef CHECK_MEMORY_LEAKS
39
#include <
foreign/nvwa/debug_new.h
>
40
#endif // CHECK_MEMORY_LEAKS
41
42
43
// ===========================================================================
44
// method definitions
45
// ===========================================================================
46
Command_SaveTLSState::Command_SaveTLSState
(
const
MSTLLogicControl::TLSLogicVariants
& logics,
47
OutputDevice
& od)
48
: myOutputDevice(od), myLogics(logics) {
49
MSNet::getInstance
()->
getEndOfTimestepEvents
().
addEvent
(
this
, 0,
MSEventControl::ADAPT_AFTER_EXECUTION
);
50
myOutputDevice
.
writeXMLHeader
(
"tls-states"
);
51
}
52
53
54
Command_SaveTLSState::~Command_SaveTLSState
() {
55
}
56
57
58
SUMOTime
59
Command_SaveTLSState::execute
(
SUMOTime
currentTime) {
60
myOutputDevice
<<
" <tlsState time=\""
<<
time2string
(currentTime)
61
<<
"\" id=\""
<<
myLogics
.
getActive
()->
getID
()
62
<<
"\" programID=\""
<<
myLogics
.
getActive
()->
getProgramID
()
63
<<
"\" phase=\""
<<
myLogics
.
getActive
()->
getCurrentPhaseIndex
()
64
<<
"\" state=\""
<<
myLogics
.
getActive
()->
getCurrentPhaseDef
().
getState
() <<
"\"/>\n"
;
65
return
DELTA_T
;
66
}
67
68
69
70
/****************************************************************************/
tmp
buildd
sumo-0.21.0+dfsg
src
microsim
actions
Command_SaveTLSState.cpp
Generated on Thu Nov 20 2014 19:49:52 for SUMO - Simulation of Urban MObility by
1.8.1.2