Skip to content

Commit

Permalink
ENH: create rocket total_mass_flow_rate attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
MateusStano committed Apr 17, 2024
1 parent e2a94c8 commit 8ee2c95
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions rocketpy/rocket/rocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ class Rocket:
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.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.
Rocket.thrust_to_weight : Function
Function of time expressing the motor thrust force divided by rocket
weight. The gravitational acceleration is assumed as 9.80665 m/s^2.
Expand Down Expand Up @@ -764,6 +767,7 @@ def add_motor(self, motor, position):
self.motor.center_of_dry_mass_position * _ + self.motor_position
)
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_total_mass()
self.evaluate_center_of_dry_mass()
Expand Down
4 changes: 2 additions & 2 deletions rocketpy/simulation/flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -1645,8 +1645,8 @@ def u_dot_generalized(self, t, u, post_processing=False):
# Retrieve necessary quantities
rho = self.env.density.get_value_opt(z)
total_mass = self.rocket.total_mass.get_value_opt(t)
total_mass_dot = self.rocket.motor.total_mass_flow_rate(t)
total_mass_ddot = self.rocket.motor.total_mass_flow_rate.differentiate(t)
total_mass_dot = self.rocket.total_mass_flow_rate.get_value_opt(t)
total_mass_ddot = self.rocket.total_mass_flow_rate.differentiate(t)
## CM position vector and time derivatives relative to CDM in body frame
r_CM_z = (
-1
Expand Down

0 comments on commit 8ee2c95

Please sign in to comment.