80 oc.
addDescription(
"taz-files",
"Input",
TL(
"Loads TAZ (districts; also from networks) from FILE(s)"));
85 oc.
addDescription(
"od-matrix-files",
"Input",
TL(
"Loads O/D-files from FILE(s)"));
88 oc.
addSynonyme(
"od-amitran-files",
"amitran-files");
90 oc.
addDescription(
"od-amitran-files",
"Input",
TL(
"Loads O/D-matrix in Amitran format from FILE(s)"));
93 oc.
addDescription(
"tazrelation-files",
"Input",
TL(
"Loads O/D-matrix in tazRelation format from FILE(s)"));
96 oc.
addSynonyme(
"tazrelation-attribute",
"attribute");
97 oc.
addDescription(
"tazrelation-attribute",
"Input",
TL(
"Define data attribute for loading counts (default 'count')"));
102 oc.
addDescription(
"output-file",
"Output",
TL(
"Writes trip definitions into FILE"));
105 oc.
addDescription(
"flow-output",
"Output",
TL(
"Writes flow definitions into FILE"));
108 oc.
addDescription(
"flow-output.probability",
"Output",
TL(
"Writes probabilistic flow instead of evenly spaced flow"));
111 oc.
addDescription(
"flow-output.poisson",
"Output",
TL(
"Writes poisson distributed flow instead of evenly spaced flow"));
114 oc.
addDescription(
"pedestrians",
"Output",
TL(
"Writes pedestrians instead of vehicles"));
117 oc.
addDescription(
"persontrips",
"Output",
TL(
"Writes persontrips instead of vehicles"));
120 oc.
addDescription(
"persontrips.modes",
"Output",
TL(
"Add modes attribute to personTrips"));
123 oc.
addSynonyme(
"ignore-vehicle-type",
"no-vtype",
true);
124 oc.
addDescription(
"ignore-vehicle-type",
"Output",
TL(
"Does not save vtype information"));
127 oc.
addDescription(
"junctions",
"Output",
TL(
"Writes trips between junctions"));
132 oc.
addDescription(
"begin",
"Time",
TL(
"Defines the begin time; Previous trips will be discarded"));
135 oc.
addDescription(
"end",
"Time",
TL(
"Defines the end time; Later trips will be discarded; Defaults to the maximum time that SUMO can represent"));
140 oc.
addDescription(
"scale",
"Processing",
TL(
"Scales the loaded flows by FLOAT"));
143 oc.
addDescription(
"spread.uniform",
"Processing",
TL(
"Spreads trips uniformly over each time period"));
146 oc.
addDescription(
"different-source-sink",
"Processing",
TL(
"Always choose source and sink edge which are not identical"));
149 oc.
addDescription(
"vtype",
"Processing",
TL(
"Defines the name of the vehicle type to use"));
152 oc.
addDescription(
"prefix",
"Processing",
TL(
"Defines the prefix for vehicle names"));
155 oc.
addDescription(
"timeline",
"Processing",
TL(
"Uses STR[] as a timeline definition"));
158 oc.
addDescription(
"timeline.day-in-hours",
"Processing",
TL(
"Uses STR as a 24h-timeline definition"));
161 oc.
addSynonyme(
"ignore-errors",
"dismiss-loading-errors",
true);
162 oc.
addDescription(
"ignore-errors",
"Report",
TL(
"Continue on broken input"));
165 oc.
addDescription(
"no-step-log",
"Processing",
TL(
"Disable console output of current time step"));
170 oc.
addDescription(
"departlane",
"Defaults",
TL(
"Assigns a default depart lane"));
173 oc.
addDescription(
"departpos",
"Defaults",
TL(
"Assigns a default depart position"));
176 oc.
addDescription(
"departspeed",
"Defaults",
TL(
"Assigns a default depart speed"));
179 oc.
addDescription(
"arrivallane",
"Defaults",
TL(
"Assigns a default arrival lane"));
182 oc.
addDescription(
"arrivalpos",
"Defaults",
TL(
"Assigns a default arrival position"));
185 oc.
addDescription(
"arrivalspeed",
"Defaults",
TL(
"Assigns a default arrival speed"));
195 if (!oc.
isSet(
"taz-files")) {
199 if (!oc.
isSet(
"od-matrix-files") && !oc.
isSet(
"od-amitran-files") && !oc.
isSet(
"tazrelation-files")) {
203 if (!oc.
isSet(
"output-file") && !oc.
isSet(
"flow-output")) {
204 WRITE_ERROR(
TL(
"No trip table output file (-o) or flow-output is specified."));
207 if (oc.
getBool(
"flow-output.probability") && oc.
getBool(
"flow-output.poisson")) {
208 WRITE_ERROR(
TL(
"Only one of the options 'flow-output.probability' and 'flow-output.poisson' may be set."));
212 WRITE_ERROR(
TL(
"Only one of the Options 'pedestrians' and 'persontrips' may be set."));
276 if (!oc.
isSet(
"taz-files")) {
277 throw ProcessError(
TL(
"You must supply a TAZ, network or districts file ('-n')."));
282 if (districts.
size() == 0) {
296 if (oc.
isSet(
"timeline")) {
301 bool haveOutput =
false;
306 oc.
getBool(
"spread.uniform"), oc.
getBool(
"different-source-sink"),
307 oc.
getBool(
"ignore-vehicle-type"),
310 oc.
getBool(
"persontrips"), modes);
317 oc.
getBool(
"flow-output.probability"),
318 oc.
getBool(
"flow-output.poisson"),
320 oc.
getBool(
"persontrips"), modes);
329 if (std::string(e.what()) != std::string(
"Process Error") && std::string(e.what()) != std::string(
"")) {
335 }
catch (
const std::exception& e) {
336 if (std::string(e.what()) != std::string(
"")) {
348 std::cout <<
"Success." << std::endl;
#define WRITE_MESSAGE(msg)
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
virtual void inform(std::string msg, bool addType=true)
adds a new error to the list
static void initOutputOptions()
init output options
int size() const
Returns the number of stored items within the container.
A container for districts.
void loadDistricts(std::vector< std::string > files)
load districts from files
An O/D (origin/destination) matrix.
void writeFlows(const SUMOTime begin, const SUMOTime end, OutputDevice &dev, const bool noVtype, const std::string &prefix, bool asProbability=false, bool asPoisson=false, bool pedestrians=false, bool persontrips=false, const std::string &modes="")
Writes the flows stored in the matrix.
double getNumLoaded() const
Returns the number of loaded vehicles.
void applyCurve(const Distribution_Points &ps)
Splits the stored cells dividing them on the given time line.
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, bool pedestrians, bool persontrips, const std::string &modes)
Writes the vehicles stored in the matrix assigning the sources and sinks.
Distribution_Points parseTimeLine(const std::vector< std::string > &def, bool timelineDayInHours)
split the given timeline
void loadMatrix(OptionsCont &oc)
read a matrix in one of several formats
double getNumWritten() const
Returns the number of written vehicles.
double getNumDiscarded() const
Returns the number of discarded vehicles.
A storage for options typed value containers)
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
void setApplicationName(const std::string &appName, const std::string &fullName)
Sets the application name.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
void addSynonyme(const std::string &name1, const std::string &name2, bool isDeprecated=false)
Adds a synonyme for an options name (any order)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
void doRegister(const std::string &name, Option *o)
Adds an option under the given name.
void setApplicationDescription(const std::string &appDesc)
Sets the application description.
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
static OptionsCont & getOptions()
Retrieves the options.
bool processMetaOptions(bool missingOptions)
Checks for help and configuration output, returns whether we should exit.
void addCallExample(const std::string &example, const std::string &desc)
Add a call example.
static void setArgs(int argc, char **argv)
Stores the command line arguments for later parsing.
static void getOptions(const bool commandLineOnly=false)
Parses the command line arguments and loads the configuration.
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
static bool createDeviceByOption(const std::string &optionName, const std::string &rootElement="", const std::string &schemaFile="", const int maximumDepth=2)
Creates the device using the output definition stored in the named option.
static void insertRandOptions(OptionsCont &oc)
Initialises the given options container with random number options.
static void initRandGlobal(SumoRNG *which=nullptr)
Reads the given random number options and initialises the random number generator in accordance.
Structure representing possible vehicle parameter.
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
double departSpeed
(optional) The initial speed of the vehicle
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.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
static bool parseDepartSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, DepartSpeedDefinition &dsd, std::string &error)
Validates a given departSpeed value.
static bool parseArrivalPos(const std::string &val, const std::string &element, const std::string &id, double &pos, ArrivalPosDefinition &apd, std::string &error)
Validates a given arrivalPos value.
static bool parseArrivalSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, ArrivalSpeedDefinition &asd, std::string &error)
Validates a given arrivalSpeed value.
double departPos
(optional) The position the vehicle shall depart from
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
double arrivalPos
(optional) The position the vehicle shall arrive on
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.
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
double arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
static bool parseDepartPos(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosDefinition &dpd, std::string &error)
Validates a given departPos value.
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
static void close()
Closes all of an applications subsystems.
static bool checkOptions(OptionsCont &oc)
checks shared options and sets StdDefs
static void addConfigurationOptions(OptionsCont &oc)
Adds configuration options to the given container.
static void addReportOptions(OptionsCont &oc)
Adds reporting options to the given container.
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme, const std::string &routeValidationScheme)
Enables or disables validation.
static void init()
Initialises the xml-subsystem.
int main(int argc, char **argv)