 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
54 double vMin,
double vMax,
double vStep,
55 double aMin,
double aMax,
double aStep,
56 double sMin,
double sMax,
double sStep,
59 WRITE_MESSAGE(
"Writing map of '" + className +
"' into '" + of +
"'.");
61 std::ofstream o(of.c_str());
62 for (
double v = vMin; v <= vMax; v += vStep) {
63 for (
double a = aMin; a <= aMax; a += aStep) {
64 for (
double s = sMin; s <= sMax; s += sStep) {
66 o << v <<
";" << a <<
";" << s <<
";" <<
"CO" <<
";" << result.
CO << std::endl;
67 o << v <<
";" << a <<
";" << s <<
";" <<
"CO2" <<
";" << result.
CO2 << std::endl;
68 o << v <<
";" << a <<
";" << s <<
";" <<
"HC" <<
";" << result.
HC << std::endl;
69 o << v <<
";" << a <<
";" << s <<
";" <<
"PMx" <<
";" << result.
PMx << std::endl;
70 o << v <<
";" << a <<
";" << s <<
";" <<
"NOx" <<
";" << result.
NOx << std::endl;
71 o << v <<
";" << a <<
";" << s <<
";" <<
"fuel" <<
";" << result.
fuel << std::endl;
72 o << v <<
";" << a <<
";" << s <<
";" <<
"electricity" <<
";" << result.
electricity << std::endl;
82 main(
int argc,
char** argv) {
92 oc.
addDescription(
"iterate",
"Processing",
"If set, maps for all available emissions are written.");
95 oc.
addDescription(
"emission-class",
"Processing",
"Defines the name of the emission class to generate the map for.");
98 oc.
addDescription(
"v-min",
"Processing",
"Defines the minimum velocity boundary of the map to generate (in m/s).");
100 oc.
addDescription(
"v-max",
"Processing",
"Defines the maximum velocity boundary of the map to generate (in m/s).");
102 oc.
addDescription(
"v-step",
"Processing",
"Defines the velocity step size (in m/s).");
104 oc.
addDescription(
"a-min",
"Processing",
"Defines the minimum acceleration boundary of the map to generate (in m/s^2).");
106 oc.
addDescription(
"a-max",
"Processing",
"Defines the maximum acceleration boundary of the map to generate (in m/s^2).");
108 oc.
addDescription(
"a-step",
"Processing",
"Defines the acceleration step size (in m/s^2).");
110 oc.
addDescription(
"s-min",
"Processing",
"Defines the minimum slope boundary of the map to generate (in deg).");
112 oc.
addDescription(
"s-max",
"Processing",
"Defines the maximum slope boundary of the map to generate (in deg).");
114 oc.
addDescription(
"s-step",
"Processing",
"Defines the slope step size (in deg).");
119 oc.
addDescription(
"output",
"Output",
"Defines the file (or the path if --iterate was set) to write the map(s) into.");
123 oc.
addDescription(
"phemlight-path",
"Emissions",
"Determines where to load PHEMlight definitions from.");
141 double vStep = oc.
getFloat(
"v-step");
144 double aStep = oc.
getFloat(
"a-step");
147 double sStep = oc.
getFloat(
"s-step");
149 if (!oc.
isSet(
"emission-class")) {
150 throw ProcessError(
"The emission class (-e) must be given.");
152 if (!oc.
isSet(
"output-file")) {
153 throw ProcessError(
"The output file (-o) must be given.");
157 c, vMin, vMax, vStep, aMin, aMax, aStep, sMin, sMax, sStep, oc.
getBool(
"verbose"));
159 if (!oc.
isSet(
"output-file")) {
160 oc.
set(
"output-file",
"./");
163 for (std::vector<SUMOEmissionClass>::const_iterator ci = classes.begin(); ci != classes.end(); ++ci) {
166 c, vMin, vMax, vStep, aMin, aMax, aStep, sMin, sMax, sStep, oc.
getBool(
"verbose"));
174 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
187 std::cout <<
"Success." << std::endl;
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
static void addConfigurationOptions(OptionsCont &oc)
Adds configuration options to the given container.
static void close()
Closes all of an applications subsystems.
bool set(const std::string &name, const std::string &value)
Sets the given value for the named option.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static OptionsCont & getOptions()
Retrieves the options.
int main(int argc, char **argv)
static std::string getName(const SUMOEmissionClass c)
Checks whether the string describes a known vehicle class.
static void addReportOptions(OptionsCont &oc)
Adds reporting options to the given container.
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
std::vector< std::string > StringVector
Definition of a vector of strings.
void setApplicationName(const std::string &appName, const std::string &fullName)
Sets the application name.
static const std::vector< SUMOEmissionClass > getAllClasses()
Checks whether the string describes a known vehicle class.
void addSynonyme(const std::string &name1, const std::string &name2, bool isDeprecated=false)
Adds a synonyme for an options name (any order)
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
static Emissions computeAll(const SUMOEmissionClass c, const double v, const double a, const double slope, const std::map< int, double > *param=0)
Returns the amount of all emitted pollutants given the vehicle type and state (in mg/s or ml/s for fu...
static void init()
Initialises the xml-subsystem.
A storage for options typed value containers)
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
static SUMOEmissionClass getClassByName(const std::string &eClass, const SUMOVehicleClass vc=SVC_IGNORING)
Checks whether the string describes a known vehicle class.
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
void setApplicationDescription(const std::string &appDesc)
Sets the application description.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
Storage for collected values of all emission types.
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
void single(const std::string &of, const std::string &className, SUMOEmissionClass c, double vMin, double vMax, double vStep, double aMin, double aMax, double aStep, double sMin, double sMax, double sStep, bool verbose)
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
#define WRITE_MESSAGE(msg)