44 #include <xercesc/parsers/SAXParser.hpp> 45 #include <xercesc/sax2/SAX2XMLReader.hpp> 67 #ifdef CHECK_MEMORY_LEAKS 69 #endif // CHECK_MEMORY_LEAKS 78 oc.
addCallExample(
"-c <CONFIGURATION>",
"run with configuration file");
95 oc.
addDescription(
"taz-files",
"Input",
"Loads TAZ (districts; also from networks) from FILE(s)");
100 oc.
addDescription(
"od-matrix-files",
"Input",
"Loads O/D-files from FILE(s)");
103 oc.
addSynonyme(
"od-amitran-files",
"amitran-files");
105 oc.
addDescription(
"od-amitran-files",
"Input",
"Loads O/D-matrix in Amitran format from FILE(s)");
111 oc.
addDescription(
"output-file",
"Output",
"Writes trip definitions into FILE");
114 oc.
addDescription(
"flow-output",
"Output",
"Writes flow definitions into FILE");
117 oc.
addSynonyme(
"ignore-vehicle-type",
"no-vtype",
true);
118 oc.
addDescription(
"ignore-vehicle-type",
"Output",
"Does not save vtype information");
123 oc.
addDescription(
"begin",
"Time",
"Defines the begin time; Previous trips will be discarded");
126 oc.
addDescription(
"end",
"Time",
"Defines the end time; Later trips will be discarded; Defaults to the maximum time that SUMO can represent");
131 oc.
addDescription(
"scale",
"Processing",
"Scales the loaded flows by FLOAT");
134 oc.
addDescription(
"spread.uniform",
"Processing",
"Spreads trips uniformly over each time period");
137 oc.
addDescription(
"different-source-sink",
"Processing",
"Always choose source and sink edge which are not identical");
140 oc.
addDescription(
"vtype",
"Processing",
"Defines the name of the vehicle type to use");
143 oc.
addDescription(
"prefix",
"Processing",
"Defines the prefix for vehicle names");
146 oc.
addDescription(
"timeline",
"Processing",
"Uses STR as a timeline definition");
149 oc.
addDescription(
"timeline.day-in-hours",
"Processing",
"Uses STR as a 24h-timeline definition");
152 oc.
addSynonyme(
"ignore-errors",
"dismiss-loading-errors",
true);
153 oc.
addDescription(
"ignore-errors",
"Processing",
"Continue on broken input");
156 oc.
addDescription(
"no-step-log",
"Processing",
"Disable console output of current time step");
161 oc.
addDescription(
"departlane",
"Defaults",
"Assigns a default depart lane");
164 oc.
addDescription(
"departpos",
"Defaults",
"Assigns a default depart position");
167 oc.
addDescription(
"departspeed",
"Defaults",
"Assigns a default depart speed");
170 oc.
addDescription(
"arrivallane",
"Defaults",
"Assigns a default arrival lane");
173 oc.
addDescription(
"arrivalpos",
"Defaults",
"Assigns a default arrival position");
176 oc.
addDescription(
"arrivalspeed",
"Defaults",
"Assigns a default arrival speed");
186 if (!oc.
isSet(
"taz-files")) {
190 if (!oc.
isSet(
"od-matrix-files") && !oc.
isSet(
"od-amitran-files")) {
194 if (!oc.
isSet(
"output-file")) {
195 WRITE_ERROR(
"No trip table output file (-o) specified.");
259 if (!oc.
isSet(
"taz-files")) {
260 throw ProcessError(
"You must supply a TAZ, network or districts file ('-n').");
265 if (districts.
size() == 0) {
279 if (oc.
isSet(
"timeline")) {
283 bool haveOutput =
false;
287 oc.
getBool(
"spread.uniform"), oc.
getBool(
"different-source-sink"),
288 oc.
getBool(
"ignore-vehicle-type"),
304 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
310 }
catch (
const std::exception& e) {
311 if (std::string(e.what()) != std::string(
"")) {
323 std::cout <<
"Success." << std::endl;
SUMOReal getNoLoaded() const
Returns the number of loaded vehicles.
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
static void init()
Initialises the xml-subsystem.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
static void insertRandOptions()
Initialises the given options container with random number options.
static bool parseDepartSpeed(const std::string &val, const std::string &element, const std::string &id, SUMOReal &speed, DepartSpeedDefinition &dsd, std::string &error)
Validates a given departSpeed value.
static void addReportOptions(OptionsCont &oc)
Adds reporting options to the given container.
static bool parseArrivalPos(const std::string &val, const std::string &element, const std::string &id, SUMOReal &pos, ArrivalPosDefinition &apd, std::string &error)
Validates a given arrivalPos value.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme)
Enables or disables validation.
void addCallExample(const std::string &example, const std::string &desc)
Add a call example.
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
SUMOReal departSpeed
(optional) The initial speed of the vehicle
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 arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
SUMOReal arrivalPos
(optional) The position the vehicle shall arrive on
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
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.
static void initRandGlobal(MTRand *which=0)
Reads the given random number options and initialises the random number generator in accordance...
void loadMatrix(OptionsCont &oc)
read a matrix in one of several formats
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)
SUMOReal getNoDiscarded() const
Returns the number of discarded vehicles.
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
An O/D (origin/destination) matrix.
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
int arrivalLane
(optional) The lane the vehicle shall arrive on (not used yet)
SUMOTime string2time(const std::string &r)
unsigned int size() const
Returns the number of items within the container.
A container for districts.
SUMOReal getNoWritten() const
Returns the number of written vehicles.
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
static bool parseArrivalLane(const std::string &val, const std::string &element, const std::string &id, int &lane, ArrivalLaneDefinition &ald, std::string &error)
Validates a given arrivalLane value.
#define SUMOTIME_MAXSTRING
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
static bool parseDepartPos(const std::string &val, const std::string &element, const std::string &id, SUMOReal &pos, DepartPosDefinition &dpd, std::string &error)
Validates a given departPos value.
void writeFlows(const SUMOTime begin, const SUMOTime end, OutputDevice &dev, const bool noVtype, const std::string &prefix)
Writes the flows stored in the matrix.
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
void loadDistricts(std::vector< std::string > files)
load districts from files
static bool parseArrivalSpeed(const std::string &val, const std::string &element, const std::string &id, SUMOReal &speed, ArrivalSpeedDefinition &asd, std::string &error)
Validates a given arrivalSpeed value.
static void getOptions()
Parses the command line arguments and loads the configuration.
int main(int argc, char **argv)
Structure representing possible vehicle parameter.
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
void inform(std::string msg, bool addType=true)
adds a new error to the list
A storage for options typed value containers)
void applyCurve(const Distribution_Points &ps)
Splits the stored cells dividing them on the given time line.
SUMOReal departPos
(optional) The position the vehicle shall depart from
static bool createDeviceByOption(const std::string &optionName, const std::string &rootElement="", const std::string &schemaFile="")
Creates the device using the output definition stored in the named option.
void write(SUMOTime begin, const SUMOTime end, OutputDevice &dev, const bool uniform, const bool differSourceSink, const bool noVtype, const std::string &prefix, const bool stepLog)
Writes the vehicles stored in the matrix assigning the sources and sinks.
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 void initOutputOptions()
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
Distribution_Points parseTimeLine(const std::vector< std::string > &def, bool timelineDayInHours)
split the given timeline
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
static bool parseDepartLane(const std::string &val, const std::string &element, const std::string &id, int &lane, DepartLaneDefinition &dld, std::string &error)
Validates a given departLane value.
void setApplicationName(const std::string &appName, const std::string &fullName)
Sets the application name.