SUBSIM Radio Room Forums



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

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > SH5 Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 12-18-10, 09:51 AM   #1
Vanilla
Lieutenant
 
Join Date: Nov 2006
Location: St. Petersburg, Russia
Posts: 264
Downloads: 73
Uploads: 0
Default

BTW, forgot to mention - there is another division by zero issue - if the tracking angle is 0 or 180 then sine of it is zero as well.

In the cases of zero divisions we need to use torpedo speed and that returns us to the problems with torpedo run away and turn times.
Vanilla is offline   Reply With Quote
Old 12-18-10, 09:55 AM   #2
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by Vanilla View Post
BTW, forgot to mention - there is another division by zero issue - if the tracking angle is 0 or 180 then sine of it is zero as well.

In the cases of zero divisions we need to use torpedo speed and that returns us to the problems with torpedo run away and turn times.
True true. But I still can't get Antar's formula to work correctly. Comparing the values it returns to the torp line's time doesn't even come close

Here's the code I have for it:

Code:
  # get the target's speed
  ts = Menu.GuiDials.GetValue( GuiDialsWrapper.DialTypes.SOL_SPEED )
  if ts == 0:
   ts = 0.000001
  # get the distance to target
  td = Menu.GuiDials.GetValue( GuiDialsWrapper.DialTypes.SOL_RANGE )
  # get the target's AOB from the TDC dial
  taob = abs( Menu.GuiDials.GetValue( GuiDialsWrapper.DialTypes.SOL_ANGONBOW ) )
  # get the track angle
  tangle = abs( Menu.GuiDials.GetValue( GuiDialsWrapper.DialTypes.SOL_TRACKANGLE ) )
  # calculate 3rd angle of triangle
  auxangle = radians( 180 - taob - ( 180 - tangle ) )
  s_ship = td * ( sin( auxangle ) / sin( radians( 180 - tangle ) ) )
  s_torp = td * ( sin( radians( taob ) ) / sin( radians( 180 - tangle ) ) )
  #to hit torp.time = ship.time
  impacttime = int( round( s_ship / ts ) )
  impacttimemins = impacttime / 60
  impacttimesecs = impacttime - ( impacttimemins * 60 )
I don't understand why we're calculating s_torp when we never use it

Using the TDW_Torp_Tutorial single mission when I set up the shot the torp line says ~2:33 to impact and the caculated values above say 0:35
TheDarkWraith is offline   Reply With Quote
Old 12-18-10, 10:15 AM   #3
PL_Andrev
Grey Wolf
 
Join Date: Feb 2009
Posts: 995
Downloads: 91
Uploads: 0
Default

Quote:
Originally Posted by TheDarkWraith View Post
I don't understand why we're calculating s_torp when we never use it
Right, it is not necessary.
But you can use to check the torpedo time:
s.ship/v.ship = s.torpedo/v.torpedo

Quote:
Originally Posted by TheDarkWraith View Post
Using the TDW_Torp_Tutorial single mission when I set up the shot the torp line says ~2:33 to impact and the caculated values above say 0:35
I have a idea. I prepare the attack mission and give you all data from my hand calculation in radians/degrees. You can check it step_by_step in UI directly.

Why do you use ts=0 => ts = 0.000001 ?
I wrote that if the v=0 these calculations have no sense and at this conditions t.torp = dist/v.torp

What about missing source to 5.7.0 at first post?
__________________

PL_Andrev is offline   Reply With Quote
Old 12-18-10, 10:35 AM   #4
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by Antar View Post
Right, it is not necessary.
But you can use to check the torpedo time:
s.ship/v.ship = s.torpedo/v.torpedo



I have a idea. I prepare the attack mission and give you all data from my hand calculation in radians/degrees. You can check it step_by_step in UI directly.

Why do you use ts=0 => ts = 0.000001 ?
I wrote that if the v=0 these calculations have no sense and at this conditions t.torp = dist/v.torp

What about missing source to 5.7.0 at first post?
I'll be releasing v5.7.1 as soon as I fix the remaining errors (mainly pfeillant's post). pfeillant posted about some kind of error but what he said doesn't make much sense (and I need to see a screenshot of the big error). I've been combing through the files looking for anything like he reported and have come up empty handed

I'd like to include this estimated impact time in v5.7.1 also.

I use ts = 0.0000001 just to avoid the division by 0 for now.
TheDarkWraith is offline   Reply With Quote
Old 12-19-10, 07:28 AM   #5
Vanilla
Lieutenant
 
Join Date: Nov 2006
Location: St. Petersburg, Russia
Posts: 264
Downloads: 73
Uploads: 0
Default

Quote:
Originally Posted by TheDarkWraith View Post
True true. But I still can't get Antar's formula to work correctly. Comparing the values it returns to the torp line's time doesn't even come close

Here's the code I have for it:

Code:
  # get the target's speed
  ts = Menu.GuiDials.GetValue( GuiDialsWrapper.DialTypes.SOL_SPEED )
  if ts == 0:
   ts = 0.000001
  # get the distance to target
  td = Menu.GuiDials.GetValue( GuiDialsWrapper.DialTypes.SOL_RANGE )
  # get the target's AOB from the TDC dial
  taob = abs( Menu.GuiDials.GetValue( GuiDialsWrapper.DialTypes.SOL_ANGONBOW ) )
  # get the track angle
  tangle = abs( Menu.GuiDials.GetValue( GuiDialsWrapper.DialTypes.SOL_TRACKANGLE ) )
  # calculate 3rd angle of triangle
  auxangle = radians( 180 - taob - ( 180 - tangle ) )
  s_ship = td * ( sin( auxangle ) / sin( radians( 180 - tangle ) ) )
  s_torp = td * ( sin( radians( taob ) ) / sin( radians( 180 - tangle ) ) )
  #to hit torp.time = ship.time
  impacttime = int( round( s_ship / ts ) )
  impacttimemins = impacttime / 60
  impacttimesecs = impacttime - ( impacttimemins * 60 )
I don't understand why we're calculating s_torp when we never use it

Using the TDW_Torp_Tutorial single mission when I set up the shot the torp line says ~2:33 to impact and the caculated values above say 0:35
I guess we forgot to convert knots to m/s. Do you get knots from the speed dial? if yes - multiply it by 0.514444 to get m/s.
Another thing: impacttimemins is int or float/double? If float - then you will always get zero seconds.
Vanilla is offline   Reply With Quote
Old 12-19-10, 08:33 AM   #6
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by Vanilla View Post
I guess we forgot to convert knots to m/s. Do you get knots from the speed dial? if yes - multiply it by 0.514444 to get m/s.
Another thing: impacttimemins is int or float/double? If float - then you will always get zero seconds.
No we didn't. Pulled torp speed from dial in knots and multiplied by 0.5145 to convert to m/s. impacttime is an int and integer division used to find impacttimemins so we're all good there also
TheDarkWraith is offline   Reply With Quote
Reply

Tags
dbrn, favorite, new ui

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 11:48 PM.


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