Eclipse SUMO - Simulation of Urban MObility
Calibrator.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2012-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 /****************************************************************************/
18 // C++ TraCI client API implementation
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 
23 #include <vector>
24 #include <libsumo/TraCIDefs.h>
26 
27 
28 // ===========================================================================
29 // class declarations
30 // ===========================================================================
31 namespace libsumo {
32 class VariableWrapper;
33 }
34 
35 
36 // ===========================================================================
37 // class definitions
38 // ===========================================================================
43 namespace libsumo {
44 class Calibrator {
45 public:
46  static std::string getEdgeID(const std::string& calibratorID);
47  static std::string getLaneID(const std::string& calibratorID);
48  static double getVehsPerHour(const std::string& calibratorID);
49  static double getSpeed(const std::string& calibratorID);
50  static std::string getTypeID(const std::string& calibratorID);
51  static double getBegin(const std::string& calibratorID);
52  static double getEnd(const std::string& calibratorID);
53  static std::string getRouteID(const std::string& calibratorID);
54  static std::string getRouteProbeID(const std::string& calibratorID);
55  static std::vector<std::string> getVTypes(const std::string& routeID);
56  static int getPassed(const std::string& calibratorID);
57  static int getInserted(const std::string& calibratorID);
58  static int getRemoved(const std::string& calibratorID);
59 
62 
63  static void setFlow(const std::string& calibratorID, double begin, double end, double vehsPerHour, double speed, const std::string& typeID,
64  const std::string& routeID,
65  const std::string& departLane = "first",
66  const std::string& departSpeed = "max");
67 
68 #ifndef LIBTRACI
69  static std::shared_ptr<VariableWrapper> makeWrapper();
70 
71  static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper);
72 
73 private:
74  static MSCalibrator* getCalibrator(const std::string& id);
76 
77 private:
80 #endif
81 
83  Calibrator() = delete;
84 };
85 
86 
87 }
#define LIBSUMO_ID_PARAMETER_API
Definition: TraCIDefs.h:97
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:44
Calibrates the flow on a segment to a specified one.
Definition: MSCalibrator.h:48
static int getPassed(const std::string &calibratorID)
Definition: Calibrator.cpp:123
static MSCalibrator * getCalibrator(const std::string &id)
Definition: Calibrator.cpp:178
static double getSpeed(const std::string &calibratorID)
Definition: Calibrator.cpp:78
Calibrator()=delete
invalidated standard constructor
static int getRemoved(const std::string &calibratorID)
Definition: Calibrator.cpp:133
static MSCalibrator::AspiredState getCalibratorState(const MSCalibrator *c)
Definition: Calibrator.cpp:188
static std::string getRouteID(const std::string &calibratorID)
Definition: Calibrator.cpp:98
static double getEnd(const std::string &calibratorID)
Definition: Calibrator.cpp:93
static std::string getEdgeID(const std::string &calibratorID)
Definition: Calibrator.cpp:58
static double getVehsPerHour(const std::string &calibratorID)
Definition: Calibrator.cpp:73
static std::vector< std::string > getVTypes(const std::string &routeID)
Definition: Calibrator.cpp:113
static std::string getRouteProbeID(const std::string &calibratorID)
Definition: Calibrator.cpp:103
static SubscriptionResults mySubscriptionResults
Definition: Calibrator.h:78
static std::string getTypeID(const std::string &calibratorID)
Definition: Calibrator.cpp:83
static double getBegin(const std::string &calibratorID)
Definition: Calibrator.cpp:88
static std::string getLaneID(const std::string &calibratorID)
Definition: Calibrator.cpp:63
static std::shared_ptr< VariableWrapper > makeWrapper()
Definition: Calibrator.cpp:197
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
Definition: Calibrator.cpp:203
LIBSUMO_ID_PARAMETER_API static LIBSUMO_SUBSCRIPTION_API void setFlow(const std::string &calibratorID, double begin, double end, double vehsPerHour, double speed, const std::string &typeID, const std::string &routeID, const std::string &departLane="first", const std::string &departSpeed="max")
Definition: Calibrator.cpp:152
static ContextSubscriptionResults myContextSubscriptionResults
Definition: Calibrator.h:79
static int getInserted(const std::string &calibratorID)
Definition: Calibrator.cpp:128
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:250
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:251