45 std::vector<std::string>
47 std::vector<std::string> ids;
60 VehicleType::getLength(
const std::string& typeID) {
66 VehicleType::getMaxSpeed(
const std::string& typeID) {
72 VehicleType::getActionStepLength(
const std::string& typeID) {
78 VehicleType::getSpeedFactor(
const std::string& typeID) {
84 VehicleType::getSpeedDeviation(
const std::string& typeID) {
90 VehicleType::getAccel(
const std::string& typeID) {
96 VehicleType::getDecel(
const std::string& typeID) {
102 VehicleType::getEmergencyDecel(
const std::string& typeID) {
108 VehicleType::getApparentDecel(
const std::string& typeID) {
114 VehicleType::getImperfection(
const std::string& typeID) {
120 VehicleType::getTau(
const std::string& typeID) {
126 VehicleType::getVehicleClass(
const std::string& typeID) {
132 VehicleType::getEmissionClass(
const std::string& typeID) {
138 VehicleType::getShapeClass(
const std::string& typeID) {
144 VehicleType::getMinGap(
const std::string& typeID) {
150 VehicleType::getWidth(
const std::string& typeID) {
156 VehicleType::getHeight(
const std::string& typeID) {
162 VehicleType::getColor(
const std::string& typeID) {
168 VehicleType::getMinGapLat(
const std::string& typeID) {
174 VehicleType::getMaxSpeedLat(
const std::string& typeID) {
180 VehicleType::getLateralAlignment(
const std::string& typeID) {
192 VehicleType::setLength(
const std::string& typeID,
double length) {
198 VehicleType::setMaxSpeed(
const std::string& typeID,
double speed) {
204 VehicleType::setActionStepLength(
const std::string& typeID,
double actionStepLength,
bool resetActionOffset) {
210 VehicleType::setVehicleClass(
const std::string& typeID,
const std::string& clazz) {
216 VehicleType::setSpeedFactor(
const std::string& typeID,
double factor) {
228 VehicleType::setEmissionClass(
const std::string& typeID,
const std::string& clazz) {
234 VehicleType::setShapeClass(
const std::string& typeID,
const std::string& shapeClass) {
240 VehicleType::setWidth(
const std::string& typeID,
double width) {
246 VehicleType::setHeight(
const std::string& typeID,
double height) {
252 VehicleType::setMinGap(
const std::string& typeID,
double minGap) {
258 VehicleType::setAccel(
const std::string& typeID,
double accel) {
264 VehicleType::setDecel(
const std::string& typeID,
double decel) {
271 WRITE_WARNING(
"Automatically setting emergencyDecel to " +
toString(decel) +
" for vType '" + typeID +
"' to match decel.");
279 VehicleType::setEmergencyDecel(
const std::string& typeID,
double decel) {
282 if (decel < v->getCarFollowModel().getMaxDecel()) {
289 VehicleType::setApparentDecel(
const std::string& typeID,
double decel) {
295 VehicleType::setImperfection(
const std::string& typeID,
double imperfection) {
301 VehicleType::setTau(
const std::string& typeID,
double tau) {
307 VehicleType::setColor(
const std::string& typeID,
const TraCIColor& c) {
313 VehicleType::setMinGapLat(
const std::string& typeID,
double minGapLat) {
319 VehicleType::setMaxSpeedLat(
const std::string& typeID,
double speed) {
325 VehicleType::setLateralAlignment(
const std::string& typeID,
const std::string& latAlignment) {
355 std::shared_ptr<VariableWrapper>
369 return wrapper->
wrapDouble(objID, variable, getLength(objID));
371 return wrapper->
wrapDouble(objID, variable, getHeight(objID));
373 return wrapper->
wrapDouble(objID, variable, getMinGap(objID));
375 return wrapper->
wrapDouble(objID, variable, getMaxSpeed(objID));
377 return wrapper->
wrapDouble(objID, variable, getAccel(objID));
379 return wrapper->
wrapDouble(objID, variable, getDecel(objID));
381 return wrapper->
wrapDouble(objID, variable, getEmergencyDecel(objID));
383 return wrapper->
wrapDouble(objID, variable, getApparentDecel(objID));
385 return wrapper->
wrapDouble(objID, variable, getActionStepLength(objID));
387 return wrapper->
wrapDouble(objID, variable, getImperfection(objID));
389 return wrapper->
wrapDouble(objID, variable, getTau(objID));
391 return wrapper->
wrapDouble(objID, variable, getSpeedFactor(objID));
393 return wrapper->
wrapDouble(objID, variable, getSpeedDeviation(objID));
395 return wrapper->
wrapString(objID, variable, getVehicleClass(objID));
397 return wrapper->
wrapString(objID, variable, getEmissionClass(objID));
399 return wrapper->
wrapString(objID, variable, getShapeClass(objID));
401 return wrapper->
wrapDouble(objID, variable, getWidth(objID));
403 return wrapper->
wrapColor(objID, variable, getColor(objID));
405 return wrapper->
wrapDouble(objID, variable, getMinGapLat(objID));
407 return wrapper->
wrapDouble(objID, variable, getMaxSpeedLat(objID));
409 return wrapper->
wrapString(objID, variable, getLateralAlignment(objID));
SUMOVehicleClass getVehicleClassID(const std::string &name)
Returns the class id of the abstract class given by its name.
double getApparentDecel() const
Get the vehicle type's apparent deceleration [m/s^2] (the one regarded by its followers.
void setMinGap(const double &minGap)
Set a new value for this type's minimum gap.
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
#define VAR_EMISSIONCLASS
virtual bool wrapInt(const std::string &objID, const int variable, const int value)=0
static TraCIColor makeTraCIColor(const RGBColor &color)
void setTau(double tau)
Set a new value for this type's headway.
void setShape(SUMOVehicleShape shape)
Set a new value for this type's shape.
Structure representing possible vehicle parameter.
virtual double getImperfection() const
Get the driver's imperfection.
std::vector< double > & getParameter()
Returns the parameters of this distribution.
void setDecel(double decel)
Set a new value for this type's deceleration.
static ContextSubscriptionResults myContextSubscriptionResults
static void setSpeedDeviation(const std::string &typeID, double deviation)
static LIBSUMO_VEHICLE_TYPE_GETTER std::string getParameter(const std::string &typeID, const std::string &key)
static SUMOTime processActionStepLength(double given)
Checks and converts given value for the action step length from seconds to miliseconds assuring it be...
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
static SubscriptionResults mySubscriptionResults
double getMinGapLat() const
Get the minimum lateral gap that vehicles of this type maintain.
void setApparentDecel(double apparentDecel)
Set a new value for this type's apparent deceleration.
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
void setLength(const double &length)
Set a new value for this type's length.
virtual bool wrapString(const std::string &objID, const int variable, const std::string &value)=0
void setMaxSpeed(const double &maxSpeed)
Set a new value for this type's maximum speed.
void setImperfection(double imperfection)
Set a new value for this type's imperfection.
#define VAR_SPEED_DEVIATION
MSVehicleType * duplicateType(const std::string &id, bool persistent) const
Duplicates the microsim vehicle type giving the newly created type the given id.
#define WRITE_WARNING(msg)
The car-following model and parameter.
std::string getVehicleShapeName(SUMOVehicleShape id)
Returns the class name of the shape class given by its id.
static LIBSUMO_SUBSCRIPTION_API std::shared_ptr< VariableWrapper > makeWrapper()
double getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
void setMinGapLat(const double &minGapLat)
Set a new value for this type's minimum lataral gap.
static RGBColor makeRGBColor(const TraCIColor &color)
static MSVehicleType * getVType(std::string id)
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
void setAccel(double accel)
Set a new value for this type's acceleration.
#define VAR_ACTIONSTEPLENGTH
double getEmergencyDecel() const
Get the vehicle type's maximal phisically possible deceleration [m/s^2].
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
void setHeight(const double &height)
Set a new value for this type's height.
#define VAR_EMERGENCY_DECEL
static LIBSUMO_VEHICLE_TYPE_SETTER void copy(const std::string &origTypeID, const std::string &newTypeID)
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
void setEmissionClass(SUMOEmissionClass eclass)
Set a new value for this type's emission class.
double getMinGap() const
Get the free space in front of vehicles of this class.
static std::string getName(const SUMOEmissionClass c)
Checks whether the string describes a known vehicle class.
double getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOMAIN)
void setSpeedDeviation(const double &dev)
Set a new value for this type's speed deviation.
void setSpeedFactor(const double &factor)
Set a new value for this type's speed factor.
const SUMOVTypeParameter & getParameter() const
void insertVTypeIDs(std::vector< std::string > &into) const
Inserts ids of all known vehicle types and vehicle type distributions to the given vector...
void setActionStepLength(const SUMOTime actionStepLength, bool resetActionOffset)
Set a new value for this type's action step length.
virtual bool wrapDouble(const std::string &objID, const int variable, const double value)=0
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.
double getMaxSpeedLat() const
Get vehicle's maximum lateral speed [m/s].
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
double getHeight() const
Get the height which vehicles of this class shall have when being drawn.
static StringBijection< LateralAlignment > LateralAlignments
lateral alignments
static void setParameter(const std::string &id, const std::string &name, const std::string &value)
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
void setEmergencyDecel(double emergencyDecel)
Set a new value for this type's emergency deceleration.
static SUMOEmissionClass getClassByName(const std::string &eClass, const SUMOVehicleClass vc=SVC_IGNORING)
Checks whether the string describes a known vehicle class.
virtual bool wrapColor(const std::string &objID, const int variable, const TraCIColor &value)=0
virtual double getHeadwayTime() const
Get the driver's desired headway [s].
SubParams cfParameter
Car-following parameter.
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
void setWidth(const double &width)
Set a new value for this type's width.
double getActionStepLengthSecs() const
Returns this type's default action step length in seconds.
double getLength() const
Get vehicle's length [m].
void setVClass(SUMOVehicleClass vclass)
Set a new value for this type's vehicle class.
void setColor(const RGBColor &color)
Set a new value for this type's color.
SUMOVehicleShape getVehicleShapeID(const std::string &name)
Returns the class id of the shape class given by its name.
#define VAR_APPARENT_DECEL
virtual bool wrapStringList(const std::string &objID, const int variable, const std::vector< std::string > &value)=0
void setMaxSpeedLat(const double &maxSpeedLat)
Set a new value for this type's maximum lateral speed.
void setPreferredLateralAlignment(LateralAlignment latAlignment)
Set vehicle's preferred lateral alignment.
const Distribution_Parameterized & getSpeedFactor() const
Returns this type's speed factor.
static std::vector< std::string > getIDList()