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;
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 void getOptions(bool loadConfig, int argc=0, char **argv=0)
Parses the command line arguments and loads the configuration optionally.
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 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.
const std::string getBuildName(const std::string &version)
attach some build flags to the version string
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.
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.