Description Format Construction Public Fields Active fields (read-only) Public Methods
World is to be used for storing Entities, Models and Containers, setting the simulation clock, and for keeping a log of your simulation outputs. You may think of it as a container that is to be passed into event functions and let each event function accesses the instances it needs that are being stored inside World.
R6::R6Class object inheriting from Container<-ContainerGeneric<-Generic.
1 |
NULL
Cont
Contains the objects those were added using self$add(...)
.
info
Contains information about the World object such as dymium's version it was
created with, its built date, creator info, R version, etc.
containers
Contains Containers those were added using self$add(...)
.
entities
Contains Entities those were added using self$add(...)
.
models
Contains Models those were added using self$add(...)
.
scale
A positive numeric value indicating the scale of Targets use by World. Note that,
this cannot be 0.
add(x, name, replace = TRUE)
(Entity and inheritances | Container | an object of the classes in
SupportedTransitionModels, character(1)
, logical(1)
)
Add an object the allowed types to self$Cont
, self$entities
, self$containers
,
self$models
. Only one instance of each class are allowed to be stored.
The stored instances can be access via self$<object-type>
or self$get(x)
.
If replace
is true then the object with the same name as name
will be replaced.
remove(x)
(character(1)
| integer(1)
)
Remove an object in element or named x
.
get(x)
(character(1)
) -> (an R6 object
)
Get the value of the key in x
. For example, if your World object contains
a Population object, then you can simply call world$get("Population")
to
get the Population object, assuming that the World object is named world
in your calling scope.
get_entity(x)
(character(1)
) -> An Entity object
Get a reference to the x
Entity object.
get_model(x)
(character(1)
) -> A Model object
Get a model object by name x
. Note that, this returns a Model object of
R6::R6Class not the actual model itself. To get the model object use $get()
on the Model object.
get_time()
() -> (integer(1)
)
Get the value of .DMevn$sim_time.
get_info()
NULL
-> list()
Get information about the creation of the world object.
Dymium's version, dependencies, R version etc.
set_time(x)
(integer(1)
) -> self
Set the time on the World's simulation clock (.DMevn$sim_time).
set_scale(x)
(numeric(1)
)
Set the simulation scale which is stored as a global option (dymium.simulation_scale
).
The scale parameter can also be accessd using optionGet("dymium.simulation_scale")
.
The simulation scale parameter is useful for running a downsized version of your
world without manually going through all the data to scale them down. This scale
automatically applies to all Targets created.
reset_time()
Reset the value of .DMevn$sim_time to 0L (L is for forcing type integer
otherwise 0 is of numeric type).
start_iter(time_step, unit)
(integer(1)
, character(1)
) -> self
Update the simulation time and returns self.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.