9. Add or Delete Entities Dynamically

<< Click to Display Table of Contents >>

Navigation:  Examples  > Exercises - Start Here >

9. Add or Delete Entities Dynamically

Previous pageReturn to chapter overviewNext page
Show/Hide Hidden Text

Actions, which we met in Exercise 8, can be used not only to change stocks and attributes, but also to add or remove entities during the simulation. This means that information generated during the run can be used to determine whether entities are created or deleted, and for those being created, what their initial characteristics will be.

 

The actions that do this are called create actions and self-delete actions. For a simple example of how they work, we'll define our pastures such that if there's more than enough grass, we'll add a cow. If a cow can't find enough grass, she'll self-delete from the model.

 

Stages of Ventity™ Modeling

In this run, we will ...

Stage 1 - Define entity types
Design the kinds of entities

 

Change the definition of the cow entity type to self-delete when food is scarce, and change the definition of the pasture entity type to add a cow when food is available.

Stage 2 - Initialize the model
Specify how many entities and their individual characteristics

 

No change from previous runs.

 

Stage 3 - Run the model

Configure time settings and perform calculations

 

No change from previous runs.

 

Stage 4 - Examine results

See model behavior in graphs and tables

 

See how appearing and disappearing entities appear in charts and tables.

 

 

hmtoggle_arrow1Stage 1: Defining Entity Types

 

hmtoggle_arrow1Stage 2: Initialization

 

hmtoggle_arrow1Stage 3: Run the model

 

hmtoggle_arrow1Stage 4: Examine Results