11from cmath import isinf , isnan
22import numpy as np
33import Air
4- from Universe import vol_sphere , molar_mass_he , g , R
4+ from Universe import radius_sphere , vol_sphere , molar_mass_he , g , R
55from Instrument import probe
66'''
77Mass: Kilogram
@@ -22,6 +22,9 @@ class Balloon():
2222 # Balloon Mass
2323 m_balloon : float = 2000e-3
2424
25+ # Initial Gas Volume
26+ vol_gas_i : float = 9
27+
2528 # Balllon Initial Radius
2629 r_i : float = 1.4 / 2 # m
2730 # Balllon Burst Radius
@@ -39,32 +42,31 @@ class Balloon():
3942 parachute_r : float = 1.3
4043
4144
42- def __init__ (self , balloon_mass : float , payload_mass : float , initial_diameter : float , burst_diameter : float , drag_coef : float , parachute_diameter : float , parachute_drag_coeff : float ) -> None :
45+ def __init__ (self , balloon_mass : float , payload_mass : float , initial_volume : float , burst_diameter : float , drag_coef : float , parachute_diameter : float , parachute_drag_coeff : float ) -> None :
4346 '''
4447 Creates balloon object
4548 balloon_mass: 1000g, 2000g etc
4649 payload_mass: in kilograms
47- initial_diameter : balloon start diameter
50+ initial_volume : balloon filled volume (m3)
4851 burst_diameter:
4952 drag_coef: Drag Coefficient
5053 parachute_diameter:
5154 parachute_drag_coeff:
5255 '''
5356 self .m_balloon = balloon_mass * 1e-3
5457 self .m_payload = payload_mass
55- self .r_i = initial_diameter / 2
58+ self .vol_gas = initial_volume
59+ self .r_i = radius_sphere (initial_volume )
5660 self .r_f = burst_diameter / 2
5761 self .drag_coeff = drag_coef
5862 self .parachute_Dcoeff = parachute_drag_coeff
5963 self .parachute_r = parachute_diameter / 2
60-
61- vol_gas = vol_sphere (self .r_i )
62- m_gas = vol_gas * Air .p_he
64+ m_gas = self .vol_gas * Air .p_he
6365
6466 print (f"Payload Mass: { self .m_payload } kg" )
6567 print (f"Balloon:\n \t Size: { balloon_mass } g \n \
66- \t Initial Diameter: { initial_diameter :.2f} m\n \
67- \t Initial Volume: { vol_gas :.2f} m3\n \
68+ \t Initial Diameter: { initial_volume :.2f} m\n \
69+ \t Initial Volume: { self . vol_gas :.2f} m3\n \
6870 \t Burst Diameter: { burst_diameter :.2f} m\n \
6971 \t Expected He Mass: { m_gas :.4f} kg\n \
7072 \t Drag Coefficient: { drag_coef :.3f} " )
@@ -103,7 +105,7 @@ def drag(self, altitude: float, velocity: float) -> float:
103105 self .drag_coeff = self .parachute_Dcoeff
104106 area = np .pi * (self .parachute_r ) ** 2
105107 else :
106- radius = (( 3.0 / 4.0 / np . pi ) * self .volume (altitude )) ** ( 1 / 3 )
108+ radius = radius_sphere ( self .volume (altitude ))
107109 area : float = np .pi * radius * radius
108110
109111 d : float = - (1 / 2 ) * self .drag_coeff * Air .density (altitude ) * area * (abs (velocity )* velocity )
0 commit comments