Skip to content

Commit 7ea4cd5

Browse files
committed
BUG: add correct effective rail
1 parent 81e4d1a commit 7ea4cd5

1 file changed

Lines changed: 31 additions & 35 deletions

File tree

rocketpy/simulation/flight.py

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,6 +1171,37 @@ def __init_equations_of_motion(self):
11711171
if self.equations_of_motion == "solid_propulsion":
11721172
self.u_dot_generalized = self.u_dot
11731173

1174+
@cached_property
1175+
def effective_1rl(self):
1176+
"""Original rail length minus the distance measured from nozzle exit
1177+
to the upper rail button. It assumes the nozzle to be aligned with
1178+
the beginning of the rail."""
1179+
nozzle = self.rocket.nozzle_position
1180+
try:
1181+
rail_buttons = self.rocket.rail_buttons[0]
1182+
upper_r_button = (
1183+
rail_buttons.component.buttons_distance * self.rocket._csys
1184+
+ rail_buttons.position
1185+
)
1186+
except IndexError: # No rail buttons defined
1187+
upper_r_button = nozzle
1188+
effective_1rl = self.rail_length - abs(nozzle - upper_r_button)
1189+
return effective_1rl
1190+
1191+
@cached_property
1192+
def effective_2rl(self):
1193+
"""Original rail length minus the distance measured from nozzle exit
1194+
to the lower rail button. It assumes the nozzle to be aligned with
1195+
the beginning of the rail."""
1196+
nozzle = self.rocket.nozzle_position
1197+
try:
1198+
rail_buttons = self.rocket.rail_buttons[0]
1199+
lower_r_button = rail_buttons.position
1200+
except IndexError: # No rail buttons defined
1201+
lower_r_button = nozzle
1202+
effective_2rl = self.rail_length - abs(nozzle - lower_r_button)
1203+
return effective_2rl
1204+
11741205
@cached_property
11751206
def frontal_surface_wind(self):
11761207
# Surface wind magnitude in the frontal direction at the rail's elevation
@@ -2542,41 +2573,6 @@ def static_margin(self):
25422573
"""Static margin of the rocket."""
25432574
return self.rocket.static_margin
25442575

2545-
# Rail Button Forces
2546-
@cached_property
2547-
def effective_1rl(self):
2548-
"""Original rail length minus the distance measured from nozzle exit
2549-
to the upper rail button. It assumes the nozzle to be aligned with
2550-
the beginning of the rail."""
2551-
nozzle = (
2552-
self.rocket.nozzle_position - self.rocket.center_of_dry_mass_position
2553-
) * self.rocket._csys # Kinda works for single nozzle
2554-
try:
2555-
rail_buttons = self.rocket.rail_buttons[0]
2556-
upper_r_button = (
2557-
rail_buttons.component.buttons_distance + rail_buttons.position
2558-
)
2559-
except IndexError: # No rail buttons defined
2560-
upper_r_button = nozzle
2561-
effective_1rl = self.rail_length - abs(nozzle - upper_r_button)
2562-
return effective_1rl
2563-
2564-
@cached_property
2565-
def effective_2rl(self):
2566-
"""Original rail length minus the distance measured from nozzle exit
2567-
to the lower rail button. It assumes the nozzle to be aligned with
2568-
the beginning of the rail."""
2569-
nozzle = (
2570-
self.rocket.nozzle_position - self.rocket.center_of_dry_mass_position
2571-
) * self.rocket._csys
2572-
try:
2573-
rail_buttons = self.rocket.rail_buttons[0]
2574-
lower_r_button = rail_buttons.position
2575-
except IndexError: # No rail buttons defined
2576-
lower_r_button = nozzle
2577-
effective_2rl = self.rail_length - abs(nozzle - lower_r_button)
2578-
return effective_2rl
2579-
25802576
@cached_property
25812577
def frontal_surface_wind(self):
25822578
"""Surface wind speed in m/s aligned with the launch rail."""

0 commit comments

Comments
 (0)