Create a Custom Logic
-
From the Resource Behavior section of the action bar,
select Manage Custom Logics
.
-
In the Manage Logics dialog box, click
to create a custom
logic.
The Edit Logic dialog box opens.
- Script Editor
- Defines and controls all or part of the simulation.
- Script Sample
- Displays reusable logic relevant to the scenario.
- Check Script
- Detects issues in the script.
- API Help
- Lets you browse for functions and methods associated with a data type.
To view the values for related Members, click
.
-
Specify the logic name and select the corresponding type.
The type dictates the event that triggers logic execution during simulation.
-
Click Sample Script
to
use predefined templates and reusable snippets.
The templates help you create controlled logic that requires similar configurations, allowing for fast and easy controlled logic creation.
-
From the Sample Scripts dialog box, copy the logic relevant to
your scenario and paste the sample in the Script Editor.
Each logic is associated with several sample scripts that you can reuse to suit your needs.
Note: The scripts displayed are for the selected logic type only. -
Customize the simulation using input attributes.
These attributes drive the scripts logic. For more information on the data types available as inputs, see SemEL Data Types.
You can browse the API Help section to see the available functions and methods associated with a data type.
Tip: Copy a method from the Members tab and Paste it in the script editor. -
Click
and select the
input attribute that you want to add.
-
Specify the Attribute Name and use it in the script to
define the logic.
Tip: You can also copy and paste the attribute name from the sample script into the Attribute Name field.
-
Click
-
Repeat the previous step to define output attributes.
You can use all the SemEL data types as output attributes. The available outputs depend on the selected logic type. Browse the API Help section to see the available functions and methods associated with a data type.
Tip: You can also copy and paste the attribute name from the sample script into the Attribute Name field. -
Optional: Select
to add the input as an
output attribute.
-
Click Check Script
to identify
syntax or build-time errors in the script.
For more information on how to resolve the errors, see Troubleshooting.
- Click Ok to validate and exit the dialog box.
Result: During simulation, the script controls the behavior of resources according to the defined inputs and outputs.