Skip to content
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Attention: The newest changes should be on top -->

### Added


- ENH: add structural to total mass ratio for motor and rocket [#713](https://github.com/RocketPy-Team/RocketPy/pull/713)

### Changed

Expand Down
2 changes: 2 additions & 0 deletions rocketpy/motors/hybrid_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ class HybridMotor(Motor):
HybridMotor.propellant_mass : Function
Total propellant mass in kg as a function of time, this includes the
mass of fluids in each tank and the mass of the solid grains.
HybridMotor.structural_mass_ratio: float
Initial ratio between the dry mass and the total mass.
HybridMotor.total_mass_flow_rate : Function
Time derivative of propellant total mass in kg/s as a function
of time as obtained by the thrust source.
Expand Down
2 changes: 2 additions & 0 deletions rocketpy/motors/liquid_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class LiquidMotor(Motor):
LiquidMotor.propellant_mass : Function
Total propellant mass in kg as a function of time, includes fuel
and oxidizer.
LiquidMotor.structural_mass_ratio: float
Initial ratio between the dry mass and the total mass.
LiquidMotor.total_mass_flow_rate : Function
Time derivative of propellant total mass in kg/s as a function
of time as obtained by the tanks mass flow.
Expand Down
21 changes: 21 additions & 0 deletions rocketpy/motors/motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
Motor.propellant_mass : Function
Total propellant mass in kg as a function of time, including solid,
liquid and gas phases.
Motor.structural_mass_ratio: float
Initial ratio between the dry mass and the total mass.
Motor.total_mass_flow_rate : Function
Time derivative of propellant total mass in kg/s as a function
of time as obtained by the thrust source.
Expand Down Expand Up @@ -497,6 +499,24 @@
Propellant initial mass in kg.
"""

@property
def structural_mass_ratio(self):
"""Calculates the structural mass ratio. The ratio is defined as
the dry mass divided by the initial total mass.

Returns
-------
float
Initial structural mass ratio.
"""
initial_total_mass = self.dry_mass + self.propellant_initial_mass
try:
return self.dry_mass / initial_total_mass
except ZeroDivisionError as e:
raise ValueError(

Check warning on line 516 in rocketpy/motors/motor.py

View check run for this annotation

Codecov / codecov/patch

rocketpy/motors/motor.py#L515-L516

Added lines #L515 - L516 were not covered by tests
"Total motor mass (dry + propellant) cannot be zero"
) from e

@funcify_method("Time (s)", "Motor center of mass (m)")
def center_of_mass(self):
"""Position of the center of mass as a function of time. The position
Expand Down Expand Up @@ -1502,6 +1522,7 @@
self.nozzle_radius = 0
self.thrust = Function(0, "Time (s)", "Thrust (N)")
self.propellant_mass = Function(0, "Time (s)", "Propellant Mass (kg)")
self.propellant_initial_mass = 0
self.total_mass = Function(0, "Time (s)", "Total Mass (kg)")
self.total_mass_flow_rate = Function(
0, "Time (s)", "Mass Depletion Rate (kg/s)"
Expand Down
2 changes: 2 additions & 0 deletions rocketpy/motors/solid_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class SolidMotor(Motor):
of propellant and dry mass.
SolidMotor.propellant_mass : Function
Total propellant mass in kg as a function of time.
SolidMotor.structural_mass_ratio: float
Initial ratio between the dry mass and the total mass.
SolidMotor.total_mass_flow_rate : Function
Time derivative of propellant total mass in kg/s as a function
of time as obtained by the thrust source.
Expand Down
1 change: 1 addition & 0 deletions rocketpy/prints/hybrid_motor_prints.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def motor_details(self):
print(
f"Total Propellant Mass: {self.hybrid_motor.propellant_initial_mass:.3f} kg"
)
print(f"Structural Mass Ratio: {self.hybrid_motor.structural_mass_ratio:.3f}")
avg = self.hybrid_motor.exhaust_velocity.average(*self.hybrid_motor.burn_time)
print(f"Average Propellant Exhaust Velocity: {avg:.3f} m/s")
print(f"Average Thrust: {self.hybrid_motor.average_thrust:.3f} N")
Expand Down
1 change: 1 addition & 0 deletions rocketpy/prints/liquid_motor_prints.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def motor_details(self):
print(
f"Total Propellant Mass: {self.liquid_motor.propellant_initial_mass:.3f} kg"
)
print(f"Structural Mass Ratio: {self.liquid_motor.structural_mass_ratio:.3f}")
avg = self.liquid_motor.exhaust_velocity.average(*self.liquid_motor.burn_time)
print(f"Average Propellant Exhaust Velocity: {avg:.3f} m/s")
print(f"Average Thrust: {self.liquid_motor.average_thrust:.3f} N")
Expand Down
1 change: 1 addition & 0 deletions rocketpy/prints/motor_prints.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def motor_details(self):
print("Motor Details")
print("Total Burning Time: " + str(self.motor.burn_out_time) + " s")
print(f"Total Propellant Mass: {self.motor.propellant_initial_mass:.3f} kg")
print(f"Structural Mass Ratio: {self.motor.structural_mass_ratio:.3f}")
print(
"Average Propellant Exhaust Velocity: "
f"{self.motor.exhaust_velocity.average(*self.motor.burn_time):.3f} m/s"
Expand Down
1 change: 1 addition & 0 deletions rocketpy/prints/rocket_prints.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def inertia_details(self):
print(f"Rocket Mass: {self.rocket.mass:.3f} kg (without motor)")
print(f"Rocket Dry Mass: {self.rocket.dry_mass:.3f} kg (with unloaded motor)")
print(f"Rocket Loaded Mass: {self.rocket.total_mass(0):.3f} kg")
print(f"Rocket Structural Mass Ratio: {self.rocket.structural_mass_ratio:.3f}")
print(
f"Rocket Inertia (with unloaded motor) 11: {self.rocket.dry_I_11:.3f} kg*m2"
)
Expand Down
1 change: 1 addition & 0 deletions rocketpy/prints/solid_motor_prints.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def motor_details(self):
print(
f"Total Propellant Mass: {self.solid_motor.propellant_initial_mass:.3f} kg"
)
print(f"Structural Mass Ratio: {self.solid_motor.structural_mass_ratio:.3f}")
average = self.solid_motor.exhaust_velocity.average(*self.solid_motor.burn_time)
print(f"Average Propellant Exhaust Velocity: {average:.3f} m/s")
print(f"Average Thrust: {self.solid_motor.average_thrust:.3f} N")
Expand Down
26 changes: 26 additions & 0 deletions rocketpy/rocket/rocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@
Function of time expressing the total mass of the rocket,
defined as the sum of the propellant mass and the rocket
mass without propellant.
Rocket.structural_mass_ratio: float
Initial ratio between the dry mass and the total mass.
Rocket.total_mass_flow_rate : Function
Time derivative of rocket's total mass in kg/s as a function
of time as obtained by the thrust source of the added motor.
Expand Down Expand Up @@ -361,6 +363,7 @@

# calculate dynamic inertial quantities
self.evaluate_dry_mass()
self.evaluate_structural_mass_ratio()
self.evaluate_total_mass()
self.evaluate_center_of_dry_mass()
self.evaluate_center_of_mass()
Expand Down Expand Up @@ -433,6 +436,28 @@

return self.dry_mass

def evaluate_structural_mass_ratio(self):
"""Calculates and returns the rocket's structural mass ratio.
It is defined as the ratio between of the dry mass
(Motor + Rocket) and the initial total mass
(Motor + Propellant + Rocket).

Returns
-------
self.structural_mass_ratio: float
Initial structural mass ratio dry mass (Rocket + Motor) (kg)
divided by total mass (Rocket + Motor + Propellant) (kg).
"""
try:
self.structural_mass_ratio = self.dry_mass / (
self.dry_mass + self.motor.propellant_initial_mass
)
except ZeroDivisionError as e:
raise ValueError(

Check warning on line 456 in rocketpy/rocket/rocket.py

View check run for this annotation

Codecov / codecov/patch

rocketpy/rocket/rocket.py#L455-L456

Added lines #L455 - L456 were not covered by tests
"Total rocket mass (dry + propellant) cannot be zero"
) from e
return self.structural_mass_ratio

def evaluate_center_of_mass(self):
"""Evaluates rocket center of mass position relative to user defined
rocket reference system.
Expand Down Expand Up @@ -951,6 +976,7 @@
self.nozzle_position = self.motor.nozzle_position * _ + self.motor_position
self.total_mass_flow_rate = self.motor.total_mass_flow_rate
self.evaluate_dry_mass()
self.evaluate_structural_mass_ratio()
self.evaluate_total_mass()
self.evaluate_center_of_dry_mass()
self.evaluate_nozzle_to_cdm()
Expand Down
Loading