next up previous index
Next: Restart a simulation Up: Run Management Previous: Run Management   Index


Start a simulation

The configuration for a simulation is specified by a configuration object. At the moment, a configuration is specified as a Python dictionary whose data is used to configure different parts of the simulation, such as the years in which to run UrbanSim, what UrbanSim models to run each year, what types of development projects exist, how to configure each type of development project, etc. See, for instance, the run configuration in psrc.configs.subset_configuration.py.

The start_run tool requires that the referenced configuration Python module either (a) defines a class (e.g. SubsetConfiguration) in a file whose name is subset_configuration.py, or (b) defines a run_configuration object that is the configuration object. In the first case, the class name is the CamelCase version of the lowercase_with_underscores file name. (The preferred method is to define a class.)

To start a simulation, use the script start_run with the desired configuration:

python start_run.py -c psrc.configs.subset_configuration

If the services database was created using the --hostname and/or --database option, you will need to include these options in start_run.py as well. Use the --help option to see start_run's possible command line parameters.

The creating_baseyear_cache_configuration entry in the configuration contains the information specifying the location of the baseyear inputs. If cache_from_mysql is True, the inputs are taken from the MySQL database specified in the input_configuration entry. Otherwise, the inputs are taken from the baseyear cache specified in the baseyear_cache entry. When the inputs are taken from MySQL, they are used to create a baseyear cache stored in the directory specified by the cache_directory entry, or, if that entry is missing, from an directory whose name encodes the date-time of the simulation request and is created in the directory specified by the cache_directory_root entry.

For large amount of data, copying from MySQL to a baseyear cache takes much longer than creating a new baseyear cache from an existing baseyear cache.

Option --directory-to-cache can be used to turn off the caching. It takes as argument the directory name from which data are copied to the new basyear cache . With the option --years-to-cache one can control specific years to be copied. The option takes as argument any python expression that returns a list of years. These two options overwrite entries in the configuration that control this behaviour.


next up previous index
Next: Restart a simulation Up: Run Management Previous: Run Management   Index
info (at) urbansim.org