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_SaveTLCoupledLaneDet.cpp
Go to the documentation of this file.
1
/****************************************************************************/
9
// Writes e2 state of a link for the time the link has yellow/red
10
/****************************************************************************/
11
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12
// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
13
/****************************************************************************/
14
//
15
// This file is part of SUMO.
16
// SUMO is free software: you can redistribute it and/or modify
17
// it under the terms of the GNU General Public License as published by
18
// the Free Software Foundation, either version 3 of the License, or
19
// (at your option) any later version.
20
//
21
/****************************************************************************/
22
23
24
// ===========================================================================
25
// included modules
26
// ===========================================================================
27
#ifdef _MSC_VER
28
#include <
windows_config.h
>
29
#else
30
#include <
config.h
>
31
#endif
32
33
#include "
Command_SaveTLCoupledLaneDet.h
"
34
#include <
microsim/MSNet.h
>
35
#include <
microsim/traffic_lights/MSTrafficLightLogic.h
>
36
#include <
microsim/MSEventControl.h
>
37
#include <
microsim/output/MSDetectorFileOutput.h
>
38
#include <
microsim/MSLinkCont.h
>
39
#include <
utils/common/UtilExceptions.h
>
40
#include <
utils/common/MsgHandler.h
>
41
#include <
utils/iodevices/OutputDevice.h
>
42
43
#ifdef CHECK_MEMORY_LEAKS
44
#include <
foreign/nvwa/debug_new.h
>
45
#endif // CHECK_MEMORY_LEAKS
46
47
48
// ===========================================================================
49
// method definitions
50
// ===========================================================================
51
Command_SaveTLCoupledLaneDet::Command_SaveTLCoupledLaneDet
(
MSTLLogicControl::TLSLogicVariants
& tlls,
52
MSDetectorFileOutput
* dtf,
unsigned
int
begin,
OutputDevice
& device,
MSLink
* link)
53
:
Command_SaveTLCoupledDet
(tlls, dtf, begin, device),
54
myLink(link), myLastState(
LINKSTATE_TL_RED
),
55
myHadOne(false) {
56
execute
();
57
}
58
59
60
Command_SaveTLCoupledLaneDet::~Command_SaveTLCoupledLaneDet
() {
61
}
62
63
64
void
65
Command_SaveTLCoupledLaneDet::execute
() {
66
if
(
myLink
->
getState
() ==
myLastState
&&
myHadOne
) {
67
return
;
68
}
69
myHadOne
=
true
;
70
if
(
myLastState
==
LINKSTATE_TL_RED
&&
myLink
->
getState
() !=
LINKSTATE_TL_RED
) {
71
SUMOTime
end =
MSNet::getInstance
()->
getCurrentTimeStep
();
72
if
(
myStartTime
!= end) {
73
myDetector
->
writeXMLOutput
(
myDevice
,
myStartTime
, end);
74
myStartTime
= end;
75
}
76
}
else
if
(
myLink
->
getState
() ==
LINKSTATE_TL_RED
) {
77
myDetector
->
reset
();
78
myStartTime
=
MSNet::getInstance
()->
getCurrentTimeStep
();
79
}
80
myLastState
=
myLink
->
getState
();
81
}
82
83
84
85
/****************************************************************************/
86
home
gladk
tmp
05
sumo-0.17.1~dfsg
src
microsim
actions
Command_SaveTLCoupledLaneDet.cpp
Generated on Sun Jun 16 2013 07:07:00 for SUMO - Simulation of Urban MObility by
1.8.1.2