|
Flow Routes
|
Info |
Category: |
Main concepts |
Role: |
Scenario design |
The flow route is a directional link that connects two
events on the same
layer. Together, the routes define a flow logic: the order of events on each layer, and when the events are switching. Four types of the routes are available, depending on how they gate the event flow: ‘time’, ‘condition’, ‘time or condition’ and ‘time and condition’. The default ‘time’ routes take an account a predefined duration of the source event, whereas 3 conditional route types also rely on a conditional code that can be attached to the route. The conditional code is a logical expression, written by an user. The condition is continuously evaluated by the program at runtime and a route gets open when the expression returns true.
Things To Know
- Switching between two events occurs only if the 'between' route exists AND the route is open. The programs continuously evaluate all outgoing routes of the current event and opens a particular route once its conditions are met.
- Flow routes allows logic branching when two or more routes originate from the same event and are controlled by different conditions.
- The routes are directional, in order to make a two-events loop, two routes have to be created with opposite directions
- Event that has no incoming routes will never be activated, unless it's the first event on the layer
- When multiple outgoing routes become open at the same time, the first route by the creation order is used. The order can be changed in GUI
Creating and managing routes ¶
Example of flow logic | Branching in event 3 |
The routes can be created and edited in the
flow routes panel. Once the routes are created, the attached condition code can be edited in the flow conditions editor, which can be opened via the Snippets panel. In this editor all outgoing routes of the current event are shown in a list. The list allows changing the evaluation order of the existing routes. The route type can be always changed, such that condition code is preserved even if it's not compiled/used at runtime.
Flow route types
Time route
The time route gets opened automatically when a duration of the source event reaches the predefined value (see properties of
event). This a default type of the flow route.
Condition route
The condition route gets opened when its attached condition becomes true. The condition is specified by a logical expression written by user's. The expression can include any global or proxy variable so its bool state can be controlled programmically at runtime. If no condition specified, the route always stays closed (disabled) at runtime.
Time or condition route
The time or condition route gets opened when a duration of the source event expires OR route's attached condition becomes true. If no condition specified, only the duration is evaluated. This type of route is useful for the 'response' events in experiments such that the event is set to end on participant's response or after certain time period.
Time and condition route ¶
The time or condition route gets opened when a duration of the source event expires AND route's attached condition becomes true. If no condition specified, the route is disabled. This type of route is designed for the events whose minimal duration has to be garantied.
Examples of the route conditions
Simple conditional expression
// RT is a global variable
RT>0
Composite conditional expression
// TrialNumber and ConditionNumber are global variables
(TrialNumber==20)||(ConditionNumber>=6)
Recurrent route
Recurrent link |
Recurrent route is a special type of route that has the same source and target event. The recurrent routes are used to build a sequence of frames of accurate durations (e.g. RSVP streams or any animated stimuli, like the random-dot motion). The recurrent route is created in the flow route panel by dragging a link out and into the same event.