Ammo
A base class for creating Weapon.
Attributes:
Name | Type | Description |
---|---|---|
dm |
DragModel
|
DragModel for projectile |
mv |
Velocity
|
Muzzle Velocity |
powder_temp |
Temperature
|
Baseline temperature that produces the given mv |
temp_modifier |
float
|
Change in velocity w temperature: % per 15°C. Can be computed with .calc_powder_sens(). Only applies if: Settings.use_powder_sensitivity = True |
use_powder_sensitivity |
bool
|
Flag to allow to adjust muzzle velocity to the powder sensitivity |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dm
|
DragModel
|
drag model |
required |
mv
|
Union[float, Velocity]
|
muzzle velocity at given powder temperature |
required |
powder_temp
|
Optional[Union[float, Temperature]]
|
powder temperature |
None
|
temp_modifier
|
float
|
Change in velocity w temperature: % per 15°C. Can be computed with .calc_powder_sens(). Only applies if: Ammo.use_powder_sensitivity = True |
0
|
use_powder_sensitivity
|
bool
|
should adjust muzzle velocity using powder sensitivity |
False
|
Example
This is how you can create a weapon
from py_ballisticcalc import Ammo, Unit, DragModel
ammo = Ammo(
dm=DragModel(
bc=0.381,
drag_table=TableG7,
weight=Unit.Grain(300),
length=Unit.Inch(1.7),
diameter=Unit.Inch(0.338),
),
mv=Unit.MPS(815),
powder_temp=Unit.Celsius(15),
temp_modifier=0.123,
use_powder_sensitivity=True,
)
Source code in py_ballisticcalc\munition.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
|
use_powder_sensitivity
class-attribute
instance-attribute
¶
use_powder_sensitivity: bool = use_powder_sensitivity
calc_powder_sens ¶
calc_powder_sens(other_velocity: Union[float, Velocity], other_temperature: Union[float, Temperature]) -> float
Calculates velocity correction by temperature change; assigns to self.temp_modifier
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other_velocity
|
Union[float, Velocity]
|
other velocity at other_temperature |
required |
other_temperature
|
Union[float, Temperature]
|
other temperature |
required |
Returns:
Type | Description |
---|---|
float
|
temperature modifier in terms %v_delta/15°C |
Example
powder_sensitivity = ammo.calc_powder_sens(
Unit.MPS(830),
Unit.Celsius(200)
)
Source code in py_ballisticcalc\munition.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
|
get_velocity_for_temp ¶
get_velocity_for_temp(current_temp: Union[float, Temperature]) -> Velocity
Calculates muzzle velocity at temperature, based on temp_modifier.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
current_temp
|
Union[float, Temperature]
|
Temperature of cartridge powder |
required |
Returns:
Type | Description |
---|---|
Velocity
|
Muzzle velocity corrected to current_temp |
Example
muzzle_velocity = ammo.get_velocity_for_temp(
Unit.Celsius(200)
)
Source code in py_ballisticcalc\munition.py
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
|