EthoVision XT 18 - THC - Trial and Hardware Control - Sub-Rules
Last updated: Jul 30, 2026
Sub-Rules
Use Sub-Rules
A sub-rule is a sequence of actions and conditions separated from the Start-Stop trial rule. You can view a sub-rule like a subroutine in a larger program, where the program is your Trial Control.
You can have the sub-rule start at specific times or under specific conditions. Each criterion defined is a Start condition of the sub-rule.
A sub-rule can be repeated, that is, when EthoVision finishes executing the instructions contained in the sub-rule, the program can start the sub-rule again from the beginning, for a specified number of times or until a condition is met.
You can also have the same sub-rule called from different points of the Trial Control sequence. To do so, define multiple References to the same sub-rule.
Why Use a Sub-Rule?
A sub-rule is necessary when your trials involve repetition of tasks. For example, when the animal has to press a lever to obtain a reward, and you want to repeat that 50 times. This is not feasible within the Start-Stop trial rule.
A sub-rule is also handy when your Trial Control logic is very complex, because it helps you have a clear overview of the phases within your trial. For example, different tasks within a trial can be kept separated and managed more easily.
Create a Sub-Rule
- In the Components pane, under Structures, double-click Sub-rule, or click the button next to it.
- If the Add a sub-rule window appears, choose one of the following:
- Create a new sub-rule. This creates a new sub-rule. You will be asked to enter a unique name for this sub-rule.
- Reuse an existing sub-rule. Choose this option if you want to re-use an existing sub-rule. Select the existing sub-rule and, if necessary, the Trial Control Settings where it is stored. Note: You only copy the sub-rule name, the Rule Begin and the Rule End boxes, not the actions and conditions inside the existing sub-rule.
- Under Name, enter a name for the sub-rule. The default name is
Sub-rule (n)where n is a progressive number. - Under Comment, enter a description of the sub-rule (optional).
- Click OK. The sub-rule is displayed on your Trial Control screen. It consists of a Rule Begin box and a Rule End box.
- Complete the sub-rule by inserting the appropriate conditions and actions between the Rule Begin and Rule End boxes.
- Define a reference to this sub-rule (see the next section).
Notes
- Sub-rule names. Names of sub-rules must be unique in your Trial Control Settings. You cannot define two sub-rules with the same name, even if these are defined in two different Trial Control Settings. However, you can create a sub-rule with the same name as an existing sub-rule stored in other Trial Control Settings by re-using it.
- Re-using a sub-rule. If you choose to re-use a sub-rule and then change any property of this copy (Name or Comment), a window appears with the message Define the scope of your changes. The program asks you whether you want to apply the properties only to the newly-created sub-rule, or to the sub-rules with the same name in all Trial Control Settings. Choose the option you require and click OK.
- Deleting a sub-rule. You cannot delete a sub-rule if at least one reference to that sub-rule is present in the Trial Control. You must first delete its reference. If you create a sub-rule without a valid reference, you can still acquire data but EthoVision informs you that trial control may not work as expected.
Create a Reference to a Sub-Rule
A Reference calls the instructions contained in an existing sub-rule.
- Make sure that the sub-rule has been defined in the Trial Control screen.
- In the Components pane, under Structures, double-click Reference or click the button next to it. If the Add a reference window appears, choose one of the following, then click OK:
- Create a new reference. To create a new reference to a sub-rule.
- Reuse an existing reference. Choose this option if you want to make a copy of an existing reference. Select that reference and, if necessary, the Trial Control Settings where it is stored.
- The Sub-rule Reference window appears. Under Name, enter a name for the reference. The default name is
Reference (n), where n is a progressive number. - Under Reference, from the Reference to sub-rule list select the sub-rule you have defined.
- Under Schedule, the Start conditions box shows Without delay. This means that, by default, the sub-rule starts as soon as the reference box becomes active. You can define one or more start conditions. Click the Add button to add a Start condition. The Add Start Condition window appears.
- From the Select type list, select one of the following:
- Without delay. To start the sub-rule as soon as the reference is activated.
- Delay (default). To start a specific time after the reference becomes active. Enter this time in the Delay field.
- Clock Time. To start at a specific day and time.
- Trial Control variable. To start when a Trial Control variable gets a specific value.
- Repeat steps 5–6 to add more start conditions. If you want to delete a start condition, select it and click the Delete button.
- Under Stop conditions, select one of the options to specify whether you want the sub-rule to be repeated once or more times.
- If you select to repeat the sub-rule, the Repeat interval option becomes available. Select:
- Stop to Start (default). To keep a constant time between the stop of a repeat and the start of the next repeat.
Source: EthoVision XT 18 - THC - Trial and Hardware Control, Noldus Information Technology