www.navalism.org

General and Administrative Discussion => Knowledge Base => Topic started by: Nobody on February 27, 2010, 02:25:50 PM

Title: A little Gun, Shell & Range calculation Tool
Post by: Nobody on February 27, 2010, 02:25:50 PM
Quite some time ago (end of 2008) I wrote a little program to estimate parameters and range of naval guns.

It's far from finished since I originally wanted to write something like an improved NAaB, but nevertheless tell me what you think.

http://www.navalism.org/resources/Ballistic.zip (http://www.navalism.org/resources/Ballistic.zip)
And thanks to Guinness for uploading the file.

Edit, guess I should add a description
Using caliber the program calculates a shell weight-range based on severals OTL projectiles. Together with barrel length (and mean gas pressure) it can estimate the shell velocity. With those the range of the gun is calculated.
The "improved calculation" takes air pressure (depending on height) and non-flat earth surface (at least partly) into account.
Main issue is air drag, which is assumed as constant because I'm missing a formula that could give me a f(v), with v in Mach, relationship.
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: TexanCowboy on February 27, 2010, 07:54:57 PM
No armour penetration screen is showing up...is that intentional? It just shows a giant blank...
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: Nobody on February 28, 2010, 01:11:57 AM
Quote from: TexanCowboy on February 27, 2010, 07:54:57 PM
No armour penetration screen is showing up...is that intentional? It just shows a giant blank...
Yes, thats only a placeholder right now as I never had the time trying to implement an "interface" which would allow to forward the data to Nathan Okun's programs. Any idea how to do this without rewriting them is appreciated.
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: TexanCowboy on February 28, 2010, 07:37:21 AM
Not a techy person, but you could use the idea Guinness had on his spreadsheet...

Much appriciated for range, though
Title: Little Gun, Shell & Range calculation Tool "v2"
Post by: Nobody on March 08, 2010, 02:38:14 PM
I have made some improvements to the program and added a few missing functions, especially for the users of imperial units.

Please tell me if there's still something wrong, if you think something is missing or if you other ideas.

Edit:
Guinness replaced the file, so the link is the same as above.
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: miketr on March 08, 2010, 05:20:53 PM
One thing we will need for N4 and odds are should have now is a set of penetration tables to cover non standard weapons such as stuff like 400mm L45's people are working on or 305mmL55 if someone want to build them and so on.  I have trouble using NAaB program are there some people that have some skill with that would be willing to generate some tables for us to use? 
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: TexanCowboy on March 08, 2010, 05:54:30 PM
This! As soon as Nobody can figure out how to do the penetration tables, we can use this. Tables are unnessasary when you have a program!
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: miketr on March 08, 2010, 06:21:03 PM
The tables are helpful for standard weapons program is for odd ball weapons.  Also we need tables to make sure there is no confusion as to what a given gun can do.  As noted above I have trouble with that program and its very easy to put in bad data and get bad results.  Don't want to deal with people going my gun should be able to defeat X" / Ymm of armor and the people moderating a battle think otherwise.
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: Desertfox on March 08, 2010, 09:29:36 PM
QuoteMain issue is air drag, which is assumed as constant because I'm missing a formula that could give me a f(v), with v in Mach, relationship.
What exactly do you need? I might be able to help you with this point.
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: P3D on March 08, 2010, 09:53:35 PM
NaAB ballistics code is based on the MCTRAJ code written in BASIC. It is available, JGI.

a/ Several range calculation option - 1000m/yards, every 5000m etc, even custom ranges, you need to iterate anyways
b/ target armor plate angle/inclination option
c/ Make the data coloumns to be displayed customizable
d/ COPY/PASTE (to clipboard) option
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: miketr on March 08, 2010, 10:43:46 PM
1,000 yard or 2,000 yard range brackets would be best for any tables.
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: Nobody on March 09, 2010, 03:26:58 AM
Quoted/ COPY/PASTE (to clipboard) option
It should already be possible to copy the table to the clipboard (however the fixed lines/rows are missing) - you want me to "unfix" them?

Quote from: Desertfox on March 08, 2010, 09:29:36 PM
QuoteMain issue is air drag, which is assumed as constant because I'm missing a formula that could give me a f(v), with v in Mach, relationship.
What exactly do you need? I might be able to help you with this point.
Well the force that's slowing down the projectile ("air drag") can be calculated with
F = 0.5 * rho * Cw * A * v^2
With A defined by the caliber, speed v and air density rho already known/calculated, all that's missing is a better drag coefficient Cw.
Good would be a function which gives an additional speed dependent (expressed in Mach) modifier which could be multiplied with the constant "low-speed-Cw".
Also good would be a function that gives a Cw-value depending shell form, so you could input the crh instead of an obscure constant (Cw).
Best would be a combination of both.

MCTRAJ (at least the version I found) isn't of much help, because it requires you to input the values I want to know.

You really want the program to iterate to give you "nice" range-tables? Ok, that can be done but till now I avoided it to prevent too long calculations.
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: P3D on March 09, 2010, 10:42:12 AM
Quote from: Nobody on March 09, 2010, 03:26:58 AM
Quoted/ COPY/PASTE (to clipboard) option
It should already be possible to copy the table to the clipboard (however the fixed lines/rows are missing) - you want me to "unfix" them?

Quote from: Desertfox on March 08, 2010, 09:29:36 PM
QuoteMain issue is air drag, which is assumed as constant because I'm missing a formula that could give me a f(v), with v in Mach, relationship.
What exactly do you need? I might be able to help you with this point.
Well the force that's slowing down the projectile ("air drag") can be calculated with
F = 0.5 * rho * Cw * A * v^2
With A defined by the caliber, speed v and air density rho already known/calculated, all that's missing is a better drag coefficient Cw.
Good would be a function which gives an additional speed dependent (expressed in Mach) modifier which could be multiplied with the constant "low-speed-Cw".
Also good would be a function that gives a Cw-value depending shell form, so you could input the crh instead of an obscure constant (Cw).
Best would be a combination of both.

MCTRAJ (at least the version I found) isn't of much help, because it requires you to input the values I want to know.

You really want the program to iterate to give you "nice" range-tables? Ok, that can be done but till now I avoided it to prevent too long calculations.

Just use the form factor values that are in NaAB? Those values, however, contain a factor for cross-sectional density.
Your main problem is getting c_w values for the shell from somewhere else. Which is generally determined by wind tunnel tests and/or CFD computation. I don't believe there would be an open-source formula available. So ask Steve how he did it in NAaB. IMHO.
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: Nobody on March 18, 2010, 04:18:28 AM
Well I can't really hope to make exact calculations, so a good estimate would be ok. And as long as we use it to design guns for game purposes we would "only" have to decide on functions representing the game tech levels.

While searching for "MCTRAJ" I found this (http://www.jbmballistics.com/downloads/downloads.shtml) page. The drag functions available there are more or less what I'm looking for.
I put them into an excel file for visualization. Most interesting might be
the Sphere, for "ball" projectiles
G1 for simple/early shells
G7 for for special long-range projectiles
and one or two of the other functions except GI for shells from around the 1920's

Anyone capable of finding not too complex functions to calculate them?
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: Nobody on March 23, 2010, 02:32:37 AM
After some work I'm happy to present you a much awaited feature (well at least by two people, miketr and P3D) - custom Range-Steps and several other changes (details in the version history). The file (http://www.navalism.org/resources/Ballistic.zip) was updated by Guinness several hours ago. While the new range calculation/iteration seems to work just fine so far, there might be quite a few "holes" in it that might cause unwanted behavior or in worst case, prevent the program from termination, so feedback is needed.
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: miketr on March 23, 2010, 08:28:50 AM
Some feed back.

1) Running windows XP with a 1.6 gig  AMD dual core and 1 gig of ram.  No problems with the program.

2) Perhaps a drop down menu for Caliber L35 to L60 in steps of L5?  I am not sure which we should use Bore Length of Rifle Length. 

3) Whenever you get around to penetration table I would have it use just the Krupp Cement type to start with.
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: Nobody on March 23, 2010, 06:18:58 PM
Quote from: miketr on March 23, 2010, 08:28:50 AM
Some feed back.

1) Running windows XP with a 1.6 gig  AMD dual core and 1 gig of ram.  No problems with the program.
Finally :D Thanks
Not much different from my machine, at least it doesn't seem to need any special libraries (in contrast to SpringSharp which requires .net). I suppose you have neither Lazarus nor FreePascal installed?
Someone with with Win9x, Vista or 7? Anyone with a slower computer (e.g. an Atom?). The range iteration should slow down calculation by a factor of 5 to 10 (much better than I feared btw).

Quote
2) Perhaps a drop down menu for Caliber L35 to L60 in steps of L5?  I am not sure which we should use Bore Length of Rifle Length. 
That would make sense if used as a gun design tool that's supposed to enforce some kind of rules, but when I wrote it I just wanted to have maximum flexibility. Maybe a "default to Lx"?
I'm not sure about bore or rifling length either, as the first is probably too long and the second too short. You might realize that I'm using some kind of intermediate right now. There is also the difference between the two major gun types (German style "quick fire" sliding breech block with brass casing and US/UK "Welin breech block").

Quote
3) Whenever you get around to penetration table I would have it use just the Krupp Cement type to start with.
About that. I finally contacted Steve and got an answer right away. He actually rewrote the complete code to use it. Considering that "FaceHard" alone has ~220 kB of source code this is not happening anytime soon. If I do this it would have to be a much, much simpler formula, at least for the beginning (who wants to choose one? (http://www.navweaps.com/index_nathan/index_nathan.htm)). I might however be doing deck penetration "the right way" by rewriting either M79APCLC, FLATNOSE or TPRFLTNS - any preference?
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: P3D on March 23, 2010, 07:39:27 PM
IMO no need to implement a gun rule now, you might want to that later - e.g. with my muzzle energy formula that fits all modern (1898-1945) guns pretty well or its metric equivalent (which I am now too lazy to calculate, maybe later).

To choose penetration formula.
Use the last one (F- formula) as it has obliquity in it for starters.
Later, you could borrow from the FACEHARD code for a given shell family (e.g. Greenboy) and just ignore the rest.

Title: Re: A little Gun, Shell & Range calculation Tool
Post by: Nobody on March 25, 2010, 07:51:13 AM
Quote from: P3D on March 23, 2010, 07:39:27 PM
IMO no need to implement a gun rule now, you might want to that later
I'm of the same opinion.

Quotewith my muzzle energy formula that fits all modern (1898-1945) guns pretty well or its metric equivalent (which I am now too lazy to calculate, maybe later).
Well I prefer my own way of calculation, so I see no real need to implement a second one. And you can already compare the result with the table in the rules since the necessary value is displayed in a compatible form.

Quote
To choose penetration formula.
Use the last one (F- formula) as it has obliquity in it for starters.
Later, you could borrow from the FACEHARD code for a given shell family (e.g. Greenboy) and just ignore the rest.

Done. The F-formula that is. Now you all only have to wait for Guinnes to update the file ;D.
I used it for both deck and belt penetration (it's not meant for face-hard armor anyway) with the same constant for now.
For future use I'm thinking about adding separate constants for shell and armor, as well modifications to the formula that would allow represent some more sophisticated material properties (e.g. how much obliquity influences penetration or not).

EDIT:
The file has been updated and is now available for download. Link is the same as above: http://www.navalism.org/resources/Ballistic.zip (http://www.navalism.org/resources/Ballistic.zip)
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: TexanCowboy on March 25, 2010, 04:19:16 PM
Works pretty well. I'm having some trouble with a few things, but I'm pretty sure it is user error, with the F-code and such. One thing I could ask is if it was possible to insert a inch-millimeter converter? A inch is 25.4 millimeters, and it would probebly be most useful if it was in half-step inchs or below...could you set that up the same way you did with range? Thanks.
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: Nobody on March 27, 2010, 10:52:35 AM
Quote from: TexanCowboy on March 25, 2010, 04:19:16 PM
Works pretty well. I'm having some trouble with a few things, but I'm pretty sure it is user error, with the F-code and such.
If you could tell me what kind of error/problem you have then I might be able to help you and maybe prevent the error from happening in future versions.
About the F: It's just a generic number I choose because it gives result that are not completely unreasonable. Suggestions for better values depending on shell are armour type are welcome. (the value represents something like a steel quality factor, smaller value giver higher results and a higher value lower penetration)

QuoteOne thing I could ask is if it was possible to insert a inch-millimeter converter? A inch is 25.4 millimeters, and it would probebly be most useful if it was in half-step inchs or below...could you set that up the same way you did with range? Thanks.
While I think that these useless, confusing and annoying imperial should have been abolished long ago ;D, it's not like I don't know what an inch is ;)(there are after all quite a number of inches already) and I will probably add penetration results in inch as well in the near future.

Quoteinch-millimeter converter
You mean like a pocket-calculator on a separate page or window?

Penetration steps... yea, it's not like I wouldn't understand why you want them (ever played "Seas of War"?) but it not as easy as you think, because those codes are pretty much independent right now and the "range-step" code isn't even working properly.
Besides, wouldn't it be much simpler and faster to use very small (elevation) steps and than pick the right value from the table?
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: TexanCowboy on March 27, 2010, 03:51:40 PM
F-code. My main error is probebly my own. I don't know wheather the .500 represents armour or shell size, and I don't know, perchance, what .500 is in terms of armour or shell by quality in error. Is that Civil War, World War I, World War II?

For Inches, if you could set it up as you did with meters and yards, I would be most appricative.

Great Job you are doing! :)
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: Nobody on March 27, 2010, 04:22:27 PM
I think I understand your problem now - I should write a manual :D

It's supposed to work this way:
1. Set the desired gun properties (Caliber, length, shell weight (check the reasonable range by clicking on the "?"-button) and the muzzle velocity (or calculate it by choosing bore and rifling length and average gas pressure(usually between 1200 and 1500 bar)).
2. Choose max and min elevation and set the average air drag coefficient.
3. "Testfire" your new gun. You should see the results in the table.
4. Choose "F", a constant that's supposed to represent both shell and armor quality and hit the button. It should now calculate the penetration for each of the previous calculated ranges (you can easily combine the two tables in excel). With F=0.5 I get ~1.5 calibers penetration at close range - not too much or too less, but far from accurate.
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: TexanCowboy on March 27, 2010, 04:23:43 PM
I know. But how does the F work. What is standard for the time period? .5, .6, .7?
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: Nobody on August 31, 2010, 11:47:11 AM
After a long time I have an update for you.
The file was already updated, the link remains the same http://www.navalism.org/resources/Ballistic.zip (http://www.navalism.org/resources/Ballistic.zip) (thank Guinness).

So what did change?
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: Sachmle on August 31, 2010, 01:48:44 PM
Bravo Nobody!! I love it so far. Keep up the good work. As to your 'value' table, I think P3D had some baseline's for that.
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: Carthaginian on August 31, 2010, 05:35:44 PM
It looks like soon we might have an 'official' gun creation tool for N-verse.
Awesome work, Nobody... THANK YOU!
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: snip on August 31, 2010, 05:53:12 PM
Ive been playing with it sporadically...and I like it  ;D

I am however a bit confused on a few of the constants that the program asks for...TO THE LIBRARY/GOOGLE! (or if anyone here would like to help out...)
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: Nobody on September 01, 2010, 02:39:46 AM
Quote from: snip on August 31, 2010, 05:53:12 PM
Ive been playing with it sporadically...and I like it  ;D

I am however a bit confused on a few of the constants that the program asks for...TO THE LIBRARY/GOOGLE! (or if anyone here would like to help out...)
If you could be more specifically...?
But you are right in a sense. Right now it's not supposed to work "stand alone". It's more like "search for a similar gun, input ALL necessary data, fix the pressure and find a good approximation for the cw-value, then sim your own gun". And if you can tell us what you found (pressure, cw and whether or not the shell weight was covered by the program).


P.S.:
Just found a major error in the calculation for very flat impact (were penetration is effectively zero).
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: Nobody on September 02, 2010, 07:42:34 AM
Okay another major update, and probably the last one for some time. Guinness already replaced the file (http://www.navalism.org/resources/Ballistic.zip (http://www.navalism.org/resources/Ballistic.zip)).

It is now possible to use speed depended air drag. However the interpolation between datapoints is far from perfect, since the quadratic approximation(any better ideas how to do this?) I wrote creates ripple. Even worse, sometimes it seems to be buggy and creates a non-continuous graph (see function "x", which I added for debugging purposes) which should be impossible and I can't find the error because the debugger refuses to work inside that particular unit.
For further details look in the version history (e.g. by pressing F1).


Quote from: Carthaginian on August 31, 2010, 05:35:44 PM
It looks like soon we might have an 'official' gun creation tool for N-verse.
Awesome work, Nobody... THANK YOU!
But only if you don't want to use it for penetration calculations directly. After adjusting the parameters (for the trajectory this is precise by a few percent!) and penetration for a certain distance(e.g. 1000 m) I found that for other distances the penetration was off by a factor of 2 to 3! (in this case belt penetration was only ~3" @30000 m but should have been 8"!) So problem lies within the "F-formula" and I can only advise to forward the ballistic data to a program like FaceHard.
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: snip on September 02, 2010, 11:52:08 AM
What im really confused on is exactly what the drag coefficient represents. Also I have noticed that there is a few boxes in the metric colom that don't change to match there imperial values wile others do.
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: Nobody on September 02, 2010, 12:45:13 PM
Quote from: snip on September 02, 2010, 11:52:08 AM
What im really confused on is exactly what the drag coefficient represents.
http://en.wikipedia.org/wiki/Drag_coefficient (http://en.wikipedia.org/wiki/Drag_coefficient)

QuoteAlso I have noticed that there is a few boxes in the metric colom that don't change to match there imperial values wile others do.
That should not be the case. It would be helpful if you could tell me which one.
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: snip on September 02, 2010, 12:58:17 PM
The rifleing box was the only one that look wrong to me. I can check the others later
Title: A little Gun, Shell & Range calculation Tool
Post by: Nobody on September 13, 2010, 03:01:00 PM
Another update (http://www.navalism.org/resources/Ballistic.zip (http://www.navalism.org/resources/Ballistic.zip)).
Apart from some little things, the interpolation between datapoints know works smoothly.


P.S.:
In the meantime I have added a "Save" and "Load" functionality and some other things, but it's not working properly, meaning saving works fine but after loading a gun the program crashes on the next occasion with what seems like no reason at all.
I don't like publishing something that doesn't work, but if you want to test it well maybe it could be made available in a different location as "Alpha" or something?
Title: Ballistics - How to add angles?
Post by: Nobody on July 02, 2011, 06:43:14 AM
I'm planning to continue working on this project - maybe as a definitive gun design tool for N4 (?) - and was wondering how I could "add" angles. That is: the "angle of fall" of the projectile, the sloop of the armor and the deflection of the target ship. I should be able to figure it out eventually, but maybe someone already knows a way to do this? If so, please tell me!
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: Logi on July 02, 2011, 10:19:39 AM
I got it n my program, but it tracks the movement of the shell step-by-step, so it can easily tell you the angle of impact. It may not work for your program, depending on your approach.
Title: Re: Ballistics - How to add angles?
Post by: P3D on July 03, 2011, 10:27:21 AM
Quote from: Nobody on July 02, 2011, 06:43:14 AM
I'm planning to continue working on this project - maybe as a definitive gun design tool for N4 (?) - and was wondering how I could "add" angles. That is: the "angle of fall" of the projectile, the sloop of the armor and the deflection of the target ship. I should be able to figure it out eventually, but maybe someone already knows a way to do this? If so, please tell me!

It is fairly straightforward, although non-trivial. At the end, you have two planes crossing - the vertical plane of the shell trajectory, and an arbitrary plane of the armored plate.
First step, make an angle of incidence calculator that takes only angle of fall and target bearing into account. The math is the same for the original problem.

Or dig up your linear algebra textbooks, and treat the problem as a series of rotations in 3D.
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: Nobody on August 07, 2011, 02:20:01 AM
Because Tanthalas said:
Quote from: Tanthalas on August 03, 2011, 01:03:44 PM
its a cool thing to have around to play with.
I thought it might be a good idea to look at it again and make some improvements. I don't have much time for testing though. So please have some more fun and report any error/bug you find:
http://www.navalism.org/resources/Ballistic-v2.zip (http://www.navalism.org/resources/Ballistic-v2.zip)

Should you encounter a serious problem, then there is still the previous (http://www.navalism.org/resources/Ballistic.zip) one.

EDIT:
Click "About" to see the latest changes.
These include a "create a gun with given nominal length" for which the bore diameter and the date of design should be set beforehand, and a untested potentially buggy save & load functionality.
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: Tanthalas on August 14, 2011, 08:13:02 PM
it apears to work just fine on my box anyway mate.
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: Tanthalas on August 31, 2011, 05:44:39 PM
so while messing aorund with your tool Nobody, I ran into what might be an issue with it.  Armor Penitration apears to be right but im getting what apears to be anomolus Data for Deck Penitration.  I was using the UKs 12/25 as a testing gun and realised the max Deck Armor it could penitrate acording to the tool was .9 inch.  I tryed the same gun in both versions with the same result.
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: Nobody on September 01, 2011, 01:15:35 AM
Well the penetration function uses the rather primitive "F-Formula", which I think isn't satisfying at all. Most importantly however, is that the constant it uses has not been calibrated yet.

So, if you find a value which gives reasonable results for several guns from a certain era, we would love to know it.

Something similar applies to the air drag, were we still need to determine which function with which constants & factors should be applied to guns of different generations.


EDIT
I would like to point out that saving and loading seems to work properly now. If you encounter any problems, don't hesitate and report them. Thank you.
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: miketr on September 19, 2011, 12:04:58 PM
I have a number of reservations about using this program but will play around with it some more and talk to Guinness and Charles.

Michael
Title: Re: A little Gun, Shell & Range calculation Tool
Post by: Nobody on September 19, 2011, 02:37:36 PM
Quote from: miketr on September 19, 2011, 12:04:58 PM
I have a number of reservations about using this program but will play around with it some more and talk to Guinness and Charles.
I was about too agree to that, considering the current, very technical approach.
But then I remembered that save & load works now. So you could offer save files pre-setted to a certain tech level. Then all the user would have to do is to choose a caliber, run the barrel length script and set the shell weight.

That still leaves room for some improvements and the question whether the "F-Formula" is a good choice and which alternatives could be approached.