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;
84 o << v <<
";" << a <<
";" << s <<
";" <<
"electricity" <<
";" << result.
electricity << std::endl;
94 main(
int argc,
char** argv) {
104 oc.
addDescription(
"iterate",
"Processing",
"If set, maps for all available emissions are written.");
107 oc.
addDescription(
"emission-class",
"Processing",
"Defines the name of the emission class to generate the map for.");
110 oc.
addDescription(
"v-min",
"Processing",
"Defines the minimum velocity boundary of the map to generate (in m/s).");
112 oc.
addDescription(
"v-max",
"Processing",
"Defines the maximum velocity boundary of the map to generate (in m/s).");
114 oc.
addDescription(
"v-step",
"Processing",
"Defines the velocity step size (in m/s).");
116 oc.
addDescription(
"a-min",
"Processing",
"Defines the minimum acceleration boundary of the map to generate (in m/s^2).");
118 oc.
addDescription(
"a-max",
"Processing",
"Defines the maximum acceleration boundary of the map to generate (in m/s^2).");
120 oc.
addDescription(
"a-step",
"Processing",
"Defines the acceleration step size (in m/s^2).");
122 oc.
addDescription(
"s-min",
"Processing",
"Defines the minimum slope boundary of the map to generate (in deg).");
124 oc.
addDescription(
"s-max",
"Processing",
"Defines the maximum slope boundary of the map to generate (in deg).");
126 oc.
addDescription(
"s-step",
"Processing",
"Defines the slope step size (in deg).");
131 oc.
addDescription(
"output",
"Output",
"Defines the file (or the path if --iterate was set) to write the map(s) into.");
135 oc.
addDescription(
"phemlight-path",
"Emissions",
"Determines where to load PHEMlight definitions from.");
162 if (!oc.
isSet(
"emission-class")) {
163 throw ProcessError(
"The emission class (-e) must be given.");
165 if (!oc.
isSet(
"output-file")) {
166 throw ProcessError(
"The output file (-o) must be given.");
170 c, vMin, vMax, vStep, aMin, aMax, aStep, sMin, sMax, sStep, oc.
getBool(
"verbose"));
172 if (!oc.
isSet(
"output-file")) {
173 oc.
set(
"output-file",
"./");
176 for (std::vector<SUMOEmissionClass>::const_iterator ci = classes.begin(); ci != classes.end(); ++ci) {
179 c, vMin, vMax, vStep, aMin, aMax, aStep, sMin, sMax, sStep, oc.
getBool(
"verbose"));
187 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
200 std::cout <<
"Success." << std::endl;
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
static void init()
Initialises the xml-subsystem.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
static void addReportOptions(OptionsCont &oc)
Adds reporting options to the given container.
static Emissions computeAll(const SUMOEmissionClass c, const double v, const double a, const double slope)
Returns the amount of all emitted pollutants given the vehicle type and state (in mg/s or ml/s for fu...
void setApplicationDescription(const std::string &appDesc)
Sets the application description.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Storage for collected values of all emission types.
SUMOReal getFloat(const std::string &name) const
Returns the SUMOReal-value of the named option (only for Option_Float)
static void close()
Closes all of an applications subsystems.
static void addConfigurationOptions(OptionsCont &oc)
Adds configuration options to the given container.
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
static OptionsCont & getOptions()
Retrieves the options.
void addSynonyme(const std::string &name1, const std::string &name2, bool isDeprecated=false)
Adds a synonyme for an options name (any order)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
int main(int argc, char **argv)
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
static const std::vector< SUMOEmissionClass > getAllClasses()
Checks whether the string describes a known vehicle class.
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
static std::string getName(const SUMOEmissionClass c)
Checks whether the string describes a known vehicle class.
static void getOptions()
Parses the command line arguments and loads the configuration.
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
static SUMOEmissionClass getClassByName(const std::string &eClass, const SUMOVehicleClass vc=SVC_IGNORING)
Checks whether the string describes a known vehicle class.
void inform(std::string msg, bool addType=true)
adds a new error to the list
A storage for options typed value containers)
void single(const std::string &of, const std::string &className, SUMOEmissionClass c, SUMOReal vMin, SUMOReal vMax, SUMOReal vStep, SUMOReal aMin, SUMOReal aMax, SUMOReal aStep, SUMOReal sMin, SUMOReal sMax, SUMOReal sStep, bool verbose)
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
#define WRITE_MESSAGE(msg)
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
void setApplicationName(const std::string &appName, const std::string &fullName)
Sets the application name.