Controllers
Icon
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 methods | Slider | Switch | Select | Input box | Calendar | Button |
---|---|---|---|---|---|---|
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.
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.
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
- 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
The slider is used to control objects in the Number type.
- Minimum Value
- Maximum Value
- Step Value
Switch
The switch is used to control objects in the Bool type; no configuration is needed.
Select
The select is used to control objects enumerated in the types of Number, String, and Datetime.
- 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
The Input Box is used to control objects of type Number, String, and DateTime.
No setup is required; simply input directly into the control object input box on the canvas.
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.