Skip to content

Commit 28fb82d

Browse files
committed
fixed new method added properties
1 parent b30e40c commit 28fb82d

1 file changed

Lines changed: 34 additions & 6 deletions

File tree

rocketpy/simulation/flight.py

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3970,20 +3970,23 @@ def __lt__(self, other):
39703970
otherwise.
39713971
"""
39723972
return self.t < other.t
3973-
def _calculate_rail_button_bending_moments(self):
3973+
@cachedproperty
3974+
def calculate_rail_button_bending_moments(self):
39743975
"""
39753976
Calculate internal bending moments at rail button attachment points.
3976-
3977+
39773978
Uses beam theory with simple support assumptions (ΣF≠0, M_contact=0)
39783979
to determine internal structural moments for stress analysis.
3979-
3980+
39803981
The bending moment at each button consists of two components:
39813982
1. Main bending from the opposing button's normal force (M = N × L)
39823983
2. Additional moment from shear force at button tip (M = S × h)
3983-
3984+
39843985
Returns
39853986
-------
3986-
None
3987+
tuple
3988+
(rail_button1_bending_moment, max_rail_button1_bending_moment,
3989+
rail_button2_bending_moment, max_rail_button2_bending_moment)
39873990
"""
39883991
# Check if rail buttons exist
39893992
if len(self.rocket.rail_buttons) == 0:
@@ -4028,4 +4031,29 @@ def _calculate_rail_button_bending_moments(self):
40284031
)
40294032
# Maximum bending moments in terms of absolute value for stress calculations
40304033
self.max_rail_button1_bending_moment = float(np.max(np.abs(M1_values)))
4031-
self.max_rail_button2_bending_moment = float(np.max(np.abs(M2_values)))
4034+
self.max_rail_button2_bending_moment = float(np.max(np.abs(M2_values)))
4035+
return (
4036+
self.rail_button1_bending_moment,
4037+
self.max_rail_button1_bending_moment,
4038+
self.rail_button2_bending_moment,
4039+
self.max_rail_button2_bending_moment,
4040+
)
4041+
@property
4042+
def rail_button1_bending_moment(self):
4043+
"""Upper rail button bending moment as a Function of time."""
4044+
return self.calculate_rail_button_bending_moments[0]
4045+
4046+
@property
4047+
def max_rail_button1_bending_moment(self):
4048+
"""Maximum upper rail button bending moment, in N·m."""
4049+
return self.calculate_rail_button_bending_moments[1]
4050+
4051+
@property
4052+
def rail_button2_bending_moment(self):
4053+
"""Lower rail button bending moment as a Function of time."""
4054+
return self.calculate_rail_button_bending_moments[2]
4055+
4056+
@property
4057+
def max_rail_button2_bending_moment(self):
4058+
"""Maximum lower rail button bending moment, in N·m."""
4059+
return self.calculate_rail_button_bending_moments[3]

0 commit comments

Comments
 (0)