About the Custom Logic Editor

The Custom Logic Editor provides tools for defining, editing, and testing custom logics to control resource behavior in Factory Flow Simulation. You can have access to custom logics through the Manage Custom Logics command.

Note: The workflow of the command is based on SemEL logic programs.

This page discusses:

See Also
Custom Logic Applicability
Defining Custom Logics
Using Breakpoints While Debugging
In Other Guides
SemEL Language

User Interface

The editor interface is divided into several areas.

Script Parameters
Defines the logic parameters and attributes of the script.
Script Code
Displays the body of the script.
Note: You can only edit the script in the Authoring mode.
Mode Selector
Lets you switch from Authoring to Execution mode, and vice versa.
Script Check
Lets you check for syntax and build-time errors, and identify breakpoints.
Save
Saves the current script and parameters.
Execute
Lets you run tests.

Mode Selector

Various working modes are available when using the Custom Logic Editor. The editor interface can be different depending on the active working mode.

  • Authoring Mode: You can create and delete parameters, as well as their associated input and output attributes, and modify the body of the script.

    By default, the editor displays this mode.

  • Execution Mode: You can specify the value of a parameter, manage breakpoints in the script, and view the list of variables.

    You populate the input values before running the script, the output values are automatically filled after execution and not modifiable.

    Note: The panel automatically switches to the Execution Mode when it detects a breakpoint.
  • Run Mode: You can run tests using the Execute option to verify the script's behavior and manage breakpoints.
    Note: To enable this mode, you must first select the Execution Mode.

    When a breakpoint is reached, the debug panel appears and the Watch Parameters section displays a list of all parameters along with their current values. Click to resume the execution.

    If no breakpoint is detected, the script runs and the output values are displayed.

Method-Chaining

Method chaining is supported when defining the script.

Method chaining is a common syntax where multiple method calls are invoked and executed on the same object, all in one statement. Each method returns an object, allowing the calls to be chained together in a single statement without requiring variables to store intermediate results.

Auto-Completion

The autocomplete function in the script editor reduces syntax errors and speeds up the writing process. The objects, methods, and parameters that are valid in the script's current context are displayed as you type. Candidates for completion come from:

  • Language keywords (true, false, break…)
  • Script parameters
  • Known variables
  • The properties of the corresponding type when a variable or parameter is followed by ".".

To select the valid candidate, use the arrow keys and press Enter.

Data Inspection

The Custom Logic Editor provides a script debugging feature.

Script debugging allows you to test whether a script is running correctly using breakpoints. These breakpoints pause the script's execution at the lines that you have specified, allowing you to track the script's progress and examine the available parameters and their values throughout the script.

A red mark identifies a breakpoint in the left margin of the Script Code. Breakpoints are saved with the script.

When running the simulation, the debug panel opens automatically when a breakpoint is detected. The Watch Parameters section shows which parameters are available at the breakpoint line and their current values. For more information about how to define breakpoints and debugging, see Using Breakpoints While Debugging.