## 19.2. Worm in the hole algorithm

19.2.1. Overview
19.2.2. Example
19.2.3. Algorithm

### 19.2.1. Overview

Frequently vehicles in Debrief use sensors with a different datum to the host platform - either because they're several metres from the position recorded datum on board the platform, or because they're an offboard sensor dragged behind the sensor. For an onboard sensor it is acceptable to locate the sensor by reference to its sensor length offset in conjunction with the current heading. However for an offboard sensor this coarse calculation may not be representative of the actual sensor location. When a platform is on a straight-line course, it is acceptable to plot the sensor datum back along the reverse heading. But, when a platform has travelled through a turn, plotting the sensor datum at the reciprocal of the platform heading will place the sensor in an unrealistic location. To counter this, Debrief offers a 'Worm in the hole' sensor locating model.

The 'worm in the hole' algorithm takes the sensor length offset value, and determines the point this specified distance back along the platform track. The metaphor is that a worm has opened a tunnel through a body of material. The sensor is being dragged through this tunnel, and we determine the sensor location accordingly.

Note This is not a perfect algorithm. In truth, during a turn the forces on a towed array will cause it to slip sideways, cutting off the corner to an extent. It is the responsibility of the analyst to appraise himself with array performance and determine the applicability of the worm in the hole algorithm - though note its results are much more accurate than the non-worm in the hole straight line model.

### 19.2.2. Example

The screenshot belows shows a comparison of the two models. The red ownship track has positions at times 100,200,300 and 400. The sensor track has positions at times 100,140,280,350. The array is 400m long.

The two array models show the same value for the first 3 points plotted: in the first two of these the array falls behind the start of the ownship track - thus the reciprocal of ownship heading is necessary to determine the position. In the third position, the length of the 400m array falls completely within the 600m leg.

The fourth position is, however, different. The straight-line model plots it back along the reciprocal of the platform heading at time 300. The worm in the hole model, however, turns back along the ownship track from position 200 to 300. At time 350, the ownship platform will be 1/2 way down between positions 300 and 400 - this will consume 1/2 of the 600m separation (300m), leaving another 100m of array to be consumed - this the algorithm moves 100m back down between the points at 200 & 300.

### 19.2.3. Algorithm

The worm in the hole algorithm is implemented as follows:

1. Determine platform track, the time at which sensor location is required, the specified length offset, and whether the sensor is 'ticked' for 'worm in the hole algorithm'.

2. Work through the platform track to find the position immediately after the specified dtg, together with a list of points preceding that. These represent the 'nextPoint' and the backTrack from that dtg.

3. Calculate the platform position at the specified dtg by interpolating between the last item of the backTrack and the nextPoint , at the specified dtg. Name this new position nextPoint - it represents the platform position at the specified dtg

4. Now repeatedly perform the following:

1. Work out the distance from nextPoint to the last item in the backTrack

2. If this distance is greater than the remaining array offset length then:

1. Work out the proportion of the distance that the remaining sensor length represents, name it timeDelta

2. Interpolate back from nextPoint to the last item in the backTrack by the timeDelta parameter. This is the resultant sensor location

3. If the calculated distance is less than the remaining sensor length then

1. reduce the remaining sensor length by the calculated distance (to represent the array being 'consumed' by the backTrack)

2. if there are any more points in the backTrack then

1. store the last point on the backTrack as nextPoint, and move back along the backTrack by one element

else

1. calculate the offset back from the start of the platform track, of the remaining sensor length, along the reciprocal of the vessel heading. This is the resultant sensor location.