 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
127 const std::string prefix = (isPerson ?
"person-device." :
"device.") +
deviceName;
128 const std::string
object = isPerson ?
"person" :
"vehicle";
130 oc.
addDescription(prefix +
".probability", optionsTopic,
"The probability for a " +
object +
" to have a '" +
deviceName +
"' device");
133 oc.
addSynonyme(prefix +
".explicit", prefix +
".knownveh",
true);
134 oc.
addDescription(prefix +
".explicit", optionsTopic,
"Assign a '" +
deviceName +
"' device to named " +
object +
"s");
137 oc.
addDescription(prefix +
".deterministic", optionsTopic,
"The '" +
deviceName +
"' devices are set deterministic using a fraction of 1000");
154 std::string result = deflt;
168 if (oc.
isSet(
"device." + paramName)) {
169 result = oc.
getString(
"device." + paramName);
172 throw ProcessError(
"Missing parameter 'device." + paramName +
"' for vehicle '" + v.
getID());
175 #ifdef DEBUG_DEVICE_PARAMS
176 std::cout <<
"vehicle '" << v.
getID() <<
"' does not supply vehicle parameter 'device." + paramName +
"'. Using default of '" << result <<
"'\n";
187 double result = deflt;
201 if (oc.
isSet(
"device." + paramName)) {
202 result = oc.
getFloat(
"device." + paramName);
205 throw ProcessError(
"Missing parameter 'device." + paramName +
"' for vehicle '" + v.
getID());
208 #ifdef DEBUG_DEVICE_PARAMS
209 std::cout <<
"vehicle '" << v.
getID() <<
"' does not supply vehicle parameter 'device." + paramName +
"'. Using default of '" << result <<
"'\n";
234 if (oc.
isSet(
"device." + paramName)) {
235 result = oc.
getBool(
"device." + paramName);
238 throw ProcessError(
"Missing parameter 'device." + paramName +
"' for vehicle '" + v.
getID());
241 #ifdef DEBUG_DEVICE_PARAMS
242 std::cout <<
"vehicle '" << v.
getID() <<
"' does not supply vehicle parameter 'device." + paramName +
"'. Using default of '" << result <<
"'\n";
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_FCD-options.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
static void cleanup()
resets counters
static void insertOptions()
Inserts MSDevice_Emissions-options.
static void insertOptions(OptionsCont &oc)
Inserts MSTransportableDevice_Routing-options.
static void buildTransportableDevices(MSTransportable &p, std::vector< MSTransportableDevice * > &into)
Build devices for the given person, if needed.
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter
#define WRITE_WARNING(msg)
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Example-options.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
Static storage of an output device and its base (abstract) implementation.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
virtual const std::string & getID() const =0
Get the vehicle's ID.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
static void buildDevices(MSTransportable &p, std::vector< MSTransportableDevice * > &into)
Build devices for the given person, if needed.
Representation of a vehicle.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static std::map< std::string, std::set< std::string > > myExplicitIDs
vehicles which explicitly carry a device, sorted by device, first
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_DriverState-options.
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
static void cleanup()
deletes the router instance
virtual void saveState(OutputDevice &out) const
Saves the state of the device.
static bool checkOptions(OptionsCont &oc)
checks MSDevice_Routing-options
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
static void insertDefaultAssignmentOptions(const std::string &deviceName, const std::string &optionsTopic, OptionsCont &oc, const bool isPerson=false)
Adds common command options that allow to assign devices to vehicles.
void addSynonyme(const std::string &name1, const std::string &name2, bool isDeprecated=false)
Adds a synonyme for an options name (any order)
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
static void cleanup()
resets the edge filter
static MSDevice_Vehroutes * buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into, int maxRoutes=std::numeric_limits< int >::max())
Build devices for the given vehicle, if needed.
static bool checkOptions(OptionsCont &oc)
check device-specific options
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_BTsender-options.
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
static void buildDevices(MSTransportable &t, std::vector< MSTransportableDevice * > &into)
Build devices for the given vehicle, if needed.
static void cleanupAll()
perform cleanup for all devices
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
static std::mt19937 myEquipmentRNG
A random number generator used to choose from vtype/route distributions and computing the speed facto...
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_SSM-options.
A storage for options typed value containers)
virtual const std::string deviceName() const =0
return the name for this type of device
static double getFloatParam(const SUMOVehicle &v, const OptionsCont &oc, std::string paramName, double deflt, bool required)
static void insertOptions(OptionsCont &oc)
Inserts MSTransportableDevice_FCD-options.
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_BTreceiver-options.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_ToC-options.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
static std::string getStringParam(const SUMOVehicle &v, const OptionsCont &oc, std::string paramName, std::string deflt, bool required)
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Routing-options.
const SUMOVTypeParameter & getParameter() const
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Example-options.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
virtual void loadState(const SUMOSAXAttributes &attrs)
Loads the state of the device from the given description.
static void insertOptions(OptionsCont &oc)
Inserts options for building devices.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
Encapsulated SAX-Attributes.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Bluelight-options.
const std::string & getID() const
Returns the id.
static bool getBoolParam(const SUMOVehicle &v, const OptionsCont &oc, std::string paramName, bool deflt, bool required)
bool knowsParameter(const std::string &key) const
Returns whether the parameter is known.