Eclipse SUMO - Simulation of Urban MObility
MSParkingArea.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2015-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
14 // A area where vehicles can park next to the road
15 /****************************************************************************/
16 #ifndef MSParkingArea_h
17 #define MSParkingArea_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 #include <config.h>
24 
25 #include <vector>
26 #include <algorithm>
27 #include <map>
28 #include <string>
30 #include <utils/common/Named.h>
31 #include "MSStoppingPlace.h"
32 
33 
34 // ===========================================================================
35 // class declarations
36 // ===========================================================================
37 class MSLane;
38 class SUMOVehicle;
39 class MSTransportable;
40 class Position;
41 class Command;
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
60 public:
61 
75  MSParkingArea(const std::string& id,
76  const std::vector<std::string>& lines, MSLane& lane,
77  double begPos, double endPos, int capacity,
78  double width, double length, double angle, const std::string& name,
79  bool onRoad);
80 
82  virtual ~MSParkingArea();
83 
84 
89  int getCapacity() const;
90 
92  bool parkOnRoad() const {
93  return myOnRoad;
94  }
95 
96 
103  int getOccupancy() const;
104 
109  int getOccupancyIncludingBlocked() const;
110 
115  int getLastStepOccupancy() const {
116  return myLastStepOccupancy;
117  }
118 
119 
131  void enter(SUMOVehicle* what, double beg, double end);
132 
133 
143  void leaveFrom(SUMOVehicle* what);
144 
145 
153  SUMOTime updateOccupancy(SUMOTime currentTime);
154 
155 
160  double getLastFreePos(const SUMOVehicle& forVehicle) const;
161 
162 
168  double getLastFreePosWithReservation(SUMOTime t, const SUMOVehicle& forVehicle);
169 
170 
175  Position getVehiclePosition(const SUMOVehicle& forVehicle) const;
176 
181  double getInsertionPosition(const SUMOVehicle& forVehicle) const;
182 
183 
188  double getVehicleAngle(const SUMOVehicle& forVehicle) const;
189 
195  int getLastFreeLotAngle() const;
196 
207  virtual void addLotEntry(double x, double y, double z,
208  double width, double length, double angle);
209 
210 
215  double getWidth() const;
216 
217 
222  double getLength() const;
223 
224 
229  double getAngle() const;
230 
231 
233  void notifyEgressBlocked();
234 
235  void setNumAlternatives(int alternatives) {
236  myNumAlternatives = MAX2(myNumAlternatives, alternatives);
237  }
238 
239  int getNumAlternatives() const {
240  return myNumAlternatives;
241  }
242 
243 protected:
244 
250  int index;
256  double myRotation;
258  double myWidth;
260  double myLength;
262  double myEndPos;
265  };
266 
267 
274  void computeLastFreePos();
275 
278 
281 
283  bool myOnRoad;
284 
286  double myWidth;
287 
289  double myLength;
290 
292  double myAngle;
293 
294 
296  std::vector<LotSpaceDefinition> mySpaceOccupancies;
297 
300 
303 
308 
311 
314 
317 
318 private:
319 
322 
325 
326 };
327 
328 
329 #endif
330 
331 /****************************************************************************/
MSParkingArea::setNumAlternatives
void setNumAlternatives(int alternatives)
Definition: MSParkingArea.h:235
MSParkingArea::LotSpaceDefinition::myRotation
double myRotation
The rotation.
Definition: MSParkingArea.h:256
MSStoppingPlace
A lane area vehicles can halt at.
Definition: MSStoppingPlace.h:59
MSParkingArea
A lane area vehicles can halt at.
Definition: MSParkingArea.h:59
MSParkingArea::enter
void enter(SUMOVehicle *what, double beg, double end)
Called if a vehicle enters this stop.
Definition: MSParkingArea.cpp:202
MSParkingArea::updateOccupancy
SUMOTime updateOccupancy(SUMOTime currentTime)
Called at the end of the time step.
Definition: MSParkingArea.cpp:234
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
MSParkingArea::myLastFreeLot
int myLastFreeLot
Last free lot number (-1 no free lot)
Definition: MSParkingArea.h:277
MSParkingArea::myReservationMaxLength
double myReservationMaxLength
Definition: MSParkingArea.h:307
MSParkingArea::notifyEgressBlocked
void notifyEgressBlocked()
update state so that vehicles wishing to enter cooperate with exiting vehicles
Definition: MSParkingArea.cpp:365
MSParkingArea::getLastStepOccupancy
int getLastStepOccupancy() const
Returns the area occupancy at the end of the last simulation step.
Definition: MSParkingArea.h:115
MSParkingArea::LotSpaceDefinition::myWidth
double myWidth
The width.
Definition: MSParkingArea.h:258
MSParkingArea::myReservations
int myReservations
Definition: MSParkingArea.h:306
MSParkingArea::operator=
MSParkingArea & operator=(const MSParkingArea &)
Invalidated assignment operator.
MSParkingArea::getNumAlternatives
int getNumAlternatives() const
Definition: MSParkingArea.h:239
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
SUMOVehicle
Representation of a vehicle.
Definition: SUMOVehicle.h:60
MSParkingArea::LotSpaceDefinition::myPosition
Position myPosition
The position of the vehicle when parking in this space.
Definition: MSParkingArea.h:254
MSParkingArea::LotSpaceDefinition::index
int index
the running index
Definition: MSParkingArea.h:250
MSParkingArea::getInsertionPosition
double getInsertionPosition(const SUMOVehicle &forVehicle) const
Returns the insertion position of a parked vehicle.
Definition: MSParkingArea.cpp:180
MSParkingArea::getVehiclePosition
Position getVehiclePosition(const SUMOVehicle &forVehicle) const
Returns the position of parked vehicle.
Definition: MSParkingArea.cpp:169
MSParkingArea::getVehicleAngle
double getVehicleAngle(const SUMOVehicle &forVehicle) const
Returns the angle of parked vehicle.
Definition: MSParkingArea.cpp:191
MSTransportable
Definition: MSTransportable.h:58
PositionVector
A list of positions.
Definition: PositionVector.h:45
MSParkingArea::myAngle
double myAngle
The default angle of each parking space.
Definition: MSParkingArea.h:292
MSParkingArea::LotSpaceDefinition::myLength
double myLength
The length.
Definition: MSParkingArea.h:260
MAX2
T MAX2(T a, T b)
Definition: StdDefs.h:79
MSParkingArea::myReservationTime
SUMOTime myReservationTime
track parking reservations from the lane for the current time step
Definition: MSParkingArea.h:305
Named.h
MSParkingArea::MSParkingArea
MSParkingArea(const MSParkingArea &)
Invalidated copy constructor.
MSParkingArea::myShape
PositionVector myShape
The roadside shape of this parkingArea.
Definition: MSParkingArea.h:299
MSParkingArea::getCapacity
int getCapacity() const
Returns the area capacity.
Definition: MSParkingArea.cpp:348
MSParkingArea::myLastStepOccupancy
int myLastStepOccupancy
Changes to the occupancy in the current time step.
Definition: MSParkingArea.h:313
MSParkingArea::LotSpaceDefinition::myEndPos
double myEndPos
The position along the lane that the vehicle needs to reach for entering this lot.
Definition: MSParkingArea.h:262
MSParkingArea::mySpaceOccupancies
std::vector< LotSpaceDefinition > mySpaceOccupancies
All the spaces in this parking area.
Definition: MSParkingArea.h:296
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
MSParkingArea::MSParkingArea
MSParkingArea(const std::string &id, const std::vector< std::string > &lines, MSLane &lane, double begPos, double endPos, int capacity, double width, double length, double angle, const std::string &name, bool onRoad)
Constructor.
Definition: MSParkingArea.cpp:45
MSParkingArea::parkOnRoad
bool parkOnRoad() const
whether vehicles park on the road
Definition: MSParkingArea.h:92
MSParkingArea::myLength
double myLength
The default length of each parking space.
Definition: MSParkingArea.h:289
MSParkingArea::addLotEntry
virtual void addLotEntry(double x, double y, double z, double width, double length, double angle)
Add a lot entry to parking area.
Definition: MSParkingArea.cpp:98
MSParkingArea::LotSpaceDefinition
Representation of a single lot space.
Definition: MSParkingArea.h:248
MSParkingArea::getLength
double getLength() const
Returns the lot rectangle length.
Definition: MSParkingArea.cpp:336
MSParkingArea::myCapacity
int myCapacity
Stop area capacity.
Definition: MSParkingArea.h:280
MSParkingArea::leaveFrom
void leaveFrom(SUMOVehicle *what)
Called if a vehicle leaves this stop.
Definition: MSParkingArea.cpp:216
MSParkingArea::computeLastFreePos
void computeLastFreePos()
Computes the last free position on this stop.
Definition: MSParkingArea.cpp:242
MSParkingArea::myOnRoad
bool myOnRoad
Whether vehicles stay on the road.
Definition: MSParkingArea.h:283
MSParkingArea::getOccupancy
int getOccupancy() const
Returns the area occupancy.
Definition: MSParkingArea.cpp:354
MSParkingArea::getWidth
double getWidth() const
Returns the lot rectangle width.
Definition: MSParkingArea.cpp:330
MSParkingArea::getLastFreeLotAngle
int getLastFreeLotAngle() const
Return the angle of myLastFreeLot - the next parking lot only expected to be called after we have est...
Definition: MSParkingArea.cpp:148
MSParkingArea::getLastFreePosWithReservation
double getLastFreePosWithReservation(SUMOTime t, const SUMOVehicle &forVehicle)
Returns the last free position on this stop including reservatiosn from the current lane and time ste...
Definition: MSParkingArea.cpp:270
MSParkingArea::getOccupancyIncludingBlocked
int getOccupancyIncludingBlocked() const
Returns the area occupancy.
Definition: MSParkingArea.cpp:360
MSParkingArea::LotSpaceDefinition::myManoeuverAngle
int myManoeuverAngle
The angle between lane and lot through which a vehicle must manoeuver to enter the lot.
Definition: MSParkingArea.h:264
Command
Base (microsim) event class.
Definition: Command.h:52
MSParkingArea::~MSParkingArea
virtual ~MSParkingArea()
Destructor.
Definition: MSParkingArea.cpp:95
MSStoppingPlace::getLastFreePos
double getLastFreePos() const
Definition: MSStoppingPlace.h:172
config.h
MSParkingArea::myNumAlternatives
int myNumAlternatives
the number of alternative parkingAreas that are assigned to parkingAreaRerouter
Definition: MSParkingArea.h:310
MSParkingArea::LotSpaceDefinition::vehicle
SUMOVehicle * vehicle
The last parked vehicle or 0.
Definition: MSParkingArea.h:252
MSParkingArea::getAngle
double getAngle() const
Returns the lot rectangle angle.
Definition: MSParkingArea.cpp:342
MSStoppingPlace.h
PositionVector.h
MSParkingArea::myUpdateEvent
Command * myUpdateEvent
Event for updating the occupancy.
Definition: MSParkingArea.h:316
MSParkingArea::myEgressBlocked
bool myEgressBlocked
whether a vehicle wants to exit but is blocked
Definition: MSParkingArea.h:302
MSParkingArea::myWidth
double myWidth
The default width of each parking space.
Definition: MSParkingArea.h:286