44std::vector<std::string>
45Calibrator::getIDList() {
47 std::vector<std::string> ids;
49 ids.push_back(item.first);
55Calibrator::getIDCount() {
56 return (
int)getIDList().size();
67 if (lane ==
nullptr) {
114std::vector<std::string>
116 std::vector<std::string> result;
117 const std::set<std::string>& vTypes =
getCalibrator(calibratorID)->getVehicleTypes();
118 result.insert(result.begin(), vTypes.begin(), vTypes.end());
119 std::sort(result.begin(), result.end());
140Calibrator::getParameter(
const std::string& calibratorID,
const std::string& param) {
148Calibrator::setParameter(
const std::string& calibratorID,
const std::string& key,
const std::string&
value) {
154Calibrator::setFlow(
const std::string& calibratorID,
double begin,
double end,
double vehsPerHour,
double speed,
const std::string& typeID,
155 const std::string& routeID,
156 const std::string& departLane,
157 const std::string& departSpeed) {
160 vehicleParams.
vtypeid = typeID;
161 vehicleParams.
routeid = routeID;
164 throw TraCIException(
"Vehicle type '" + typeID +
"' is not known");
167 throw TraCIException(error);
170 throw TraCIException(error);
182 auto it = dict.find(
id);
183 if (it == dict.end()) {
184 throw TraCIException(
"Calibrator '" +
id +
"' is not known");
190std::shared_ptr<VariableWrapper>
200 return wrapper->wrapStringList(objID, variable, getIDList());
202 return wrapper->wrapInt(objID, variable, getIDCount());
204 return wrapper->wrapString(objID, variable,
getEdgeID(objID));
206 return wrapper->wrapString(objID, variable,
getLaneID(objID));
208 return wrapper->wrapDouble(objID, variable,
getVehsPerHour(objID));
210 return wrapper->wrapDouble(objID, variable,
getSpeed(objID));
212 return wrapper->wrapString(objID, variable,
getTypeID(objID));
214 return wrapper->wrapDouble(objID, variable,
getBegin(objID));
216 return wrapper->wrapDouble(objID, variable,
getEnd(objID));
218 return wrapper->wrapString(objID, variable,
getRouteID(objID));
222 return wrapper->wrapStringList(objID, variable,
getVTypes(objID));
224 return wrapper->wrapInt(objID, variable,
getPassed(objID));
226 return wrapper->wrapInt(objID, variable,
getInserted(objID));
228 return wrapper->wrapInt(objID, variable,
getRemoved(objID));
231 return wrapper->wrapString(objID, variable, getParameter(objID, paramData->
readString()));
234 return wrapper->wrapStringPair(objID, variable, getParameterWithKey(objID, paramData->
readString()));
const std::string invalid_return< std::string >::value
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOM)
#define LIBSUMO_GET_PARAMETER_WITH_KEY_IMPLEMENTATION(CLASS)
C++ TraCI client API implementation.
static int getPassed(const std::string &calibratorID)
static MSCalibrator * getCalibrator(const std::string &id)
static double getSpeed(const std::string &calibratorID)
static int getRemoved(const std::string &calibratorID)
static std::string getRouteID(const std::string &calibratorID)
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper, tcpip::Storage *paramData)
static double getEnd(const std::string &calibratorID)
static std::vector< std::string > getVTypes(const std::string &calibratorID)
static std::string getEdgeID(const std::string &calibratorID)
static double getVehsPerHour(const std::string &calibratorID)
static std::string getRouteProbeID(const std::string &calibratorID)
static SubscriptionResults mySubscriptionResults
static std::string getTypeID(const std::string &calibratorID)
static double getBegin(const std::string &calibratorID)
static std::string getLaneID(const std::string &calibratorID)
static std::shared_ptr< VariableWrapper > makeWrapper()
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")
static ContextSubscriptionResults myContextSubscriptionResults
static int getInserted(const std::string &calibratorID)
Calibrates the flow on a segment to a specified one.
static const std::map< std::string, MSCalibrator * > & getInstances()
return all calibrator instances
Representation of a lane in the micro simulation.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Writes routes of vehicles passing a certain edge.
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, SumoRNG *rng=nullptr, bool readOnly=false)
Returns the named vehicle type or a sample from the named distribution.
The car-following model and parameter.
const std::string & getID() const
Returns the id.
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
virtual void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
Structure representing possible vehicle parameter.
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
double departSpeed
(optional) The initial speed of the vehicle
std::string vtypeid
The vehicle's type id.
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
static bool parseDepartSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, DepartSpeedDefinition &dsd, std::string &error)
Validates a given departSpeed value.
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
static bool parseDepartLane(const std::string &val, const std::string &element, const std::string &id, int &lane, DepartLaneDefinition &dld, std::string &error)
Validates a given departLane value.
std::string routeid
The vehicle's route id.
static MSCalibrator::AspiredState getCalibratorState(const MSCalibrator *c)
virtual std::string readString()
virtual int readUnsignedByte()
TRACI_CONST int VAR_VEHSPERHOUR
TRACI_CONST int VAR_BEGIN
TRACI_CONST int VAR_ROUTE_PROBE
TRACI_CONST int TRACI_ID_LIST
std::map< std::string, libsumo::SubscriptionResults > ContextSubscriptionResults
TRACI_CONST int VAR_REMOVED
TRACI_CONST int VAR_ROAD_ID
TRACI_CONST int VAR_VTYPES
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int VAR_LANE_ID
TRACI_CONST int VAR_SPEED
TRACI_CONST int VAR_PARAMETER_WITH_KEY
TRACI_CONST int VAR_INSERTED
TRACI_CONST int VAR_PASSED
TRACI_CONST int VAR_ROUTE_ID
SUMOVehicleParameter * vehicleParameter