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-2022 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// A area where vehicles can park next to the road
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23#include <vector>
24#include <algorithm>
25#include <map>
26#include <string>
28#include <utils/common/Named.h>
30#include "MSStoppingPlace.h"
31
32
33// ===========================================================================
34// class declarations
35// ===========================================================================
36class MSLane;
37class SUMOVehicle;
38class MSTransportable;
39class Position;
40class Command;
41
42
43// ===========================================================================
44// class definitions
45// ===========================================================================
59public:
60
74 MSParkingArea(const std::string& id,
75 const std::vector<std::string>& lines, MSLane& lane,
76 double begPos, double endPos, int capacity,
77 double width, double length, double angle, const std::string& name,
78 bool onRoad,
79 const std::string& departPos);
80
82 virtual ~MSParkingArea();
83
85 int getCapacity() const;
86
88 bool parkOnRoad() const;
89
91 int getLotIndex(const SUMOVehicle* veh) const;
92
99 int getOccupancy() const;
100
103
105 int getLastStepOccupancy() const;
106
116 void enter(SUMOVehicle* veh);
117
127 void leaveFrom(SUMOVehicle* what);
128
136 SUMOTime updateOccupancy(SUMOTime currentTime);
137
139 double getLastFreePos(const SUMOVehicle& forVehicle, double brakePos = 0) const;
140
146 double getLastFreePosWithReservation(SUMOTime t, const SUMOVehicle& forVehicle, double brakePos);
147
149 Position getVehiclePosition(const SUMOVehicle& forVehicle) const;
150
152 double getInsertionPosition(const SUMOVehicle& forVehicle) const;
153
155 double getVehicleAngle(const SUMOVehicle& forVehicle) const;
156
158 double getVehicleSlope(const SUMOVehicle& forVehicle) const;
159
165 int getLastFreeLotAngle() const;
166
172 double getLastFreeLotGUIAngle() const;
173
175 int getManoeuverAngle(const SUMOVehicle& forVehicle) const;
176
178 double getGUIAngle(const SUMOVehicle& forVehicle) const;
179
191 virtual void addLotEntry(double x, double y, double z,
192 double width, double length,
193 double angle, double slope);
194
196 double getWidth() const;
197
199 double getLength() const;
200
202 double getAngle() const;
203
205 void notifyEgressBlocked();
206
208 int getNumAlternatives() const;
209
211 void setNumAlternatives(int alternatives);
212
213protected:
220
222 LotSpaceDefinition(int index, SUMOVehicle* vehicle, double x, double y, double z, double rotation, double slope, double width, double length);
223
225 const int index;
226
229
232
234 const double rotation;
235
237 const double slope;
238
240 const double width;
241
243 const double length;
244
246 double endPos;
247
250
253 };
254
261 void computeLastFreePos();
262
265
268
271
274
276 double myWidth;
277
279 double myLength;
280
282 double myAngle;
283
285 std::vector<LotSpaceDefinition> mySpaceOccupancies;
286
289
292
295
298
301
304
307
311
314
315private:
317 MSParkingArea(const MSParkingArea&) = delete;
318
321};
long long int SUMOTime
Definition: GUI.h:36
DepartPosDefinition
Possible ways to choose the departure position.
Base (microsim) event class.
Definition: Command.h:50
Representation of a lane in the micro simulation.
Definition: MSLane.h:84
A lane area vehicles can halt at.
Definition: MSParkingArea.h:58
void notifyEgressBlocked()
update state so that vehicles wishing to enter cooperate with exiting vehicles
double getAngle() const
Returns the lot rectangle angle.
void leaveFrom(SUMOVehicle *what)
Called if a vehicle leaves this stop.
int getNumAlternatives() const
get number alternatives
int myReservations
number of reservations
int myCapacity
Stop area total capacity.
int getCapacity() const
Returns the area capacity.
void enter(SUMOVehicle *veh)
Called if a vehicle enters this stop.
MSParkingArea(const MSParkingArea &)=delete
Invalidated copy constructor.
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, const std::string &departPos)
Constructor.
int myLastStepOccupancy
Changes to the occupancy in the current time step.
MSParkingArea & operator=(const MSParkingArea &)=delete
Invalidated assignment operator.
bool myOnRoad
Whether vehicles stay on the road.
int myLastFreeLot
Last free lot number (-1 no free lot)
void setNumAlternatives(int alternatives)
set number alternatives
PositionVector myShape
The roadside shape of this parkingArea.
double getLength() const
Returns the lot rectangle length.
virtual void addLotEntry(double x, double y, double z, double width, double length, double angle, double slope)
Add a lot entry to parking area.
SUMOTime myReservationTime
track parking reservations from the lane for the current time step
double getWidth() const
Returns the lot rectangle width.
double getVehicleSlope(const SUMOVehicle &forVehicle) const
Returns the slope of parked vehicle.
int myRoadSideCapacity
Stop area capacity configured via roadsideCapacity.
int getLotIndex(const SUMOVehicle *veh) const
compute lot for this vehicle
virtual ~MSParkingArea()
Destructor.
SUMOTime updateOccupancy(SUMOTime currentTime)
Called at the end of the time step.
int getLastFreeLotAngle() const
Return the angle of myLastFreeLot - the next parking lot only expected to be called after we have est...
double myDepartPos
custom departPos
double myAngle
The default angle of each parking space.
bool parkOnRoad() const
whether vehicles park on the road
DepartPosDefinition myDepartPosDefinition
double myReservationMaxLength
reservation max length
int myNumAlternatives
the number of alternative parkingAreas that are assigned to parkingAreaRerouter
double myWidth
The default width of each parking space.
double myLength
The default length of each parking space.
void computeLastFreePos()
Computes the last free position on this stop.
int getOccupancyIncludingBlocked() const
Returns the area occupancy.
double getLastFreePosWithReservation(SUMOTime t, const SUMOVehicle &forVehicle, double brakePos)
Returns the last free position on this stop including reservatiosn from the current lane and time ste...
double getLastFreeLotGUIAngle() const
Return the GUI angle of myLastFreeLot - the angle the GUI uses to rotate into the next parking lot as...
int getManoeuverAngle(const SUMOVehicle &forVehicle) const
Return the manoeuver angle of the lot where the vehicle is parked.
int getLastStepOccupancy() const
Returns the area occupancy at the end of the last simulation step.
int getOccupancy() const
Returns the area occupancy.
double getVehicleAngle(const SUMOVehicle &forVehicle) const
Returns the angle of parked vehicle.
Command * myUpdateEvent
Event for updating the occupancy.
std::vector< LotSpaceDefinition > mySpaceOccupancies
All the spaces in this parking area.
double getInsertionPosition(const SUMOVehicle &forVehicle) const
Returns the insertion position of a parked vehicle.
Position getVehiclePosition(const SUMOVehicle &forVehicle) const
Returns the position of parked vehicle.
double getGUIAngle(const SUMOVehicle &forVehicle) const
Return the GUI angle of the lot where the vehicle is parked.
bool myEgressBlocked
whether a vehicle wants to exit but is blocked
A lane area vehicles can halt at.
double getLastFreePos() const
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
A list of positions.
Representation of a vehicle.
Definition: SUMOVehicle.h:60
Representation of a single lot space.
const double slope
The slope.
const Position position
The position of the vehicle when parking in this space.
bool sideIsLHS
Whether the lot is on the LHS of the lane relative to the lane direction.
const int index
the running index
const double width
The width.
double manoeuverAngle
The angle between lane and lot through which a vehicle must manoeuver to enter the lot.
const double rotation
The rotation.
double endPos
The position along the lane that the vehicle needs to reach for entering this lot.
LotSpaceDefinition()
default constructor
const double length
The length.
const SUMOVehicle * vehicle
The last parked vehicle or 0.