Command_SaveTLCoupledLaneDet Class Reference

#include <Command_SaveTLCoupledLaneDet.h>

Inheritance diagram for Command_SaveTLCoupledLaneDet:

Command_SaveTLCoupledDet MSTLLogicControl::OnSwitchAction

Detailed Description

Writes e2-state of a link for the time the link has yellow/red.

Todo:
Problem: The detector may not save the last state (on simulation end)

Definition at line 45 of file Command_SaveTLCoupledLaneDet.h.


Public Member Functions

 Command_SaveTLCoupledLaneDet (MSTLLogicControl::TLSLogicVariants &tlls, MSDetectorFileOutput *dtf, unsigned int begin, OutputDevice &device, MSLink *link) throw ()
 Constructor.
void execute () throw ()
 Executes the command.
 ~Command_SaveTLCoupledLaneDet () throw ()
 Destructor.

Protected Attributes

MSDetectorFileOutputmyDetector
 The detector to use.
OutputDevicemyDevice
 The file to write the output to.
const
MSTLLogicControl::TLSLogicVariants
myLogics
 The logic to use.
SUMOTime myStartTime
 The last time the values were written.

Private Member Functions

 Command_SaveTLCoupledLaneDet (const Command_SaveTLCoupledLaneDet &)
 Invalidated copy constructor.
Command_SaveTLCoupledLaneDetoperator= (const Command_SaveTLCoupledLaneDet &)
 Invalidated assignment operator.

Private Attributes

bool myHadOne
 Whether the last link state was already saved.
MSLink::LinkState myLastState
 The state the link had the last time.
MSLinkmyLink
 The link to observe.

Constructor & Destructor Documentation

Command_SaveTLCoupledLaneDet::Command_SaveTLCoupledLaneDet ( MSTLLogicControl::TLSLogicVariants tlls,
MSDetectorFileOutput dtf,
unsigned int  begin,
OutputDevice device,
MSLink link 
) throw ()

Constructor.

Parameters:
[in] tlls The logic to observe
[in] dtf The detector used to generate the values
[in] begin The begin simulation time
[in] device The output device to write the detector values into
[in] link The link that shall be observed

Definition at line 48 of file Command_SaveTLCoupledLaneDet.cpp.

00053         : Command_SaveTLCoupledDet(tlls, dtf, begin, device),
00054         myLink(link), myLastState(MSLink::LINKSTATE_TL_RED),
00055         myHadOne(false) {}

Command_SaveTLCoupledLaneDet::~Command_SaveTLCoupledLaneDet (  )  throw ()

Destructor.

Definition at line 58 of file Command_SaveTLCoupledLaneDet.cpp.

00058                                                                     {
00059 }

Command_SaveTLCoupledLaneDet::Command_SaveTLCoupledLaneDet ( const Command_SaveTLCoupledLaneDet  )  [private]

Invalidated copy constructor.


Member Function Documentation

void Command_SaveTLCoupledLaneDet::execute (  )  throw () [virtual]

Executes the command.

Called when an active tls program switches, this method checks whether the tls signal responsible for the link has switched to green. If so, the values collected so far are written using "writeXMLOutput". Otherwise, the values are reset.

See also:
MSDetectorFileOutput::writeXMLOutput

MSE2Collector::writeXMLOutput

Reimplemented from Command_SaveTLCoupledDet.

Definition at line 63 of file Command_SaveTLCoupledLaneDet.cpp.

References MSNet::getCurrentTimeStep(), MSNet::getInstance(), MSLink::getState(), MSLink::LINKSTATE_TL_RED, Command_SaveTLCoupledDet::myDetector, Command_SaveTLCoupledDet::myDevice, myHadOne, myLastState, myLink, Command_SaveTLCoupledDet::myStartTime, MSDetectorFileOutput::reset(), and MSDetectorFileOutput::writeXMLOutput().

00063                                               {
00064     if (myLink->getState()==myLastState&&myHadOne) {
00065         return;
00066     }
00067     myHadOne = true;
00068     if (myLastState==MSLink::LINKSTATE_TL_RED&&myLink->getState()!=MSLink::LINKSTATE_TL_RED) {
00069         SUMOTime end = MSNet::getInstance()->getCurrentTimeStep();
00070         if (myStartTime!=end) {
00071             myDetector->writeXMLOutput(myDevice, myStartTime, end);
00072             myStartTime = end;
00073         }
00074     }
00075     if (myLink->getState()!=MSLink::LINKSTATE_TL_RED) {
00076         myDetector->reset();
00077         myStartTime = MSNet::getInstance()->getCurrentTimeStep();
00078     }
00079     myLastState = myLink->getState();
00080 }

Command_SaveTLCoupledLaneDet& Command_SaveTLCoupledLaneDet::operator= ( const Command_SaveTLCoupledLaneDet  )  [private]

Invalidated assignment operator.


Field Documentation

The detector to use.

Definition at line 91 of file Command_SaveTLCoupledDet.h.

Referenced by execute(), and Command_SaveTLCoupledDet::execute().

The file to write the output to.

Definition at line 85 of file Command_SaveTLCoupledDet.h.

Referenced by execute(), and Command_SaveTLCoupledDet::execute().

Whether the last link state was already saved.

Definition at line 85 of file Command_SaveTLCoupledLaneDet.h.

Referenced by execute().

The state the link had the last time.

Definition at line 82 of file Command_SaveTLCoupledLaneDet.h.

Referenced by execute().

The link to observe.

Definition at line 79 of file Command_SaveTLCoupledLaneDet.h.

Referenced by execute().

The logic to use.

Definition at line 88 of file Command_SaveTLCoupledDet.h.

The last time the values were written.

Definition at line 94 of file Command_SaveTLCoupledDet.h.

Referenced by execute(), and Command_SaveTLCoupledDet::execute().


The documentation for this class was generated from the following files:

Generated on Wed May 5 00:06:40 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6