Week 4 and 5

This commit is contained in:
Aidan Sharpe
2025-02-24 22:16:41 -05:00
parent e95865b7e3
commit 9b4f36ab47
99 changed files with 117460 additions and 2 deletions

View File

@@ -16,7 +16,7 @@ def pressure(altitude):
if altitude > 25000:
kpa = 2.488 * ((T+273.1)/216.6)**(-11.388)
elif altitude > 11000:
kpa = 22.65 * np.exp(1.73 - 0.000157*alititude)
kpa = 22.65 * np.exp(1.73 - 0.000157*altitude)
else:
kpa = 101.29 * ((T+273.1)/288.08)**5.256
return 1000*kpa

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 KiB

After

Width:  |  Height:  |  Size: 222 KiB

View File

@@ -1,4 +1,4 @@
import atmospheric_model as atmos
import atmosphere as atmos
import axial_drag
import numpy as np
import matplotlib.pyplot as plt

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,45 @@
import numpy as np
import matplotlib.pyplot as plt
TARGET_RANGE = 20E3
MIN_RANGE = 2E3
MIN_DELAY = 5
T_HOMING = 8
V_MISSILE = 700
def depth_of_fire(target_range, min_range, t_homing, v_target, v_missile):
t_engagement = (target_range - min_range) / v_target
t_flight = target_range / (v_missile + v_target)
return (t_engagement + t_flight)/t_homing
def launch_delay(t_homing, v_missile, v_target):
return t_homing*(1 + v_target/v_missile)
def main():
# Range of target speeds from 0 to 1200 (inclusive)
v_target = np.arange(1200+1)
# Delta T_L for each target speed
t_L = launch_delay(T_HOMING, V_MISSILE, v_target)
plt.plot(v_target, t_L, label=r"$\Delta T_L$")
plt.hlines(0, v_target[-1], MIN_DELAY, label=r"$\Delta T_{L_\text{min}}$", color='r')
plt.legend()
plt.savefig("launch-delay.png")
plt.show()
dof = depth_of_fire(TARGET_RANGE, MIN_RANGE, T_HOMING, v_target, V_MISSILE)
print("DOF for V_T=200:", depth_of_fire(TARGET_RANGE, MIN_RANGE, T_HOMING, 200, V_MISSILE))
plt.plot(v_target, dof, label="Depth of Fire")
plt.savefig("depth-of-fire.png")
plt.show()
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,73 @@
---
title: Weapon Systems Homework 3
author: Aidan Sharpe
date: February 17th, 2025
geometry: margin=1in
---
# 1. Rocket Motor Equation
```python
def specific_impulse(v_burnout, w_launch, w_burnout):
return v_burnout / (g*np.log(w_launch/w_burnout))
def main():
v_burnout = 1000
w_rocket = 300
w_propellant_0 = 800
w_lauch = w_rocket + w_propellant_0
I_sp = specific_impulse(v_burnout, w_lauch, w_rocket)
v_exit = I_sp * g
print("I_sp:", I_sp)
print("V_e:", v_exit)
# Assume constant weight flow rate
a_burnout = 18*g
weight_flow_rate = a_burnout*w_rocket/v_exit
dt = 0.1
t = np.arange(0, 12, dt)
w_propellant = w_propellant_0 - weight_flow_rate*t
w_propellant = np.maximum(w_propellant, 0)
thrust = weight_flow_rate*v_exit/g
w_total = w_rocket + w_propellant
# Acceleration in g is force/weight
acceleration_g = thrust/w_total
v_no_gravity = np.cumsum(acceleration_g*g)
v_gravity_45_x = v_no_gravity*np.cos(np.pi/4)
v_gravity_45_y = v_no_gravity*np.sin(np.pi/4) - np.cumsum(g*np.ones_like(acceleration_g))
v_gravity_45 = np.sqrt(v_gravity_45_x**2 + v_gravity_45_y**2)
```
$I_{SP} = 78.46$
$V_e = 769.66$
![](rocket_motor.png)
# 2. Projectile with Attack Angle
I have been re-writing the math from the cannonball exercise to make it easier to expand in the future. For this reason, I am still working on my simulation routine:
```python
def simulate(mass, position, velocity, acceleration, attack_angle):
altitude = position[1]
speed = np.linalg.norm(velocity, 2)
Mach = atmosphere.Mach(altitude, speed)
axial_drag = np.array([-axial_drag.CA(Mach), 0])
dynamic_pressure = atmosphere.dynamic_pressure(altitude, velocity)
elevation = np.atan(velocity[1]/velocity[0]) + attack_angle
gravity = mass*g*np.array([np.cos(-angle-np.pi/2), np.sin(-angle-np.pi/2)])
normal_force = np.zeros(2)
normal_force[1] = TARGET_ACCEL - np.linalg.norm(axial_drag + gravity, 2)
```

View File

@@ -0,0 +1,14 @@
import numpy as np
import matplotlib.pyplot as plt
def main():
if __name__ == "__main__":
main()

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -0,0 +1,101 @@
---
title: Lecture 5 Homework
author: Aidan Sharpe
date: February 24th, 2025
geometry: margin=1in
---
### 1.1 What are the individual principles used to create a balanced weapon system?
The weapon system should be robust, simple, and predictable.
### 1.2 Name three of the measures of weapon effectiveness.
Weapon systems may be measured in terms of circular error probability ($\text{CEP}_\text{XX}$), probability of mission kill ($P_\text{MK}$), probability of guidance ($P_G$), and probability of hit, damage, or kill ($P_H$, $P_D$, $P_K$).
### 1.3 Is the ENU coordinate system in invariant?
No, because all three directions (East, North, and up) are dependent on where on the surface you are.
### 1.4 Assume only one illuminator and one launcher in the combat system, what two limitations of the combat system determine the depth of fire?
With only one illuminator, only one semi-active missle can be supported at a time. With only one launcher, the time between firings is limited by the the launchers minimum time between missile launches ($\Delta T_{L_\text{min}}$).
### 1.5 What are the two main philosophies in weapon scheduling? How are they different?
#### Quickdraw
Shoot early and often to maximize the number of shot opportunities.
#### Sharpshooter
Maximize the performance of every shot by trading firing rate for shot quality.
### 2.1 Delay between missile launches ($\Delta T_L$)
$$\Delta T_L = T_H \left(1 + \frac{v_t}{v_m}\right)$$
```python
import numpy as np
import matplotlib.pyplot as plt
MIN_DELAY = 5
T_HOMING = 8
V_MISSILE = 700
def launch_delay(t_homing, v_missile, v_target):
return t_homing*(1 + v_target/v_missile)
def main():
# Range of target speeds from 0 to 1200 (inclusive)
v_target = np.arange(1200+1)
# Delta T_L for each target speed
delays = launch_delay(T_HOMING, V_MISSILE, v_target)
plt.plot(v_target, delays, label=r"$\Delta T_L$")
plt.hlines(0, v_target[-1], MIN_DELAY,
label=r"$\Delta T_{L_\text{min}}$", color='r')
plt.legend()
plt.savefig("launch-delay.png")
plt.show()
```
![](./launch-delay.png)
Since the homing time is longer than the minimum time between missile launches, there is no such target speed where $\Delta T_{L_\text{Min}} = \Delta T_L$.
### 2.2 Depth of Fire
$$\text{TET} = \frac{\text{ROF} - R_\text{min}}{V_T}$$
$$\text{TOF}_1 = \frac{\text{ROF}}{V_M + V_T}$$
$$\text{DOF} = \frac{\text{TET} + \text{TOF}_1}{T_H} + 1$$
```python
import numpy as np
import matplotlib.pyplot as plt
TARGET_RANGE = 20E3
MIN_RANGE = 2E3
MIN_DELAY = 5
T_HOMING = 8
V_MISSILE = 700
def depth_of_fire(target_range, min_range, t_homing, v_target, v_missile):
t_engagement = (target_range - min_range) / v_target
t_flight = target_range / (v_missile + v_target)
return (t_engagement + t_flight)/t_homing
def main():
# Range of target speeds from 0 to 1200 (inclusive)
v_target = np.arange(1200+1)
dof = depth_of_fire(TARGET_RANGE, MIN_RANGE, T_HOMING, v_target, V_MISSILE)
print("DOF for V_T=200:", depth_of_fire(TARGET_RANGE, \
MIN_RANGE, T_HOMING, 200, V_MISSILE))
plt.plot(v_target, dof, label="Depth of Fire")
plt.savefig("depth-of-fire.png")
plt.show()
```
![](./depth-of-fire.png)
DOF, where $V_T = 200$[m/s] is 14.0278 shots.

View File

@@ -0,0 +1,73 @@
import numpy as np
import matplotlib.pyplot as plt
import axial_drag
import atmosphere
WEIGHT = 200
DIAMETER = 0.15
ATTACK_MAX = np.radians(40)
MAX_TIME = 100
T_s = 0.1
ANGLES = np.arange(10, 60+1, 5)
g = 9.81
TARGET_ACCEL = 30*g
def new_attack_angle(normal_force, dynamic_pressure, area):
C_N_alpha = 15
C_N = normal_force/(dynamic_pressure*area)
attack_angle = C_N_alpha / C_N
return min(attack_angle, ATTACK_MAX)
def simulate(mass, position, velocity, acceleration, attack_angle):
#altitude = position[1]
#speed = np.linalg.norm(velocity, 2)
#Mach = atmosphere.Mach(altitude, speed)
#axial_drag = np.array([-axial_drag.CA(Mach), 0])
#
#dynamic_pressure = atmosphere.dynamic_pressure(altitude, velocity)
#
#elevation = np.atan(velocity[1]/velocity[0]) + attack_angle
#gravity = mass*g*np.array([np.cos(-angle-np.pi/2), np.sin(-angle-np.pi/2)])
#
#normal_force = TARGET_ACCEL - np.linalg.norm(axial_drag + gravity, 2)
position += velocity*T_s + 0.5*acceleration*T_s**2
velocity += acceleration*T_s
return position, velocity, acceleration
def main():
t = np.arange(0, MAX_TIME, T_s)
speed = 600
accel = np.array([0, -g])
mass = 200
attack_angle = np.radians(40)
step = 1
t = np.arange(0, 100, T_s)
pos = np.zeros((len(t), 2))
vel = np.zeros_like(pos)
vel[0] = speed*np.array([np.cos(np.pi/4), np.sin(np.pi/4)])
while step < len(pos) and pos[step-1][1] >= 0:
vel[step] = vel[step-1] + accel*T_s
pos[step] = pos[step-1] + vel[step]*T_s + 0.5*accel*T_s**2
step += 1
plt.plot(t, pos[:,1])
plt.show()
if __name__ == "__main__":
main()

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View File

@@ -0,0 +1,66 @@
import numpy as np
import matplotlib.pyplot as plt
g = 9.81
# F = W*V_e / g
# I_SP = V_e / g
# V_burnout = 1000 = I_SP*G ln(W_L/W_BO)
def specific_impulse(v_burnout, w_launch, w_burnout):
return v_burnout / (g*np.log(w_launch/w_burnout))
def main():
plt.figure(figsize=(16,9))
v_burnout = 1000
w_rocket = 300
w_propellant_0 = 800
w_lauch = w_rocket + w_propellant_0
I_sp = specific_impulse(v_burnout, w_lauch, w_rocket)
v_exit = I_sp * g
print("I_sp:", I_sp)
print("V_e:", v_exit)
# Assume constant weight flow rate
a_burnout = 18*g
weight_flow_rate = a_burnout*w_rocket/v_exit
dt = 0.1
t = np.arange(0, 12, dt)
w_propellant = w_propellant_0 - weight_flow_rate*t
w_propellant = np.maximum(w_propellant, 0)
thrust = weight_flow_rate*v_exit/g
w_total = w_rocket + w_propellant
# Acceleration in g is force/weight
acceleration_g = thrust/w_total
v_no_gravity = np.cumsum(acceleration_g*g)
v_gravity_45_x = v_no_gravity*np.cos(np.pi/4)
v_gravity_45_y = v_no_gravity*np.sin(np.pi/4) - np.cumsum(g*np.ones_like(acceleration_g))
v_gravity_45 = np.sqrt(v_gravity_45_x**2 + v_gravity_45_y**2)
plt.subplot(411)
plt.plot(t, w_propellant)
plt.ylabel("Propellant weight [N]")
plt.subplot(412)
plt.plot(t, acceleration_g)
plt.ylabel("Acceleration [g]")
plt.subplot(413)
plt.plot(t, v_no_gravity)
plt.ylabel("Velocity w/o gravity [m/s]")
plt.subplot(414)
plt.plot(t, v_gravity_45)
plt.ylabel(r"Velocity w/ gravity [m/s]")
plt.xlabel("Time [s]")
plt.savefig("rocket_motor.png")
plt.show()
if __name__ == "__main__":
main()