52 #ifdef CHECK_MEMORY_LEAKS
54 #endif // CHECK_MEMORY_LEAKS
71 WRITE_MESSAGE(
"Writing map of '" + className +
"' into '" + of +
"'.");
73 std::ofstream o(of.c_str());
74 for (
SUMOReal v = vMin; v <= vMax; v += vStep) {
75 for (
SUMOReal a = aMin; a <= aMax; a += aStep) {
76 for (
SUMOReal s = sMin; s <= sMax; s += sStep) {
78 o << v <<
";" << a <<
";" << s <<
";" <<
"CO" <<
";" << result.
CO << std::endl;
79 o << v <<
";" << a <<
";" << s <<
";" <<
"CO2" <<
";" << result.
CO2 << std::endl;
80 o << v <<
";" << a <<
";" << s <<
";" <<
"HC" <<
";" << result.
HC << std::endl;
81 o << v <<
";" << a <<
";" << s <<
";" <<
"PMx" <<
";" << result.
PMx << std::endl;
82 o << v <<
";" << a <<
";" << s <<
";" <<
"NOx" <<
";" << result.
NOx << std::endl;
83 o << v <<
";" << a <<
";" << s <<
";" <<
"fuel" <<
";" << result.
fuel << std::endl;
93 main(
int argc,
char** argv) {
103 oc.
addDescription(
"iterate",
"Processing",
"If set, maps for all available emissions are written.");
106 oc.
addDescription(
"emission-class",
"Processing",
"Defines the name of the emission class to generate the map for.");
109 oc.
addDescription(
"v-min",
"Processing",
"Defines the minimum velocity boundary of the map to generate (in m/s).");
111 oc.
addDescription(
"v-max",
"Processing",
"Defines the maximum velocity boundary of the map to generate (in m/s).");
113 oc.
addDescription(
"v-step",
"Processing",
"Defines the velocity step size (in m/s).");
115 oc.
addDescription(
"a-min",
"Processing",
"Defines the minimum acceleration boundary of the map to generate (in m/s^2).");
117 oc.
addDescription(
"a-max",
"Processing",
"Defines the maximum acceleration boundary of the map to generate (in m/s^2).");
119 oc.
addDescription(
"a-step",
"Processing",
"Defines the acceleration step size (in m/s^2).");
121 oc.
addDescription(
"s-min",
"Processing",
"Defines the minimum slope boundary of the map to generate (in deg).");
123 oc.
addDescription(
"s-max",
"Processing",
"Defines the maximum slope boundary of the map to generate (in deg).");
125 oc.
addDescription(
"s-step",
"Processing",
"Defines the slope step size (in deg).");
130 oc.
addDescription(
"output",
"Output",
"Defines the file (or the path if --iterate was set) to write the map(s) into.");
134 oc.
addDescription(
"phemlight-path",
"Emissions",
"Determines where to load PHEMlight definitions from.");
160 if (!oc.
isSet(
"emission-class")) {
161 throw ProcessError(
"The emission class (-e) must be given.");
163 if (!oc.
isSet(
"output-file")) {
164 throw ProcessError(
"The output file (-o) must be given.");
168 c, vMin, vMax, vStep, aMin, aMax, aStep, sMin, sMax, sStep, oc.
getBool(
"verbose"));
170 if (!oc.
isSet(
"output-file")) {
171 oc.
set(
"output-file",
"./");
174 for (std::vector<SUMOEmissionClass>::const_iterator ci = classes.begin(); ci != classes.end(); ++ci) {
177 c, vMin, vMax, vStep, aMin, aMax, aStep, sMin, sMax, sStep, oc.
getBool(
"verbose"));
185 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
198 std::cout <<
"Success." << std::endl;