Simulation with AnyLogic/Agent-Based Modeling/Step 4. Counting the product adopters

Step 4. Counting the Product Adopters

The main purpose of the model is to study how the new product is adopted, so we want to know how many people have already purchased our product at any given moment. Therefore we will define two statistics variables to count product adopters and potential adopters.

Create statistics variables to count adopters and potential adopters

  1. Open the Main class diagram by double-clicking the Main item in the Project view.
  2. Select the embedded object people.
  3. Go to the Statistics page of the Properties view.
  4. Define a statistics variable to calculate number of adopters. Click the Add Statistics button. This will open the property section below.
  5. Type adopters in the Name property field.
  6. Leave the selected Type: Count.
  7. Specify the Condition:
    item.statechart.isStateActive(item.Adopter)
    This variable will count the number of people satisfying the specified condition, i.e. those who are in the Adopter state currently (adopters).
  8. Create another statistics variable that will count potential adopters in the same way. Name it potentialAdopters and specify the following Condition:
    item.statechart.isStateActive(item.PotentialAdopter)