Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSInstantInductLoop.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2011-2026 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/****************************************************************************/
19// An instantaneous induction loop
20/****************************************************************************/
21#pragma once
22#include <config.h>
23
24#include <string>
25#include <deque>
26#include <map>
27#include <functional>
28#include <vector>
31
32
33// ===========================================================================
34// class declarations
35// ===========================================================================
36class MSLane;
37class MSVehicle;
38class OutputDevice;
40
41
42// ===========================================================================
43// class definitions
44// ===========================================================================
53 : public MSMoveReminder, public MSDetectorFileOutput {
54public:
63 MSInstantInductLoop(const std::string& id, OutputDevice& od,
64 MSLane* const lane, double positionInMeters,
65 const std::string name, const std::string& vTypes,
66 const std::string& nextEdges,
67 int detectPersons);
68
69
72
73
74
77
80
90 bool notifyEnter(SUMOTrafficObject& veh, Notification reason, const MSLane* enteredLane = 0);
91
108 bool notifyMove(SUMOTrafficObject& veh, double oldPos, double newPos, double newSpeed);
109
110
124 bool notifyLeave(SUMOTrafficObject& veh, double lastPos, MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
126
127
128
139 SUMOTime startTime, SUMOTime stopTime) {
140 UNUSED_PARAMETER(dev);
141 UNUSED_PARAMETER(startTime);
142 UNUSED_PARAMETER(stopTime);
143 }
144
145
154 void writeXMLDetectorProlog(OutputDevice& dev) const;
155
156
158 void detectorUpdate(const SUMOTime step);
159
160
161protected:
170 void write(const char* state, double t, SUMOTrafficObject& veh, double speed, const char* add = 0, double addValue = -1);
171
172
173protected:
175 const std::string myName;
176
179
181 const double myPosition;
182
185
187 std::map<SUMOTrafficObject*, double> myEntryTimes;
188
190 struct Event {
191 double time;
192 long long int numericalID;
193 const char* state;
194 std::string vehID;
195 double speed;
196 double length;
197 std::string typeID;
198 const char* add;
199 double addValue;
200 };
201
203 std::vector<Event> myEvents;
204
205private:
208
211
212
213};
long long int SUMOTime
Definition GUI.h:36
Base of value-generating classes (detectors)
An instantaneous induction loop.
MSInstantInductLoop(const MSInstantInductLoop &)
Invalidated copy constructor.
std::map< SUMOTrafficObject *, double > myEntryTimes
The last exit time.
std::vector< Event > myEvents
the events of this step
void detectorUpdate(const SUMOTime step)
writes the events of this step (detectors are updated serially in a fixed order)
MSInstantInductLoop & operator=(const MSInstantInductLoop &)
Invalidated assignment operator.
bool notifyEnter(SUMOTrafficObject &veh, Notification reason, const MSLane *enteredLane=0)
Checks whether the reminder is activated by a vehicle entering the lane.
OutputDevice & myOutputDevice
The output device to use.
void writeXMLDetectorProlog(OutputDevice &dev) const
Open the XML-output.
void write(const char *state, double t, SUMOTrafficObject &veh, double speed, const char *add=0, double addValue=-1)
Writes an event line.
const double myPosition
Detector's position on lane [m].
void writeXMLOutput(OutputDevice &dev, SUMOTime startTime, SUMOTime stopTime)
Write the generated output to the given device.
const std::string myName
name
bool notifyLeave(SUMOTrafficObject &veh, double lastPos, MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
Dismisses the vehicle if it is on the detector due to a lane change.
double myLastExitTime
The last exit time.
bool notifyMove(SUMOTrafficObject &veh, double oldPos, double newPos, double newSpeed)
Checks whether the vehicle shall be counted and/or shall still touch this MSMoveReminder.
Representation of a lane in the micro simulation.
Definition MSLane.h:84
Something on a lane to be noticed about vehicle movement.
Notification
Definition of a vehicle state.
Representation of a vehicle in the micro simulation.
Definition MSVehicle.h:77
Static storage of an output device and its base (abstract) implementation.
Representation of a vehicle, person, or container.
#define UNUSED_PARAMETER(x)
an event of this step, written in detectorUpdate