@@ -227,6 +227,7 @@ def build_rocket(self, nb: nbf.v4.new_notebook):
227
227
nb ["cells" ].append (nbf .v4 .new_code_cell (text ))
228
228
229
229
nb = self .add_parachutes_to_rocket (nb )
230
+ nb = self .build_rail_buttons (nb )
230
231
231
232
text = "### Rocket Info\n "
232
233
text += "rocket.all_info()\n "
@@ -243,7 +244,6 @@ def build_all_aerodynamic_surfaces(
243
244
self .build_nosecones (nb )
244
245
self .build_fins (nb )
245
246
self .build_tails (nb )
246
- self .build_rail_buttons (nb )
247
247
self .build_parachute (nb )
248
248
logger .info ("[NOTEBOOK BUILDER] All aerodynamic surfaces created." )
249
249
return nb
@@ -434,7 +434,21 @@ def build_tails(self, nb: nbf.v4.new_notebook) -> nbf.v4.new_notebook:
434
434
return nb
435
435
436
436
def build_rail_buttons (self , nb : nbf .v4 .new_notebook ) -> nbf .v4 .new_notebook :
437
- logger .info ("rail buttons not implemented yet" )
437
+ # add a markdown cell
438
+ text = "### Rail Buttons\n "
439
+ nb ["cells" ].append (nbf .v4 .new_markdown_cell (text ))
440
+ rail_button_i = self .parameters ["rail_buttons" ]
441
+ upper_position = rail_button_i ["upper_position" ]
442
+ lower_position = rail_button_i ["lower_position" ]
443
+ ang_position = rail_button_i ["angular_position" ]
444
+ text = "rail_buttons = rocket.set_rail_buttons(\n "
445
+ text += f" upper_button_position={ upper_position :.3f} ,\n "
446
+ text += f" lower_button_position={ lower_position :.3f} ,\n "
447
+ text += f" angular_position={ ang_position :.3f} ,\n "
448
+ text += ")\n "
449
+ nb ["cells" ].append (nbf .v4 .new_code_cell (text ))
450
+
451
+ logger .info ("[NOTEBOOK BUILDER] Rail Buttons created." )
438
452
return nb
439
453
440
454
def build_parachute (self , nb : nbf .v4 .new_notebook ) -> nbf .v4 .new_notebook :
@@ -535,6 +549,7 @@ def build_compare_results(self, nb: nbf.v4.new_notebook) -> nbf.v4.new_notebook:
535
549
text += "error = abs((apogee_difference)/time_to_apogee_rpy)*100"
536
550
text += "\n "
537
551
text += r'print(f"Time to apogee difference: {error:.3f} %")'
552
+ text += "\n print()"
538
553
text += "\n \n "
539
554
540
555
# Flight time
@@ -550,10 +565,11 @@ def build_compare_results(self, nb: nbf.v4.new_notebook) -> nbf.v4.new_notebook:
550
565
"error_flight_time = abs((flight_time_difference)/flight_time_rpy)*100\n "
551
566
)
552
567
text += r'print(f"Flight time difference: {error_flight_time:.3f} %")'
568
+ text += "\n print()"
553
569
text += "\n \n "
554
570
555
571
# Ground hit velocity
556
- ground_hit_velocity_ork = self .parameters ["stored_results" ][
572
+ ground_hit_velocity_ork = - self .parameters ["stored_results" ][
557
573
"ground_hit_velocity"
558
574
]
559
575
text += f"ground_hit_velocity_ork = { ground_hit_velocity_ork } \n "
@@ -565,6 +581,7 @@ def build_compare_results(self, nb: nbf.v4.new_notebook) -> nbf.v4.new_notebook:
565
581
text += "ground_hit_velocity_difference = ground_hit_velocity_rpy - ground_hit_velocity_ork\n "
566
582
text += "error_ground_hit_velocity = abs((ground_hit_velocity_difference)/ground_hit_velocity_rpy)*100\n "
567
583
text += r'print(f"Ground hit velocity difference: {error_ground_hit_velocity:.3f} %")'
584
+ text += "\n print()"
568
585
text += "\n \n "
569
586
570
587
# Launch rod velocity
@@ -580,6 +597,7 @@ def build_compare_results(self, nb: nbf.v4.new_notebook) -> nbf.v4.new_notebook:
580
597
text += "launch_rod_velocity_difference = launch_rod_velocity_rpy - launch_rod_velocity_ork\n "
581
598
text += "error_launch_rod_velocity = abs((launch_rod_velocity_difference)/launch_rod_velocity_rpy)*100\n "
582
599
text += r'print(f"Launch rod velocity difference: {error_launch_rod_velocity:.3f} %")'
600
+ text += "\n print()"
583
601
text += "\n \n "
584
602
585
603
# Max acceleration
@@ -599,6 +617,7 @@ def build_compare_results(self, nb: nbf.v4.new_notebook) -> nbf.v4.new_notebook:
599
617
text += (
600
618
r'print(f"Max acceleration difference: {error_max_acceleration:.3f} %")'
601
619
)
620
+ text += "\n print()"
602
621
text += "\n \n "
603
622
604
623
# Max altitude
@@ -614,6 +633,7 @@ def build_compare_results(self, nb: nbf.v4.new_notebook) -> nbf.v4.new_notebook:
614
633
"error_max_altitude = abs((max_altitude_difference)/max_altitude_rpy)*100\n "
615
634
)
616
635
text += r'print(f"Max altitude difference: {error_max_altitude:.3f} %")'
636
+ text += "\n print()"
617
637
text += "\n \n "
618
638
619
639
# Max Mach
@@ -627,6 +647,7 @@ def build_compare_results(self, nb: nbf.v4.new_notebook) -> nbf.v4.new_notebook:
627
647
text += "max_mach_difference = max_mach_rpy - max_mach_ork\n "
628
648
text += "error_max_mach = abs((max_mach_difference)/max_mach_rpy)*100\n "
629
649
text += r'print(f"Max Mach difference: {error_max_mach:.3f} %")'
650
+ text += "\n print()"
630
651
text += "\n \n "
631
652
632
653
# Max velocity
@@ -642,6 +663,7 @@ def build_compare_results(self, nb: nbf.v4.new_notebook) -> nbf.v4.new_notebook:
642
663
"error_max_velocity = abs((max_velocity_difference)/max_velocity_rpy)*100\n "
643
664
)
644
665
text += r'print(f"Max velocity difference: {error_max_velocity:.3f} %")'
666
+ text += "\n print()"
645
667
text += "\n \n "
646
668
647
669
# Max thrust
@@ -655,6 +677,7 @@ def build_compare_results(self, nb: nbf.v4.new_notebook) -> nbf.v4.new_notebook:
655
677
text += "max_thrust_difference = max_thrust_rpy - max_thrust_ork\n "
656
678
text += "error_max_thrust = abs((max_thrust_difference)/max_thrust_rpy)*100\n "
657
679
text += r'print(f"Max thrust difference: {error_max_thrust:.3f} %")'
680
+ text += "\n print()"
658
681
text += "\n \n "
659
682
660
683
# # Burnout stability margin
@@ -670,6 +693,7 @@ def build_compare_results(self, nb: nbf.v4.new_notebook) -> nbf.v4.new_notebook:
670
693
text += "burnout_stability_margin_difference = burnout_stability_margin_rpy - burnout_stability_margin_ork\n "
671
694
text += "error_burnout_stability_margin = abs((burnout_stability_margin_difference)/burnout_stability_margin_rpy)*100\n "
672
695
text += r'print(f"Burnout stability margin difference: {error_burnout_stability_margin:.3f} %")'
696
+ text += "\n print()"
673
697
text += "\n \n "
674
698
675
699
# # Max stability margin
@@ -685,6 +709,7 @@ def build_compare_results(self, nb: nbf.v4.new_notebook) -> nbf.v4.new_notebook:
685
709
text += "max_stability_margin_difference = max_stability_margin_rpy - max_stability_margin_ork\n "
686
710
text += "error_max_stability_margin = abs((max_stability_margin_difference)/max_stability_margin_rpy)*100\n "
687
711
text += r'print(f"Max stability margin difference: {error_max_stability_margin:.3f} %")'
712
+ text += "\n print()"
688
713
text += "\n \n "
689
714
690
715
# Min stability margin
@@ -700,6 +725,7 @@ def build_compare_results(self, nb: nbf.v4.new_notebook) -> nbf.v4.new_notebook:
700
725
text += "min_stability_margin_difference = min_stability_margin_rpy - min_stability_margin_ork\n "
701
726
text += "error_min_stability_margin = abs((min_stability_margin_difference)/min_stability_margin_rpy)*100\n "
702
727
text += r'print(f"Min stability margin difference: {error_min_stability_margin:.3f} %")'
728
+ text += "\n print()"
703
729
text += "\n \n "
704
730
705
731
nb ["cells" ].append (nbf .v4 .new_code_cell (text ))
0 commit comments