Skip to content

Commit

Permalink
added second parachute and corresponding widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
OctaveCharrin committed Apr 26, 2023
1 parent b19b3ee commit e064b68
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 31 deletions.
2 changes: 1 addition & 1 deletion UI/include/init_rocket/rocket_dict.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"tube_length": 2.0, "tube_radius": 0.1, "tube_thickness": 0.01, "tube_material": "fibre_carbon", "tube_density": 1780.0, "nose_type": "ellipse", "nose_parameter": 0.0, "nose_length": 0.5, "nose_radius": 0.1, "nose_thickness": 0.01, "nose_material": "fibre_carbon", "nose_density": 1780.0, "fins_Cr": 0.2, "fins_Ct": 0.1, "fins_Xt": 0.1, "fins_s": 0.15, "fins_thickness": 0.01, "delta": 0.05, "fins_number": 4, "fins_material": "fibre_carbon", "fins_density": 1780.0, "fins_position": 0.0, "motor": {"availability": "OOP", "avgThrustN": 76.33, "burnTimeS": 8.26, "caseInfo": "SU 54x235", "certOrg": "National Association of Rocketry", "commonName": "I65", "dataFiles": 2, "designation": "I65W", "diameter": 54, "impulseClass": "I", "infoUrl": "http://nar.org/SandT/pdf/Aerotech/I65.pdf", "length": 235, "manufacturer": "AeroTech", "manufacturerAbbrev": "AeroTech", "maxThrustN": 150.1, "motorId": "5f4294d2000231000000009d", "propInfo": "White Lightning", "propWeightG": 369.7, "samples": [[0, 0], [0.18, 125.4], [0.544, 139.3], [0.908, 145.4], [1.273, 148.3], [1.638, 146.7], [2.002, 139], [2.367, 131.2], [2.731, 123.3], [3.096, 113.5], [3.46, 102.4], [3.825, 90.21], [4.19, 78.08], [4.554, 66.81], [4.919, 55.78], [5.283, 47.28], [5.648, 39.15], [6.012, 32.53], [6.377, 27.07], [6.742, 22.1], [7.106, 18.09], [7.471, 14.82], [7.835, 12.1], [8.2, 9.763], [8.565, 7.875], [8.929, 5.999], [9.294, 0]], "totImpulseNs": 630.5, "totalWeightG": 761.6, "type": "SU", "updatedOn": "2019-04-17"}, "motor_position": 0.0, "motor_ring": false, "motor_ring_material": "acier", "motor_ring_density": 7850.0, "parachute_l0": 1.0, "parachute_weight": 0.5, "parachute_sref": 0.29, "parachute_Cd": 1.75, "parachute_deploy_method": "velocity", "parachute_deploy_timer": 10.0, "additional_masses": [], "rocket_mass": 2.0, "rocket_prop_weight": 0.2, "ejected_nose_mass": 0.5, "rocket_launch_angle": 1.3962634015954636, "wind_on": true, "wind_average_speed": 5.0, "rocket_volume": 0.03928693438153156, "rocket_cog": [1.0463035005017027, 0.0, 0.0], "rocket_inertia": [[10, 0.0, 0.0], [0.0, 200, 0.0], [0.0, 0.0, 200]]}
{"tube_length": 2.0, "tube_radius": 0.1, "tube_thickness": 0.01, "tube_material": "fibre_carbon", "tube_density": 1780.0, "nose_type": "ellipse", "nose_parameter": 0.0, "nose_length": 0.5, "nose_radius": 0.1, "nose_thickness": 0.01, "nose_material": "fibre_carbon", "nose_density": 1780.0, "fins_Cr": 0.2, "fins_Ct": 0.1, "fins_Xt": 0.1, "fins_s": 0.15, "fins_thickness": 0.01, "delta": 0.05, "fins_number": 4, "fins_material": "fibre_carbon", "fins_density": 1780.0, "fins_position": 0.0, "motor": {"availability": "OOP", "avgThrustN": 76.33, "burnTimeS": 8.26, "caseInfo": "SU 54x235", "certOrg": "National Association of Rocketry", "commonName": "I65", "dataFiles": 2, "designation": "I65W", "diameter": 54, "impulseClass": "I", "infoUrl": "http://nar.org/SandT/pdf/Aerotech/I65.pdf", "length": 235, "manufacturer": "AeroTech", "manufacturerAbbrev": "AeroTech", "maxThrustN": 150.1, "motorId": "5f4294d2000231000000009d", "propInfo": "White Lightning", "propWeightG": 369.7, "samples": [[0, 0], [0.18, 125.4], [0.544, 139.3], [0.908, 145.4], [1.273, 148.3], [1.638, 146.7], [2.002, 139], [2.367, 131.2], [2.731, 123.3], [3.096, 113.5], [3.46, 102.4], [3.825, 90.21], [4.19, 78.08], [4.554, 66.81], [4.919, 55.78], [5.283, 47.28], [5.648, 39.15], [6.012, 32.53], [6.377, 27.07], [6.742, 22.1], [7.106, 18.09], [7.471, 14.82], [7.835, 12.1], [8.2, 9.763], [8.565, 7.875], [8.929, 5.999], [9.294, 0]], "totImpulseNs": 630.5, "totalWeightG": 761.6, "type": "SU", "updatedOn": "2019-04-17"}, "motor_position": 0.0, "motor_ring": false, "motor_ring_material": "acier", "motor_ring_density": 7850.0, "parachute_l0": 1.0, "parachute_weight": 0.5, "parachute_sref1": 0.01, "parachute_sref2": 0.05, "parachute_Cd": 1.75, "parachute_deploy_method": "velocity","second_para_deploy_alt":500.0, "parachute_deploy_timer": 10.0, "additional_masses": [], "rocket_mass": 2.0, "rocket_prop_weight": 0.2, "ejected_nose_mass": 0.5, "rocket_launch_angle": 1.3962634015954636, "wind_on": true, "wind_average_speed": 5.0, "rocket_volume": 0.03928693438153156, "rocket_cog": [1.0463035005017027, 0.0, 0.0], "rocket_inertia": [[10, 0.0, 0.0], [0.0, 200, 0.0], [0.0, 0.0, 200]]}
14 changes: 9 additions & 5 deletions UI/include/widgets/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,15 @@ def change_thrustcurve(change):
# Parachute settings
rope_rest_length = widgets.BoundedFloatText(value=1.,min=0.,max=1000.,step=.1,description='Rope rest length ($m$):',style={'description_width': 'initial'},disabled=False)
parachute_weight = widgets.BoundedFloatText(value=.5,min=0.,max=1000.,step=.1,description='Parachute weight ($kg$):',style={'description_width': 'initial'},disabled=False)
s_ref = widgets.BoundedFloatText(value=.29,min=0.,max=1000.,step=.1,description='Reference surface of parachute ($m^2$):',style={'description_width': 'initial'},disabled=False)
s_ref1 = widgets.BoundedFloatText(value=.05,min=0.,max=1000.,step=.1,description='Reference surface of parachute ($m^2$):',style={'description_width': 'initial'},disabled=False)
s_ref2 = widgets.BoundedFloatText(value=.5,min=0.,max=1000.,step=.1,description='Reference surface of parachute ($m^2$):',style={'description_width': 'initial'},disabled=False)
parachute_cd = widgets.BoundedFloatText(value=1.75,min=0.,max=100.,step=.1,description='Drag coefficient of parachute:',style={'description_width': 'initial'},disabled=False)
deploy_method = widgets.Dropdown(options=[('timer','timer'), ('negative vertical velocity','velocity')],value='timer',description='Parachute deployment method:',style={'description_width': 'initial'},disabled=False)
deploy_method = widgets.Dropdown(options=[('timer','timer'), ('negative vertical velocity','velocity')],value='timer',description='First parachute deployment method:',style={'description_width': 'initial'},disabled=False)
deploy_alt = widgets.BoundedFloatText(value=100., min=0.,max=1000000., step = 1., description = "Second para. deployment alt. ($m$):",style={'description_width': 'initial'},disabled=False)
parachute_timer = widgets.BoundedFloatText(value=10.,min=0.,max=3600.,step=1,description='(*)Deployment time ($s$):',style={'description_width': 'initial'},disabled=False)
timer_text = widgets.Label(value="(*)Time before parachute deployment in seconds.", style={'description_width':'initial'})
timer_text = widgets.Label(value="(*)Time before first parachute deployment in seconds.", style={'description_width':'initial'})

parachute_widget = widgets.VBox([rope_rest_length, parachute_weight, s_ref, parachute_cd, deploy_method, parachute_timer])
parachute_widget = widgets.VBox([rope_rest_length, parachute_weight, s_ref1, s_ref2, parachute_cd, deploy_method, parachute_timer, timer_text, deploy_alt])

def show_timer(change):
if change['new'] == 'timer':
Expand Down Expand Up @@ -474,9 +476,11 @@ def rocket_dictionary():
'motor_ring_density':ring_density.value,
'parachute_l0':rope_rest_length.value,
'parachute_weight':parachute_weight.value,
'parachute_sref':s_ref.value,
'parachute_sref1':s_ref1.value,
'parachute_sref2':s_ref2.value,
'parachute_Cd':parachute_cd.value,
'parachute_deploy_method':deploy_method.value,
'second_para_deploy_alt':deploy_alt.value,
'parachute_deploy_timer':parachute_timer.value,
'additional_masses':mass_dict_list(),
'rocket_mass':rocket_mass.value,
Expand Down
2 changes: 1 addition & 1 deletion UI/model/DynamicsPar.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def compute(self):

S_ref = self.S_ref1

if self.r2<self.AltPara:
if self.r2[2]<self.AltPara:
S_ref = self.S_ref2

Drag = -.5 * self.rho * S_ref * self.Cd * np.linalg.norm(self.v1) * (self.v1-self.v_wind.val)
Expand Down
53 changes: 29 additions & 24 deletions UI/model/rocket_trajectory.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

#Add RungeKutta driver
driver = earth.add_driver(RungeKutta(order=4, dt=dt))
driver.time_interval = (0, 50)
driver.time_interval = (0, 100)

#Add NonLinearSolver driver
solver = driver.add_child(NonLinearSolver('solver', factor=1.0))
Expand Down Expand Up @@ -97,7 +97,11 @@
'Para.l0' : rocket_dict['parachute_l0'],
'Para.m1' : rocket_dict['parachute_weight'] + rocket_dict['ejected_nose_mass'],
'Para.m2' : rocket_dict['rocket_mass'] - rocket_dict['ejected_nose_mass'],
'Para.DynPar.S_ref' : rocket_dict['parachute_sref'],
'Para.DynPar.S_ref1' : rocket_dict['parachute_sref1'],
'Para.DynPar.S_ref2' : rocket_dict['parachute_sref2'],
'Para.DynPar.AltPara' : rocket_dict['second_para_deploy_alt'],


'Para.DynPar.Cd' : rocket_dict['parachute_Cd'],

'Traj.parachute_deploy_method' : 0 if rocket_dict['parachute_deploy_method'] == 'velocity' else 1,
Expand Down Expand Up @@ -488,29 +492,27 @@ def simulation_2d_plots():
if IPython.get_ipython() is not None:
IPython.get_ipython().run_line_magic('matplotlib', 'inline')

# global time, pres, r_then_r2, cog, cpa
# plt.plot(time, np.array(r_then_r2)[:,2])
# plt.title("Rocket Altitude")
# plt.xlabel("Time (s)")
# plt.ylabel("Height (m)")
# plt.show()

# plt.plot(np.array(r_then_r2)[:,0], np.array(r_then_r2)[:,2])
# plt.title("Rocket XZ Trajectory")
# plt.xlabel("Horizontal Displacement (m)")
# plt.ylabel("Height (m)")
# plt.show()

# plt.plot(time, pres)
# plt.title("Pressure over Time")
# plt.xlabel("Time (s)")
# plt.ylabel("Pressure (Pa)")
# plt.show()
global time, pres, r_then_r2, cog, cpa
plt.plot(time, np.array(r_then_r2)[:,2])
plt.title("Rocket Altitude")
plt.xlabel("Time (s)")
plt.ylabel("Height (m)")
plt.show()

plt.plot(np.array(r_then_r2)[:,0], np.array(r_then_r2)[:,2])
plt.title("Rocket XZ Trajectory")
plt.xlabel("Horizontal Displacement (m)")
plt.ylabel("Height (m)")
plt.show()

plt.plot(time, pres)
plt.title("Pressure over Time")
plt.xlabel("Time (s)")
plt.ylabel("Pressure (Pa)")
plt.show()

stability_margin = cog-cpa
plt.plot(time, stability_margin, label = 'margin')
# plt.plot(time[:duree], cog[:duree], label='cog')
# plt.plot(time[:duree],cpa[:duree], label='cpa')
plt.title("Stability margin over Time")
plt.xlabel("Time (s)")
plt.ylabel("Stability margin (m)")
Expand All @@ -534,6 +536,9 @@ def simulation_2d_plots():
plt.tight_layout()
plt.show()

###################################################################
# Call the code bellow to plot additional curves after simulation #
###################################################################

if IPython.get_ipython() is None:
simulation_2d_plots()
# if IPython.get_ipython() is None:
# simulation_2d_plots()

0 comments on commit e064b68

Please sign in to comment.