 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
46 myWaitingForVehicleNumber(0),
47 myHaveNewWaiting(false) {
76 std::map<std::string, MSTransportable*>::const_iterator i =
myTransportables.find(
id);
96 const std::map<std::string, MSTransportable*>::iterator i =
myTransportables.find(transportable->
getID());
110 if (std::find(transportables.begin(), transportables.end(), transportable) == transportables.end()) {
122 for (
int i = 0; i < (int)transportables.size(); ++i) {
123 if (transportables[i]->proceed(net, time)) {
126 erase(transportables[i]);
134 for (
int i = 0; i < (int)transportables.size(); ++i) {
135 if (!transportables[i]->proceed(net, time)) {
136 erase(transportables[i]);
158 for (TransportableVector::iterator i = wait.begin(); i != wait.end();) {
159 if ((*i)->isWaitingFor(vehicle)
161 && timeToBoardNextPerson <= currentTime
162 && stop.
startPos <= (*i)->getEdgePos()
163 && (*i)->getEdgePos() <= stop.
endPos) {
166 if (timeToBoardNextPerson >= 0) {
170 if (boardingDuration >= stopDuration) {
171 stopDuration = boardingDuration;
174 if (timeToBoardNextPerson > currentTime -
DELTA_T) {
175 timeToBoardNextPerson += boardingDuration;
177 timeToBoardNextPerson = currentTime + boardingDuration;
189 if (wait.size() == 0) {
202 for (TransportableVector::iterator i = waitContainers.begin(); i != waitContainers.end();) {
204 if ((*i)->isWaitingFor(vehicle)
206 && timeToLoadNextContainer <= currentTime
207 && stop.
startPos <= (*i)->getEdgePos()
208 && (*i)->getEdgePos() <= stop.
endPos) {
214 if (loadingDuration >= stopDuration) {
215 stopDuration = loadingDuration;
218 timeToLoadNextContainer = currentTime + loadingDuration;
221 i = waitContainers.erase(i);
228 if (waitContainers.size() == 0) {
257 const MSEdge* edge = (*i).first;
259 for (TransportableVector::const_iterator j = pv.begin(); j != pv.end(); ++j) {
261 std::string transportableType;
262 if (
dynamic_cast<MSPerson*
>(p) !=
nullptr) {
264 transportableType =
"Person";
266 transportableType =
"Container";
271 WRITE_WARNING(transportableType +
" '" + p->
getID() +
"' aborted " + waitDescription +
".");
283 auto it2 = std::find(waiting.begin(), waiting.end(), t);
284 if (it2 != waiting.end()) {
294 TransportableVector::iterator it2 = std::find(ts.begin(), ts.end(), t);
295 if (it2 != ts.end()) {
301 TransportableVector::iterator it2 = std::find(ts.begin(), ts.end(), t);
302 if (it2 != ts.end()) {
311 std::mt19937* rng)
const {
313 return new MSPerson(pars, vtype, plan, speedFactor);
The car-following model and parameter.
SUMOTime getBoardingDuration() const
Get this vehicle type's boarding duration.
void abortWaitingForVehicle(MSTransportable *t)
let the given transportable abort waiting for a vehicle (when removing stage via TraCI)
bool boardAnyWaiting(MSEdge *edge, SUMOVehicle *vehicle, const SUMOVehicleParameter::Stop &stop, SUMOTime &timeToBoardNextPerson, SUMOTime &stopDuration)
board any applicable persons Boards any people who wait on that edge for the given vehicle and remove...
int getActiveCount()
return the number of active transportable objects
#define WRITE_WARNING(msg)
virtual void addPerson(MSTransportable *person)=0
Adds a person to this vehicle.
An output device that encapsulates an ofstream.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.
virtual void erase(MSTransportable *transportable)
removes a single transportable
The simulated network and simulation perfomer.
virtual int getContainerNumber() const =0
Returns the number of containers.
virtual ~MSTransportableControl()
Destructor.
Representation of a vehicle.
std::map< const MSEdge *, TransportableVector > myWaiting4Vehicle
the lists of waiting transportables
static OptionsCont & getOptions()
Retrieves the options.
Structure representing possible vehicle parameter.
bool add(MSTransportable *transportable)
Adds a single transportable, returns false if an id clash occurred.
int getPersonCapacity() const
Get this vehicle type's person capacity.
void setWaitEnd(SUMOTime time, MSTransportable *transportable)
sets the arrival time for a waiting transportable
bool loadAnyWaiting(MSEdge *edge, SUMOVehicle *vehicle, const SUMOVehicleParameter::Stop &stop, SUMOTime &timeToLoadNextContainer, SUMOTime &stopDuration)
load any applicable containers Loads any container that is waiting on that edge for the given vehicle...
bool hasNonWaiting() const
checks whether any transportable is still engaged in walking / stopping
MSTransportable * get(const std::string &id) const
Returns the named transportable, if existing.
std::map< SUMOTime, TransportableVector > myWaiting4Departure
Transportables waiting for departure.
const MSEdge * getEdge() const
Returns the current edge.
int myRunningNumber
The number of transportables within the network (build and inserted but not removed)
double computeChosenSpeedDeviation(std::mt19937 *rng, const double minDev=-1.) const
Computes and returns the speed deviation.
MSTransportable::Stage * getCurrentStage() const
Return the current stage.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
virtual MSTransportable * buildPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, std::mt19937 *rng) const
Builds a new person.
std::string id
The vehicle's id.
bool hasTransportables() const
checks whether any transportable waits to finish her plan
void abortAnyWaitingForVehicle()
aborts the plan for any transportable that is still waiting for a ride
A road/street connecting two junctions.
double endPos
The stopping position end.
int myLoadedNumber
The number of build transportables.
std::map< SUMOTime, TransportableVector > myWaitingUntil
the lists of walking / stopping transportables
virtual void removeContainer(MSTransportable *container) const
Remove container from myContainers.
virtual void tripInfoOutput(OutputDevice &os) const =0
Called on writing tripinfo output.
virtual void removePerson(MSTransportable *p) const
double startPos
The stopping position start.
virtual void addContainer(MSTransportable *container)=0
Adds a container to this vehicle.
bool myHaveNewWaiting
whether a new transportable waiting for a vehicle has been added in the last step
std::vector< MSTransportable * > TransportableVector
Definition of a list of transportables.
int myWaitingForVehicleNumber
The number of transportables waiting for vehicles.
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
virtual void routeOutput(OutputDevice &os, const bool withRouteLength) const =0
Called on writing vehroute output.
MSTransportableControl()
Constructor.
void addWaiting(const MSEdge *edge, MSTransportable *person)
adds a transportable to the list of transportables waiting for a vehicle on the specified edge
void checkWaiting(MSNet *net, const SUMOTime time)
checks whether any transportables waiting time is over
const std::string & getID() const
returns the id of the transportable
virtual int getPersonNumber() const =0
Returns the number of persons.
int getContainerCapacity() const
Get this vehicle type's container capacity.
std::map< std::string, MSTransportable * > myTransportables
all currently created transportables by id
std::string getWaitingDescription() const
Return where the person waits and for what.
void abortWaiting(MSTransportable *t)
aborts waiting stage of transportable
virtual MSTransportable * buildContainer(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan) const
Builds a new container.
const SUMOVehicleParameter & getParameter() const
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
Definition of vehicle stop (position and duration)
SUMOTime getLoadingDuration() const
Get this vehicle type's loading duration.