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
MSEmissionExport.cpp
Go to the documentation of this file.
1
/****************************************************************************/
6
// Realises dumping Emission Data
7
/****************************************************************************/
8
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
9
// Copyright (C) 2001-2013 DLR (http://www.dlr.de/) and contributors
10
/****************************************************************************/
11
//
12
// This file is part of SUMO.
13
// SUMO is free software: you can redistribute it and/or modify
14
// it under the terms of the GNU General Public License as published by
15
// the Free Software Foundation, either version 3 of the License, or
16
// (at your option) any later version.
17
//
18
/****************************************************************************/
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 <
microsim/MSEdgeControl.h
>
31
#include <
microsim/MSEdge.h
>
32
#include <
microsim/MSLane.h
>
33
#include <
microsim/MSGlobals.h
>
34
#include <
utils/iodevices/OutputDevice.h
>
35
#include "
MSEmissionExport.h
"
36
#include <
microsim/MSNet.h
>
37
#include <
microsim/MSVehicle.h
>
38
39
#ifdef HAVE_MESOSIM
40
#include <mesosim/MELoop.h>
41
#include <mesosim/MESegment.h>
42
#endif
43
44
#ifdef CHECK_MEMORY_LEAKS
45
#include <
foreign/nvwa/debug_new.h
>
46
#endif // CHECK_MEMORY_LEAKS
47
48
49
// ===========================================================================
50
// method definitions
51
// ===========================================================================
52
void
53
MSEmissionExport::write
(
OutputDevice
& of,
SUMOTime
timestep) {
54
55
of.
openTag
(
"timestep"
) <<
" time=\""
<<
time2string
(timestep) <<
"\">\n"
;
56
57
MSVehicleControl
& vc =
MSNet::getInstance
()->
getVehicleControl
();
58
MSVehicleControl::constVehIt
it = vc.
loadedVehBegin
();
59
MSVehicleControl::constVehIt
end = vc.
loadedVehEnd
();
60
61
for
(; it != end; ++it) {
62
const
MSVehicle
* veh =
static_cast<
const
MSVehicle
*
>
((*it).second);
63
64
if
(veh->
isOnRoad
()) {
65
66
std::string fclass = veh->
getVehicleType
().
getID
();
67
fclass = fclass.substr(0, fclass.find_first_of(
"@"
));
68
69
Position
pos = veh->
getLane
()->
getShape
().
positionAtOffset
(veh->
getPositionOnLane
());
70
of.
openTag
(
"vehicle"
) <<
" id=\""
<< veh->
getID
() <<
"\" eclass=\""
<< veh->
getVehicleType
().
getEmissionClass
() <<
"\" co2=\""
<< veh->
getHBEFA_CO2Emissions
()
71
<<
"\" co=\""
<< veh->
getHBEFA_COEmissions
() <<
"\" hc=\""
<< veh->
getHBEFA_HCEmissions
()
72
<<
"\" nox=\""
<< veh->
getHBEFA_NOxEmissions
() <<
"\" pmx=\""
<< veh->
getHBEFA_PMxEmissions
()
73
<<
"\" noise=\""
<< veh->
getHarmonoise_NoiseEmissions
() <<
"\" route=\""
<< veh->
getRoute
().
getID
()
74
<<
"\" type=\""
<< fclass <<
"\" waiting=\""
<< veh->
getWaitingSeconds
()
75
<<
"\" lane=\""
<< veh->
getLane
()->
getID
() <<
"\" pos=\""
76
<< veh->
getPositionOnLane
() <<
"\" speed=\""
<< veh->
getSpeed
() * 3.6
77
<<
"\" angle=\""
<< veh->
getAngle
() <<
"\" x=\""
<< pos.
x
() <<
"\" y=\""
<< pos.
y
() <<
"\""
;
78
of.
closeTag
();
79
80
}
81
}
82
83
of.
closeTag
();
84
}
home
gladk
tmp
05
sumo-0.17.1~dfsg
src
microsim
output
MSEmissionExport.cpp
Generated on Sun Jun 16 2013 07:07:32 for SUMO - Simulation of Urban MObility by
1.8.1.2