36 OutputDevice& od,
bool saveDetectors,
bool saveConditions) :
53 std::map<SumoXMLAttr, std::string> attrs;
55 std::vector<std::string> IDs;
56 for (
auto item :
myLogics.getActive()->getDetectorStates()) {
57 IDs.push_back(item.first);
63 std::vector<std::string> IDs;
64 for (
auto item :
myLogics.getActive()->getConditions()) {
65 IDs.push_back(item.first);
69 myOutputDevice.writeXMLHeader(
"tlsStates",
"tlsstates_file.xsd", attrs);
77 if (!
myLogics.getActive()->getCurrentPhaseDef().getName().empty()) {
81 std::vector<int> states;
82 for (
auto item :
myLogics.getActive()->getDetectorStates()) {
83 states.push_back((
int)item.second);
89 std::vector<double> states;
90 for (
auto item :
myLogics.getActive()->getConditions()) {
91 states.push_back(item.second);
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
@ SUMO_ATTR_STATE
The state of a link.
@ SUMO_ATTR_TIME
trigger: the time of the step
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
~Command_SaveTLSState()
Destructor.
OutputDevice & myOutputDevice
The device to write to.
const bool mySaveConditions
Command_SaveTLSState(const MSTLLogicControl::TLSLogicVariants &logics, OutputDevice &od, bool saveDetectors, bool saveConditions)
Constructor.
SUMOTime execute(SUMOTime currentTime)
Writes the current state of the tls.
const bool mySaveDetectors
additiona logging
const MSTLLogicControl::TLSLogicVariants & myLogics
The traffic light logic to use.
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
MSEventControl * getEndOfTimestepEvents()
Returns the event control for events executed at the end of a time step.
Storage for all programs of a single tls.
Static storage of an output device and its base (abstract) implementation.