Learn R Programming

NetSim (version 0.9)

time_models: Overview of time models implemented in NetSim

Description

Overview of different time models implemented in NetSim. The first model is a deterministic round-based time model, the second is a Poisson model based on a fixed (unchangeable) parameter, the third is a Poisson model for which parameters can be stored in an attribute container (changeable).

Usage

create_round_based_time_model(timerIndex, intervalLength = 1.0, startTime = 0.0) create_poisson_model(param = 1) create_attribute_poisson_model(attributeIndex)

Arguments

timerIndex
A pointer to a global attribute in the process state representing the timer
intervalLength
interval length between two subsequent events triggered
startTime
First point in time when the timer index is triggered
param
Fixed Poisson parameter
attributeIndex
A pointer to an attribute container giving a vector of concurring Poisson parameters

See Also

create_model_manager

Examples

Run this code
	processState <- create_process_state()

	# add attribute container to process state	
	attribute <- create_attribute_container(rep(2.0, 5))
	processState <- add_attribute_container(processState, attribute, name = "poissonAttribute")
	attributeIndex <- get_attribute_container_index(processState, name = "poissonAttribute")
	
	# add timer variable to process state
	processState <- add_global_attribute(processState, name = "timer", value = 0)
	timerIndex <- get_global_attribute_index(processState, name = "timer")
	
	
	# create time models based on process state pointers
	timeModel1 <- create_round_based_time_model(timerIndex)
	timeModel2 <- create_poisson_model(3.0)
	timeModel3 <- create_attribute_poisson_model(attributeIndex)
	
	# a change of the attribute container changes time model 3
	set_value(attribute, 0, 0.5)
	

Run the code above in your browser using DataLab