Conversation
Co-authored-by: kevin-alcaniz <kevinalcaniz22@gmail.com>
Co-authored-by: kevin-alcaniz <kevinalcaniz22@gmail.com>
commit c674725 Author: Kevin Alcañiz <kevinalcaniz22@gmail.com> Date: Sat Apr 12 13:40:25 2025 +0200 ENH: Introduce Net Thrust with pressure corrections (#789) * wind factor bug corrected the wind factor wasn't applied to the env.wind_velocity properties * BUG: StochasticModel visualize attributes of a uniform distribution It showed the nominal and the standard deviation values and it doesn't make sense in a uniform distribution. In a np.random.uniform the 'nominal value' is the lower bound of the distribution, and the 'standard deviation' value is the upper bound. Now, a new condition has been added for the uniform distributions where the mean and semi range are calculated and showed. This way the visualize_attribute function will show the whole range where the random values are uniformly taken in * variable names corrections * Corrections requested by the pylint test * ENH: Add pressure corrections for thrust in SolidMotor The thrust generated by a SolidMotor is now adjusted for the atmospheric pressure. To achieve that, a new attribute, 'vacuum_thrust', has been created. The 'net_thrust' is the result of 'vacuum_thrust' minus the atmospheric pressure multiplied by the nozzle area. * ENH: pylint recommendations done * ENH: net thrust method extended to the rest of the motor classes * BUG: __post_processed_variables inconsistent array * ENH: ruff reformatting * Update rocketpy/motors/motor.py Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> * ENH: Avoid breaking change * ENH: Pressure Thrust method added * BUG: call to the thrust function wrong * BUG: pressure thrust evaluated when motor is turned off * ENH: CHANGELOG updated * DOC: definition of exhaust velocity improved --------- Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> commit 9f2644a Author: Lucas Prates <57069366+Lucas-Prates@users.noreply.github.com> Date: Sat Apr 12 11:27:53 2025 +0200 ENH: Implement Multivariate Rejection Sampling (MRS) (#738) * ENH: implementing a draft version of the Multivarite Rejectio Sampler (MRS). * MNT: quick notebook to test MRS during development * MNT: refactoring class to match review suggestions * ENH: add comparison prints, plots and ellipses to MonteCarlo and finally checks in MRS * MNT: add MultivariateRejectionSampler class to inits and apply format * DOC: writting .rst documentation for MRS * MNT: adding pylint flags to skip checks * DOC: completing missing sections in mrs.rst * DOC: add changelog and apply sugestions in MRS class * DOC: apply suggestions to the MRS.rst * MNT: use Union instead of | for type hinting since we have to support python3.9 * TST: adding unit and integration tests to MRS * MNT: use pylint flag to fix linter * TST: adding tests to MonteCarlo comparison features * MNT: applying suggestions in .rst, better handling nested variables in MRS and applying linters * MNT: removing TODO comments from monte_carlo_plots * MNT: remove useless TODO * MNT: inserting pragmas for no cover and resolving changelog conflict commit d49c40e Author: ArthurJWH <167456467+ArthurJWH@users.noreply.github.com> Date: Fri Apr 11 16:11:20 2025 -0400 ENH: Create a rocketpy file to store flight simulations (#800) * ENH: added .rpy file functionality (see issue 668) This commit add 'save_to_rpy' and 'load_from_rpy' functions, that allows saving and loading flights. * MNT: adjusting minor changes to .rpy functions and tests. Formatted docstrings correctly. Reverted duplication of `test_encoding.py` files. Version warning will be called when loaded version is more recent. * MNT: incorporating previous comments Change file management from os to Path Adjust docstrings * DOC: Added comment about outputs in `to_dict` method * MNT: Refactoring `RocketPyDecoder` unpacking operation and other small adjustments * DOC: update changelog * STY: formatted according to ruff * MNT: changing `str | Path` operation to support Python 3.9 * MNT: fixed trailing commas on .rpy and added shield against `ruff` formatting .rpy and .json files * MNT: fixing error related to `test_flight_save_load_no_resimulate` When `include_outputs` were set to `True`, it would try to include the additional data into the flight, breaking the test * MNT: fixing a typo and adding comment on test coverage --------- Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> commit 6bf70f3 Author: Júlio Machado <85506246+juliomachad0@users.noreply.github.com> Date: Sat Apr 5 15:08:53 2025 -0300 ENH: Support for the RSE file format has been added to the library (#798) * ENH: Support for the RSE file format has been added to the library. The import_rse method in the Abstract Motor class and the load_from_rse_file method in the GenericMotor class are now available. With this update, the library natively supports Rock Sim software data, eliminating the need for users to manually convert motor files. The implementation was based on the import_eng and load_from_eng_file methods, utilizing Python's standard XML library. * ENH: Adding tests to the methods of .rse file treatment. * ENH: fixing mistakes on the method and test file * MNT: Running ruff * MNT: Adding the PR to CHANGELOG.md commit 220bb59 Merge: 4a41f7a 4df0b38 Author: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> Date: Thu Mar 27 06:14:22 2025 -0300 Merge pull request #797 from RocketPy-Team/master Updates develop after 1.9.0 commit 4df0b38 Author: MateusStano <69485049+MateusStano@users.noreply.github.com> Date: Mon Mar 24 17:35:03 2025 +0100 REL: Update version to 1.9.0 (#795) commit 5328d66 Author: MateusStano <69485049+MateusStano@users.noreply.github.com> Date: Mon Mar 24 13:07:52 2025 +0100 DEP: Remove Pending Deprecations and Add Warnings Where Needed (#794) * DEP: Add deprecation warnings for outdated methods and functions * DEP: Remove deprecated methods for NOAA RUC soundings and power drag plots * DEV: changelog * MNT: ruff * DEP: Update deprecation warning for post_process method to specify removal in v1.10 * MNT: Remove unused imports commit 76fb5ef Merge: a4b42c3 4a41f7a Author: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> Date: Sun Mar 23 19:17:16 2025 -0300 Merge pull request #793 from RocketPy-Team/develop DEV: Master to v1.9.0 commit 4a41f7a Author: Kevin Alcañiz <kevinalcaniz22@gmail.com> Date: Sun Mar 23 21:52:51 2025 +0100 ENH: Introduce the StochasticAirBrakes class (#785) * wind factor bug corrected the wind factor wasn't applied to the env.wind_velocity properties * BUG: StochasticModel visualize attributes of a uniform distribution It showed the nominal and the standard deviation values and it doesn't make sense in a uniform distribution. In a np.random.uniform the 'nominal value' is the lower bound of the distribution, and the 'standard deviation' value is the upper bound. Now, a new condition has been added for the uniform distributions where the mean and semi range are calculated and showed. This way the visualize_attribute function will show the whole range where the random values are uniformly taken in * variable names corrections * Corrections requested by the pylint test * ENH: add multiplication for 2D functions in rocketpy.function Added the ability to multiply functions with 2D domains in the __mul__ function * ENH: StochasticAirBrakes class created The StochasticAirBrakes class has been created. The __init__.py files in the stochastic and rocketpy folders have also been modified accordingly to incorporate this new class * ENH: set_air_brakes function created This functions appends an airbrake and controller objects previuosly created to the rocket * ENH: add StochasticAirBrake to rocketpy.stochastic_rocket Some functions has been modified and other has been created in order to include the new StochasticAirBrakes feature into the StochasticRocket class. A new function named 'add_air_brakes' has been created to append a StochasticAirBrakes and Controller objects to the StochasticRocket object. A new function '_create_air_brake' has been introduced to create a sample of an AirBrake object through a StochasticAirBrake object. Enventually, the 'create_object' function has been modified to add the sampled AirBrakes to the sampled Rocket * BUG: StochasticAirBrake object input in _Controller When defining the _Controller object a StochasticAirBrake was input. This is already corrected and a AirBrake object is now introduced * ENH: add time_overshoot option to rocketpy.stochastic_flight Since the new StochasticAirBrake class is defined, we need the 'time_overshoot' option in the Flight class to ensure that the time step defined in the simulation is the controller sampling rate. The MonteCarlo class has had to be modified as well to include this option. * DOC: StochasticAirBrakes related documentation added Documentation related to the StochasticAirBrakes implementation has been added in StochasticAirBrakes, StochasticRocket and Rocket classes. * ENH: pylint recommendations done * ENH: Reformatted files to pass Ruff linting checks * ENH: Update rocketpy/stochastic/stochastic_rocket.py Unnecessary comment Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> * DOC: improve drag curve factor definition in StochasticAirBrakes * ENH: Change assert statement to if Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> * DOC: better explanation of __mul__ function Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com> * ENH: delete set_air_brakes function for simplicity * DOC: CHANGELOG file updated --------- Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com> commit 90553f5 Author: Kevin Alcañiz <kevinalcaniz22@gmail.com> Date: Sun Mar 23 20:31:50 2025 +0100 ENH: Add Eccentricity to Stochastic Simulations (#792) * wind factor bug corrected the wind factor wasn't applied to the env.wind_velocity properties * BUG: StochasticModel visualize attributes of a uniform distribution It showed the nominal and the standard deviation values and it doesn't make sense in a uniform distribution. In a np.random.uniform the 'nominal value' is the lower bound of the distribution, and the 'standard deviation' value is the upper bound. Now, a new condition has been added for the uniform distributions where the mean and semi range are calculated and showed. This way the visualize_attribute function will show the whole range where the random values are uniformly taken in * variable names corrections * Corrections requested by the pylint test * ENH: more intuitive uniform distribution display in StochasticModel Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com> * ENH: Eccentricities added to the StochasticRocket class A bug has been corrected in Flight class and an enhancement has been performed in the Rocket class as well * BUG: thrust eccentricity bug corrected eccentricity_y was defined by x coordinate and eccentricity_x was defined by y coordinate * BUG: Undo some Rocket class changes * ENH: add eccentricities to StochasticRocket * BUG: fix MonteCarlo eccentricity inputs * ENH: pylint and ruff recommended changes * TST: fix tests with eccentricity --------- Co-authored-by: Gui-FernandesBR <guilherme_fernandes@usp.br> commit 7348053 Author: Kevin Alcañiz <kevinalcaniz22@gmail.com> Date: Sun Mar 23 13:49:35 2025 +0100 BUG: fix the wind velocity factors usage and better visualization of uniform distributions in Stochastic Classes (#783) * wind factor bug corrected the wind factor wasn't applied to the env.wind_velocity properties * BUG: StochasticModel visualize attributes of a uniform distribution It showed the nominal and the standard deviation values and it doesn't make sense in a uniform distribution. In a np.random.uniform the 'nominal value' is the lower bound of the distribution, and the 'standard deviation' value is the upper bound. Now, a new condition has been added for the uniform distributions where the mean and semi range are calculated and showed. This way the visualize_attribute function will show the whole range where the random values are uniformly taken in * variable names corrections * Corrections requested by the pylint test * ENH: more intuitive uniform distribution display in StochasticModel Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com> --------- Co-authored-by: MateusStano <69485049+MateusStano@users.noreply.github.com> commit d2f89ba Author: Leonardo Rosa <leogabriel3@gmail.com> Date: Fri Mar 21 18:57:49 2025 -0300 DEV: add requirements-tests.txt on make install target (#791) * DEV: adds 'pip install -r requirements-tests.txt' recipe to 'make install' target on Makefile Co-authored-by: Gui-FernandesBR <63590233+Gui-FernandesBR@users.noreply.github.com> commit 91ac567 Author: Leonardo Rosa <leogabriel3@gmail.com> Date: Fri Mar 21 18:53:53 2025 -0300 BUG: fixes get_instance_attributes for Flight objects containing a Rocket object without rail buttons (#786) * DOC: fixed a typo in funcify_method() description * TST: created test for get_instante_attributes() with flight without rail buttons * BUG: fixed __calculate_rail_button_forces() by assigning a Function(0) to null_force instead of an empty array * DEV: updates CHANGELOG commit 9407470 Author: Leonard <74966503+L30-stack@users.noreply.github.com> Date: Wed Mar 19 16:01:59 2025 +0100 BUG: fixed AGL altitude in _FlightPrints.events_registered (#788) * BUG: fixed AGL altitude in _FlightPrints.events_registered * updeted CHANGELOG
|
Is this branch will be in production soon? Where can I read updated README? |
Not at all!
I didn't understand this question If you want to, you can fork this branch and continue the implementation on your fork, thus proposing a PR to our repo later |
|
Are you planning adding individual fins configurations, and custom functions into simulation loop? |
|
closed, but can be re-opened when ready |
|
@phmbressan @Gui-FernandesBR this is ready for a new review. I added tests and addressed all the comments in the last few commits |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
I will review this PR this weekend |
Gui-FernandesBR
left a comment
There was a problem hiding this comment.
a few comments left, but overall a very good implementation
My recommendation is to merge this PR already create a new release version
| example_rocket.aerodynamic_surfaces.pop() | ||
| example_rocket.aerodynamic_surfaces.pop() | ||
|
|
||
| Given oposing canards at 0 degrees and 180 degrees, having opposite cant angles, |
There was a problem hiding this comment.
| Given oposing canards at 0 degrees and 180 degrees, having opposite cant angles, | |
| Given opposing canards at 0 degrees and 180 degrees, having opposite cant angles, |
| M_{z \, \text{final}} = M_{z} + M_{damp} | ||
|
|
||
| Where :math:`C_{ld}` is the roll moment damping coefficient, :math:`L_{r}` | ||
| is the reference length, which is equal to the rocket diamete, and |
There was a problem hiding this comment.
| is the reference length, which is equal to the rocket diamete, and | |
| is the reference length, which is equal to the rocket diameter, and |
There was a problem hiding this comment.
TODO for later: the rocketpy/prints/aero_surface_prints.py file could be separated into different, smaller files.
I'd appreciate if you could add this TODO at the top of the file
There was a problem hiding this comment.
rocketpy/rocket/aero_surface/fins/_geometry.py could be divided into smaller parts
I would expect different unit tests, covering each geometry method
| None | ||
| """ | ||
| # Center of pressure position in local coordinates | ||
| cpz = 0.288 * self.root_chord |
There was a problem hiding this comment.
please reference in the code
| # TODO: this depends on cant angle, so it should somehow be | ||
| # recalculated whenever the cant angle of the fin changes |
There was a problem hiding this comment.
I saw the TODO, but it lacks your full explanation. By reading the comment, a young developer could easily become keen to solve a very hard non-profitable problem
| Parameters | ||
| ---------- | ||
| surfaces : list, AeroSurface, NoseCone, TrapezoidalFins, EllipticalFins, Tail, RailButtons | ||
| surfaces : list[AeroSurface], AeroSurface |
There was a problem hiding this comment.
could we fix in list[AeroSurface] only?
surfaces : list[AeroSurface], AeroSurface| center_of_mass_without_motor_to_CDM, | ||
| motor_center_of_dry_mass_to_CDM, | ||
| generic_motor_cesaroni_M1520, | ||
| R_phi, |
| ax.legend(bbox_to_anchor=(1.05, 1.0), loc="upper left") | ||
|
|
||
| plt.tight_layout() | ||
| plt.show() |
There was a problem hiding this comment.
In this method (and a few other ones) is the filename being used? Should we use show_or_save plot for them?
| self._cant_angle_rad = math.radians(cant_angle) | ||
| self.geometry = None | ||
|
|
||
| self.d = 2 * rocket_radius |
There was a problem hiding this comment.
Generally I don't mind much the abbreviated names. But even though it is clear to most people this is a diameter, this is documented nowhere (I think) and is a bit too short of a name. Perhaps rocket_diameter and make a local alias before big formulas?
There was a problem hiding this comment.
good catch, it's even in our documentatiom to not use single letter attributes
|
|
||
| super().__init__(name, self.ref_area, self.d) | ||
|
|
||
| def _run_geometry_update_chain(self): |
There was a problem hiding this comment.
Optional, this name is bit too verbose (e.g. I don't think the word run really accomplishes anything here and chain gives a sense of order, but it is vague). I would strive for simplicity with _update_geometry, but it is just a suggestion.
| class _EllipticalGeometry(_FinGeometry): | ||
| """Geometry strategy for elliptical fins.""" | ||
|
|
||
| def evaluate_geometrical_parameters(self): # pylint: disable=too-many-statements | ||
| """Calculates and saves elliptical fin geometric parameters.""" | ||
| owner = self.owner |
There was a problem hiding this comment.
This is a bit unusual, since the direction of dependence is reversed here, i.e., a rocketpy more internal object depends on an outer one. If I understood correctly:
ownerwill be theFin(orFins) themselves. This is odd, since the attributegeometrynow depends on the class it is part of. It is almost circular;- this attribute
geometrymutates the outer object, which is also unusual, unless there is an reason for it.
Could you give some hints on why it was not possible to instantiate a geometry with purely a few values from the Fin and Fins classes, but instead, it was necessary to input the full object?
Ideally, the geometry class should not mutate the outer object, but instead have methods and properties (e.g. geometry.Af, geometry.roll_interference_factor etc) that compute and return the values the outer object (i.e. the fin classes) need.
| """Calculates and returns the center of pressure of the fin in local | ||
| coordinates. The center of pressure position is saved and stored as a | ||
| tuple. | ||
|
|
||
| Returns | ||
| ------- | ||
| None |
There was a problem hiding this comment.
Here it says it returns, but the methods returns None.
| self.prints = _EllipticalFinPrints(self) | ||
| self.plots = _EllipticalFinPlots(self) | ||
|
|
||
| def evaluate_center_of_pressure(self): |
There was a problem hiding this comment.
Are these evaluate_ methods kept for backwards compatibility? I don't see why it would be useful to an user, and, hence, they should not be public.
Why not have a new property (or a cached_property or a funcify) that is .center_of_pressure? You can keep these evaluate_ methods for backwards compatibility. Maybe I overlooked some condition on why there should be these evaluates, so please, correct me if I am wrong.
Note: a similar reasoning applies to the evaluates_ of the geometry classes:
- one could probably convert most evaluates into individual properties (e.g.
evaluate_center_of_pressure->.center_of_pressure); - when a parameter is set in the
Fin(s) class, one can either:- recreate the
geometryinstance with the new value; - have a
setterin the geometry that sets the new value and calls the correct re-evaluate for better performance (in this case, the evaluates should be privategeometry._evaluate..., since they would only be used internaly).
- recreate the
| def _run_geometry_update_chain(self): | ||
| """Recompute all dependent aerodynamic properties after a geometry change.""" | ||
| self.evaluate_geometrical_parameters() | ||
| self.evaluate_center_of_pressure() | ||
| self.evaluate_lift_coefficient() | ||
| self.evaluate_roll_parameters() |
There was a problem hiding this comment.
Also, ideally, this method should not be needed, since the update of the parameters would all be done inside the geometry, by a setter. The sequence would similar to:
User (action fin.root_chord=0.5)
TrapezoidalFin.root_chord setter (sets fin.geometry.root_chord=0.5)
_TrapezoidalFinGeometry.root_chord setter (evaluates self._root_chord=0.5 and self.update_geometry())
Note:
- the update geometry would mostly delete any caches of the geometrical attributes of the _TrapezoidalFinGeometry (e.g. center_of_pressure));
- The
gettersof theTrapezoidalFinwould generally delegate to thegeometry, e.g.:
-def root_chord -> self.geometry.root_chord
We can discuss more (or go with the current implementation) if this does not seem to tackle our class schema/needs.
Checklist
Description
Individual Fins model have been added:
Usage can be seen in the documentation files. All equations and modelling are also described in the docs file.
A lot of structural changes were made to all fin classes. Please review this new structure with care.
If you run a simulation with the standard Fins model and another with individual fins, the results will be a little different. This happens because the individual fin model calculates forces for each fin separately, using the airflow at each fin’s exact position. The standard model (Barrowman) treats all the fins as one and uses a single point along the rocket’s center. In theory, this means that individual fins are more accurate then the standard model
There are a couple of TODOs relating to cant angle control. The center of pressure position relative to CDM is precalculated in the Rocket class and then accessed in the Flight. This causes a problem if the fin’s cant angle changes during the simulation because that changes the center of pressure position, but right now there’s no easy way to update these values in the Rocket while the simulation is running.
Breaking change