59 oc.
addDescription(
"device.bluelight.parameter",
"Bluelight Device",
"An exemplary parameter which can be used by all instances of the example device");
70 double customParameter2 = -1;
79 std::cout <<
"vehicle '" << v.
getID() <<
"' does not supply vehicle parameter 'bluelight'. Using default of " << customParameter2 <<
"\n";
82 double customParameter3 = -1;
91 std::cout <<
"vehicle '" << v.
getID() <<
"' does not supply vType parameter 'bluelight'. Using default of " << customParameter3 <<
"\n";
94 oc.
getFloat(
"device.bluelight.parameter"),
97 into.push_back(device);
106 double customValue1,
double customValue2,
double customValue3) :
139 if (distanceDelta <= 100 && veh.
getID() != veh2->
getID()) {
158 std::cout <<
"device '" <<
getID() <<
"' notifyEnter: reason=" << reason <<
" currentEdge=" << veh.
getEdge()->
getID() <<
"\n";
165 std::cout <<
"device '" <<
getID() <<
"' notifyLeave: reason=" << reason <<
" currentEdge=" << veh.
getEdge()->
getID() <<
"\n";
183 if (key ==
"customValue1") {
185 }
else if (key ==
"customValue2") {
187 }
else if (key ==
"meaningOfLife") {
202 if (key ==
"customValue1") {
virtual MSLane * getLane() const =0
Returns the lane the vehicle is on.
void doRegister(const std::string &name, Option *v)
Adds an option under the given name.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Representation of a vehicle in the micro simulation.
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 loadedVehBegin() const
Returns the begin of the internal vehicle map.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
double myCustomValue3
a value which is initialised based on a vType parameter
Notification
Definition of a vehicle state.
virtual const MSEdge * getEdge() const =0
Returns the edge the vehicle is currently at.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
double myCustomValue1
a value which is initialised based on a commandline/configuration option
virtual Position getPosition(const double offset=0) const =0
Return current position (x/y, cartesian)
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
#define WRITE_WARNING(msg)
The car-following model and parameter.
static OptionsCont & getOptions()
Retrieves the options.
const std::string & getID() const
Returns the id.
~MSDevice_Bluelight()
Destructor.
const SUMOVTypeParameter & getParameter() const
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Representation of a vehicle.
bool notifyLeave(SUMOVehicle &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Saves arrival info.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
bool notifyEnter(SUMOVehicle &veh, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Saves departure info on insertion.
const std::string deviceName() const
return the name for this type of device
static void insertDefaultAssignmentOptions(const std::string &deviceName, const std::string &optionsTopic, OptionsCont &oc)
Adds common command options that allow to assign devices to vehicles.
void addOptionSubTopic(const std::string &topic)
Adds an option subtopic.
MSDevice_Bluelight(SUMOVehicle &holder, const std::string &id, double customValue1, double customValue2, double customValue3)
Constructor.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.
maintain the current alignment
int getIndex() const
Returns the lane's index.
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, std::mt19937 *rng=0)
Returns the named vehicle type or a sample from the named distribution.
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_Bluelight-options.
Abstract in-vehicle device.
static bool equippedByDefaultAssignmentOptions(const OptionsCont &oc, const std::string &deviceName, SUMOVehicle &v)
Determines whether a vehicle should get a certain device.
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
A storage for options typed value containers)
static double _2double(const E *const data)
converts a char-type array into the double value described by it
const std::string & getID() const
Returns the name of the vehicle type.
virtual const std::string & getID() const =0
Get the vehicle's ID.
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
A device which collects info on the vehicle trip (mainly on departure and arrival) ...
bool notifyMove(SUMOVehicle &veh, double oldPos, double newPos, double newSpeed)
Checks for waiting steps when the vehicle moves.
Static storage of an output device and its base (abstract) implementation.
bool closeTag()
Closes the most recently opened tag.
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
The class responsible for building and deletion of vehicles.
bool knowsParameter(const std::string &key) const
Returns whether the parameter is known.
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into)
Build devices for the given vehicle, if needed.
void addDescription(const std::string &name, const std::string &subtopic, const std::string &description)
Adds a description for an option.
void setPreferredLateralAlignment(LateralAlignment latAlignment)
Set vehicle's preferred lateral alignment.
void generateOutput() const
Called on writing tripinfo output.
std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this device. Throw exception for unsupported key ...
Representation of a lane in the micro simulation.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
double myCustomValue2
a value which is initialised based on a vehicle parameter