Learn R Programming

NetSim (version 0.9)

simulator: Functions related to run a simulation

Description

Functions related to run a simulation based on a process state and a model manager. A simulator object needs to be created, then the simulator can be run. After the simulation the number of simulation steps can be returned.

Usage

create_simulator(processState, modelManager, periodLength = 1, verbose = TRUE, debug = FALSE) simulate(simulator) get_iteration_steps(simulator)

Arguments

processState
A process state object
modelManager
A model manager object
periodLength
A time span to simulate. The default is 1.
verbose
If TRUE it generates some basic information output including a progress bar
debug
If TRUE it generate a very detailed output for some models. Slows down the simulation process significantly.
simulator
A simulator object

See Also

create_process_state create_model_manager

Examples

Run this code
	## Detailed examples of process states and model managers can be found in 
	## section 4 of the package vignette.
	processState <- create_process_state()
	modelManager <- create_model_manager()
	
	processState <- create_process_state()
	processState <- add_global_attribute(processState, 0.0, name = "timer")
	timerIndex <- get_global_attribute_index(processState, name = "timer")
	myTimeModel <- create_round_based_time_model(timerIndex)
	modelManager <- add_time_model(modelManager, myTimeModel)
	
	timeSpan <- 20
	simulator <- create_simulator(processState, modelManager, timeSpan,
	verbose = TRUE, debug = FALSE)
	simulate(simulator)

Run the code above in your browser using DataLab