-
-
Notifications
You must be signed in to change notification settings - Fork 206
BUG: Air Brakes Deployment Constant at Post Process #586
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #586 +/- ##
===========================================
+ Coverage 73.31% 73.33% +0.02%
===========================================
Files 57 57
Lines 9436 9448 +12
===========================================
+ Hits 6918 6929 +11
- Misses 2518 2519 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good PR, thanks for the implementations.
I've added some comments, and I'm open to discuss all of them before approving your PR.
Regarding the initialization of acceleration arrays with zeros, I believe it was done to avoid errors when initializing a flight using another flight as the initial solution.
Could you check if all the examples in the examples page are running correctly after you PR?
Also, sorry for being the CHANGELOG guru again, but could you please add your PR to the list? It should become an habit to us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to build the docs here... look what I've got:
File ~\Documents\github\RocketPy\rocketpy\mathutils\function.py:3388, in funcify_method.<locals>.funcify_method_decorator.__get__(self, instance, owner)
3384 except KeyError:
3385 # If cache is not ready, create it
3386 try:
3387 # Handle methods which return Function instances
-> 3388 val = self.func(instance).reset(*args, **kwargs)
3389 except AttributeError:
3390 # Handle methods which return a valid source
3391 source = self.func(instance)
File ~\Documents\github\RocketPy\rocketpy\simulation\flight.py:2449, in Flight.stream_velocity_x(self)
2445 @funcify_method("Time (s)", "Freestream Velocity X (m/s)", "spline", "constant")
2446 def stream_velocity_x(self):
2447 """Freestream velocity X component as a Function of time."""
2448 stream_velocity_x = np.column_stack(
-> 2449 (self.time, self.wind_velocity_x[:, 1] - self.vx[:, 1])
2450 )
2451 return stream_velocity_x
ValueError: operands could not be broadcast together with shapes (2066,) (2067,)
This seems to be due to |
|
This PR may present a conflict with the #581 , given that both deal with the postprocessing methods. |
…Py-Team/RocketPy into bug/airbrakes-postprocess
|
@Gui-FernandesBR ready for a new review!
The best option is to merge your PR first, and then I can change what is necessary here. Its not a big conflict |
|
@MateusStano please let me know when this gets ready for a re-review |
|
@Gui-FernandesBR its ready |
Ok, I want to test it locally before approving, so I will take a little longer time to review it. |
Co-authored-by: Pedro Henrique Marinho Bressan <87212571+phmbressan@users.noreply.github.com>
…Py-Team/RocketPy into bug/airbrakes-postprocess
Pull request type
Checklist
black rocketpy/ tests/) has passed locallypytest tests -m slow --runslow) have passed locallyCHANGELOG.mdhas been updated (if relevant)Current behavior
The calculations of post-processed variable (i.e. accelerations, forces and moments) are considering only the last state of the air brakes, instead of reconsidering its deployment level.
New behavior
Fixing this issue was quite challenging since we wanted to maintain the freedom of the
Controllerclass without big/breaking changes. The complexity here has to do with the fact that whatever object is being controlled (in this case the air brakes) has a state that varies throughout the simulation. There are two ways to go about dealing with this:@cached_propertyThe second option was implemented. The following was changed on the code:
_resetmethod was added to theAirBrakesclass that resets the deployment level to its initial value. This guarantees that running the air brakes will behave equally if twoFlightinitializations are run consecutivelytime_overshoot=False__retrieve_arraysmethod was created that unitesretrieve_acceleration_arraysandretrieve_temporary_values_arraysinto only one loop and optimizes it. This was done so that the in-simulation post-processing for controllers could be done in only one udot call.Breaking change
Additional information
One thing was changed that changes simulation results. The accelerations used to always be initialized with.
I do not know what this was for and it seems wrong at a first glance. I changed it to be initialized with empty lists instead and all tests are passing.
The initialization with
[[0, 0]]was introduced in #295, commit 291d479. Maybe @Gui-FernandesBR knows what this was for?