Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Initial solution from flights gets previous results #568

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Gui-FernandesBR
Copy link
Member

@Gui-FernandesBR Gui-FernandesBR commented Mar 4, 2024

Pull request type

  • Code changes (bugfix, features)

Checklist

  • Tests for the changes have been added (not needed)
  • Docs have been reviewed and added / updated
  • Lint (black rocketpy/ tests/) has passed locally
  • All tests (pytest tests -m slow --runslow) have passed locally
  • CHANGELOG.md has 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:
image

New behavior

Now the whole flight solution array is used in the new flight.
See orange plot now:

image

Breaking change

  • 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.

@Gui-FernandesBR Gui-FernandesBR added Enhancement New feature or request, including adjustments in current codes Outputs Dedicated to visualizations enhancements like prints and plots Flight Flight Class related features labels Mar 4, 2024
@Gui-FernandesBR Gui-FernandesBR added this to the Release v1.X.0 milestone Mar 4, 2024
@Gui-FernandesBR Gui-FernandesBR self-assigned this Mar 4, 2024
@Gui-FernandesBR Gui-FernandesBR requested a review from a team as a code owner March 4, 2024 19:30
@Gui-FernandesBR Gui-FernandesBR changed the base branch from master to develop March 4, 2024 19:30
Copy link

codecov bot commented Mar 4, 2024

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 ⚠️
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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@phmbressan phmbressan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Flights with colors and labeling. I might open an issue about that later.

@Gui-FernandesBR
Copy link
Member Author

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 Flights with 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.

@Gui-FernandesBR
Copy link
Member Author

This is what happens when running the deployable_payload_example.ipynb example:

image

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.

@Gui-FernandesBR
Copy link
Member Author

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

@Gui-FernandesBR Gui-FernandesBR marked this pull request as draft March 21, 2024 15:30
@Gui-FernandesBR Gui-FernandesBR force-pushed the enh/initial-solution-from-flights-gets-previous-results branch from 5045d6a to 59e44c6 Compare August 3, 2024 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request, including adjustments in current codes Flight Flight Class related features Outputs Dedicated to visualizations enhancements like prints and plots
Projects
Status: Mid-Term
Development

Successfully merging this pull request may close these issues.

2 participants