From e064b681fe5e8c19c985df6a565f57dc901af7e8 Mon Sep 17 00:00:00 2001 From: Octave Charrin Date: Wed, 26 Apr 2023 16:35:15 +0200 Subject: [PATCH] added second parachute and corresponding widgets --- UI/include/init_rocket/rocket_dict.json | 2 +- UI/include/widgets/widgets.py | 14 ++++--- UI/model/DynamicsPar.py | 2 +- UI/model/rocket_trajectory.py | 53 ++++++++++++++----------- 4 files changed, 40 insertions(+), 31 deletions(-) diff --git a/UI/include/init_rocket/rocket_dict.json b/UI/include/init_rocket/rocket_dict.json index 34e9a7d..60df0ba 100644 --- a/UI/include/init_rocket/rocket_dict.json +++ b/UI/include/init_rocket/rocket_dict.json @@ -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]]} \ No newline at end of file +{"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]]} \ No newline at end of file diff --git a/UI/include/widgets/widgets.py b/UI/include/widgets/widgets.py index 2c6dfe7..101fe48 100644 --- a/UI/include/widgets/widgets.py +++ b/UI/include/widgets/widgets.py @@ -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': @@ -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, diff --git a/UI/model/DynamicsPar.py b/UI/model/DynamicsPar.py index 489b3e1..b927779 100644 --- a/UI/model/DynamicsPar.py +++ b/UI/model/DynamicsPar.py @@ -47,7 +47,7 @@ def compute(self): S_ref = self.S_ref1 - if self.r2