|
26 | 26 | }
|
27 | 27 | ],
|
28 | 28 | "source": [
|
29 |
| - "%pip install rocketpy<=2.0\n" |
| 29 | + "%pip install rocketpy<=2.0" |
30 | 30 | ]
|
31 | 31 | },
|
32 | 32 | {
|
|
36 | 36 | "metadata": {},
|
37 | 37 | "outputs": [],
|
38 | 38 | "source": [
|
39 |
| - "from rocketpy import Environment, SolidMotor, Rocket, Flight, TrapezoidalFins, EllipticalFins, RailButtons, NoseCone, Tail, Parachute\n", |
40 |
| - "import datetime\n" |
| 39 | + "from rocketpy import (\n", |
| 40 | + " Environment,\n", |
| 41 | + " SolidMotor,\n", |
| 42 | + " Rocket,\n", |
| 43 | + " Flight,\n", |
| 44 | + " TrapezoidalFins,\n", |
| 45 | + " EllipticalFins,\n", |
| 46 | + " RailButtons,\n", |
| 47 | + " NoseCone,\n", |
| 48 | + " Tail,\n", |
| 49 | + " Parachute,\n", |
| 50 | + ")\n", |
| 51 | + "import datetime" |
41 | 52 | ]
|
42 | 53 | },
|
43 | 54 | {
|
|
57 | 68 | "source": [
|
58 | 69 | "env = Environment()\n",
|
59 | 70 | "env.set_location(latitude=-23.36417778, longitude=-48.0)\n",
|
60 |
| - "env.set_elevation(668.0)\n" |
| 71 | + "env.set_elevation(668.0)" |
61 | 72 | ]
|
62 | 73 | },
|
63 | 74 | {
|
|
168 | 179 | }
|
169 | 180 | ],
|
170 | 181 | "source": [
|
171 |
| - "env.all_info()\n" |
| 182 | + "env.all_info()" |
172 | 183 | ]
|
173 | 184 | },
|
174 | 185 | {
|
|
188 | 199 | "outputs": [],
|
189 | 200 | "source": [
|
190 | 201 | "motor = SolidMotor(\n",
|
191 |
| - " thrust_source='thrust_source.csv',\n", |
| 202 | + " thrust_source=\"thrust_source.csv\",\n", |
192 | 203 | " dry_mass=0,\n",
|
193 | 204 | " center_of_dry_mass_position=0,\n",
|
194 | 205 | " dry_inertia=[0, 0, 0],\n",
|
|
203 | 214 | " nozzle_position=-0.378,\n",
|
204 | 215 | " throat_radius=0.0107,\n",
|
205 | 216 | " reshape_thrust_curve=False, # Not implemented in Rocket-Serializer\n",
|
206 |
| - " interpolation_method='linear',\n", |
207 |
| - " coordinate_system_orientation='nozzle_to_combustion_chamber',\n", |
208 |
| - ")\n" |
| 217 | + " interpolation_method=\"linear\",\n", |
| 218 | + " coordinate_system_orientation=\"nozzle_to_combustion_chamber\",\n", |
| 219 | + ")" |
209 | 220 | ]
|
210 | 221 | },
|
211 | 222 | {
|
|
424 | 435 | }
|
425 | 436 | ],
|
426 | 437 | "source": [
|
427 |
| - "motor.all_info()\n" |
| 438 | + "motor.all_info()" |
428 | 439 | ]
|
429 | 440 | },
|
430 | 441 | {
|
|
454 | 465 | "source": [
|
455 | 466 | "nosecone = NoseCone(\n",
|
456 | 467 | " length=0.274169,\n",
|
457 |
| - " kind='Von Karman',\n", |
| 468 | + " kind=\"Von Karman\",\n", |
458 | 469 | " base_radius=0.04045000000000001,\n",
|
459 | 470 | " rocket_radius=0.04045000000000001,\n",
|
460 |
| - " name='0.274169',\n", |
461 |
| - ")\n" |
| 471 | + " name=\"0.274169\",\n", |
| 472 | + ")" |
462 | 473 | ]
|
463 | 474 | },
|
464 | 475 | {
|
|
477 | 488 | "metadata": {},
|
478 | 489 | "outputs": [],
|
479 | 490 | "source": [
|
480 |
| - "trapezoidal_fins = {}\n" |
| 491 | + "trapezoidal_fins = {}" |
481 | 492 | ]
|
482 | 493 | },
|
483 | 494 | {
|
|
493 | 504 | " tip_chord=0.018000000000000002,\n",
|
494 | 505 | " span=0.077,\n",
|
495 | 506 | " cant_angle=0.0,\n",
|
496 |
| - " sweep_length= 0.03933010329337934,\n", |
497 |
| - " sweep_angle= None,\n", |
| 507 | + " sweep_length=0.03933010329337934,\n", |
| 508 | + " sweep_angle=None,\n", |
498 | 509 | " rocket_radius=0.04045000000000001,\n",
|
499 |
| - " name='Conjunto de aletas trapezoidais',\n", |
500 |
| - ")\n", |
501 |
| - "\n" |
| 510 | + " name=\"Conjunto de aletas trapezoidais\",\n", |
| 511 | + ")" |
502 | 512 | ]
|
503 | 513 | },
|
504 | 514 | {
|
|
517 | 527 | "metadata": {},
|
518 | 528 | "outputs": [],
|
519 | 529 | "source": [
|
520 |
| - "tails = {}\n" |
| 530 | + "tails = {}" |
521 | 531 | ]
|
522 | 532 | },
|
523 | 533 | {
|
|
536 | 546 | "metadata": {},
|
537 | 547 | "outputs": [],
|
538 | 548 | "source": [
|
539 |
| - "parachutes = {}\n" |
| 549 | + "parachutes = {}" |
540 | 550 | ]
|
541 | 551 | },
|
542 | 552 | {
|
|
547 | 557 | "outputs": [],
|
548 | 558 | "source": [
|
549 | 559 | "parachutes[0] = Parachute(\n",
|
550 |
| - " name='Drogue_chute',\n", |
| 560 | + " name=\"Drogue_chute\",\n", |
551 | 561 | " cd_s=0.454,\n",
|
552 |
| - " trigger='apogee',\n", |
553 |
| - " sampling_rate=100, \n", |
554 |
| - ")\n" |
| 562 | + " trigger=\"apogee\",\n", |
| 563 | + " sampling_rate=100,\n", |
| 564 | + ")" |
555 | 565 | ]
|
556 | 566 | },
|
557 | 567 | {
|
|
565 | 575 | " radius=0.04045000000000001,\n",
|
566 | 576 | " mass=8.2564,\n",
|
567 | 577 | " inertia=[0.01467, 0.01467, 5.5915],\n",
|
568 |
| - " power_off_drag='drag_curve.csv',\n", |
569 |
| - " power_on_drag='drag_curve.csv',\n", |
| 578 | + " power_off_drag=\"drag_curve.csv\",\n", |
| 579 | + " power_on_drag=\"drag_curve.csv\",\n", |
570 | 580 | " center_of_mass_without_motor=1.4023,\n",
|
571 |
| - " coordinate_system_orientation='nose_to_tail',\n", |
572 |
| - ")\n" |
| 581 | + " coordinate_system_orientation=\"nose_to_tail\",\n", |
| 582 | + ")" |
573 | 583 | ]
|
574 | 584 | },
|
575 | 585 | {
|
|
598 | 608 | "metadata": {},
|
599 | 609 | "outputs": [],
|
600 | 610 | "source": [
|
601 |
| - "rocket.add_motor(motor, position= 2.052896709219859)\n" |
| 611 | + "rocket.add_motor(motor, position=2.052896709219859)" |
602 | 612 | ]
|
603 | 613 | },
|
604 | 614 | {
|
|
616 | 626 | "metadata": {},
|
617 | 627 | "outputs": [],
|
618 | 628 | "source": [
|
619 |
| - "rocket.parachutes = list(parachutes.values())\n" |
| 629 | + "rocket.parachutes = list(parachutes.values())" |
620 | 630 | ]
|
621 | 631 | },
|
622 | 632 | {
|
|
635 | 645 | "outputs": [],
|
636 | 646 | "source": [
|
637 | 647 | "rail_buttons = rocket.set_rail_buttons(\n",
|
638 |
| - " upper_button_position=1.148,\n", |
639 |
| - " lower_button_position=2.399,\n", |
640 |
| - " angular_position=30.000,\n", |
641 |
| - ")\n" |
| 648 | + " upper_button_position=1.148,\n", |
| 649 | + " lower_button_position=2.399,\n", |
| 650 | + " angular_position=30.000,\n", |
| 651 | + ")" |
642 | 652 | ]
|
643 | 653 | },
|
644 | 654 | {
|
|
818 | 828 | ],
|
819 | 829 | "source": [
|
820 | 830 | "### Rocket Info\n",
|
821 |
| - "rocket.all_info()\n" |
| 831 | + "rocket.all_info()" |
822 | 832 | ]
|
823 | 833 | },
|
824 | 834 | {
|
|
1229 | 1239 | }
|
1230 | 1240 | ],
|
1231 | 1241 | "source": [
|
1232 |
| - "flight.all_info()\n" |
| 1242 | + "flight.all_info()" |
1233 | 1243 | ]
|
1234 | 1244 | },
|
1235 | 1245 | {
|
|
1309 | 1319 | "print(f\"Time to apogee (OpenRocket): {time_to_apogee_ork:.3f} s\")\n",
|
1310 | 1320 | "print(f\"Time to apogee (RocketPy): {time_to_apogee_rpy:.3f} s\")\n",
|
1311 | 1321 | "apogee_difference = time_to_apogee_rpy - time_to_apogee_ork\n",
|
1312 |
| - "error = abs((apogee_difference)/time_to_apogee_rpy)*100\n", |
| 1322 | + "error = abs((apogee_difference) / time_to_apogee_rpy) * 100\n", |
1313 | 1323 | "print(f\"Time to apogee difference: {error:.3f} %\")\n",
|
1314 | 1324 | "print()\n",
|
1315 | 1325 | "\n",
|
|
1318 | 1328 | "print(f\"Flight time (OpenRocket): {flight_time_ork:.3f} s\")\n",
|
1319 | 1329 | "print(f\"Flight time (RocketPy): {flight_time_rpy:.3f} s\")\n",
|
1320 | 1330 | "flight_time_difference = flight_time_rpy - flight_time_ork\n",
|
1321 |
| - "error_flight_time = abs((flight_time_difference)/flight_time_rpy)*100\n", |
| 1331 | + "error_flight_time = abs((flight_time_difference) / flight_time_rpy) * 100\n", |
1322 | 1332 | "print(f\"Flight time difference: {error_flight_time:.3f} %\")\n",
|
1323 | 1333 | "print()\n",
|
1324 | 1334 | "\n",
|
|
1327 | 1337 | "print(f\"Ground hit velocity (OpenRocket): {ground_hit_velocity_ork:.3f} m/s\")\n",
|
1328 | 1338 | "print(f\"Ground hit velocity (RocketPy): {ground_hit_velocity_rpy:.3f} m/s\")\n",
|
1329 | 1339 | "ground_hit_velocity_difference = ground_hit_velocity_rpy - ground_hit_velocity_ork\n",
|
1330 |
| - "error_ground_hit_velocity = abs((ground_hit_velocity_difference)/ground_hit_velocity_rpy)*100\n", |
| 1340 | + "error_ground_hit_velocity = (\n", |
| 1341 | + " abs((ground_hit_velocity_difference) / ground_hit_velocity_rpy) * 100\n", |
| 1342 | + ")\n", |
1331 | 1343 | "print(f\"Ground hit velocity difference: {error_ground_hit_velocity:.3f} %\")\n",
|
1332 | 1344 | "print()\n",
|
1333 | 1345 | "\n",
|
|
1336 | 1348 | "print(f\"Launch rod velocity (OpenRocket): {launch_rod_velocity_ork:.3f} m/s\")\n",
|
1337 | 1349 | "print(f\"Launch rod velocity (RocketPy): {launch_rod_velocity_rpy:.3f} m/s\")\n",
|
1338 | 1350 | "launch_rod_velocity_difference = launch_rod_velocity_rpy - launch_rod_velocity_ork\n",
|
1339 |
| - "error_launch_rod_velocity = abs((launch_rod_velocity_difference)/launch_rod_velocity_rpy)*100\n", |
| 1351 | + "error_launch_rod_velocity = (\n", |
| 1352 | + " abs((launch_rod_velocity_difference) / launch_rod_velocity_rpy) * 100\n", |
| 1353 | + ")\n", |
1340 | 1354 | "print(f\"Launch rod velocity difference: {error_launch_rod_velocity:.3f} %\")\n",
|
1341 | 1355 | "print()\n",
|
1342 | 1356 | "\n",
|
|
1345 | 1359 | "print(f\"Max acceleration (OpenRocket): {max_acceleration_ork:.3f} m/s²\")\n",
|
1346 | 1360 | "print(f\"Max acceleration (RocketPy): {max_acceleration_rpy:.3f} m/s²\")\n",
|
1347 | 1361 | "max_acceleration_difference = max_acceleration_rpy - max_acceleration_ork\n",
|
1348 |
| - "error_max_acceleration = abs((max_acceleration_difference)/max_acceleration_rpy)*100\n", |
| 1362 | + "error_max_acceleration = abs((max_acceleration_difference) / max_acceleration_rpy) * 100\n", |
1349 | 1363 | "print(f\"Max acceleration difference: {error_max_acceleration:.3f} %\")\n",
|
1350 | 1364 | "print()\n",
|
1351 | 1365 | "\n",
|
|
1354 | 1368 | "print(f\"Max altitude (OpenRocket): {max_altitude_ork:.3f} m\")\n",
|
1355 | 1369 | "print(f\"Max altitude (RocketPy): {max_altitude_rpy:.3f} m\")\n",
|
1356 | 1370 | "max_altitude_difference = max_altitude_rpy - max_altitude_ork\n",
|
1357 |
| - "error_max_altitude = abs((max_altitude_difference)/max_altitude_rpy)*100\n", |
| 1371 | + "error_max_altitude = abs((max_altitude_difference) / max_altitude_rpy) * 100\n", |
1358 | 1372 | "print(f\"Max altitude difference: {error_max_altitude:.3f} %\")\n",
|
1359 | 1373 | "print()\n",
|
1360 | 1374 | "\n",
|
1361 | 1375 | "max_mach_ork = 0.36177\n",
|
1362 |
| - "max_mach_rpy = flight.max_mach_number \n", |
| 1376 | + "max_mach_rpy = flight.max_mach_number\n", |
1363 | 1377 | "print(f\"Max Mach (OpenRocket): {max_mach_ork:.3f}\")\n",
|
1364 | 1378 | "print(f\"Max Mach (RocketPy): {max_mach_rpy:.3f}\")\n",
|
1365 | 1379 | "max_mach_difference = max_mach_rpy - max_mach_ork\n",
|
1366 |
| - "error_max_mach = abs((max_mach_difference)/max_mach_rpy)*100\n", |
| 1380 | + "error_max_mach = abs((max_mach_difference) / max_mach_rpy) * 100\n", |
1367 | 1381 | "print(f\"Max Mach difference: {error_max_mach:.3f} %\")\n",
|
1368 | 1382 | "print()\n",
|
1369 | 1383 | "\n",
|
|
1372 | 1386 | "print(f\"Max velocity (OpenRocket): {max_velocity_ork:.3f} m/s\")\n",
|
1373 | 1387 | "print(f\"Max velocity (RocketPy): {max_velocity_rpy:.3f} m/s\")\n",
|
1374 | 1388 | "max_velocity_difference = max_velocity_rpy - max_velocity_ork\n",
|
1375 |
| - "error_max_velocity = abs((max_velocity_difference)/max_velocity_rpy)*100\n", |
| 1389 | + "error_max_velocity = abs((max_velocity_difference) / max_velocity_rpy) * 100\n", |
1376 | 1390 | "print(f\"Max velocity difference: {error_max_velocity:.3f} %\")\n",
|
1377 | 1391 | "print()\n",
|
1378 | 1392 | "\n",
|
|
1381 | 1395 | "print(f\"Max thrust (OpenRocket): {max_thrust_ork:.3f} N\")\n",
|
1382 | 1396 | "print(f\"Max thrust (RocketPy): {max_thrust_rpy:.3f} N\")\n",
|
1383 | 1397 | "max_thrust_difference = max_thrust_rpy - max_thrust_ork\n",
|
1384 |
| - "error_max_thrust = abs((max_thrust_difference)/max_thrust_rpy)*100\n", |
| 1398 | + "error_max_thrust = abs((max_thrust_difference) / max_thrust_rpy) * 100\n", |
1385 | 1399 | "print(f\"Max thrust difference: {error_max_thrust:.3f} %\")\n",
|
1386 | 1400 | "print()\n",
|
1387 | 1401 | "\n",
|
1388 | 1402 | "burnout_stability_margin_ork = 2.4363\n",
|
1389 |
| - "burnout_stability_margin_rpy = flight.stability_margin(flight.rocket.motor.burn_out_time)\n", |
| 1403 | + "burnout_stability_margin_rpy = flight.stability_margin(\n", |
| 1404 | + " flight.rocket.motor.burn_out_time\n", |
| 1405 | + ")\n", |
1390 | 1406 | "print(f\"Burnout stability margin (OpenRocket): {burnout_stability_margin_ork:.3f}\")\n",
|
1391 | 1407 | "print(f\"Burnout stability margin (RocketPy): {burnout_stability_margin_rpy:.3f}\")\n",
|
1392 |
| - "burnout_stability_margin_difference = burnout_stability_margin_rpy - burnout_stability_margin_ork\n", |
1393 |
| - "error_burnout_stability_margin = abs((burnout_stability_margin_difference)/burnout_stability_margin_rpy)*100\n", |
| 1408 | + "burnout_stability_margin_difference = (\n", |
| 1409 | + " burnout_stability_margin_rpy - burnout_stability_margin_ork\n", |
| 1410 | + ")\n", |
| 1411 | + "error_burnout_stability_margin = (\n", |
| 1412 | + " abs((burnout_stability_margin_difference) / burnout_stability_margin_rpy) * 100\n", |
| 1413 | + ")\n", |
1394 | 1414 | "print(f\"Burnout stability margin difference: {error_burnout_stability_margin:.3f} %\")\n",
|
1395 | 1415 | "print()\n",
|
1396 | 1416 | "\n",
|
|
1399 | 1419 | "print(f\"Max stability margin (OpenRocket): {max_stability_margin_ork:.3f}\")\n",
|
1400 | 1420 | "print(f\"Max stability margin (RocketPy): {max_stability_margin_rpy:.3f}\")\n",
|
1401 | 1421 | "max_stability_margin_difference = max_stability_margin_rpy - max_stability_margin_ork\n",
|
1402 |
| - "error_max_stability_margin = abs((max_stability_margin_difference)/max_stability_margin_rpy)*100\n", |
| 1422 | + "error_max_stability_margin = (\n", |
| 1423 | + " abs((max_stability_margin_difference) / max_stability_margin_rpy) * 100\n", |
| 1424 | + ")\n", |
1403 | 1425 | "print(f\"Max stability margin difference: {error_max_stability_margin:.3f} %\")\n",
|
1404 | 1426 | "print()\n",
|
1405 | 1427 | "\n",
|
|
1408 | 1430 | "print(f\"Min stability margin (OpenRocket): {min_stability_margin_ork:.3f}\")\n",
|
1409 | 1431 | "print(f\"Min stability margin (RocketPy): {min_stability_margin_rpy:.3f}\")\n",
|
1410 | 1432 | "min_stability_margin_difference = min_stability_margin_rpy - min_stability_margin_ork\n",
|
1411 |
| - "error_min_stability_margin = abs((min_stability_margin_difference)/min_stability_margin_rpy)*100\n", |
| 1433 | + "error_min_stability_margin = (\n", |
| 1434 | + " abs((min_stability_margin_difference) / min_stability_margin_rpy) * 100\n", |
| 1435 | + ")\n", |
1412 | 1436 | "print(f\"Min stability margin difference: {error_min_stability_margin:.3f} %\")\n",
|
1413 |
| - "print()\n", |
1414 |
| - "\n" |
| 1437 | + "print()" |
1415 | 1438 | ]
|
1416 | 1439 | }
|
1417 | 1440 | ],
|
|
0 commit comments