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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
21 // Builds trigger objects for microsim
22 /****************************************************************************/
23 #ifndef NLTriggerBuilder_h
24 #define NLTriggerBuilder_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <string>
37 #include <vector>
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 class MSTrigger;
44 class MSNet;
45 class MSLaneSpeedTrigger;
46 class NLHandler;
48 class MSLane;
49 class MSEdge;
50 class MSStoppingPlace;
51 class MSCalibrator;
52 class MSRouteProbe;
53 
55 
56 
57 // ===========================================================================
58 // class definitions
59 // ===========================================================================
69 public:
72 
73 
75  virtual ~NLTriggerBuilder();
76 
77 
82  void setHandler(NLHandler* handler);
83 
84 
94  void buildVaporizer(const SUMOSAXAttributes& attrs);
95 
96 
101 
102 
117  void parseAndBuildLaneSpeedTrigger(MSNet& net, const SUMOSAXAttributes& attrs,
118  const std::string& base);
119 
120 
128  void parseAndBuildRerouter(MSNet& net, const SUMOSAXAttributes& attrs,
129  const std::string& base);
130 
131 
139  void parseAndBuildStoppingPlace(MSNet& net, const SUMOSAXAttributes& attrs, const SumoXMLTag element);
140 
141 
158  virtual void beginParkingArea(MSNet& net,
159  const std::string& id, const std::vector<std::string>& lines,
160  MSLane* lane, double frompos, double topos,
161  unsigned int capacity,
162  double width, double length, double angle);
163 
164 
177  void addLotEntry(double x, double y, double z,
178  double width, double length, double angle);
179 
180 
181 
188  void addAccess(MSNet& net, const SUMOSAXAttributes& attrs);
189 
190 
197  void parseAndBeginParkingArea(MSNet& net, const SUMOSAXAttributes& attrs);
198 
199 
204  void parseAndAddLotEntry(const SUMOSAXAttributes& attrs);
205 
206 
211  virtual void endParkingArea();
212 
213 
220  void parseAndBuildChargingStation(MSNet& net, const SUMOSAXAttributes& attrs);
221 
229  void parseAndBuildCalibrator(MSNet& net, const SUMOSAXAttributes& attrs,
230  const std::string& base);
232 
233 protected:
242 
243 
256  const std::string& id, const std::vector<MSLane*>& destLanes,
257  const std::string& file);
258 
259 
273  virtual void buildStoppingPlace(MSNet& net, std::string id, std::vector<std::string> lines, MSLane* lane,
274  double frompos, double topos, const SumoXMLTag element, std::string string);
275 
291  virtual void buildChargingStation(MSNet& net, const std::string& id, MSLane* lane, double frompos, double topos,
292  double chargingPower, double efficiency, bool chargeInTransit, double chargeDelay);
293 
305  virtual MSCalibrator* buildCalibrator(MSNet& net,
306  const std::string& id, MSEdge* edge, MSLane* lane, double pos,
307  const std::string& file, const std::string& outfile,
308  const SUMOTime freq, const MSRouteProbe* probe);
309 
322  const std::string& id, const MSEdge* edge, double pos,
323  const std::string& file, const std::string& outfile,
324  const SUMOTime freq, MSRouteProbe* probe);
325 
326 
338  const std::string& id, MSEdgeVector& edges,
339  double prob, const std::string& file, bool off,
340  SUMOTime timeThreshold);
342 
343 
344 protected:
347 
359  std::string getFileName(const SUMOSAXAttributes& attrs,
360  const std::string& base,
361  const bool allowEmpty = false);
362 
363 
375  MSLane* getLane(const SUMOSAXAttributes& attrs,
376  const std::string& tt, const std::string& tid);
377 
378 
392  double getPosition(const SUMOSAXAttributes& attrs,
393  MSLane* lane, const std::string& tt, const std::string& tid, MSEdge* edge = 0);
395 
396 
397 protected:
404 };
405 
406 
407 #endif
408 
409 /****************************************************************************/
410 
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:65
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.
void addAccess(MSNet &net, const SUMOSAXAttributes &attrs)
Parses the values and adds an access point to the currently parsed stopping place.
A lane area vehicles can halt at.
Writes routes of vehicles passing a certain edge.
Definition: MSRouteProbe.h:67
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.
virtual MSTriggeredRerouter * buildRerouter(MSNet &net, const std::string &id, MSEdgeVector &edges, double prob, const std::string &file, bool off, SUMOTime timeThreshold)
builds an 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:90
Changes the speed allowed on a set of lanes.
A road/street connecting two junctions.
Definition: MSEdge.h:80
An abstract device that changes the state of the micro simulation.
Definition: MSTrigger.h:47
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 void buildChargingStation(MSNet &net, const std::string &id, MSLane *lane, double frompos, double topos, double chargingPower, double efficiency, bool chargeInTransit, double chargeDelay)
Builds a charging Station.
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.
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:87
Reroutes vehicles passing an edge.
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)
Begin a parking area.
Calibrates the flow on a segment to a specified one.
Definition: MSCalibrator.h:56
long long int SUMOTime
Definition: TraCIDefs.h:51
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:77
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:77
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".