Eclipse SUMO - Simulation of Urban MObility
|
The main interface for loading a microsim. More...
#include <NLBuilder.h>
Data Structures | |
class | EdgeFloatTimeLineRetriever_EdgeEffort |
class | EdgeFloatTimeLineRetriever_EdgeTravelTime |
Obtains edge efforts from a weights handler and stores them within the edges. More... | |
Public Member Functions | |
virtual bool | build () |
Builds and initialises the simulation. | |
NLBuilder (OptionsCont &oc, MSNet &net, NLEdgeControlBuilder &eb, NLJunctionControlBuilder &jb, NLDetectorBuilder &db, NLHandler &xmlHandler) | |
Constructor. | |
virtual | ~NLBuilder () |
Destructor. | |
Static Public Member Functions | |
static SUMORouteLoaderControl * | buildRouteLoaderControl (const OptionsCont &oc) |
Builds the route loader control. | |
static MSNet * | init (const bool isLibsumo=false) |
static void | initRandomness () |
initializes all RNGs | |
Protected Member Functions | |
void | buildDefaultMeanData (const std::string &optionName, const std::string &id, bool useLanes) |
build meanData definition based on option | |
void | buildNet () |
Closes the net building process. | |
bool | load (const std::string &mmlWhat, const bool isNet=false) |
Loads a described subpart form the given list of files. | |
Protected Attributes | |
NLDetectorBuilder & | myDetectorBuilder |
The detector control builder to use. | |
NLEdgeControlBuilder & | myEdgeBuilder |
The edge control builder to use. | |
NLJunctionControlBuilder & | myJunctionBuilder |
The junction control builder to use. | |
MSNet & | myNet |
The net to fill. | |
OptionsCont & | myOptions |
The options to get the names of the files to load and further information from. | |
NLHandler & | myXMLHandler |
The handler used to parse the net. | |
Private Member Functions | |
NLBuilder (const NLBuilder &s) | |
invalidated copy operator | |
NLBuilder & | operator= (const NLBuilder &s) |
invalidated assignment operator | |
The main interface for loading a microsim.
It is a black-box where only the options and factories must be supplied on the constructor call. An (empty) instance of the network must be supplied, too, and is filled during loading.
Definition at line 58 of file NLBuilder.h.
NLBuilder::NLBuilder | ( | OptionsCont & | oc, |
MSNet & | net, | ||
NLEdgeControlBuilder & | eb, | ||
NLJunctionControlBuilder & | jb, | ||
NLDetectorBuilder & | db, | ||
NLHandler & | xmlHandler | ||
) |
Constructor.
[in] | oc | The options to use |
[in,out] | net | The network to fill |
[in] | eb | The builder of edges to use |
[in] | jb | The builder of junctions to use |
[in] | db | The detector builder to use |
[in] | tb | The trigger builder to use |
[in] | xmlHandler | The xml handler to use |
Definition at line 109 of file NLBuilder.cpp.
|
virtual |
Destructor.
Definition at line 120 of file NLBuilder.cpp.
|
private |
invalidated copy operator
|
virtual |
Builds and initialises the simulation.
At first, the network is loaded and the built using "buildNet". If this could be done, additional information is loaded (state dump, weight files, route files, and additional files). If everything could be done, true is returned, otherwise false.
ProcessError | If something fails on network building |
Definition at line 124 of file NLBuilder.cpp.
References MSEdge::addSuccessor(), NamedObjectCont< T >::begin(), buildDefaultMeanData(), NLEdgeControlBuilder::buildEdge(), buildNet(), MSTriggeredRerouter::checkParkingRerouteConsistency(), CONNECTOR, MSEdge::dictionary(), NamedObjectCont< T >::end(), MSTLLogicControl::getAllLogics(), OptionsCont::getBool(), MSNet::getEdgeControl(), MsgHandler::getErrorInstance(), MSJunction::getIncoming(), TraCIServer::getInstance(), MSNet::getJunctionControl(), MSVehicleControl::getLoadedVehicleNo(), MSJunction::getOutgoing(), MSNet::getShapeContainer(), OptionsCont::getString(), OptionsCont::getStringVector(), MSStateHandler::MSStateTimeHandler::getTime(), MSNet::getTLSControl(), MSNet::getVehicleControl(), MSGlobals::gUseMesoSim, NLHandler::haveSeenAdditionalSpeedRestrictions(), NLHandler::haveSeenDefaultLength(), NLHandler::haveSeenInternalEdge(), NLHandler::haveSeenMesoEdgeType(), MSDevice_FCDReplay::init(), MSEdge::initialize(), OptionsCont::isDefault(), OptionsCont::isSet(), OptionsCont::isUsableFileList(), load(), ShapeHandler::loadFiles(), myEdgeBuilder, myJunctionBuilder, myNet, myOptions, myXMLHandler, NLHandler::networkVersion(), NLJunctionControlBuilder::postLoadInitialization(), PROGRESS_BEGIN_TIME_MESSAGE, PROGRESS_TIME_MESSAGE, XMLSubSys::runParser(), OptionsCont::set(), MSEdgeControl::setAdditionalRestrictions(), MSNet::setCurrentTimeStep(), MSEdgeControl::setMesoTypes(), MSEdge::setOtherTazConnector(), NLNetShapeHandler::sortInternalShapes(), TraCIServer::stateLoaded(), string2time(), MSTLLogicControl::switchOffAll(), time2string(), TL, TLF, WRITE_MESSAGE, WRITE_MESSAGEF, WRITE_WARNING, and WRITE_WARNINGF.
Referenced by init(), and GUILoadThread::run().
|
protected |
build meanData definition based on option
Definition at line 471 of file NLBuilder.cpp.
References NLDetectorBuilder::createEdgeLaneMeanData(), OptionsCont::getOptions(), MSGlobals::gUseMesoSim, myDetectorBuilder, SUMO_const_haltingSpeed, TL, WRITE_ERROR, and WRITE_WARNING.
Referenced by build().
|
protected |
Closes the net building process.
Builds the microsim-structures which belong to a MSNet using the factories filled while loading. Initialises the network using these structures by calling MSNet::closeBuilding. If an error occurs, all built structures are deleted and a ProcessError is thrown.
ProcessError | If the loaded structures could not be built |
Definition at line 383 of file NLBuilder.cpp.
References NLJunctionControlBuilder::build(), NLEdgeControlBuilder::build(), buildRouteLoaderControl(), MSFrame::buildStreams(), NLJunctionControlBuilder::buildTLLogics(), MSEdge::clear(), MSLane::clear(), MSNet::closeBuilding(), OptionsCont::getString(), OptionsCont::getStringVector(), NLHandler::hasJunctionHigherSpeeds(), NLHandler::haveSeenInternalEdge(), OptionsCont::isSet(), myEdgeBuilder, myJunctionBuilder, myNet, myOptions, myXMLHandler, NLHandler::networkVersion(), MSJunctionControl::postloadInitContainer(), string2time(), time2string(), and TL.
Referenced by build().
|
static |
Builds the route loader control.
Goes through the list of route files to open defined in the option "route-files" and builds loaders reading these files
[in] | oc | The options to read the list of route files to open from |
ProcessError | If an error occurred |
Definition at line 450 of file NLBuilder.cpp.
References SUMORouteLoaderControl::add(), OptionsCont::getString(), OptionsCont::getStringVector(), FileHelpers::isReadable(), OptionsCont::isSet(), string2time(), and TLF.
Referenced by buildNet(), MSNet::loadState(), and MSNet::quickReload().
|
static |
loads the net, additional routes and the detectors
Definition at line 304 of file NLBuilder.cpp.
References build(), MSFrame::checkOptions(), SystemFrame::checkOptions(), OptionsCont::clear(), MsgHandler::clear(), SystemFrame::close(), MsgHandlerSynchronized::create(), MSFrame::fillOptions(), OptionsIO::getArgC(), MsgHandler::getErrorInstance(), OptionsCont::getInt(), MsgHandler::getMessageInstance(), OptionsCont::getOptions(), OptionsIO::getOptions(), OptionsCont::getString(), MsgHandler::getWarningInstance(), MSGlobals::gUseMesoSim, MsgHandler::initOutputOptions(), initRandomness(), OptionsCont::isDefault(), MSNet::loadRoutes(), TraCIServer::openSocket(), OptionsCont::processMetaOptions(), libsumo::Helper::registerStateListener(), MsgHandler::setFactory(), NLTriggerBuilder::setHandler(), MSFrame::setMSGlobals(), and XMLSubSys::setValidation().
Referenced by LIBSUMO_NAMESPACE::Simulation::load(), and main().
|
static |
initializes all RNGs
Definition at line 371 of file NLBuilder.cpp.
References MSDevice::getEquipmentRNG(), OptionsCont::getOptions(), MSRouteHandler::getParsingRNG(), MSDevice_BTreceiver::getRecognitionRNG(), MSDevice_ToC::getResponseTimeRNG(), OUProcess::getRNG(), RandHelper::initRandGlobal(), and MSLane::initRNGs().
Referenced by init(), MSNet::quickReload(), and GUILoadThread::run().
|
protected |
Loads a described subpart form the given list of files.
Assuming the given string to be an option name behind which a list of files is stored, this method invokes an XML reader on all the files set for this option.
[in] | mmlWhat | The option to get the file list from |
[in] | isNet | whether a network gets loaded |
Definition at line 432 of file NLBuilder.cpp.
References OptionsCont::getStringVector(), OptionsCont::isUsableFileList(), myOptions, myXMLHandler, PROGRESS_BEGIN_TIME_MESSAGE, PROGRESS_TIME_MESSAGE, XMLSubSys::runParser(), TL, TLF, and WRITE_MESSAGEF.
Referenced by build().
|
protected |
The detector control builder to use.
Definition at line 209 of file NLBuilder.h.
Referenced by buildDefaultMeanData().
|
protected |
The edge control builder to use.
Definition at line 203 of file NLBuilder.h.
Referenced by build(), and buildNet().
|
protected |
The junction control builder to use.
Definition at line 206 of file NLBuilder.h.
Referenced by build(), and buildNet().
|
protected |
The net to fill.
Definition at line 212 of file NLBuilder.h.
Referenced by NLBuilder::EdgeFloatTimeLineRetriever_EdgeTravelTime::addEdgeWeight(), build(), and buildNet().
|
protected |
The options to get the names of the files to load and further information from.
Definition at line 200 of file NLBuilder.h.
Referenced by build(), buildNet(), and load().
|
protected |
The handler used to parse the net.
Definition at line 215 of file NLBuilder.h.
Referenced by build(), buildNet(), and load().