53 const std::vector<MSLane*>& destLanes,
54 const std::string& file) :
57 myDestLanes(destLanes),
58 myCurrentSpeed(destLanes[0]->getSpeedLimit()),
59 myDefaultSpeed(destLanes[0]->getSpeedLimit()),
60 myAmOverriding(false),
61 mySpeedOverrideValue(destLanes[0]->getSpeedLimit()),
92 (*myCurrentEntry).first);
109 std::vector<MSLane*>::iterator i;
115 while (first !=
nullptr) {
116 first->
setSpeed(speed, currentTime, -1);
122 (*i)->setMaxSpeed(speed);
133 return ((*myCurrentEntry).first) - ((*(
myCurrentEntry - 1)).first);
202 return (*myCurrentEntry).second;
219 return (*myCurrentEntry).second;
#define WRITE_WARNING(msg)
std::string time2string(SUMOTime t)
convert SUMOTime to string
@ SUMO_TAG_STEP
trigger: a step description
@ SUMO_TAG_VSS
A variable speed sign.
@ SUMO_ATTR_TIME
trigger: the time of the step
#define UNUSED_PARAMETER(x)
MESegment * getSegmentForEdge(const MSEdge &e, double pos=0)
Get the segment for a given edge at a given position.
A single mesoscopic segment (cell)
MESegment * getNextSegment() const
Returns the following segment on the same edge (0 if it is the last).
void setSpeed(double newSpeed, SUMOTime currentTime, double jamThresh=DO_NOT_PATCH_JAM_THRESHOLD)
reset mySpeed and patch the speed of all vehicles in it. Also set/recompute myJamThreshold
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
static MELoop * gMesoNet
mesoscopic simulation infrastructure
void setOverridingValue(double val)
std::vector< std::pair< SUMOTime, double > >::iterator myCurrentEntry
void setOverriding(bool val)
static std::map< std::string, MSLaneSpeedTrigger * > myInstances
MSLaneSpeedTrigger(const std::string &id, const std::vector< MSLane * > &destLanes, const std::string &file)
Constructor.
std::vector< std::pair< SUMOTime, double > > myLoadedSpeeds
virtual void myEndElement(int element)
Called on the closing of a tag;.
double getCurrentSpeed() const
Returns the current speed.
double mySpeedOverrideValue
The speed to use if overriding the read speed.
virtual ~MSLaneSpeedTrigger()
Destructor.
double myDefaultSpeed
The original speed allowed on the lanes.
std::vector< MSLane * > myDestLanes
bool myAmOverriding
The information whether the read speed shall be overridden.
virtual void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
SUMOTime processCommand(bool move2next, SUMOTime currentTime)
double getDefaultSpeed() const
bool myDidInit
The information whether init was called.
SUMOTime execute(SUMOTime currentTime)
Executes a switch command.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
An abstract device that changes the state of the micro simulation.
const std::string & getID() const
Returns the id.
Encapsulated SAX-Attributes.
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue, bool report=true) const
Tries to read given attribute assuming it is an int.
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
SAX-handler base for SUMO-files.
A wrapper for a Command function.
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false, const bool isRoute=false)
Runs the given handler on the given file; returns if everything's ok.