RocketPy
RocketPy copied to clipboard
ENH: Initial solution from flights gets previous results
Pull request type
- [x] Code changes (bugfix, features)
Checklist
- [ ] Tests for the changes have been added (not needed)
- [ ] Docs have been reviewed and added / updated
- [x] Lint (
black rocketpy/ tests/) has passed locally - [x] All tests (
pytest tests -m slow --runslow) have passed locally - [x]
CHANGELOG.mdhas been updated (if relevant)
Current behavior
When you use a Flight object as the initial solution, only the final state of the flight is captured.
See orange plot:
New behavior
Now the whole flight solution array is used in the new flight. See orange plot now:
Breaking change
- [x] No (all the current script made on top of rocketpy will still run and work, just some plots might change (for better) when using deployables of multi-stage.
Additional information
Another enhancement allowed by the euroc works that we have been doing.
Codecov Report
Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
Project coverage is 75.74%. Comparing base (
aa0673a) to head (59e44c6). Report is 1 commits behind head on develop.
| Files | Patch % | Lines |
|---|---|---|
| rocketpy/simulation/flight.py | 0.00% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## develop #568 +/- ##
===========================================
- Coverage 75.75% 75.74% -0.01%
===========================================
Files 81 81
Lines 9820 9821 +1
===========================================
Hits 7439 7439
- Misses 2381 2382 +1
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Good improvements, plots are much more intuitive to interpret now.
As a future enhancement, I believe it would be interesting to divide this plot different
Flightswith colors and labeling. I might open an issue about that later.
I don't think that is possible. The solution array from the first flight is passed as the initial solution array of the second. After the simulation is executed, there's no easy way to distinguish the first phase from the second.
This is what happens when running the deployable_payload_example.ipynb example:
Maybe your idea of creating different colors for the flight might help a little. Moreover, I think a better idea is to have some kind of "events" attribute and save the initial time with it. In other words, be able too identify the events that happened in a flight: FlightEvents(ignition=0, out_of_rail=x, burn_out=y, apogee=z, deploy_chute=w ....)
Anyways, I think it is important to add tests to this PR before merging. I'm not sure if all the plots will work properly after the changes.
PR is not working, needs some debugging still. As this is not so urgent, I will mark as a draft for now.
self = <rocketpy.simulation.flight.Flight object at 0x70b7fba580d0>
@funcify_method("Time (s)", "Freestream Velocity X (m/s)", "spline", "constant")
def stream_velocity_x(self):
"""Freestream velocity X component as a Function of time."""
stream_velocity_x = np.column_stack(
> (self.time, self.wind_velocity_x[:, 1] - self.vx[:, 1])
)
E ValueError: operands could not be broadcast together with shapes (389,) (1429,)
rocketpy/simulation/flight.py:2356: ValueError