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,853
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 offline   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
Reply


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 07:12 AM.


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.