Skip to content

Commit a99c3c2

Browse files
committed
ENH: add structural mass ratio to rocket
1 parent 04afa13 commit a99c3c2

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

rocketpy/motors/motor.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,8 @@ def structural_mass_ratio(self):
510510
Initial structural mass ratio.
511511
"""
512512
initial_total_mass = self.dry_mass + self.propellant_initial_mass
513+
if initial_total_mass == 0:
514+
raise ValueError("Motor total mass is zero!")
513515
return self.dry_mass / initial_total_mass
514516

515517
@funcify_method("Time (s)", "Motor center of mass (m)")
@@ -1517,6 +1519,7 @@ def __init__(self):
15171519
self.nozzle_radius = 0
15181520
self.thrust = Function(0, "Time (s)", "Thrust (N)")
15191521
self.propellant_mass = Function(0, "Time (s)", "Propellant Mass (kg)")
1522+
self.propellant_initial_mass = 0
15201523
self.total_mass = Function(0, "Time (s)", "Total Mass (kg)")
15211524
self.total_mass_flow_rate = Function(
15221525
0, "Time (s)", "Mass Depletion Rate (kg/s)"

rocketpy/prints/rocket_prints.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ def inertia_details(self):
3636
print(f"Rocket Mass: {self.rocket.mass:.3f} kg (without motor)")
3737
print(f"Rocket Dry Mass: {self.rocket.dry_mass:.3f} kg (with unloaded motor)")
3838
print(f"Rocket Loaded Mass: {self.rocket.total_mass(0):.3f} kg")
39-
mass_ratio = self.rocket.dry_mass / self.rocket.total_mass(0)
40-
print(f"Rocket Structural to total mass ratio: {mass_ratio:.3f}")
39+
print(f"Rocket Structural Mass Ratio: {self.rocket.structural_mass_ratio:.3f}")
4140
print(
4241
f"Rocket Inertia (with unloaded motor) 11: {self.rocket.dry_I_11:.3f} kg*m2"
4342
)

rocketpy/rocket/rocket.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ def __init__( # pylint: disable=too-many-statements
361361

362362
# calculate dynamic inertial quantities
363363
self.evaluate_dry_mass()
364+
self.evaluate_structural_mass_ratio()
364365
self.evaluate_total_mass()
365366
self.evaluate_center_of_dry_mass()
366367
self.evaluate_center_of_mass()
@@ -433,6 +434,26 @@ def evaluate_dry_mass(self):
433434

434435
return self.dry_mass
435436

437+
def evaluate_structural_mass_ratio(self):
438+
"""Calculates and returns the rocket's structural mass ratio.
439+
It is defined as the ratio between of the dry mass
440+
(Motor + Rocket) and the initial total mass
441+
(Motor + Propellant + Rocket).
442+
443+
Returns
444+
-------
445+
self.structural_mass_ratio: float
446+
Initial structural mass ratio dry mass (Rocket + Motor) (kg)
447+
divided by total mass (Rocket + Motor + Propellant) (kg).
448+
"""
449+
# Make sure there is a motor associated with the rocket
450+
451+
self.structural_mass_ratio = self.dry_mass / (
452+
self.dry_mass + self.motor.propellant_initial_mass
453+
)
454+
455+
return self.structural_mass_ratio
456+
436457
def evaluate_center_of_mass(self):
437458
"""Evaluates rocket center of mass position relative to user defined
438459
rocket reference system.
@@ -951,6 +972,7 @@ def add_motor(self, motor, position): # pylint: disable=too-many-statements
951972
self.nozzle_position = self.motor.nozzle_position * _ + self.motor_position
952973
self.total_mass_flow_rate = self.motor.total_mass_flow_rate
953974
self.evaluate_dry_mass()
975+
self.evaluate_structural_mass_ratio()
954976
self.evaluate_total_mass()
955977
self.evaluate_center_of_dry_mass()
956978
self.evaluate_nozzle_to_cdm()

0 commit comments

Comments
 (0)