-
Notifications
You must be signed in to change notification settings - Fork 29
Simulation Configuration
The simulation.xml file is a common configuration file for short-term and mid-term. The user can configure the following settings in this file:
- Database connection information from where the network and demand is loaded
- Login credentials for the database
- Simulation start time, end time and granularity
- Percentage of drivers using in-simulation travel time
- Strategy to add new agents to workers
- Mutual exclusion (multi threading) method
- Driver behaviour file
The file is grouped into three XML elements, viz.
- constructs
- simulation
- generic props
The database connection and login credential settings are grouped under constructs
tag.
<constructs>
<databases>
...
...
</databases>
<credentials>
...
...
</credentials>
</constructs>
The user can configure multiple database connections in this section. The databases
tag can hold a list of database
elements. Each database
element holds the connection settings for a single database. Each database
tag must have a different value for the id
attribute which is used to uniquely identify that database. The structure of a database
element within databases
is shown below.
<databases>
<database id="<user_defined_id>" dbtype="<type_of_database>"/>
<host value="<ip_address_value>"/>
<port value="<port_number>"/>
<dbname value="<name_of_the_database>"/>
</database>
.
.
</databases>
Each database element contains only host, port and database name. The login credentials are kept separate under credentials
. The credentials can either be passed in plain-text or file-based formats. The structure of the child elements are explained below. Any number of plain-text and file-based credentials can be configured within credentials
. However, similar to database
elements, each credential element must have a unique value for the id
attribute.
<credentials>
<plaintext-credential id="<user_defined_id>">
<username value="<user_name>"/>
<password value="<password>"/>
</plaintext-credential>
.
.
.
</credentials>
<credentials>
<file-based-credential id="<user_defined_id>">
<file path="<path_of_the_file>"/>
</file-based-credential>
</credentials>
The file-based credentials are loaded from a JSON file. It is possible to specify more than one file in a single configuration, in this case the simulator will use the first matching file. File based credentials allow us to encrypt the database password to keep it confidential.
The credential file format is as follows.
{
"username" : "<user_defined_name>",
"password" : "<encrypted_password>",
"algorithm" : "<algorithm>"
}
This section contains the settings for simulation start time, run time, warm up time, granularity (simulation step size), strategy for assigning agents to workers and mutual exclusion method.
<simulation>
<base_granularity value="100" units="ms"/>
<total_runtime value="20" units="minutes"/>
<total_warmup value="10" units="seconds"/>
<start_time value="10:00:00"/>
<workgroup_assignment value="roundrobin"/>
<mutex_enforcement strategy="buffered"/>
<auto_id_start value="0"/>
</simulation>
-
base_granularity
: The step size in which the total runtime is divided and processed. The granularity is filled in thevalue
tag and unit is specified inunits
tag. The minimum step size is 100ms (milliseconds) for short-term and usually 5 seconds for mid-term. -
total_runtime
: Total runtime of the simulation. The runtime is filled in the 'value' tag and unit is specified in theunits
tag -
total_warmup
: The total time at the start of the simulation where the statistics are not collected. Currently, this feature is not available. The time is filled in thevalue
tag and unit is specified in theunits
tag -
start_time
: Start time of the simulation. It is given inHH:MM:SS
format. The start time is specified in thevalue
tag -
in_simulation_travel_time_usage
: Specify the percentage of drivers that use the in-simulation travel time rather than the historical travel time. The drivers will be picked based on uniform distribution. The percentage is specified in thevalue
tag -
workgroup_assignment
: The mode in which the agents are assigned to different workers (threads). Currently, SimMobility supports two modes.-
roundrobin
: Assigns the agents to workers in order -
smallest
: Assigns the agents to a worker which manages the least number of agents at the time of the assignation. At the moment this mode doesn't offer better performance thanroundrobin
method
The option is filled invalue
tag
-
-
mutex_enforcement
: The method in which the mutual exclusion is handled to synchronise different workers (threads) at each time step. Currently, SimMobility supports two modes.-
buffered
: Variable values are changed locally (at agent level) and synchronized at the end of each time step -
locked
: Variables are guarded with a lock when making a changebuffered
gives better performance and it is the default option. The option in filled instrategy
tag
-
-
auto_id_start
: Internally, each agent created in the simulation has a given id. The starting value of the id-s should be filled in thevalue
tag
This section can be used by developers to quickly add configuration for testing new features. This section is used to contain the configuration to locate the driver behaviour file for short-term.
<generic_props>
<property key="driver_behaviour_file" value="data/driver_behavior_model/driver_param.xml"/>
</generic_props>
The driver_behaviour_file
parameter specifies the location of the file which holds the driver behaviour parameter settings. This file is explained in detail in the [Parameter] (https://github.com/smart-fm/simmobility-prod/wiki/Short-Term-Parameters) section.