SUBSIM: The Web's #1 BBS for all submarine and naval simulations since 1997 
04012019, 07:55 AM  #1 
Sailor man
Join Date: Jan 2013
Location: Hong Kong
Posts: 47
Downloads: 71
Uploads: 3

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/AutoTMAconsole) For example, I recorded 3 bearings at a 2minute 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.
__________________
Automatic TMA calculator (metric system) Automatic TMA line detector and solver for DW/SC/688i Automatic TMA line detector and solver for maneuvering target (new) Last edited by ljqcn101; 04142019 at 11:25 PM. 
04012019, 01:11 PM  #2 
Gefallen Engel U666

welcome back!
ljqcn101! AFTER A SIX YEAR SILENT RUN!
__________________
"Only two things are infinite: The Universe and human stupidity; And I'm not too sure about the Universe..." Albert Einstein 
04012019, 11:35 PM  #3 
Sailor man
Join Date: Jan 2013
Location: Hong Kong
Posts: 47
Downloads: 71
Uploads: 3

Added an example which is similar to the last section of game manual.

04022019, 03:21 PM  #4 
Captain
Join Date: Nov 2005
Location: Atlántico Sur
Posts: 501
Downloads: 344
Uploads: 0

Thanks!
__________________
Cold Waters 1968 Campaign LINK a lista de Youtube My Blog: www.marenguerra.blogspot.com 
04072019, 11:24 PM  #5 
Sailor man
Join Date: Jan 2013
Location: Hong Kong
Posts: 47
Downloads: 71
Uploads: 3

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 = (xm, yn) By knowing the bearing of this vector, we can get the bearing vector equation: (yn)*sin(brg) = (xm)*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) = (yn)*sin(brg)  (xm)*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. 
04132019, 03:31 AM  #6 
Sailor man
Join Date: Jan 2013
Location: Hong Kong
Posts: 47
Downloads: 71
Uploads: 3

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 3bearing AOB or 4bearing methods. 
04132019, 05:03 PM  #7  
Silent Hunter

Quote:
I'm using this tool to quickly work out the AOB vs bearing differences for the stationary 3bearing method: http://www.subsim.com/radioroom/showthread.php?t=147719 It is based on the following math formula: cotangent (AOB) = cotangent (B2B1)  2*cotangent (B3B1) 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: B2B1 1 degree ; B3B1 +0.5 degree B2B1 +1 degree; B3B1 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 AOBrange of 4691. That is substantially narrowed, but still pretty wide. We could also reuse 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 halfway 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 4bearing 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.
__________________
Steam profile: https://steamcommunity.com/profiles/76561198032774177/ My site downloads: https://ricojansen.nl/downloads 

04142019, 11:51 PM  #8 
Sailor man
Join Date: Jan 2013
Location: Hong Kong
Posts: 47
Downloads: 71
Uploads: 3

Thanks Pisces for the analysis on 3bearing 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. 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.
__________________
Automatic TMA calculator (metric system) Automatic TMA line detector and solver for DW/SC/688i Automatic TMA line detector and solver for maneuvering target (new) Last edited by ljqcn101; 04172019 at 07:44 AM. 
04242019, 01:18 AM  #9 
Samurai Navy
Join Date: Oct 2006
Location: Salamis Base
Posts: 559
Downloads: 217
Uploads: 0

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.
__________________

04242019, 01:30 AM  #10  
Sailor man
Join Date: Jan 2013
Location: Hong Kong
Posts: 47
Downloads: 71
Uploads: 3

Quote:


04242019, 01:56 AM  #11 
Samurai Navy
Join Date: Oct 2006
Location: Salamis Base
Posts: 559
Downloads: 217
Uploads: 0

I am currently working on a method based on radial speed rule
(Bearing Rate=(Target Speed*sinAOBOwnspeed*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!
__________________

04242019, 03:06 AM  #12  
Sailor man
Join Date: Jan 2013
Location: Hong Kong
Posts: 47
Downloads: 71
Uploads: 3

Quote:
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. 

Thread Tools  
Display Modes  

