Skip to main content

Controllers

Icon

Controllers_image1.png

Function

Controllers are used to set or assign data components quickly.

Key Points

Control Objects

Control objects are global variables of type Number, String, Bool, or DateTime.

Data Types for Different Interaction Controls

Data Types or Objects | Control methodsSliderSwitchSelectInput boxCalendarButton
Number
String
Bool
DataTime
Conditional Event

Running Mechanism

If the running speed is not set to "As fast as possible" and the model logic requires reading the controlled variable over multiple Ticks, any adjustments to the controller during simulation running will cause the system to run based on the most recent set value. For additional details, please refer to the example at the end of this section.

Setup Method

The Settings include specifying the control target and configuring the interaction method.

Controllers_image2.png

Specifying Control Target

Use the dropdown list to select the data object in the model's current or higher scope that matches these data types.

Tip

Suppose you create a controller within an entity to set the value of the entity's individual property. In that case, you set the default value for this individual property rather than the real-time actual value of the property for all individuals. That is, the property of all existing individuals will not change with controller adjustments. Still, when you create new individuals with the default property value, it will adopt the controller's current settings.

Selecting Data Type

Controllers_image3.png

  • Use the dropdown list to select the supported data type: Number/String/Boolean/Dict.
  • After selecting, the interaction configuration items will be displayed based on the current data type.

Configuring Interaction Method

Slider

Controllers_image4.png

The slider is used to control objects in the Number type.

Controllers_image5.png

  • Minimum Value
  • Maximum Value
  • Step Value

Switch

Controllers_image6.png

The switch is used to control objects in the Bool type; no configuration is needed.

Select

Controllers_image7.png

The select is used to control objects enumerated in the types of Number, String, and Datetime.

Controllers_image8.png

  • Input an enum: Tag input box
    • Input: Press Enter after entering an enum value to complete the input.
    • Delete: Click on the X on the target enumerated value tag.

Input Box

Controllers_image9.png

The Input Box is used to control objects of type Number, String, and DateTime.

Controllers_image10.png

No setup is required; simply input directly into the control object input box on the canvas.

Example

Model Example

A model simulating bird flock behavior.

  • The global variable floyNum determines the number of birds in the model.
  • You can control this variable through the controller of the same name to observe the effects.