SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Current crop of subsims & naval games > Wolfpack
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 04-01-19, 07:55 AM   #1
ljqcn101
Sailor man
 
Join Date: Jan 2013
Location: Hong Kong
Posts: 50
Downloads: 78
Uploads: 3
Default Open sourced automatic TMA calculator

Download link: http://www.subsim.com/radioroom/down...o=file&id=5458

I decided to share my personal TMA calculator suitable for figuring out target course/speed/distance using bearing only information.

The calculator uses metric system and is particularly designed for Wolfpack.

It's an old school C++ console for quick input/output, so you enter parameters one by one according to the console display and then you got the results. (Source code: https://github.com/LJQCN101/Auto-TMA-console)


For example, I recorded 3 bearings at a 2-minute interval with my boat staying still using AP connected to TDC, so I can get some pretty precise readings from TDC heading dial: 321.3, 326.48, 330.9 in this case. Inputted into the calculator and got a target course of 32.8deg.

Then I moved straight forward for 935m with my heading 20deg, and took the 4th bearing 334.5 at time 8:30. Put them all into the calculator, and I got the target course 32.8deg, speed around 8 kts, distance 4716m.

The calculator is not limited to this situation and you are allowed to move and steer the boat as you want.


Last edited by ljqcn101; 04-14-19 at 11:25 PM.
ljqcn101 is offline   Reply With Quote
Old 04-01-19, 01:11 PM   #2
Aktungbby
Gefallen Engel U-666
 
Aktungbby's Avatar
 
Join Date: Jul 2013
Location: On a tilted, overheated, overpopulated spinning mudball on Collision course with Andromeda Galaxy
Posts: 27,814
Downloads: 22
Uploads: 0


Default welcome back!

ljqcn101! AFTER A SIX YEAR SILENT RUN!
__________________

"Only two things are infinite; The Universe and human squirrelyness; and I'm not too sure about the Universe"
Aktungbby is online   Reply With Quote
Old 04-01-19, 11:35 PM   #3
ljqcn101
Sailor man
 
Join Date: Jan 2013
Location: Hong Kong
Posts: 50
Downloads: 78
Uploads: 3
Default

Added an example which is similar to the last section of game manual.
ljqcn101 is offline   Reply With Quote
Old 04-02-19, 03:21 PM   #4
Topo65
Samurai Navy
 
Join Date: Nov 2005
Location: Atlántico Sur
Posts: 557
Downloads: 382
Uploads: 0
Default

Thanks!
__________________
Cold Waters 1968 Campaign
LINK a lista de Youtube
My Blog: www.marenguerra.blogspot.com
Topo65 is offline   Reply With Quote
Old 04-07-19, 11:24 PM   #5
ljqcn101
Sailor man
 
Join Date: Jan 2013
Location: Hong Kong
Posts: 50
Downloads: 78
Uploads: 3
Default

For anyone who is interested in the formulas or wants to implement in other apps:

First I set three unknown variables,
1. target distance at first bearing as "L1_distance"
2. target course as "crs"
3. target speed as "spd"

And I let ownship coordinate (m,n) initiate at (0,0). Y axis points to north (0 deg), and X axis points to east (90 deg). All angles start at Y axis and rotate in clockwise direction. So we can get:

1. target speed component on x axis "u" = spd * sin(crs)
2. target speed component on y axis "v" = spd * cos(crs)
3. target coordinate (a,b) at first bearing = L1_distance * sin(brg1), L1_distance * cos(brg1)
4. target coordinate (x,y) at each time = (a+u*t, b+v*t)
5. the vector pointing from ownship to target = (x-m, y-n)

By knowing the bearing of this vector, we can get the bearing vector equation:
(y-n)*sin(brg) = (x-m)*cos(brg)

Since we have three unknown variables to solve, in order to make sure the left hand side of the equation is really close to the right hand side, we can use the least square method:

Let formula f(t) = (y-n)*sin(brg) - (x-m)*cos(brg)
So we need to minimise the sum of squared f(t) for all bearing vectors. I used BFGS algorithm to solve this utilising C++ Dlib library.
ljqcn101 is offline   Reply With Quote
Old 04-13-19, 03:31 AM   #6
ljqcn101
Sailor man
 
Join Date: Jan 2013
Location: Hong Kong
Posts: 50
Downloads: 78
Uploads: 3
Default

Next version I'm planning to add random -/+ 0.5 deg noise to the bearing inputs and do some basic error analysis on the solution, so players can decided if they want to continue record bearings or just use the current solution.

Interest myself to see how much impact it has to those 3-bearing AOB or 4-bearing methods.
ljqcn101 is offline   Reply With Quote
Old 04-13-19, 05:03 PM   #7
Pisces
Silent Hunter
 
Join Date: Dec 2004
Location: AN9771
Posts: 4,892
Downloads: 300
Uploads: 0
Default

Quote:
Originally Posted by ljqcn101 View Post
Interest myself to see how much impact it has to those 3-bearing AOB or 4-bearing methods.
Bearing accuracy has a BIG impact on these methods, in particular AOB accuracy! And range and speed depends on that. The longer the time interval the lower the impact the bearing errors will have. My experience is that this AOB error vs time is inversely proportional. Because of the bearing drift size vs error size you will get more accuracy.

I'm using this tool to quickly work out the AOB vs bearing differences for the stationary 3-bearing method: http://www.subsim.com/radioroom/showthread.php?t=147719

It is based on the following math formula: cotangent (AOB) = cotangent (B2-B1) - 2*cotangent (B3-B1)

Let's say we start taking bearings when a target happens to show an AOB of 21 degrees to it's course at the first bearing. Starting with the a time taken for an initial bearing difference of 6 degrees then the 3rd bearing will be around 16 degrees from the first.

If you consider the edge cases of 0.5 degree bearing inaccuracies you would end up with the 2 situations that show the biggest variation to AOB:

B2-B1 -1 degree ; B3-B1 +0.5 degree
B2-B1 +1 degree; B3-B1 -0.5 degree

This results in a AOB range of 35 degrees:
5 vs 16.5, AOB = 12 degrees
7 vs 15.5, AOB = 47 degrees

This range of possible AOBs might be acceptable. But you are not always as lucky to find a target this far away still on the horizon. In these situations, but also when it is moving away, the AOB convergence goes quickly. But the nearer the target is to the horizon, the slower the bearing drift becomes. Ultimately a snails pace.

The closer you are to the point where the target starts with an AOB of 90 the harder it becomes to notice a change in bearing drift. It is pretty constant in that area. For example, with an AOB of 70, and a time interval worth 6 degrees the 3rd bearing would indicate 12.35 degrees of drift. We are not able to measure to such precision, but let's assume we were. Then with the above mentioned bearing difference errors this would entail an AOB range between 21 and 145 degrees. That is certainly not very useful. But with periscope sightings instead, and measuring using the heading dial on the TDC this situation will have much better results.

We have several options to increase the change in bearing. First, to double up the interval, meaning we would have to stay listening stationary for a total of 4 original time intervals. If the target started again at 70 degrees AOB at bearing 1, but we instead listen at the double duration then bearing 2 was likely recorded as 12 degrees. And subsequent the third would come around 25 degrees from the first. This would lead to a AOB-range of 46-91. That is substantially narrowed, but still pretty wide.

We could also re-use the 2nd and 3rd bearings and wait for the 4th from a stationary position. Then we can verify our first three bearings for correctness. If we additionally listen half-way through the 2nd interval we can use B1, B2.5 and B4 to get AOB based on a wider bearing change range. The latter one will have the possible AOB range narrowed down.

With the superior speed on the surface vs the convoy it would seem using the moving 4-bearing method, as described by Kuikueg and Neuro, is more effective. As one is able to move perpendicular to the bearings to either side in order to increase the bearing changes. But perhaps this only becomes necessary when the game provides more challenging convoy spawn distances. Simply moving towards the sound, with a intermediate hydrophone check is still the simplest option.
__________________
My site downloads: https://ricojansen.nl/downloads
Pisces is offline   Reply With Quote
Old 04-14-19, 11:51 PM   #8
ljqcn101
Sailor man
 
Join Date: Jan 2013
Location: Hong Kong
Posts: 50
Downloads: 78
Uploads: 3
Default

Thanks Pisces for the analysis on 3-bearing AOB method!

I've just released v0.3 and added probability calculation for positional/course error distributions, assuming a random inaccuracy of bearing input within a range of -0.5 to 0.5 deg. The probability is computed over 1000 iterations.

Since this tool uses least squares optimisation to interpolate an solution, I can keep the original time interval and take one more bearing to further reduce the impact from bearing inaccuracies.

An example of recording a 5 deg/min bearing rate target when stationary:
Code:
time t1 = 0 (sec)
ownship heading at t1 (deg): 0

target bearing at t1 (deg): 350

ownship straight direction from last position = 0 (deg)
ownship straight distance from last position = 0 (meter)
*******************************
time t2 (sec): 120

ownship heading at t2: 0

target bearing at t2 (deg): 0

ownship straight direction from last position (deg): 0

ownship straight distance from last position (meter): 0

*******************************
time t3 (sec): 240

ownship heading at t3: 0

target bearing at t3 (deg): 10

ownship straight direction from last position (deg): 0

ownship straight distance from last position (meter): 0


target course: 90deg

probability of target course error within 5deg: 29.5868 %
probability of target course error within 10deg: 54.7107
probability of target course error within 20deg: 89.9174

3 bearings when stationary can only get course solution.

*******************************
time t4 (sec): 360

ownship heading at t4: 0

target bearing at t4 (deg): 19.4

ownship straight direction from last position (deg): 0

ownship straight distance from last position (meter): 0


target course: 89.78deg

probability of target course error within 5deg: 55.1948 %
probability of target course error within 10deg: 87.6623
probability of target course error within 20deg: 100 %

4 bearings when stationary can only get course solution.

*******************************
time t5 (sec): 480

ownship heading at t5: 0

target bearing at t5 (deg): 27.8

ownship straight direction from last position (deg): 0

ownship straight distance from last position (meter): 0


target course: 89.64deg

probability of target course error within 5deg: 85.7143 %
probability of target course error within 10deg: 100 %
probability of target course error within 20deg: 100 %

5 bearings when stationary can only get course solution.

*******************************
time t6 (sec): 600

ownship heading at t6: 0

target bearing at t6 (deg): 35.1

ownship straight direction from last position (deg): 0

ownship straight distance from last position (meter): 0


target course: 89.71deg

probability of target course error within 5deg: 100 %
probability of target course error within 10deg: 100 %
probability of target course error within 20deg: 100 %

6 bearings when stationary can only get course solution.
As you can see the probability of target course error within 5 deg almost doubled by adding the 4th bearing into interpolation. Adding a 5th bearing can even improve it to over 85%.

But looks like simply increasing the time interval virtually achieved the same result:
Code:
time t1 = 0 (sec)
ownship heading at t1 (deg): 0

target bearing at t1 (deg): 350

ownship straight direction from last position = 0 (deg)
ownship straight distance from last position = 0 (meter)
*******************************
time t2 (sec): 240

ownship heading at t2: 0

target bearing at t2 (deg): 10

ownship straight direction from last position (deg): 0

ownship straight distance from last position (meter): 0

*******************************
time t3 (sec): 480

ownship heading at t3: 0

target bearing at t3 (deg): 27.8

ownship straight direction from last position (deg): 0

ownship straight distance from last position (meter): 0


target course: 89.6deg

probability of target course error within 5deg: 85.6198 %
probability of target course error within 10deg: 100 %
probability of target course error within 20deg: 100 %

3 bearings when stationary can only get course solution.
And I've also updated the example in the original post. Since the bearing rate is lower and the target is pretty far away, the solution is more error prone to bearing inaccuracies.

Last edited by ljqcn101; 04-17-19 at 07:44 AM.
ljqcn101 is offline   Reply With Quote
Old 04-24-19, 01:18 AM   #9
geosub1978
Samurai Navy
 
Join Date: Oct 2006
Location: Salamis Base
Posts: 567
Downloads: 229
Uploads: 0
Default

Hi!
Can you please tell me which Windows version did you use? My copy refuses to be installed an dI guess it has to do with that.
__________________
geosub1978 is offline   Reply With Quote
Old 04-24-19, 01:30 AM   #10
ljqcn101
Sailor man
 
Join Date: Jan 2013
Location: Hong Kong
Posts: 50
Downloads: 78
Uploads: 3
Default

Quote:
Originally Posted by geosub1978 View Post
Hi!
Can you please tell me which Windows version did you use? My copy refuses to be installed an dI guess it has to do with that.
I tested on win8.1 and win10. Both are x64 systems. Make sure you have Visual C++ Redistributable for Visual Studio 2015 x64 installed.
ljqcn101 is offline   Reply With Quote
Old 04-24-19, 01:56 AM   #11
geosub1978
Samurai Navy
 
Join Date: Oct 2006
Location: Salamis Base
Posts: 567
Downloads: 229
Uploads: 0
Default

I am currently working on a method based on radial speed rule
(Bearing Rate=(Target Speed*sinAOB-Ownspeed*sin(LeadingAngle))/Range)

By taking into consideration that the new AOB=PREVIOUSAOB+BEARINGCHANGE

Then if you apply the Rule of Sins for three individual bearing shootings and counting manualy the bearing rate, you can have a final equation with an unkown target speed or sinAOB. The maths are too long for the moment and require patience!
__________________
geosub1978 is offline   Reply With Quote
Old 04-24-19, 03:06 AM   #12
ljqcn101
Sailor man
 
Join Date: Jan 2013
Location: Hong Kong
Posts: 50
Downloads: 78
Uploads: 3
Default

Quote:
Originally Posted by geosub1978 View Post
I am currently working on a method based on radial speed rule
(Bearing Rate=(Target Speed*sinAOB-Ownspeed*sin(LeadingAngle))/Range)

By taking into consideration that the new AOB=PREVIOUSAOB+BEARINGCHANGE

Then if you apply the Rule of Sins for three individual bearing shootings and counting manualy the bearing rate, you can have a final equation with an unkown target speed or sinAOB. The maths are too long for the moment and require patience!
Great. But be careful when computing with Ownspeed, since you need a course change in order to get a single solution, if you keep a constant ownspeed.

For computational convenience the boat is always assumed to be able to instantaneously change speed or course at each observation point, but in reality it cannot. And any departure from these idealisations introduce errors. That's why I use distance and direction between two observation points for computation.
ljqcn101 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 02:18 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 1995- 2024 Subsim®
"Subsim" is a registered trademark, all rights reserved.