47 myWaitingForVehicleNumber(0),
48 myHaveNewWaiting(false) {
77 std::map<std::string, MSTransportable*>::const_iterator i =
myTransportables.find(
id);
97 const std::map<std::string, MSTransportable*>::iterator i =
myTransportables.find(transportable->
getID());
111 if (std::find(transportables.begin(), transportables.end(), transportable) == transportables.end()) {
123 for (
int i = 0; i < (int)transportables.size(); ++i) {
124 if (transportables[i]->proceed(net, time)) {
127 erase(transportables[i]);
135 for (
int i = 0; i < (int)transportables.size(); ++i) {
136 if (!transportables[i]->proceed(net, time)) {
137 erase(transportables[i]);
159 for (TransportableVector::iterator i = wait.begin(); i != wait.end();) {
160 if ((*i)->isWaitingFor(vehicle)
162 && timeToBoardNextPerson <= currentTime
163 && stop.
startPos <= (*i)->getEdgePos()
164 && (*i)->getEdgePos() <= stop.
endPos) {
167 if (timeToBoardNextPerson >= 0) {
171 if (boardingDuration >= stopDuration) {
172 stopDuration = boardingDuration;
175 if (timeToBoardNextPerson > currentTime -
DELTA_T) {
176 timeToBoardNextPerson += boardingDuration;
178 timeToBoardNextPerson = currentTime + boardingDuration;
190 if (wait.size() == 0) {
203 for (TransportableVector::iterator i = waitContainers.begin(); i != waitContainers.end();) {
205 if ((*i)->isWaitingFor(vehicle)
207 && timeToLoadNextContainer <= currentTime
208 && stop.
startPos <= (*i)->getEdgePos()
209 && (*i)->getEdgePos() <= stop.
endPos) {
215 if (loadingDuration >= stopDuration) {
216 stopDuration = loadingDuration;
219 timeToLoadNextContainer = currentTime + loadingDuration;
222 i = waitContainers.erase(i);
229 if (waitContainers.size() == 0) {
258 const MSEdge* edge = (*i).first;
260 for (TransportableVector::const_iterator j = pv.begin(); j != pv.end(); ++j) {
262 std::string transportableType;
263 if (dynamic_cast<MSPerson*>(p) !=
nullptr) {
265 transportableType =
"Person";
267 transportableType =
"Container";
272 WRITE_WARNING(transportableType +
" '" + p->
getID() +
"' aborted " + waitDescription +
".");
284 auto it2 = std::find(waiting.begin(), waiting.end(), t);
285 if (it2 != waiting.end()) {
295 TransportableVector::iterator it2 = std::find(ts.begin(), ts.end(), t);
296 if (it2 != ts.end()) {
302 TransportableVector::iterator it2 = std::find(ts.begin(), ts.end(), t);
303 if (it2 != ts.end()) {
312 std::mt19937* rng)
const {
314 return new MSPerson(pars, vtype, plan, speedFactor);
void abortWaiting(MSTransportable *t)
aborts waiting stage of transportable
void addWaiting(const MSEdge *edge, MSTransportable *person)
adds a transportable to the list of transportables waiting for a vehicle on the specified edge ...
bool hasNonWaiting() const
checks whether any transportable is still engaged in walking / stopping
std::string getWaitingDescription() const
Return where the person waits and for what.
virtual void tripInfoOutput(OutputDevice &os) const =0
Called on writing tripinfo output.
virtual const MSVehicleType & getVehicleType() const =0
Returns the vehicle's type.
const MSEdge * getEdge() const
Returns the current edge.
int getActiveCount()
return the number of active transportable objects
virtual void routeOutput(OutputDevice &os, const bool withRouteLength) const =0
Called on writing vehroute output.
std::map< SUMOTime, TransportableVector > myWaiting4Departure
Transportables waiting for departure.
void setWaitEnd(SUMOTime time, MSTransportable *transportable)
sets the arrival time for a waiting transportable
virtual ~MSTransportableControl()
Destructor.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
std::map< std::string, MSTransportable * > myTransportables
all currently created transportables by id
const SUMOVehicleParameter & getParameter() const
int getPersonCapacity() const
Get this vehicle type's person capacity.
std::map< const MSEdge *, TransportableVector > myWaiting4Vehicle
the lists of waiting transportables
virtual MSTransportable * buildContainer(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan) const
Builds a new container.
int getContainerCapacity() const
Get this vehicle type's container capacity.
#define WRITE_WARNING(msg)
The simulated network and simulation perfomer.
int myLoadedNumber
The number of build transportables.
The car-following model and parameter.
virtual void erase(MSTransportable *transportable)
removes a single transportable
static OptionsCont & getOptions()
Retrieves the options.
SUMOTime getBoardingDuration() const
Get this vehicle type's boarding duration.
virtual void addContainer(MSTransportable *container)=0
Adds a container to this vehicle.
A road/street connecting two junctions.
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
MSTransportable::Stage * getCurrentStage() const
Return the current stage.
Representation of a vehicle.
void abortAnyWaitingForVehicle()
aborts the plan for any transportable that is still waiting for a ride
SUMOTime getLoadingDuration() const
Get this vehicle type's loading duration.
bool myHaveNewWaiting
whether a new transportable waiting for a vehicle has been added in the last step ...
virtual int getPersonNumber() const =0
Returns the number of persons.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
const std::string & getID() const
returns the id of the transportable
virtual void removePerson(MSTransportable *p) const
bool hasTransportables() const
checks whether any transportable waits to finish her plan
double endPos
The stopping position end.
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...
virtual void removeContainer(MSTransportable *container) const
Remove container from myContainers.
Definition of vehicle stop (position and duration)
int myWaitingForVehicleNumber
The number of transportables waiting for vehicles.
double startPos
The stopping position start.
Structure representing possible vehicle parameter.
MSTransportableControl()
Constructor.
void abortWaitingForVehicle(MSTransportable *t)
let the given transportable abort waiting for a vehicle (when removing stage via TraCI) ...
static OutputDevice & getDeviceByOption(const std::string &name)
Returns the device described by the option.
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...
bool add(MSTransportable *transportable)
Adds a single transportable, returns false if an id clash occurred.
void checkWaiting(MSNet *net, const SUMOTime time)
checks whether any transportables waiting time is over
virtual void addPerson(MSTransportable *person)=0
Adds a person to this vehicle.
MSTransportable * get(const std::string &id) const
Returns the named transportable, if existing.
virtual int getContainerNumber() const =0
Returns the number of containers.
std::vector< MSTransportable * > TransportableVector
Definition of a list of transportables.
virtual MSTransportable * buildPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, std::mt19937 *rng) const
Builds a new person.
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.
std::map< SUMOTime, TransportableVector > myWaitingUntil
the lists of walking / stopping transportables
An output device that encapsulates an ofstream.
std::string id
The vehicle's id.