 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
54 oc.
addDescription(
"device.bluelight.parameter",
"Bluelight Device",
"An exemplary parameter which can be used by all instances of the example device");
65 double customParameter2 = -1;
74 #ifdef DEBUG_BLUELIGHT
75 std::cout <<
"vehicle '" << v.
getID() <<
"' does not supply vehicle parameter 'bluelight'. Using default of " << customParameter2 <<
"\n";
79 double customParameter3 = -1;
88 #ifdef DEBUG_BLUELIGHT
89 std::cout <<
"vehicle '" << v.
getID() <<
"' does not supply vType parameter 'bluelight'. Using default of " << customParameter3 <<
"\n";
93 oc.
getFloat(
"device.bluelight.parameter"),
96 into.push_back(device);
105 double customValue1,
double customValue2,
double customValue3) :
107 myCustomValue1(customValue1),
108 myCustomValue2(customValue2),
109 myCustomValue3(customValue3) {
110 #ifdef DEBUG_BLUELIGHT
122 double ,
double newSpeed) {
123 #ifdef DEBUG_BLUELIGHT
124 std::cout <<
"device '" <<
getID() <<
"' notifyMove: newSpeed=" << newSpeed <<
"\n";
154 std::vector<std::pair<SUMOTime, double> > speedTimeLine;
171 if (reaction < (distanceDelta * -1.6 + 100) / 100) {
176 MSVehicleType& t = static_cast<MSVehicle*>(veh2)->getSingularType();
191 if (distanceDelta > maxdist && veh.
getID() != veh2->
getID()) {
198 if (targetType !=
nullptr) {
199 static_cast<MSVehicle*>(veh2)->replaceVehicleType(targetType);
212 #ifdef DEBUG_BLUELIGHT
213 std::cout <<
"device '" <<
getID() <<
"' notifyEnter: reason=" << reason <<
" currentEdge=" << veh.
getEdge()->
getID() <<
"\n";
224 #ifdef DEBUG_BLUELIGHT
225 std::cout <<
"device '" <<
getID() <<
"' notifyLeave: reason=" << reason <<
" currentEdge=" << veh.
getEdge()->
getID() <<
"\n";
247 if (key ==
"customValue1") {
249 }
else if (key ==
"customValue2") {
251 }
else if (key ==
"meaningOfLife") {
266 if (key ==
"customValue1") {
The car-following model and parameter.
#define UNUSED_PARAMETER(x)
bool notifyLeave(SUMOTrafficObject &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Saves arrival info.
Representation of a vehicle or person.
virtual Position getPosition(const double offset=0) const =0
Return current position (x/y, cartesian)
const std::string & getID() const
Returns the name of the vehicle type.
void setPreferredLateralAlignment(LateralAlignment latAlignment)
Set vehicle's preferred lateral alignment.
Changes the wished vehicle speed / lanes.
#define WRITE_WARNING(msg)
Representation of a lane in the micro simulation.
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, std::mt19937 *rng=nullptr)
Returns the named vehicle type or a sample from the named distribution.
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.
maintain the current alignment
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
virtual const MSEdge * getEdge() const =0
Returns the edge the vehicle is currently at.
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.
Representation of a vehicle.
static OptionsCont & getOptions()
Retrieves the options.
MSDevice_Bluelight(SUMOVehicle &holder, const std::string &id, double customValue1, double customValue2, double customValue3)
Constructor.
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
std::map< std::string, std::string > influencedTypes
double myCustomValue1
a value which is initialised based on a commandline/configuration option
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this device. Throw exception for unsupported key
double myCustomValue2
a value which is initialised based on a vehicle parameter
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
static double rand(std::mt19937 *rng=0)
Returns a random real number in [0, 1)
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
std::set< std::string > influencedVehicles
void generateOutput() const
Called on writing tripinfo output.
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.
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this device. Throw exception for unsupported key
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
virtual MSVehicleDevice * getDevice(const std::type_info &type) const =0
Returns a device of the given type if it exists or 0.
virtual MSLane * getLane() const =0
Returns the lane the vehicle is on.
void setSpeedTimeLine(const std::vector< std::pair< SUMOTime, double > > &speedTimeLine)
Sets a new velocity timeline.
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
double myCustomValue3
a value which is initialised based on a vType parameter
A storage for options typed value containers)
const std::string deviceName() const
return the name for this type of device
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
bool notifyEnter(SUMOTrafficObject &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Saves departure info on insertion.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
static bool equippedByDefaultAssignmentOptions(const OptionsCont &oc, const std::string &deviceName, DEVICEHOLDER &v, bool outputOptionSet, const bool isPerson=false)
Determines whether a vehicle should get a certain device.
void setLaneChangeMode(int value)
Sets lane changing behavior.
const SUMOVTypeParameter & getParameter() const
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
~MSDevice_Bluelight()
Destructor.
The class responsible for building and deletion of vehicles.
bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
Checks for waiting steps when the vehicle moves.
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
void setSpeedMode(int speedMode)
Sets speed-constraining behaviors.
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Bluelight-options.
A device which collects info on the vehicle trip (mainly on departure and arrival)
const std::string & getID() const
Returns the id.
Notification
Definition of a vehicle state.
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
int getIndex() const
Returns the lane's index.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
bool knowsParameter(const std::string &key) const
Returns whether the parameter is known.
virtual double getSpeed() const =0
Returns the vehicle's current speed.
Abstract in-vehicle device.