Skip to content

Commit

Permalink
MNT: black correction
Browse files Browse the repository at this point in the history
  • Loading branch information
juliomachad0 committed Jun 15, 2024
1 parent c93e62c commit 1f828b9
Showing 1 changed file with 77 additions and 54 deletions.
131 changes: 77 additions & 54 deletions examples/ProjetoJupiter--Valetudo--2019/simulation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
}
],
"source": [
"%pip install rocketpy<=2.0\n"
"%pip install rocketpy<=2.0"
]
},
{
Expand All @@ -36,8 +36,19 @@
"metadata": {},
"outputs": [],
"source": [
"from rocketpy import Environment, SolidMotor, Rocket, Flight, TrapezoidalFins, EllipticalFins, RailButtons, NoseCone, Tail, Parachute\n",
"import datetime\n"
"from rocketpy import (\n",
" Environment,\n",
" SolidMotor,\n",
" Rocket,\n",
" Flight,\n",
" TrapezoidalFins,\n",
" EllipticalFins,\n",
" RailButtons,\n",
" NoseCone,\n",
" Tail,\n",
" Parachute,\n",
")\n",
"import datetime"
]
},
{
Expand All @@ -57,7 +68,7 @@
"source": [
"env = Environment()\n",
"env.set_location(latitude=-23.36417778, longitude=-48.0)\n",
"env.set_elevation(668.0)\n"
"env.set_elevation(668.0)"
]
},
{
Expand Down Expand Up @@ -168,7 +179,7 @@
}
],
"source": [
"env.all_info()\n"
"env.all_info()"
]
},
{
Expand All @@ -188,7 +199,7 @@
"outputs": [],
"source": [
"motor = SolidMotor(\n",
" thrust_source='thrust_source.csv',\n",
" thrust_source=\"thrust_source.csv\",\n",
" dry_mass=0,\n",
" center_of_dry_mass_position=0,\n",
" dry_inertia=[0, 0, 0],\n",
Expand All @@ -203,9 +214,9 @@
" nozzle_position=-0.378,\n",
" throat_radius=0.0107,\n",
" reshape_thrust_curve=False, # Not implemented in Rocket-Serializer\n",
" interpolation_method='linear',\n",
" coordinate_system_orientation='nozzle_to_combustion_chamber',\n",
")\n"
" interpolation_method=\"linear\",\n",
" coordinate_system_orientation=\"nozzle_to_combustion_chamber\",\n",
")"
]
},
{
Expand Down Expand Up @@ -424,7 +435,7 @@
}
],
"source": [
"motor.all_info()\n"
"motor.all_info()"
]
},
{
Expand Down Expand Up @@ -454,11 +465,11 @@
"source": [
"nosecone = NoseCone(\n",
" length=0.274169,\n",
" kind='Von Karman',\n",
" kind=\"Von Karman\",\n",
" base_radius=0.04045000000000001,\n",
" rocket_radius=0.04045000000000001,\n",
" name='0.274169',\n",
")\n"
" name=\"0.274169\",\n",
")"
]
},
{
Expand All @@ -477,7 +488,7 @@
"metadata": {},
"outputs": [],
"source": [
"trapezoidal_fins = {}\n"
"trapezoidal_fins = {}"
]
},
{
Expand All @@ -493,12 +504,11 @@
" tip_chord=0.018000000000000002,\n",
" span=0.077,\n",
" cant_angle=0.0,\n",
" sweep_length= 0.03933010329337934,\n",
" sweep_angle= None,\n",
" sweep_length=0.03933010329337934,\n",
" sweep_angle=None,\n",
" rocket_radius=0.04045000000000001,\n",
" name='Conjunto de aletas trapezoidais',\n",
")\n",
"\n"
" name=\"Conjunto de aletas trapezoidais\",\n",
")"
]
},
{
Expand All @@ -517,7 +527,7 @@
"metadata": {},
"outputs": [],
"source": [
"tails = {}\n"
"tails = {}"
]
},
{
Expand All @@ -536,7 +546,7 @@
"metadata": {},
"outputs": [],
"source": [
"parachutes = {}\n"
"parachutes = {}"
]
},
{
Expand All @@ -547,11 +557,11 @@
"outputs": [],
"source": [
"parachutes[0] = Parachute(\n",
" name='Drogue_chute',\n",
" name=\"Drogue_chute\",\n",
" cd_s=0.454,\n",
" trigger='apogee',\n",
" sampling_rate=100, \n",
")\n"
" trigger=\"apogee\",\n",
" sampling_rate=100,\n",
")"
]
},
{
Expand All @@ -565,11 +575,11 @@
" radius=0.04045000000000001,\n",
" mass=8.2564,\n",
" inertia=[0.01467, 0.01467, 5.5915],\n",
" power_off_drag='drag_curve.csv',\n",
" power_on_drag='drag_curve.csv',\n",
" power_off_drag=\"drag_curve.csv\",\n",
" power_on_drag=\"drag_curve.csv\",\n",
" center_of_mass_without_motor=1.4023,\n",
" coordinate_system_orientation='nose_to_tail',\n",
")\n"
" coordinate_system_orientation=\"nose_to_tail\",\n",
")"
]
},
{
Expand Down Expand Up @@ -598,7 +608,7 @@
"metadata": {},
"outputs": [],
"source": [
"rocket.add_motor(motor, position= 2.052896709219859)\n"
"rocket.add_motor(motor, position=2.052896709219859)"
]
},
{
Expand All @@ -616,7 +626,7 @@
"metadata": {},
"outputs": [],
"source": [
"rocket.parachutes = list(parachutes.values())\n"
"rocket.parachutes = list(parachutes.values())"
]
},
{
Expand All @@ -635,10 +645,10 @@
"outputs": [],
"source": [
"rail_buttons = rocket.set_rail_buttons(\n",
" upper_button_position=1.148,\n",
" lower_button_position=2.399,\n",
" angular_position=30.000,\n",
")\n"
" upper_button_position=1.148,\n",
" lower_button_position=2.399,\n",
" angular_position=30.000,\n",
")"
]
},
{
Expand Down Expand Up @@ -818,7 +828,7 @@
],
"source": [
"### Rocket Info\n",
"rocket.all_info()\n"
"rocket.all_info()"
]
},
{
Expand Down Expand Up @@ -1229,7 +1239,7 @@
}
],
"source": [
"flight.all_info()\n"
"flight.all_info()"
]
},
{
Expand Down Expand Up @@ -1309,7 +1319,7 @@
"print(f\"Time to apogee (OpenRocket): {time_to_apogee_ork:.3f} s\")\n",
"print(f\"Time to apogee (RocketPy): {time_to_apogee_rpy:.3f} s\")\n",
"apogee_difference = time_to_apogee_rpy - time_to_apogee_ork\n",
"error = abs((apogee_difference)/time_to_apogee_rpy)*100\n",
"error = abs((apogee_difference) / time_to_apogee_rpy) * 100\n",
"print(f\"Time to apogee difference: {error:.3f} %\")\n",
"print()\n",
"\n",
Expand All @@ -1318,7 +1328,7 @@
"print(f\"Flight time (OpenRocket): {flight_time_ork:.3f} s\")\n",
"print(f\"Flight time (RocketPy): {flight_time_rpy:.3f} s\")\n",
"flight_time_difference = flight_time_rpy - flight_time_ork\n",
"error_flight_time = abs((flight_time_difference)/flight_time_rpy)*100\n",
"error_flight_time = abs((flight_time_difference) / flight_time_rpy) * 100\n",
"print(f\"Flight time difference: {error_flight_time:.3f} %\")\n",
"print()\n",
"\n",
Expand All @@ -1327,7 +1337,9 @@
"print(f\"Ground hit velocity (OpenRocket): {ground_hit_velocity_ork:.3f} m/s\")\n",
"print(f\"Ground hit velocity (RocketPy): {ground_hit_velocity_rpy:.3f} m/s\")\n",
"ground_hit_velocity_difference = ground_hit_velocity_rpy - ground_hit_velocity_ork\n",
"error_ground_hit_velocity = abs((ground_hit_velocity_difference)/ground_hit_velocity_rpy)*100\n",
"error_ground_hit_velocity = (\n",
" abs((ground_hit_velocity_difference) / ground_hit_velocity_rpy) * 100\n",
")\n",
"print(f\"Ground hit velocity difference: {error_ground_hit_velocity:.3f} %\")\n",
"print()\n",
"\n",
Expand All @@ -1336,7 +1348,9 @@
"print(f\"Launch rod velocity (OpenRocket): {launch_rod_velocity_ork:.3f} m/s\")\n",
"print(f\"Launch rod velocity (RocketPy): {launch_rod_velocity_rpy:.3f} m/s\")\n",
"launch_rod_velocity_difference = launch_rod_velocity_rpy - launch_rod_velocity_ork\n",
"error_launch_rod_velocity = abs((launch_rod_velocity_difference)/launch_rod_velocity_rpy)*100\n",
"error_launch_rod_velocity = (\n",
" abs((launch_rod_velocity_difference) / launch_rod_velocity_rpy) * 100\n",
")\n",
"print(f\"Launch rod velocity difference: {error_launch_rod_velocity:.3f} %\")\n",
"print()\n",
"\n",
Expand All @@ -1345,7 +1359,7 @@
"print(f\"Max acceleration (OpenRocket): {max_acceleration_ork:.3f} m/s²\")\n",
"print(f\"Max acceleration (RocketPy): {max_acceleration_rpy:.3f} m/s²\")\n",
"max_acceleration_difference = max_acceleration_rpy - max_acceleration_ork\n",
"error_max_acceleration = abs((max_acceleration_difference)/max_acceleration_rpy)*100\n",
"error_max_acceleration = abs((max_acceleration_difference) / max_acceleration_rpy) * 100\n",
"print(f\"Max acceleration difference: {error_max_acceleration:.3f} %\")\n",
"print()\n",
"\n",
Expand All @@ -1354,16 +1368,16 @@
"print(f\"Max altitude (OpenRocket): {max_altitude_ork:.3f} m\")\n",
"print(f\"Max altitude (RocketPy): {max_altitude_rpy:.3f} m\")\n",
"max_altitude_difference = max_altitude_rpy - max_altitude_ork\n",
"error_max_altitude = abs((max_altitude_difference)/max_altitude_rpy)*100\n",
"error_max_altitude = abs((max_altitude_difference) / max_altitude_rpy) * 100\n",
"print(f\"Max altitude difference: {error_max_altitude:.3f} %\")\n",
"print()\n",
"\n",
"max_mach_ork = 0.36177\n",
"max_mach_rpy = flight.max_mach_number \n",
"max_mach_rpy = flight.max_mach_number\n",
"print(f\"Max Mach (OpenRocket): {max_mach_ork:.3f}\")\n",
"print(f\"Max Mach (RocketPy): {max_mach_rpy:.3f}\")\n",
"max_mach_difference = max_mach_rpy - max_mach_ork\n",
"error_max_mach = abs((max_mach_difference)/max_mach_rpy)*100\n",
"error_max_mach = abs((max_mach_difference) / max_mach_rpy) * 100\n",
"print(f\"Max Mach difference: {error_max_mach:.3f} %\")\n",
"print()\n",
"\n",
Expand All @@ -1372,7 +1386,7 @@
"print(f\"Max velocity (OpenRocket): {max_velocity_ork:.3f} m/s\")\n",
"print(f\"Max velocity (RocketPy): {max_velocity_rpy:.3f} m/s\")\n",
"max_velocity_difference = max_velocity_rpy - max_velocity_ork\n",
"error_max_velocity = abs((max_velocity_difference)/max_velocity_rpy)*100\n",
"error_max_velocity = abs((max_velocity_difference) / max_velocity_rpy) * 100\n",
"print(f\"Max velocity difference: {error_max_velocity:.3f} %\")\n",
"print()\n",
"\n",
Expand All @@ -1381,16 +1395,22 @@
"print(f\"Max thrust (OpenRocket): {max_thrust_ork:.3f} N\")\n",
"print(f\"Max thrust (RocketPy): {max_thrust_rpy:.3f} N\")\n",
"max_thrust_difference = max_thrust_rpy - max_thrust_ork\n",
"error_max_thrust = abs((max_thrust_difference)/max_thrust_rpy)*100\n",
"error_max_thrust = abs((max_thrust_difference) / max_thrust_rpy) * 100\n",
"print(f\"Max thrust difference: {error_max_thrust:.3f} %\")\n",
"print()\n",
"\n",
"burnout_stability_margin_ork = 2.4363\n",
"burnout_stability_margin_rpy = flight.stability_margin(flight.rocket.motor.burn_out_time)\n",
"burnout_stability_margin_rpy = flight.stability_margin(\n",
" flight.rocket.motor.burn_out_time\n",
")\n",
"print(f\"Burnout stability margin (OpenRocket): {burnout_stability_margin_ork:.3f}\")\n",
"print(f\"Burnout stability margin (RocketPy): {burnout_stability_margin_rpy:.3f}\")\n",
"burnout_stability_margin_difference = burnout_stability_margin_rpy - burnout_stability_margin_ork\n",
"error_burnout_stability_margin = abs((burnout_stability_margin_difference)/burnout_stability_margin_rpy)*100\n",
"burnout_stability_margin_difference = (\n",
" burnout_stability_margin_rpy - burnout_stability_margin_ork\n",
")\n",
"error_burnout_stability_margin = (\n",
" abs((burnout_stability_margin_difference) / burnout_stability_margin_rpy) * 100\n",
")\n",
"print(f\"Burnout stability margin difference: {error_burnout_stability_margin:.3f} %\")\n",
"print()\n",
"\n",
Expand All @@ -1399,7 +1419,9 @@
"print(f\"Max stability margin (OpenRocket): {max_stability_margin_ork:.3f}\")\n",
"print(f\"Max stability margin (RocketPy): {max_stability_margin_rpy:.3f}\")\n",
"max_stability_margin_difference = max_stability_margin_rpy - max_stability_margin_ork\n",
"error_max_stability_margin = abs((max_stability_margin_difference)/max_stability_margin_rpy)*100\n",
"error_max_stability_margin = (\n",
" abs((max_stability_margin_difference) / max_stability_margin_rpy) * 100\n",
")\n",
"print(f\"Max stability margin difference: {error_max_stability_margin:.3f} %\")\n",
"print()\n",
"\n",
Expand All @@ -1408,10 +1430,11 @@
"print(f\"Min stability margin (OpenRocket): {min_stability_margin_ork:.3f}\")\n",
"print(f\"Min stability margin (RocketPy): {min_stability_margin_rpy:.3f}\")\n",
"min_stability_margin_difference = min_stability_margin_rpy - min_stability_margin_ork\n",
"error_min_stability_margin = abs((min_stability_margin_difference)/min_stability_margin_rpy)*100\n",
"error_min_stability_margin = (\n",
" abs((min_stability_margin_difference) / min_stability_margin_rpy) * 100\n",
")\n",
"print(f\"Min stability margin difference: {error_min_stability_margin:.3f} %\")\n",
"print()\n",
"\n"
"print()"
]
}
],
Expand Down

0 comments on commit 1f828b9

Please sign in to comment.