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 03-26-13, 04:51 PM   #1
THE_MASK
Ace of the deep .
 
THE_MASK's Avatar
 
Join Date: Jan 2006
Posts: 9,153
Downloads: 901
Uploads: 73


Default

I have a ctd on loading a save game with the new rendering patches when i click on the navigation map icon . This save game was a save with all the rendering patches enabled . I just tried disabling one by one and it seems to be the sub rendering patches . Does it have something to do with real navigation ?

Last edited by THE_MASK; 03-26-13 at 05:18 PM.
THE_MASK is offline   Reply With Quote
Old 03-26-13, 05:18 PM   #2
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by sober View Post
I have a ctd on loading a save game with the new rendering patches when i click on the navigation map icon . This save game was a save with all the rendering patches enabled . I just tried disabling one by one and it seems to be the Disables rendering of units except players sub (all the time) . Does it have something to do with sunk ship icons ?
I wondered about that one. Maybe I should remove it from patch list There are other render patches that do the same thing it did
TheDarkWraith is offline   Reply With Quote
Old 03-26-13, 05:33 PM   #3
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Here's a question/something to test:

Can you totally drain the batteries? I mean does battery level ever go to 0% and you lose propulsion? Looking at the game code here (just stumbled onto it ) it suggests that if current battery capacity < 0.001 then set current battery capacity to 0.001 thus meaning you can never deplete the batteries fully Can someone test this and report on it
TheDarkWraith is offline   Reply With Quote
Old 03-26-13, 05:52 PM   #4
Fifi
Navy Seal
 
Fifi's Avatar
 
Join Date: Dec 2012
Location: France
Posts: 6,254
Downloads: 510
Uploads: 0


Default

You are right TDW!!
Flank speed underwater, i fall to 2% (and never can go under this value) but speed finally fall to 1 knot...and i can navigate submerged for ever! (unless i have no more CO2)
So batteries never can stop...this is a major bug you have to fix IMO!!
Fifi is offline   Reply With Quote
Old 03-26-13, 05:58 PM   #5
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by TheDarkWraith View Post
Here's a question/something to test:

Can you totally drain the batteries? I mean does battery level ever go to 0% and you lose propulsion? Looking at the game code here (just stumbled onto it ) it suggests that if current battery capacity < 0.001 then set current battery capacity to 0.001 thus meaning you can never deplete the batteries fully Can someone test this and report on it
Quote:
Originally Posted by Fifi View Post
You are right TDW!!
Flank speed underwater, i fall to 2% (and never can go under this value) but speed finally fall to 1 knot...and i can navigate submerged for ever! (unless i have no more CO2)
So batteries never can stop...this is a major bug you have to fix IMO!!
Maybe this is a life buoy devs left in the code for us
gap is offline   Reply With Quote
Old 03-26-13, 06:14 PM   #6
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by Fifi View Post
You are right TDW!!
Flank speed underwater, i fall to 2% (and never can go under this value) but speed finally fall to 1 knot...and i can navigate submerged for ever! (unless i have no more CO2)
So batteries never can stop...this is a major bug you have to fix IMO!!
Assembly code doesn't lie

Quote:
Originally Posted by gap View Post
Maybe this is a life buoy devs left in the code for us
Unrealistic. Time to patch this out I'm looking for a battery drain curve and so far I'm not finding it. Appears devs have simple battery drain - linear. Real life this is an exponential curve where the curve falls off quickly towards the end of the battery's capacity (ex-Navy Nuke EM here ) . Looks like have to code that in if I can't find it also.
TheDarkWraith is offline   Reply With Quote
Old 03-26-13, 07:08 PM   #7
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by TheDarkWraith View Post
Unrealistic. Time to patch this out I'm looking for a battery drain curve and so far I'm not finding it. Appears devs have simple battery drain - linear. Real life this is an exponential curve where the curve falls off quickly towards the end of the battery's capacity (ex-Navy Nuke EM here ) . Looks like have to code that in if I can't find it also.
some typical charge/discharge curves for lead acid batteries (the ones used on U-boats), in case you needed for them:

http://www.ibt-power.com/Lead_acid_t...cid_tech.html#
http://www.yuasaeurope.com/en-gb/ind.../products/npl/

The graphs available from the above links are relative to modern batteries, indeed, but hopefully they didn't change that mutch since WWII
gap is offline   Reply With Quote
Old 03-26-13, 07:45 PM   #8
Fifi
Navy Seal
 
Fifi's Avatar
 
Join Date: Dec 2012
Location: France
Posts: 6,254
Downloads: 510
Uploads: 0


Default

Quote:
Originally Posted by TheDarkWraith View Post
Time to patch this out
Good luck with it! I'm sure you'll offer a nice fix as usual
Luckily you are here
Fifi is offline   Reply With Quote
Old 03-27-13, 06:52 AM   #9
BigWalleye
Sea Lord
 
Join Date: Jul 2012
Location: On the Eye-lond, mon!
Posts: 1,973
Downloads: 465
Uploads: 0


Default

Quote:
Originally Posted by sober View Post
I have a ctd on loading a save game with the new rendering patches when i click on the navigation map icon . This save game was a save with all the rendering patches enabled . I just tried disabling one by one and it seems to be the sub rendering patches . Does it have something to do with real navigation ?
What he said. Except that disabling Render Patch 7 does not correct the problem for me. Disabling all render patches does, as does rollback to v1.0.77.0. I have not yet fault-treed the render patches to isolate the cause. Concerned there might be more than one, and did not have time to test all combinations. I will do so later.
BigWalleye is offline   Reply With Quote
Old 03-27-13, 06:56 AM   #10
Vanilla
Lieutenant
 
Join Date: Nov 2006
Location: St. Petersburg, Russia
Posts: 264
Downloads: 73
Uploads: 0
Default

1/3 power (cube root) is to give lesser speed increase at greater speed orders. That is - less and less efficiency (speed increase) at greater and greater PS applies. Just look at the plot of the cube root.
NB: Cube root works well both for positive and negative ordered speeds as compared to even roots (that is why it is not square root - 1/2 power).


I will give my full analysis later, I am at it at the moment. My wild guess so far is that it is xmm2 you should tinker with to lower or increase the engine 'efficiency'.
Vanilla is offline   Reply With Quote
Old 03-27-13, 08:22 AM   #11
Vanilla
Lieutenant
 
Join Date: Nov 2006
Location: St. Petersburg, Russia
Posts: 264
Downloads: 73
Uploads: 0
SHO

Ok, here is the analysis:

Let's first derive the formula implied in the code:

speed = 30.99133 x cube_root[ (7432.328 / 559500) x (XMM2 + ordered_speed x XMM1) x (ordered_speed x XMM1)^2 ]

or:

speed = 30.99133 x 0.23683266 x cube_root[ (XMM2 + ordered_speed x XMM1) x (ordered_speed x XMM1)^2 ]

We can try to simplify it further but if we just insert this formula into excel/calc we will get to the following values (we drop the negative values since we cannot see what what is done with those from the code excerpt given):
Code:
0             0,00000
0,1          4,38442
0,2          7,55932
0,3          10,58301
0,4          13,54768
0,5          16,48260
0,6          19,40030
0,7          22,30711
0,8          25,20658
0,9          28,10086
1             30,99133
Now we can see that the speed goes way higher than expected max 12 knots. There should be some mechanism that limits either the speed or the orders. My guess that the game actually limits the order by 0,4 this gives 13,6 knots -- close to the max speed.
The other thing to see is that the combination of constants 3.913995 (xmm1) and 7432.328/559500 works so that the max speed at order 1.0 will be equal to the constant given later in the code (30.99133) if we change this number to, say, 20, the speed at 1.0 setting will be also 20 with speeds at other settings changing accordingly (@TDW this can be the answer to your question), at 0.4 setting the speed will be 8.7 knots.
What is puzzling is XMM2 which changes almost nothing. If we set it to 0 the max speed (30.99) will change only by 2 knots to 28 and the speed at 0.4 will be 11.49. Why this xmm2 variable is needed at all?

To put some logic into the formula here is my thinking:
  • 1/3 power (cube root) is used to make the curve that match reduced efficiency at greater power.
  • The 3.913995 number is the conversion coefficient for either PS or RPMs to knots. That is, for example 'we get 3.913995 knots per each 100 RPMs increase if we assume 100% efficiency.
  • The 30.99133 is theoretically possible max speed the sub can achieve. (Though it is puzzling why it is so huge? Surface speed with all the upgrades? Still too much).
  • xmm2 is a puzzle
  • The 7432.328 and 559500 are there just to balance the equation.
Vanilla is offline   Reply With Quote
Old 03-27-13, 09:23 AM   #12
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by Vanilla View Post
1/3 power (cube root) is to give lesser speed increase at greater speed orders. That is - less and less efficiency (speed increase) at greater and greater PS applies. Just look at the plot of the cube root.
NB: Cube root works well both for positive and negative ordered speeds as compared to even roots (that is why it is not square root - 1/2 power).
that makes perfect sense Thank you

Quote:
Originally Posted by Vanilla View Post
Ok, here is the analysis:

Let's first derive the formula implied in the code:

speed = 30.99133 x cube_root[ (7432.328 / 559500) x (XMM2 + ordered_speed x XMM1) x (ordered_speed x XMM1)^2 ]

or:

speed = 30.99133 x 0.23683266 x cube_root[ (XMM2 + ordered_speed x XMM1) x (ordered_speed x XMM1)^2 ]

We can try to simplify it further but if we just insert this formula into excel/calc we will get to the following values (we drop the negative values since we cannot see what what is done with those from the code excerpt given):
Code:
0             0,00000
0,1          4,38442
0,2          7,55932
0,3          10,58301
0,4          13,54768
0,5          16,48260
0,6          19,40030
0,7          22,30711
0,8          25,20658
0,9          28,10086
1             30,99133
Now we can see that the speed goes way higher than expected max 12 knots. There should be some mechanism that limits either the speed or the orders. My guess that the game actually limits the order by 0,4 this gives 13,6 knots -- close to the max speed.
The other thing to see is that the combination of constants 3.913995 (xmm1) and 7432.328/559500 works so that the max speed at order 1.0 will be equal to the constant given later in the code (30.99133) if we change this number to, say, 20, the speed at 1.0 setting will be also 20 with speeds at other settings changing accordingly (@TDW this can be the answer to your question), at 0.4 setting the speed will be 8.7 knots.
What is puzzling is XMM2 which changes almost nothing. If we set it to 0 the max speed (30.99) will change only by 2 knots to 28 and the speed at 0.4 will be 11.49. Why this xmm2 variable is needed at all?

To put some logic into the formula here is my thinking:
  • 1/3 power (cube root) is used to make the curve that match reduced efficiency at greater power.
  • The 3.913995 number is the conversion coefficient for either PS or RPMs to knots. That is, for example 'we get 3.913995 knots per each 100 RPMs increase if we assume 100% efficiency.
  • The 30.99133 is theoretically possible max speed the sub can achieve. (Though it is puzzling why it is so huge? Surface speed with all the upgrades? Still too much).
  • xmm2 is a puzzle
  • The 7432.328 and 559500 are there just to balance the equation
I will play around with the values to try and verify/figure out what this XMM2 variable is doing This is a great puzzle. I love trying to figure out why a programmer made the code the way they did. This one is one of those hmmmm types
I have to see if those same constants hold true when the sub is surfaced and using diesels for engine power. If so this could answer why the 30.99133 contant.
TheDarkWraith is offline   Reply With Quote
Old 03-27-13, 10:10 AM   #13
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
Default

Brilliant deductions, guys
gap is offline   Reply With Quote
Old 03-27-13, 01:25 PM   #14
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

@Vanilla: I think you are correct in that the speed in knots from the calculation is the theoretical maximum speed in knots by that engine alone. I did more testing:

VIIC surfaced (5m) with no snorkel using diesel engines (both available):

zeroes out XMM0
loads 1.0 into XMM2
Loads something dealing with engine into XMM1 (9.115489) <----- this number is a constant and does not change with ordered throttle settings. This number changes to a different value when using electric engines
multiplies XMM1 by ordered throttle (0.3) - ordered speed in range -1.0 to 1.0
XMM1 now equals 2.734647
compares XMM0 (0.0) to XMM1
if before or equal then jump to *1*
saves -1.0 to stack variable
jumps to *2*
*1* compares XMM1 to XMM0 (0.0)
if before or equal then jump to *3*
loads XMM2 (1.0) into stack variable
jumps to *2*
*3* loads XMM0 (0.0) into stack variable
*2* compares XMM0 (0.0) to XMM1
loads XMM1 into XMM0 (XMM0 now equals 2.734647)
if before or equal then jump to *4*
changes sign of XMM0
*4* loads constant 0.333333 (1/3) into ST0
adds XMM2 (1.0) to XMM0 (2.734647) thus XMM0 now equals 3.734647
divides XMM0 by 2387200.0 <---- this number is a constant and does not change with ordered throttle settings. This number changes to a different value when using electric engines
XMM0 = 1.564447e-06
multiplies XMM0 by 2840.155 <---- this number is a constant and does not change with ordered throttle settings. This number changes to a different value when using electric engines
XMM0 = 0.004443270
multiplies XMM0 (0.004443270) by XMM1 (2.734647)
XMM0 = 0.1215077
multiplies XMM0 (0.1215077) by XMM1 (2.734647)
XMM0 = 0.332280667
raises XMM0 to the 0.3333333 power (1/3 power) - a function is called to do this and it returns the value in ST0
ST0 = 0.321490681
multiplies ST0 by 50.26548 <---- this number is a constant and does not change with ordered throttle settings. This number changes to a different value when using electric engines
ST0 = 16.15988339 which is the new theoretical maximum speed of this engine in knots at this throttle setting
multiplies ST0 by stack variable
saves ST0 to engine's theoretical maximum speed in knots at this throttle setting to memory address

Notice the constants do not change with different throttle settings. They do change with engine type though (diesel or electric) so that further provides proof. The ordered throttle is the value defined in the unit's .cfg file under [EngineProperties]. I believe that lowering the value highlighted in yellow (or the one in cyan) over the player's career will account for engine wear over time. Agree I'm going to check to see if the game continually writes to this memory value or if it's static (only wrote to at game start).
TheDarkWraith is offline   Reply With Quote
Old 03-27-13, 08:22 AM   #15
LemonA
Lieutenant
 
Join Date: Jan 2012
Posts: 252
Downloads: 66
Uploads: 0
Default

american u-boat 1944: speed vs. duration

Formular y = 2.402133918·10^-6 x^6 - 2.480632527·10^-4 x^5 + 1.022176849·10^-2 x^4 - 2.159633693·10-1 x^3 + 2.53236561 x^2 - 18.08338354 x + 115.6332116

Battery capacity of type vii C maybe found in commanders handbook

some other info here
http://www.uboat.net/technical/batteries.htm
and her3
http://sourceforge.net/apps/trac/der...i/VIIbatteries

NYGM or GWX3 (SH3) have totally different calculations.
Ex. With ordered submerged speed 6 kts the battery lasts longer than 23 hours but the speed droppes off sharply etc.
__________________
Robert Schmidt, LTJG
U-43

Last edited by LemonA; 03-27-13 at 08:39 AM.
LemonA 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 12:00 AM.


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.