Skip to content

Commit

Permalink
BUG: fix dry_mass None check
Browse files Browse the repository at this point in the history
  • Loading branch information
laurapgp committed Oct 9, 2024
1 parent 9c0b3e7 commit bdc51ba
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions rocketpy/motors/motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,38 @@ def burn_time(self, burn_time):
" argument must be specified."
)

@property
def dry_mass(self):
"""Dry mass of the motor in kg.
Returns
-------
self.dry_mass : float
Motor dry mass in kg.
"""
return self._dry_mass

@dry_mass.setter
def dry_mass(self, dry_mass):
"""Sets dry mass of the motor in kg.
Parameters
----------
dry_mass : float
Motor dry mass in kg.
"""
if dry_mass is not None:
if isinstance(dry_mass, (int, float)):
self._dry_mass = dry_mass
else:
raise ValueError("Dry mass must be a number.")
elif self.description_eng_file:
self._dry_mass = float(self.description_eng_file[-2]) - float(
self.description_eng_file[-3]
)
else:
raise ValueError("Dry mass must be specified.")

@cached_property
def total_impulse(self):
"""Calculates and returns total impulse by numerical integration
Expand Down

0 comments on commit bdc51ba

Please sign in to comment.