SUMO - Simulation of Urban MObility
NLTriggerBuilder.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2002-2018 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 /****************************************************************************/
19 // Builds trigger objects for microsim
20 /****************************************************************************/
21 #ifndef NLTriggerBuilder_h
22 #define NLTriggerBuilder_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #include <config.h>
29 
30 #include <string>
31 #include <vector>
32 
33 
34 // ===========================================================================
35 // class declarations
36 // ===========================================================================
37 class MSTrigger;
38 class MSNet;
39 class MSLaneSpeedTrigger;
40 class NLHandler;
42 class MSLane;
43 class MSEdge;
44 class MSStoppingPlace;
45 class MSCalibrator;
46 class MSRouteProbe;
47 
49 
50 
51 // ===========================================================================
52 // class definitions
53 // ===========================================================================
63 public:
66 
67 
69  virtual ~NLTriggerBuilder();
70 
71 
76  void setHandler(NLHandler* handler);
77 
78 
88  void buildVaporizer(const SUMOSAXAttributes& attrs);
89 
90 
95 
96 
111  void parseAndBuildLaneSpeedTrigger(MSNet& net, const SUMOSAXAttributes& attrs,
112  const std::string& base);
113 
114 
122  void parseAndBuildRerouter(MSNet& net, const SUMOSAXAttributes& attrs,
123  const std::string& base);
124 
125 
133  void parseAndBuildStoppingPlace(MSNet& net, const SUMOSAXAttributes& attrs, const SumoXMLTag element);
134 
135 
152  virtual void beginParkingArea(MSNet& net,
153  const std::string& id, const std::vector<std::string>& lines,
154  MSLane* lane, double frompos, double topos,
155  unsigned int capacity,
156  double width, double length, double angle, const std::string& name,
157  bool onRoad);
158 
159 
172  void addLotEntry(double x, double y, double z,
173  double width, double length, double angle);
174 
175 
176 
183  void addAccess(MSNet& net, const SUMOSAXAttributes& attrs);
184 
185 
192  void parseAndBeginParkingArea(MSNet& net, const SUMOSAXAttributes& attrs);
193 
194 
199  void parseAndAddLotEntry(const SUMOSAXAttributes& attrs);
200 
201 
206  virtual void endParkingArea();
207 
212  virtual void endStoppingPlace();
213 
214 
221  void parseAndBuildChargingStation(MSNet& net, const SUMOSAXAttributes& attrs);
222 
230  void parseAndBuildCalibrator(MSNet& net, const SUMOSAXAttributes& attrs,
231  const std::string& base);
233 
234 protected:
243 
244 
257  const std::string& id, const std::vector<MSLane*>& destLanes,
258  const std::string& file);
259 
260 
274  virtual void buildStoppingPlace(MSNet& net, std::string id, std::vector<std::string> lines, MSLane* lane,
275  double frompos, double topos, const SumoXMLTag element, std::string string);
276 
292  virtual void buildChargingStation(MSNet& net, const std::string& id, MSLane* lane, double frompos, double topos, const std::string& name,
293  double chargingPower, double efficiency, bool chargeInTransit, double chargeDelay);
294 
306  virtual MSCalibrator* buildCalibrator(MSNet& net,
307  const std::string& id, MSEdge* edge, MSLane* lane, double pos,
308  const std::string& file, const std::string& outfile,
309  const SUMOTime freq, const MSRouteProbe* probe);
310 
323  const std::string& id, const MSEdge* edge, double pos,
324  const std::string& file, const std::string& outfile,
325  const SUMOTime freq, MSRouteProbe* probe);
326 
327 
339  const std::string& id, MSEdgeVector& edges,
340  double prob, const std::string& file, bool off,
341  SUMOTime timeThreshold,
342  const std::string& vTypes);
344 
345 
346 protected:
349 
361  std::string getFileName(const SUMOSAXAttributes& attrs,
362  const std::string& base,
363  const bool allowEmpty = false);
364 
365 
377  MSLane* getLane(const SUMOSAXAttributes& attrs,
378  const std::string& tt, const std::string& tid);
379 
380 
394  double getPosition(const SUMOSAXAttributes& attrs,
395  MSLane* lane, const std::string& tt, const std::string& tid, MSEdge* edge = 0);
397 
398 
399 protected:
406 };
407 
408 
409 #endif
410 
411 /****************************************************************************/
412 
void setHandler(NLHandler *handler)
Sets the parent handler to use for nested parsing.
void parseAndAddLotEntry(const SUMOSAXAttributes &attrs)
Parses his values and adds a lot entry to current parking area.
A lane area vehicles can halt at.
Definition: MSParkingArea.h:59
void parseAndBuildCalibrator(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a mesoscopic or microscopic calibrator.
SumoXMLTag
Numbers representing SUMO-XML - element names.
virtual void buildStoppingPlace(MSNet &net, std::string id, std::vector< std::string > lines, MSLane *lane, double frompos, double topos, const SumoXMLTag element, std::string string)
Builds a stopping place.
long long int SUMOTime
Definition: SUMOTime.h:36
void addAccess(MSNet &net, const SUMOSAXAttributes &attrs)
Parses the values and adds an access point to the currently parsed stopping place.
virtual MSTriggeredRerouter * buildRerouter(MSNet &net, const std::string &id, MSEdgeVector &edges, double prob, const std::string &file, bool off, SUMOTime timeThreshold, const std::string &vTypes)
builds an rerouter
A lane area vehicles can halt at.
Writes routes of vehicles passing a certain edge.
Definition: MSRouteProbe.h:61
void parseAndBuildChargingStation(MSNet &net, const SUMOSAXAttributes &attrs)
Parses his values and builds a charging station.
void parseAndBuildRerouter(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a rerouter.
NLTriggerBuilder()
Constructor.
MSParkingArea * myParkingArea
definition of the currently parsed parking area
virtual ~NLTriggerBuilder()
Destructor.
void parseAndBeginParkingArea(MSNet &net, const SUMOSAXAttributes &attrs)
Parses his values and builds a parking area.
virtual MSCalibrator * buildCalibrator(MSNet &net, const std::string &id, MSEdge *edge, MSLane *lane, double pos, const std::string &file, const std::string &outfile, const SUMOTime freq, const MSRouteProbe *probe)
builds a microscopic calibrator
void addLotEntry(double x, double y, double z, double width, double length, double angle)
Add a lot entry to current parking area.
The simulated network and simulation perfomer.
Definition: MSNet.h:84
Changes the speed allowed on a set of lanes.
A road/street connecting two junctions.
Definition: MSEdge.h:75
An abstract device that changes the state of the micro simulation.
Definition: MSTrigger.h:41
Encapsulated SAX-Attributes.
Calibrates the flow on a segment to a specified one.
NLHandler * myHandler
The parent handler to set for subhandlers.
virtual void endParkingArea()
End a parking area.
virtual METriggeredCalibrator * buildMECalibrator(MSNet &net, const std::string &id, const MSEdge *edge, double pos, const std::string &file, const std::string &outfile, const SUMOTime freq, MSRouteProbe *probe)
builds a mesoscopic calibrator
void parseAndBuildLaneSpeedTrigger(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a lane speed trigger.
virtual void beginParkingArea(MSNet &net, const std::string &id, const std::vector< std::string > &lines, MSLane *lane, double frompos, double topos, unsigned int capacity, double width, double length, double angle, const std::string &name, bool onRoad)
Begin a parking area.
MSStoppingPlace * myCurrentStop
The currently parsed stop to add access points to.
void parseAndBuildStoppingPlace(MSNet &net, const SUMOSAXAttributes &attrs, const SumoXMLTag element)
Parses the values and builds a stopping places for busses, trains or container vehicles.
virtual MSLaneSpeedTrigger * buildLaneSpeedTrigger(MSNet &net, const std::string &id, const std::vector< MSLane *> &destLanes, const std::string &file)
Builds a lane speed trigger.
std::string getFileName(const SUMOSAXAttributes &attrs, const std::string &base, const bool allowEmpty=false)
Helper method to obtain the filename.
The XML-Handler for network loading.
Definition: NLHandler.h:81
Reroutes vehicles passing an edge.
virtual void endStoppingPlace()
End a stopping place.
virtual void buildChargingStation(MSNet &net, const std::string &id, MSLane *lane, double frompos, double topos, const std::string &name, double chargingPower, double efficiency, bool chargeInTransit, double chargeDelay)
Builds a charging station.
Calibrates the flow on a segment to a specified one.
Definition: MSCalibrator.h:50
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:71
Builds trigger objects for microsim.
double getPosition(const SUMOSAXAttributes &attrs, MSLane *lane, const std::string &tt, const std::string &tid, MSEdge *edge=0)
returns the position on the lane checking it
Representation of a lane in the micro simulation.
Definition: MSLane.h:78
void buildVaporizer(const SUMOSAXAttributes &attrs)
Builds a vaporization.
MSLane * getLane(const SUMOSAXAttributes &attrs, const std::string &tt, const std::string &tid)
Returns the lane defined by attribute "lane".