Home Examples Multiple Targets and Multiple Target States
Visuals

Multiple Targets and Multiple Target States

This example shows how multiple targets can be displayed simultaneously and how multiple target states can be used. The purpose of having multiple “on” states for a target is to allow a single target to change from one colour and/or size to another without having to completely redefine the target. For example, if you wish to have a target change from green to red, then a target can be defined with two states such that the two states share the same location, size and target type, and the only difference between them is the colour.

10.7.1   Simulink Code for Multiple Targets and Multiple Target States Example

Multiple states for a target are defined by double-clicking the Show_Target block within Simulink, and choosing 2 or more states. For each desired state, the columns in the Target_Table that reference size and colour need to be chosen. Having the target switch back and forth between these states then requires the Target_State input to the Show_Targetblock to be the desired state. For more information on defining target states, click Help in the Show_Targetblock from within Simulink.

Showing multiple targets simultaneously requires two things: the Matrix Concatenation block (which concatenates the VCODE outputs) and a separate Show_Target block for each target. In this particular example, 2 targets are shown.

You can either set the transparency (or alpha) for a target within a Simulink Show_Targetblock, or have it passed into the Show_Target block as a parameter. Within the Show_Target block you can also specify if a target should show up on the operator display (i.e. in Dexterit-E), the subject display, or both.

Figure 10.14: Simulink Code for Multiple Targets and Multiple Target States Example

10.7.2   Stateflow Chart for Multiple Targets and Multiple Target States Example

The Stateflow Chart for this example is not shown here. The main features are two new outputs

target_2_row and target_2_state which must be set as desired from within Stateflow in a

similar manner to target_row and target_state. Also note that target_state and

target_state_2 now have three valid values: 0 (target off), 1 (state 1) and 2 (state 2).

Attention: In this example there are 2 Show_Target blocks. However, the Show_Target block can take a vector input such that it will display more than one target at a time, which allows you to accomplish what is done here with a single Show_Target block.

10.7.3   Parameter Table Defn Block for Multiple Targets and Multiple Target States Example

In this example, another column has been defined in the Target Table (Figure: 10.15). State 2 of the Show_Target blocks reference column 6 of the Target Table for the colour of the targets (see Simulink code above) and so a new line needs to be added to the Parameter Table Defn.

Figure 10.15: Target Table Definition

Note: The constant names defined in the Parameter Table Defn block can be used to specify the columns in the various target blocks.

Related Tasks

Coding Tips
Persistent Variables
Persistent variables are ones that hold their value between calls to the embedded MATLAB code they are defined in.
Coding Tips
Custom Control of the Trial Protocol Order
Normally, Dexterit-E manages and controls the order in which Trial Protocols (TPs) execute based on what is defined in the block table of the Task Protocol (see the Dexterit-E User Guide for more details).