Eclipse 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-2020 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 /****************************************************************************/
22 // Builds trigger objects for microsim
23 /****************************************************************************/
24 #pragma once
25 #include <config.h>
26 
27 #include <string>
28 #include <vector>
29 
30 
31 // ===========================================================================
32 // class declarations
33 // ===========================================================================
34 class MSTrigger;
35 class MSNet;
36 class MSLaneSpeedTrigger;
37 class NLHandler;
39 class MSLane;
40 class MSEdge;
41 class MSStoppingPlace;
42 class MSCalibrator;
43 class MSRouteProbe;
44 
46 
47 
48 // ===========================================================================
49 // class definitions
50 // ===========================================================================
60 public:
63 
64 
66  virtual ~NLTriggerBuilder();
67 
68 
73  void setHandler(NLHandler* handler);
74 
75 
85  void buildVaporizer(const SUMOSAXAttributes& attrs);
86 
87 
92 
93 
108  void parseAndBuildLaneSpeedTrigger(MSNet& net, const SUMOSAXAttributes& attrs,
109  const std::string& base);
110 
111 
119  void parseAndBuildRerouter(MSNet& net, const SUMOSAXAttributes& attrs,
120  const std::string& base);
121 
122 
130  void parseAndBuildStoppingPlace(MSNet& net, const SUMOSAXAttributes& attrs, const SumoXMLTag element);
131 
132 
149  virtual void beginParkingArea(MSNet& net,
150  const std::string& id, const std::vector<std::string>& lines,
151  MSLane* lane, double frompos, double topos,
152  unsigned int capacity,
153  double width, double length, double angle, const std::string& name,
154  bool onRoad);
155 
156 
169  void addLotEntry(double x, double y, double z,
170  double width, double length, double angle);
171 
172 
173 
180  void addAccess(MSNet& net, const SUMOSAXAttributes& attrs);
181 
182 
189  void parseAndBeginParkingArea(MSNet& net, const SUMOSAXAttributes& attrs);
190 
191 
196  void parseAndAddLotEntry(const SUMOSAXAttributes& attrs);
197 
198 
203  virtual void endParkingArea();
204 
209  virtual void endStoppingPlace();
210 
211 
218  void parseAndBuildChargingStation(MSNet& net, const SUMOSAXAttributes& attrs);
219 
227 
235 
243 
252  void parseAndBuildOverheadWireClamp(MSNet& net, const SUMOSAXAttributes& attrs);
253 
261  void parseAndBuildCalibrator(MSNet& net, const SUMOSAXAttributes& attrs,
262  const std::string& base);
264 
265 
267 
268 
269 protected:
278 
279 
292  const std::string& id, const std::vector<MSLane*>& destLanes,
293  const std::string& file);
294 
295 
309  virtual void buildStoppingPlace(MSNet& net, std::string id, std::vector<std::string> lines, MSLane* lane,
310  double frompos, double topos, const SumoXMLTag element, std::string string,
311  int personCapacity, double parkingLength);
312 
328  virtual void buildChargingStation(MSNet& net, const std::string& id, MSLane* lane, double frompos, double topos, const std::string& name,
329  double chargingPower, double efficiency, bool chargeInTransit, double chargeDelay);
330 
343  virtual void buildOverheadWireSegment(MSNet& net, const std::string& id, MSLane* lane, double frompos, double topos, bool voltageSource);
344 
356  void buildInnerOverheadWireSegments(MSNet& net, const MSLane* connection, const MSLane* frontConnection, const MSLane* behindConnection);
357 
367  void buildTractionSubstation(MSNet& net, std::string id, double voltage);
368 
369  virtual void buildOverheadWireClamp(MSNet& net, const std::string& id, MSLane* lane_start, MSLane* lane_end);
370 
382  virtual MSCalibrator* buildCalibrator(MSNet& net,
383  const std::string& id, MSEdge* edge, MSLane* lane, double pos,
384  const std::string& file, const std::string& outfile,
385  const SUMOTime freq,
386  const MSRouteProbe* probe,
387  const double invalidJamThreshold,
388  const std::string& vTypes);
389 
402  const std::string& id, const MSEdge* edge, double pos,
403  const std::string& file, const std::string& outfile,
404  const SUMOTime freq,
405  MSRouteProbe* probe,
406  const double invalidJamThreshold,
407  const std::string& vTypes);
408 
409 
421  const std::string& id, MSEdgeVector& edges,
422  double prob, const std::string& file, bool off,
423  SUMOTime timeThreshold,
424  const std::string& vTypes);
426 
427 
428 protected:
431 
443  std::string getFileName(const SUMOSAXAttributes& attrs,
444  const std::string& base,
445  const bool allowEmpty = false);
446 
447 
459  MSLane* getLane(const SUMOSAXAttributes& attrs,
460  const std::string& tt, const std::string& tid);
461 
462 
476  double getPosition(const SUMOSAXAttributes& attrs,
477  MSLane* lane, const std::string& tt, const std::string& tid, MSEdge* edge = 0);
479 
480 
481 protected:
488 
490 };
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:73
long long int SUMOTime
Definition: SUMOTime.h:31
SumoXMLTag
Numbers representing SUMO-XML - element names.
Calibrates the flow on a segment to a specified one.
Calibrates the flow on a segment to a specified one.
Definition: MSCalibrator.h:48
A road/street connecting two junctions.
Definition: MSEdge.h:77
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
Changes the speed allowed on a set of lanes.
The simulated network and simulation perfomer.
Definition: MSNet.h:89
A lane area vehicles can halt at.
Definition: MSParkingArea.h:57
Writes routes of vehicles passing a certain edge.
Definition: MSRouteProbe.h:58
A lane area vehicles can halt at.
An abstract device that changes the state of the micro simulation.
Definition: MSTrigger.h:38
Reroutes vehicles passing an edge.
The XML-Handler for network loading.
Definition: NLHandler.h:79
Builds trigger objects for microsim.
NLTriggerBuilder()
Constructor.
virtual void buildOverheadWireClamp(MSNet &net, const std::string &id, MSLane *lane_start, MSLane *lane_end)
MSParkingArea * myParkingArea
definition of the currently parsed parking area
void parseAndBuildTractionSubstation(MSNet &net, const SUMOSAXAttributes &attrs)
Parses its values and builds a traction substation.
void addAccess(MSNet &net, const SUMOSAXAttributes &attrs)
Parses the values and adds an access point to the currently parsed stopping place.
void parseAndBuildOverheadWireSegment(MSNet &net, const SUMOSAXAttributes &attrs)
Parses its values and builds an overhead wire segment.
void parseAndBuildCalibrator(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a mesoscopic or microscopic calibrator.
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
void buildInnerOverheadWireSegments(MSNet &net, const MSLane *connection, const MSLane *frontConnection, const MSLane *behindConnection)
Builds an overhead wire inner segments.
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.
virtual MSLaneSpeedTrigger * buildLaneSpeedTrigger(MSNet &net, const std::string &id, const std::vector< MSLane * > &destLanes, const std::string &file)
Builds a lane speed trigger.
virtual void endParkingArea()
End a parking area.
void parseAndBuildLaneSpeedTrigger(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a lane speed trigger.
void parseAndAddLotEntry(const SUMOSAXAttributes &attrs)
Parses his values and adds a lot entry to current parking area.
NLHandler * myHandler
The parent handler to set for subhandlers.
void buildTractionSubstation(MSNet &net, std::string id, double voltage)
Builds a traction substation.
MSLane * getLane(const SUMOSAXAttributes &attrs, const std::string &tt, const std::string &tid)
Returns the lane defined by attribute "lane".
void buildVaporizer(const SUMOSAXAttributes &attrs)
Builds a vaporization.
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
void parseAndBuildOverheadWireSection(MSNet &net, const SUMOSAXAttributes &attrs)
Parses its values and builds an overhead wire section.
void setHandler(NLHandler *handler)
Sets the parent handler to use for nested parsing.
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, const double invalidJamThreshold, const std::string &vTypes)
builds a microscopic calibrator
virtual ~NLTriggerBuilder()
Destructor.
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.
void parseAndBuildChargingStation(MSNet &net, const SUMOSAXAttributes &attrs)
Parses his values and builds a charging station.
void parseAndBuildOverheadWireClamp(MSNet &net, const SUMOSAXAttributes &attrs)
Parses its values and builds an overhead wire clamp.
void parseAndBuildRerouter(MSNet &net, const SUMOSAXAttributes &attrs, const std::string &base)
Parses his values and builds a rerouter.
virtual void endStoppingPlace()
End a stopping place.
virtual void buildOverheadWireSegment(MSNet &net, const std::string &id, MSLane *lane, double frompos, double topos, bool voltageSource)
Builds an overhead wire segment.
MSStoppingPlace * myCurrentStop
The currently parsed stop to add access points to.
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, int personCapacity, double parkingLength)
Builds a stopping place.
MSStoppingPlace * getCurrentStop()
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, const double invalidJamThreshold, const std::string &vTypes)
builds a mesoscopic calibrator
void parseAndBuildStoppingPlace(MSNet &net, const SUMOSAXAttributes &attrs, const SumoXMLTag element)
Parses the values and builds a stopping places for busses, trains or container vehicles.
void parseAndBeginParkingArea(MSNet &net, const SUMOSAXAttributes &attrs)
Parses his values and builds a parking area.
std::string getFileName(const SUMOSAXAttributes &attrs, const std::string &base, const bool allowEmpty=false)
Helper method to obtain the filename.
void addLotEntry(double x, double y, double z, double width, double length, double angle)
Add a lot entry to current parking area.
Encapsulated SAX-Attributes.