|
ANY-maze Help > The ANY-maze reference > The Protocol page > The elements of a protocol > Testing > Events and actions > An introduction to events and actions An introduction to events and actions
IntroductionEvents and actions provide a method by which you can detect specific situations that occur during a test (events) and take some action because of them. For example, you could: - Detect when the animal enters a zone, and end the test when this occurs (see figure 1); - Detect when the animal is immobile for a certain amount of time, and pause the ANY-maze video recorder; unpausing it when the animal becomes mobile again; - Detect when the animal activates an on/off input, and turn on an on/off output for a certain duration - perhaps to activate a shocker.
Figure 1. The steps that would occur in a water-maze, where entry into an island zone is to end the test.
Detecting eventsThe intention of ANY-maze events is to detect when a particular situation occurs during a test. To this end, ANY-maze allows you to base an event on a wide range of different things, including,
Performing actionsThe purpose of an action is to do something when an event occurs. What the action actually does is defined by you, and could be:
In fact, a single action can cause any number of these things to occur - so it might add a label to a video, play a sound, and activate a switch. Detecting multiple eventsAn obvious question about the events/actions model used in ANY-maze is to ask why the system includes these two elements separately - why not simply have a single item which, when triggered, performs the action? In fact, there are two reasons why the system works this way. First, it allows you to define a number of different events, any of which can trigger a single action - e.g. the action will occur if event A or Event B or event C occurs. And secondly, it allows you to define multiple events, all of which must occur in order to trigger an action - e.g. the action will only occur if event A and Event B and event C occur. For example, you might want to end the test if the animal enters a certain zone but only if it does this after 1 minute of the test has passed. In this case, you could create an event that would be triggered 1 minute after the test start and another that would be triggered when the animal enters the zone. You would then create an action to end the test but set it to occur only if BOTH of the events were 'active' (i.e. they had both been triggered). In fact, you might spot a problem with this example - if the animal enters the zone during the first minute, then the action WON'T be triggered because the '1 minute' event is not active; but when the end of the first minute occurs, the action WOULD be triggered because now both events would have occurred. In other words, the test would end after one minute provided the animal had visited the zone during that minute - and this is NOT what we intended. The solution to this problem is related to how events are reset. Basically, after an event has been triggered, it is said to be active and it remains in this state until it's reset which can be done either automatically, by the system, or 'manually' by an action. In the case where an event is reset automatically, the system first processes all the effects of the event and then resets the event so it's no longer active. In contrast, a manual reset event has its effects processed and is then left in an active state - it's only reset if some action explicitly resets it. Let's see how this can be used to fix the problem with the above example: What we would want to do is to set the 'Animal enters the zone' event to be automatically reset, but the '1 minute' event to be manually reset (in fact, we'll never reset it). Thus, if the animal enters the zone during the first minute of the test the 'Animal enters the zone' event will become active; however, nothing will actually happen because the '1 minute' event will be inactive. Having determined that there are no actions to perform, ANY-maze will simply reset the 'Animal enters the zone' event back to an inactive state. Now, after 1 minute the '1 minute' event will become active, but it won't trigger the action either, because the 'Animal enters the zone' event won't be active - and because it's a manual reset event, it'll be left in the active state. What will happen now if the animal enters the zone is that both events will become active, and this WILL trigger the action which will end the test.
© Copyright 2003-2026 Stoelting Co. All rights reserved ANY-maze help topic T0412 |