Skip to content

Commit

Permalink
ENH: Add propellant_mass plot to motors plots
Browse files Browse the repository at this point in the history
  • Loading branch information
Gui-FernandesBR committed Nov 10, 2023
1 parent fc2398c commit 064384a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 21 deletions.
6 changes: 3 additions & 3 deletions rocketpy/plots/liquid_motor_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ def all(self):
-------
None
"""

self.thrust(*self.motor.burn_time)
self.total_mass(*self.motor.burn_time)
self.center_of_mass(*self.motor.burn_time)
self.mass_flow_rate(*self.motor.burn_time)
self.exhaust_velocity(*self.motor.burn_time)
self.total_mass(*self.motor.burn_time)
self.propellant_mass(*self.motor.burn_time)
self.center_of_mass(*self.motor.burn_time)
self.I_11(*self.motor.burn_time)
self.I_22(*self.motor.burn_time)
self.I_33(*self.motor.burn_time)
Expand Down
36 changes: 21 additions & 15 deletions rocketpy/plots/motor_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def __init__(self, motor):
-------
None
"""

self.motor = motor

def thrust(self, lower_limit=None, upper_limit=None):
Expand All @@ -39,7 +38,6 @@ def thrust(self, lower_limit=None, upper_limit=None):
------
None
"""

self.motor.thrust.plot(lower=lower_limit, upper=upper_limit)

def total_mass(self, lower_limit=None, upper_limit=None):
Expand All @@ -58,9 +56,26 @@ def total_mass(self, lower_limit=None, upper_limit=None):
------
None
"""

self.motor.total_mass.plot(lower=lower_limit, upper=upper_limit)

def propellant_mass(self, lower_limit=None, upper_limit=None):
"""Plots propellant_mass of the motor as a function of time.
Parameters
----------
lower_limit : float
Lower limit of the plot. Default is None, which means that the plot
limits will be automatically calculated.
upper_limit : float
Upper limit of the plot. Default is None, which means that the plot
limits will be automatically calculated.
Return
------
None
"""
self.motor.propellant_mass.plot(lower=lower_limit, upper=upper_limit)

def center_of_mass(self, lower_limit=None, upper_limit=None):
"""Plots center_of_mass of the motor as a function of time.
Expand All @@ -77,7 +92,6 @@ def center_of_mass(self, lower_limit=None, upper_limit=None):
------
None
"""

self.motor.center_of_mass.plot(lower=lower_limit, upper=upper_limit)

def mass_flow_rate(self, lower_limit=None, upper_limit=None):
Expand All @@ -96,7 +110,6 @@ def mass_flow_rate(self, lower_limit=None, upper_limit=None):
------
None
"""

self.motor.mass_flow_rate.plot(lower=lower_limit, upper=upper_limit)

def exhaust_velocity(self, lower_limit=None, upper_limit=None):
Expand All @@ -115,7 +128,6 @@ def exhaust_velocity(self, lower_limit=None, upper_limit=None):
------
None
"""

self.motor.exhaust_velocity.plot(lower=lower_limit, upper=upper_limit)

def I_11(self, lower_limit=None, upper_limit=None):
Expand All @@ -134,7 +146,6 @@ def I_11(self, lower_limit=None, upper_limit=None):
------
None
"""

self.motor.I_11.plot(lower=lower_limit, upper=upper_limit)

def I_22(self, lower_limit=None, upper_limit=None):
Expand All @@ -153,7 +164,6 @@ def I_22(self, lower_limit=None, upper_limit=None):
------
None
"""

self.motor.I_22.plot(lower=lower_limit, upper=upper_limit)

def I_33(self, lower_limit=None, upper_limit=None):
Expand All @@ -172,7 +182,6 @@ def I_33(self, lower_limit=None, upper_limit=None):
------
None
"""

self.motor.I_33.plot(lower=lower_limit, upper=upper_limit)

def I_12(self, lower_limit=None, upper_limit=None):
Expand All @@ -191,7 +200,6 @@ def I_12(self, lower_limit=None, upper_limit=None):
------
None
"""

self.motor.I_12.plot(lower=lower_limit, upper=upper_limit)

def I_13(self, lower_limit=None, upper_limit=None):
Expand All @@ -210,7 +218,6 @@ def I_13(self, lower_limit=None, upper_limit=None):
------
None
"""

self.motor.I_13.plot(lower=lower_limit, upper=upper_limit)

def I_23(self, lower_limit=None, upper_limit=None):
Expand All @@ -229,7 +236,6 @@ def I_23(self, lower_limit=None, upper_limit=None):
------
None
"""

self.motor.I_23.plot(lower=lower_limit, upper=upper_limit)

def draw(self):
Expand All @@ -243,12 +249,12 @@ def all(self):
-------
None
"""

# Show plots
self.thrust(*self.motor.burn_time)
# self.mass_flow_rate(*self.motor.burn_time)
self.exhaust_velocity(*self.motor.burn_time)
self.total_mass(*self.motor.burn_time)
self.propellant_mass(*self.motor.burn_time)
self.center_of_mass(*self.motor.burn_time)
self.exhaust_velocity(*self.motor.burn_time)
self.I_11(*self.motor.burn_time)
self.I_22(*self.motor.burn_time)
self.I_33(*self.motor.burn_time)
Expand Down
6 changes: 3 additions & 3 deletions rocketpy/plots/solid_motor_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ def all(self):
-------
None
"""

self.thrust(*self.motor.burn_time)
self.total_mass(*self.motor.burn_time)
self.center_of_mass(*self.motor.burn_time)
self.mass_flow_rate(*self.motor.burn_time)
self.exhaust_velocity(*self.motor.burn_time)
self.total_mass(*self.motor.burn_time)
self.propellant_mass(*self.motor.burn_time)
self.center_of_mass(*self.motor.burn_time)
self.grain_inner_radius(*self.motor.burn_time)
self.grain_height(*self.motor.burn_time)
self.burn_rate(self.motor.burn_time[0], self.motor.grain_burn_out)
Expand Down

0 comments on commit 064384a

Please sign in to comment.