|
Dynamical System Framework
|
Public Member Functions | |
| TrafficSimulator () | |
| Construct a new TrafficSimulator with a generated simulation id. | |
| TrafficSimulator (std::string_view const jsonConfigFile) | |
| Construct a new TrafficSimulator and import its configuration from JSON. | |
| void | importConfig (std::string_view const jsonConfigFile) |
| Import a JSON configuration file and apply it to the simulator. | |
| void | connectDataBase (std::string_view const dbPath, std::string_view const queries="PRAGMA busy_timeout = 5000;PRAGMA journal_mode = WAL;PRAGMA " "synchronous=NORMAL;PRAGMA temp_store=MEMORY;PRAGMA cache_size=-20000;") |
| Connect to a SQLite database, creating it if it doesn't exist, and executing optional initialization queries. | |
| void | importRoadNetwork (std::string_view const edgesFile, std::string_view const nodePropertiesFile=std::string_view()) |
| Import a road network and build the simulation dynamics. | |
| void | updatePaths (std::time_t const deltaT=0, bool const throw_on_empty=true) |
| Configure the path-update cadence forwarded to the dynamics engine. | |
| void | saveData (std::time_t const savingInterval, bool const saveAverageStats=false, bool const saveStreetData=false, bool const saveTravelData=false, bool const saveAgentData=false) |
| Configure the data-saving behavior. | |
| void | setName (std::string_view const name) |
| Set the name of the simulation. | |
| void | setOutputPrefix (std::string_view const prefix) |
| Set the output prefix used for generated CSV files and database paths. | |
| void | setTimeFrame (std::time_t const initTime, std::optional< std::time_t > const endTime=std::nullopt) |
| Set the simulation time frame. | |
| void | setAgentInsertionMethod (AgentInsertionMethod const insertionMethod) noexcept |
| Set the strategy used when inserting new agents. | |
| void | run (std::vector< std::size_t > const &nAgentsPerTimeStep, std::optional< std::time_t > const deltaT=std::nullopt) |
| Run the simulation until the configured end time. | |
| void | run (std::size_t const nInitialAgents, std::time_t const agentInsertionDeltaT, std::time_t const checkDeltaT, std::size_t const agentIncrement=1) |
| auto * | database () const |
| Get the database connection (const version). | |
| auto const * | dynamics () const |
| Get the dynamics engine managed by this simulator. | |
| auto * | dynamics () |
| Get the mutable dynamics engine managed by this simulator. | |
| auto | id () const |
| Get the id of the simulation. | |
| auto | initTime () const |
| Get the simulation start time. | |
| auto | strInitTime () const |
| Get the formatted simulation start time. | |
| auto | endTime () const |
| Get the simulation end time. | |
| auto | strEndTime () const |
| Get the formatted simulation end time. | |
| auto const & | name () const |
| Get the name of the simulation. | |
| auto const & | safeName () const |
| Get a safe name string for filenames (spaces replaced by underscores). | |
|
explicit |
Construct a new TrafficSimulator and import its configuration from JSON.
| jsonConfigFile | The path to the JSON configuration file. |
| void dsf::mobility::TrafficSimulator::connectDataBase | ( | std::string_view const | dbPath, |
| std::string_view const | queries = "PRAGMA busy_timeout = 5000;PRAGMA journal_mode = WAL;PRAGMA " "synchronous=NORMAL;PRAGMA temp_store=MEMORY;PRAGMA cache_size=-20000;" ) |
Connect to a SQLite database, creating it if it doesn't exist, and executing optional initialization queries.
| dbPath | The path to the SQLite database file |
| queries | Optional SQL queries to execute upon connecting to the database (default is a set of pragmas for performance optimization : "PRAGMA busy_timeout = 5000;PRAGMA journal_mode = WAL;PRAGMA synchronous=NORMAL;PRAGMA temp_store=MEMORY;PRAGMA cache_size=-20000;") |
|
inline |
Get the database connection (const version).
|
inline |
Get the id of the simulation.
| void dsf::mobility::TrafficSimulator::importConfig | ( | std::string_view const | jsonConfigFile | ) |
Import a JSON configuration file and apply it to the simulator.
| jsonConfigFile | The path to the JSON configuration file. |
| void dsf::mobility::TrafficSimulator::importRoadNetwork | ( | std::string_view const | edgesFile, |
| std::string_view const | nodePropertiesFile = std::string_view() ) |
Import a road network and build the simulation dynamics.
| edgesFile | The edges CSV file. |
| nodePropertiesFile | Optional node-properties CSV file. |
|
inline |
Get the name of the simulation.
|
inline |
Get a safe name string for filenames (spaces replaced by underscores).
|
inlinenoexcept |
Set the strategy used when inserting new agents.
| insertionMethod | The insertion method to use. |
| void dsf::mobility::TrafficSimulator::setName | ( | std::string_view const | name | ) |
Set the name of the simulation.
| name | The name of the simulation |
| void dsf::mobility::TrafficSimulator::setOutputPrefix | ( | std::string_view const | prefix | ) |
Set the output prefix used for generated CSV files and database paths.
| prefix | The prefix or directory path. |
| void dsf::mobility::TrafficSimulator::setTimeFrame | ( | std::time_t const | initTime, |
| std::optional< std::time_t > const | endTime = std::nullopt ) |
Set the simulation time frame.
| initTime | The simulation start time. |
| endTime | Optional simulation end time. |
| void dsf::mobility::TrafficSimulator::updatePaths | ( | std::time_t const | deltaT = 0, |
| bool const | throw_on_empty = true ) |
Configure the path-update cadence forwarded to the dynamics engine.
| deltaT | The update cadence in time steps. |
| throw_on_empty | Whether an empty itinerary path should throw. |