51 #ifdef CHECK_MEMORY_LEAKS
53 #endif // CHECK_MEMORY_LEAKS
70 WRITE_MESSAGE(
"Writing map of '" + className +
"' into '" + of +
"'.");
72 std::ofstream o(of.c_str());
73 for (
SUMOReal v = vMin; v <= vMax; v += vStep) {
74 for (
SUMOReal a = aMin; a <= aMax; a += aStep) {
75 for (
SUMOReal s = sMin; s <= sMax; s += sStep) {
91 main(
int argc,
char** argv) {
100 oc.
addDescription(
"iterate",
"Processing",
"If set, maps for all available emissions are written.");
103 oc.
addDescription(
"emission-class",
"Processing",
"Defines the name of the emission class to generate the map for.");
106 oc.
addDescription(
"v-min",
"Processing",
"Defines the minimum velocity boundary of the map to generate (in [m/s]).");
108 oc.
addDescription(
"v-max",
"Processing",
"Defines the maximum velocity boundary of the map to generate (in [m/s]).");
110 oc.
addDescription(
"v-step",
"Processing",
"Defines the velocity step size (in [m/s]).");
112 oc.
addDescription(
"a-min",
"Processing",
"Defines the minimum acceleration boundary of the map to generate (in [m/s^2]).");
114 oc.
addDescription(
"a-max",
"Processing",
"Defines the maximum acceleration boundary of the map to generate (in [m/s^2]).");
116 oc.
addDescription(
"a-step",
"Processing",
"Defines the acceleration step size (in [m/s^2]).");
118 oc.
addDescription(
"s-min",
"Processing",
"Defines the minimum slope boundary of the map to generate (in [°]).");
120 oc.
addDescription(
"s-max",
"Processing",
"Defines the maximum slope boundary of the map to generate (in [°]).");
122 oc.
addDescription(
"s-step",
"Processing",
"Defines the slope step size (in [°]).");
127 oc.
addDescription(
"emission-class",
"Output",
"Defines the file (or the path if --iterate was set) to write the map(s) into.");
131 oc.
addDescription(
"phemlight-path",
"Emissions",
"Determines where to load PHEMlight definitions from.");
135 oc.
addDescription(
"verbose",
"Report",
"Switches to verbose output.");
161 if (!oc.
isSet(
"emission-class")) {
162 throw ProcessError(
"The emission class (-e) must be given.");
164 if (!oc.
isSet(
"output-file")) {
165 throw ProcessError(
"The output file (-o) must be given.");
169 c, vMin, vMax, vStep, aMin, aMax, aStep, sMin, sMax, sStep, oc.
getBool(
"verbose"));
171 if (!oc.
isSet(
"output-file")) {
172 oc.
set(
"output-file",
"./");
179 c, vMin, vMax, vStep, aMin, aMax, aStep, sMin, sMax, sStep, oc.
getBool(
"verbose"));
188 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
201 std::cout <<
"Success." << std::endl;
SUMOEmissionClass getVehicleEmissionTypeID(const std::string &name)
Returns the class id of the emission class given by its name.
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.
std::string getVehicleEmissionTypeName(SUMOEmissionClass id)
Returns the class name of the emission class given by its id.
static void getOptions(bool loadConfig, int argc=0, char **argv=0)
Parses the command line arguments and loads the configuration optionally.
StringBijection< SUMOEmissionClass > SumoEmissionClassStrings(SumoEmissionClassStringInitializer, SVE_Solo_LKW_D_EU6_II)
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)
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 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)
static SUMOReal computeFuel(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of consumed fuel given the vehicle type and state (in ml/s)
SUMOEmissionClass
Definition of vehicle emission classes.
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)
static SUMOReal computeCO2(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of emitted CO2 given the vehicle type and state (in mg/s)
static SUMOReal computeNOx(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of emitted NOx given the vehicle type and state (in mg/s)
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
static SUMOReal computeHC(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of emitted HC given the vehicle type and state (in mg/s)
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
static SUMOReal computeCO(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of emitted CO given the vehicle type and state (in mg/s)
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)
static SUMOReal computePMx(SUMOEmissionClass c, double v, double a, double slope)
Returns the amount of emitted PMx given the vehicle type and state (in mg/s)
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.