Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
ProjectSpec Class Reference

The specificaiton of a simulation project. More...

#include <ProjectSpec.h>

Public Member Functions

 ProjectSpec ()
 Constructor.
 
 ~ProjectSpec ()
 Destructor.
 
std::string getScene () const
 Get the scene specification file name. More...
 
std::string getBehavior () const
 Get the beahvior specification file name. More...
 
std::string getModel () const
 Get the model name. More...
 
std::string getOutputName () const
 Get the name of the trajectory output file. More...
 
std::string getSCBVersion () const
 Get the version string for the trajectory output file. More...
 
bool getVerbosity () const
 Get the verbosity state for the application. More...
 
std::string getView () const
 Get the view specification file. More...
 
int getRandomSeed () const
 Get the random number seed value. More...
 
std::string getDumpPath () const
 Get the path at which to dump files. More...
 
size_t getSubSteps () const
 Get the number of simulation sub steps to take. More...
 
float getDuration () const
 Get the maximum simulation duration. More...
 
float getTimeStep () const
 Get the override simulation time step. More...
 
bool parseCommandParameters (int argc, char *argv[], const SimulatorDB *simDB)
 Parse the command line arguments. More...
 
bool fullySpecified () const
 Reports if the project specification contains enough information to attempt to run a simulation. I.e., it has values for all fields but does not know if those values are valid. More...
 

Protected Member Functions

void setOutputName (const std::string &fileName)
 Set output file. More...
 
bool loadFromXML (const std::string &xmlName)
 Loads a project specification from an xml file. More...
 

Protected Attributes

std::string _projPath
 The path to the project – it is the folder containing the project xml. Defaults to the current working directory.
 
std::string _sceneXML
 The full path to the scene specification xml file.
 
std::string _behaviorXML
 The full path to the behavior specification xml file.
 
std::string _modelName
 The name of the pedestrian model.
 
std::string _scbFileName
 The name of the output trajectory file to write.
 
std::string _scbVersion
 The scb version to write.
 
bool _verbose
 Determines if the simulator should be verbose (printing status to the console.
 
std::string _viewConfig
 The path to the file that specifies the view configuration.
 
float _duration
 The maximum allowable duration of the simulation (in simulation seconds).
 
float _timeStep
 The size of the simulation time step.
 
int _seed
 The seed number for the global random number generator.
 
std::string _imgDumpPath
 The path to the output folder for screen grab images.
 
size_t _subSteps
 The number of intermediate simulation steps to take. More...
 

Friends

Loggeroperator<< (Logger &out, const ProjectSpec &spec)
 Print the project specification to an output stream. More...
 

Detailed Description

The specificaiton of a simulation project.

Some project parameters have default values (such as duration and random seed). Others require explicit definitions (such as scene specification, etc.) The break down is as follows:

Required parameters:

Optional parameters (with defaults):

Member Function Documentation

bool ProjectSpec::fullySpecified ( ) const

Reports if the project specification contains enough information to attempt to run a simulation. I.e., it has values for all fields but does not know if those values are valid.

Returns
True if all required fields have values, false otherwise.
std::string ProjectSpec::getBehavior ( ) const
inline

Get the beahvior specification file name.

Returns
The path to the behavior specification file.
std::string ProjectSpec::getDumpPath ( ) const
inline

Get the path at which to dump files.

Returns
The folder in which screen captures should be written.
float ProjectSpec::getDuration ( ) const
inline

Get the maximum simulation duration.

Returns
The maximum allowable simulation duration.
std::string ProjectSpec::getModel ( ) const
inline

Get the model name.

Returns
The path to the string specification file.
std::string ProjectSpec::getOutputName ( ) const
inline

Get the name of the trajectory output file.

Returns
The name of the output file. Empty string if no output file is to be written.
int ProjectSpec::getRandomSeed ( ) const
inline

Get the random number seed value.

Returns
The global random number generator seed.
std::string ProjectSpec::getSCBVersion ( ) const
inline

Get the version string for the trajectory output file.

Returns
The version of the output file to write.
std::string ProjectSpec::getScene ( ) const
inline

Get the scene specification file name.

Returns
The path to the scene specification file.
size_t ProjectSpec::getSubSteps ( ) const
inline

Get the number of simulation sub steps to take.

Returns
The number of simulation sub steps.
float ProjectSpec::getTimeStep ( ) const
inline

Get the override simulation time step.

Returns
The overridden simulation time step. If negative, use the time step in the scene specification.
bool ProjectSpec::getVerbosity ( ) const
inline

Get the verbosity state for the application.

Returns
True if the application should be verbose, false otherwise.
std::string ProjectSpec::getView ( ) const
inline

Get the view specification file.

Returns
The name of the view configuration file (empty string if there is none).
bool ProjectSpec::loadFromXML ( const std::string &  xmlName)
protected

Loads a project specification from an xml file.

The return value only indicates if there was successful parsing of the xml. It does not imply that there was sufficient information in the project to run a simulation. Ultimately, a successful project is defined by the union of the project file and the command-line parameters.

Parameters
xmlNameThe path to the file containing the project specification.
Returns
True if parsing was successful, false otherwise.
bool ProjectSpec::parseCommandParameters ( int  argc,
char *  argv[],
const SimulatorDB simDB 
)

Parse the command line arguments.

Parameters
argcthe number of command-line arguments.
argvThe command-line parameters.
simDBA pointer to the current simulator database.
Returns
True if a simulation should be attempted (i.e. the project specification and command-line parameters require it and false if not.
void ProjectSpec::setOutputName ( const std::string &  fileName)
protected

Set output file.

Parameters
fileNameThe name of the file to write the trajectories to.

Friends And Related Function Documentation

Logger& operator<< ( Logger out,
const ProjectSpec spec 
)
friend

Print the project specification to an output stream.

Parameters
outAn output stream.
specA ProjectSpec
Returns
A reference to the output stream

Member Data Documentation

size_t ProjectSpec::_subSteps
protected

The number of intermediate simulation steps to take.

If the simulation time step is N Hz, and substeps is set to k, then the effective simulation rate is N * ( 1 + k ) Hz. For example, simulate at 10 Hz, with a single substep. Simulation is performed at 10 * (1 + 1) = 20 Hz, but the results are only output at 10 Hz.


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