46 myParameter(pars), myVType(vtype), myPlan(plan), myAmPerson(isPerson) {
61 for (MSTransportablePlan::const_iterator i =
myPlan->begin(); i !=
myPlan->end(); ++i) {
84 const std::string& error = prior->
setArrived(net,
this, time, vehicleArrived);
102 (*myStep)->proceed(net,
this, time, prior);
117 throw ProcessError(
"Changing a transportable ID is not permitted");
127 (*myStep)->setDeparted(now);
152 return (*myStep)->getSpeed();
164 return (
int)
myPlan->size();
175 i->tripInfoOutput(os,
this);
183 const std::string typeID = (
190 const MSStage* previous =
nullptr;
207 if (stepIndex + next > (
int)
myPlan->size()) {
210 myPlan->insert(
myPlan->begin() + stepIndex + next, stage);
218 assert(
myStep + next < myPlan->end());
231 (*myStep)->abort(
this);
239 for (MSTransportablePlan::const_iterator i =
myPlan->begin(); i !=
myPlan->end(); ++i) {
240 (*i)->setSpeed(speed);
271 const Position back = p +
Position(-cos(angle) * length, -sin(angle) * length);
272 centerLine.push_back(p);
273 centerLine.push_back(back);
285 assert(stageIndex < (
int)
myPlan->size());
286 assert(stageIndex >= 0);
298 return myPlan->size() > 0 &&
myPlan->front()->getDeparted() >= 0;
309 WRITE_WARNING(
"parkingAreaReroute not support for containers");
334 MSStage*
const futureStage = *it;
335 MSStage*
const prevStage = *(it - 1);
347 int prevStageRelIndex = (int)(it - 1 -
myStep);
361 if (
typeid(*dev) == type) {
372 const double gp = edge->
getLanes()[0]->interpolateLanePosToGeometryPos(ep);
373 return edge->
getLanes()[0]->getShape().slopeDegreeAtOffset(gp);
397 std::ostringstream state;
405 (*myStep)->saveState(state);
407 const MSStage* previous =
nullptr;
418 std::istringstream iss(state);
422 (*myStep)->loadState(
this, iss);
#define WRITE_WARNING(msg)
std::string time2string(SUMOTime t)
convert SUMOTime to string
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
const std::string DEFAULT_PEDTYPE_ID
const std::string DEFAULT_CONTAINERTYPE_ID
@ SUMO_ATTR_STATE
The state of a link.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static void buildTransportableDevices(MSTransportable &p, std::vector< MSTransportableDevice * > &into)
Build devices for the given person, if needed.
A road/street connecting two junctions.
virtual void removeContainer(MSTransportable *container) const
Remove container from myContainers.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
virtual void removePerson(MSTransportable *p) const
MSEdge & getEdge() const
Returns the lane's edge.
The simulated network and simulation perfomer.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
virtual MSTransportableControl & getPersonControl()
Returns the person control.
const std::set< std::string > & getLines() const
SUMOVehicle * getVehicle() const
Whether the transportable waits for a vehicle.
double getArrivalPos() const
return default value for undefined arrivalPos
void setOrigin(const MSEdge *origin)
change origin for parking area rerouting
const MSEdge * getDestination() const
returns the destination edge
virtual const MSEdge * getFromEdge() const
virtual double getArrivalPos() const
virtual const std::string setArrived(MSNet *net, MSTransportable *transportable, SUMOTime now, const bool vehicleArrived)
logs end of the step
MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
MSStageType getStageType() const
void setDestination(const MSEdge *newDestination, MSStoppingPlace *newDestStop)
virtual void routeOutput(const bool isPerson, OutputDevice &os, const bool withRouteLength, const MSStage *const previous) const =0
Called on writing vehroute output.
virtual const MSEdge * getEdge() const
Returns the current edge.
A lane area vehicles can halt at.
void removeTransportable(MSTransportable *p)
Removes a transportable from this stop.
const MSLane & getLane() const
Returns the lane this stop is located at.
Abstract in-person device.
virtual double getEdgePos() const
Return the position on the edge.
bool hasDeparted() const
return whether the transportable has started it's plan
SUMOVehicleClass getVClass() const
Returns the object's access class.
SUMOTime getWaitingTime() const
virtual double getAngle() const
return the current angle of the transportable
void routeOutput(OutputDevice &os, const bool withRouteLength) const
Called on writing vehroute output.
int getNumRemainingStages() const
Return the number of remaining stages (including the current)
virtual double getSpeed() const
the current speed of the transportable
PositionVector getBoundingBox() const
return the bounding box of the person
std::string getStageSummary(int stageIndex) const
return textual summary for the given stage
MSTransportableDevice * getDevice(const std::type_info &type) const
Returns a device of the given type if it exists or 0.
void setDeparted(SUMOTime now)
logs depart time of the current stage
void setSpeed(double speed)
sets the walking speed (ignored in other stages)
virtual bool proceed(MSNet *net, SUMOTime time, const bool vehicleArrived=false)
MSTransportablePlan::iterator myStep
the iterator over the route
MSTransportablePlan * myPlan
the plan of the transportable
MSVehicleType * myVType
This transportable's type. (mainly used for drawing related information Note sure if it is really nec...
const MSVehicleType & getVehicleType() const
Returns the object's "vehicle" type.
bool isPerson() const
Whether it is a person.
virtual Position getPosition() const
Return the Network coordinate of the transportable.
const SUMOVehicleParameter * myParameter
the plan of the transportable
std::mt19937 * getRNG() const
returns the associated RNG
void saveState(OutputDevice &out)
Saves the current state into the given stream.
bool isContainer() const
Whether it is a container.
void removeStage(int next)
removes the nth next stage
virtual ~MSTransportable()
destructor
int getNumStages() const
Return the total number stages in this persons plan.
MSStageType getCurrentStageType() const
the current stage type of the transportable
void rerouteParkingArea(MSStoppingPlace *orig, MSStoppingPlace *replacement)
adapt plan when the vehicle reroutes and now stops at replacement instead of orig
const MSEdge * getEdge() const
Returns the current edge.
void loadState(const std::string &state)
Reconstructs the current state.
std::vector< MSTransportableDevice * > myDevices
The devices this transportable has.
virtual double getWaitingSeconds() const
the time this transportable spent waiting in seconds
MSTransportable(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportablePlan *plan, const bool isPerson)
constructor
bool hasArrived() const
return whether the person has reached the end of its plan
double getSlope() const
Returns the slope of the road at object's position in degrees.
void tripInfoOutput(OutputDevice &os) const
Called on writing tripinfo output.
void appendStage(MSStage *stage, int next=-1)
Appends the given stage to the current plan.
MSVehicleType & getSingularType()
Replaces the current vehicle type with a new one used by this vehicle only.
virtual void checkAccess(const MSStage *const prior, const bool isDisembark=true)
std::vector< MSStage * > MSTransportablePlan
the structure holding the plan of a transportable
const MSEdge * getDestination() const
Returns the current destination.
void setID(const std::string &newID)
set the id (inherited from Named but forbidden for transportables)
virtual double getSpeedFactor() const
the current speed factor of the transportable (where applicable)
void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
SUMOTime getDesiredDepart() const
Returns the desired departure time.
double getMaxSpeed() const
Returns the object's maximum speed.
void removeVType(const MSVehicleType *vehType)
The car-following model and parameter.
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
bool isVehicleSpecific() const
Returns whether this type belongs to a single vehicle only (was modified)
const std::string & getID() const
Returns the name of the vehicle type.
double getLength() const
Get vehicle's length [m].
MSVehicleType * buildSingularType(const std::string &id) const
Duplicates the microsim vehicle type giving the newly created type the given id, marking it as vehicl...
const std::string & getID() const
Returns the id.
static OptionsCont & getOptions()
Retrieves the options.
Static storage of an output device and its base (abstract) implementation.
void lf()
writes a line feed if applicable
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
A point in 2D or 3D with translation and scaling methods.
void append(const PositionVector &v, double sameThreshold=2.0)
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
PositionVector reverse() const
reverse position vector
Representation of a vehicle, person, or container.
virtual void removeTransportable(MSTransportable *t)=0
removes a person or container
Structure representing possible vehicle parameter.
int parametersSet
Information for the router which parameter were set, TraCI may modify this (when changing color)
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag tag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.