Skip to content

Commit

Permalink
Merge branch 'develop' into mnt/flight-simulation-speed-up
Browse files Browse the repository at this point in the history
  • Loading branch information
Gui-FernandesBR authored Apr 18, 2024
2 parents 826331f + a011c5a commit 9568256
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

- BUG: Swap rocket.total_mass.differentiate for motor.total_mass_flow rate [#585](https://github.com/RocketPy-Team/RocketPy/pull/585)
- BUG: export_eng 'Motor' method would not work for liquid motors. [#559](https://github.com/RocketPy-Team/RocketPy/pull/559)

## [v1.2.2] - 2024-03-22
Expand Down
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 @@ -771,6 +774,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 @@ -1644,8 +1644,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.total_mass.differentiate(t)
total_mass_ddot = self.rocket.total_mass.differentiate(t, order=2)
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
14 changes: 7 additions & 7 deletions tests/test_flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,12 +604,12 @@ def test_max_values(flight_calisto_robust):
calculated by hand, it was just copied from the test results. This is
because the expected values are not easy to calculate by hand, and the
results are not expected to change. If the results change, the test will
fail, and the expected values must be updated. If if want to update the
values, always double check if the results are really correct. Acceptable
reasons for changes in the results are: 1) changes in the code that
improve the accuracy of the simulation, 2) a bug was found and fixed. Keep
in mind that other tests may be more accurate than this one, for example,
the acceptance tests, which are based on the results of real flights.
fail, and the expected values must be updated. If the values are updated,
always double check if the results are really correct. Acceptable reasons
for changes in the results are: 1) changes in the code that improve the
accuracy of the simulation, 2) a bug was found and fixed. Keep in mind that
other tests may be more accurate than this one, for example, the acceptance
tests, which are based on the results of real flights.
Parameters
----------
Expand All @@ -622,7 +622,7 @@ def test_max_values(flight_calisto_robust):
assert pytest.approx(105.2774, abs=atol) == test.max_acceleration_power_on
assert pytest.approx(105.2774, abs=atol) == test.max_acceleration
assert pytest.approx(0.85999, abs=atol) == test.max_mach_number
assert pytest.approx(285.90240, abs=atol) == test.max_speed
assert pytest.approx(285.94948, abs=atol) == test.max_speed


def test_rail_buttons_forces(flight_calisto_custom_wind):
Expand Down

0 comments on commit 9568256

Please sign in to comment.