Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,19 @@ Attention: The newest changes should be on top -->

### Added

- ENH: Adds GenericMotor.load_from_eng_file() method [#676](https://github.com/RocketPy-Team/RocketPy/pull/676)
- ENH: Introducing local sensitivity analysis [#575](https://github.com/RocketPy-Team/RocketPy/pull/575)
- ENH: Add STFT function to Function class [#620](https://github.com/RocketPy-Team/RocketPy/pull/620)
- ENH: Rocket Axis Definition [#635](https://github.com/RocketPy-Team/RocketPy/pull/635)

### Changed

- DOC: Fix documentation dependencies [#651](https://github.com/RocketPy-Team/RocketPy/pull/651)
- DOC: Fix documentation warnings [#645](https://github.com/RocketPy-Team/RocketPy/pull/645)
- DOC: New Environment class docs pages [#644](https://github.com/RocketPy-Team/RocketPy/pull/644)

### Fixed

- DOC: Fix documentation dependencies [#651](https://github.com/RocketPy-Team/RocketPy/pull/651)
- DOC: Fix documentation warnings [#645](https://github.com/RocketPy-Team/RocketPy/pull/645)
- BUG: Rotational EOMs Not Relative To CDM [#674](https://github.com/RocketPy-Team/RocketPy/pull/674)
- BUG: Pressure ISA Extrapolation as "linear" [#675](https://github.com/RocketPy-Team/RocketPy/pull/675)
- BUG: fix the Frequency Response plot of Flight class [#653](https://github.com/RocketPy-Team/RocketPy/pull/653)
Expand Down
108 changes: 108 additions & 0 deletions docs/user/motors/genericmotor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
.. _genericmotor:

GenericMotor Class Usage
========================

Here we explore different features of the GenericMotor class.

Class that represents a simple motor defined mainly by its thrust curve.
There is no distinction between the propellant types (e.g. Solid, Liquid).
This class is meant for rough estimations of the motor performance,
therefore for more accurate results, use the ``SolidMotor``, ``HybridMotor``
or ``LiquidMotor`` classes.

Creating a Generic Motor
------------------------

To define a generic motor, we will need a few information about our motor:

- The thrust source file, which is a file containing the thrust curve of the motor. \
This file can be a .eng file, a .rse file, or a .csv file. See more details in \
:doc:`Thrust Source Details </user/motors/thrust>`
- A few physical parameters, which the most important are:
- The burn time of the motor.
- The combustion chamber radius;
- The combustion chamber height;
- The combustion chamber position;
- The propellant initial mass;
- The nozzle radius;
- The motor dry mass.

The usage of the GenericMotor class is very similar to the other motor classes.
See more details in the
:doc:`SolidMotor Class Usage </user/motors/solidmotor>`,
:doc:`LiquidMotor Class Usage </user/motors/liquidmotor>`, and
:doc:`HybridMotor Class Usage </user/motors/hybridmotor>` pages.


.. jupyter-execute::

from rocketpy.motors import GenericMotor

# Define the motor parameters
motor = GenericMotor(
thrust_source = "../data/motors/Cesaroni_M1670.eng",
burn_time = 3.9,
chamber_radius = 33 / 100,
chamber_height = 600 / 1000,
chamber_position = 0,
propellant_initial_mass = 2.5,
nozzle_radius = 33 / 1000,
dry_mass = 1.815,
center_of_dry_mass_position = 0,
dry_inertia = (0.125, 0.125, 0.002),
nozzle_position = 0,
reshape_thrust_curve = False,
interpolation_method = "linear",
coordinate_system_orientation = "nozzle_to_combustion_chamber",
)

# Print the motor information
motor.info()

.. note::

The GenericMotor is a simplified model of a rocket motor. If you need more \
accurate results, use the ``SolidMotor``, ``HybridMotor`` or ``LiquidMotor`` classes.


The ``load_from_eng_file`` method
---------------------------------

The ``GenericMotor`` class has a method called ``load_from_eng_file`` that allows
the user to build a GenericMotor object by providing just the path to an .eng file.

The parameters available in the method are the same as the ones used in the
constructor of the GenericMotor class. But the method will automatically read
the .eng file and extract the required information if the user does not
provide it. In this case, the following assumptions about the most
relevant parameters are made:

- The ``chamber_radius`` is assumed to be the same as the motor diameter in the .eng file;
- The ``chamber_height`` is assumed to be the same as the motor length in the .eng file;
- The ``chamber_position`` is assumed to be 0;
- The ``propellant_initial_mass`` is assumed to be the same as the propellant mass in the .eng file;
- The ``nozzle_radius`` is assumed to be 85% of the ``chamber_radius``;
- The ``dry_mass`` is assumed to be the total mass minus the propellant mass in the .eng file;

As an example, we can demonstrate:

.. jupyter-execute::

from rocketpy.motors import GenericMotor


# Load the motor from an .eng file
motor = GenericMotor.load_from_eng_file("../data/motors/Cesaroni_M1670.eng")

# Print the motor information
motor.info()

Although the ``load_from_eng_file`` method is very useful, it is important to
note that the user can still provide the parameters manually if needed.

.. tip::

The ``load_from_eng_file`` method is a very useful tool for simulating motors \
when the user does not have all the information required to build a ``SolidMotor`` yet.

6 changes: 6 additions & 0 deletions docs/user/motors/motors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ Motors Usage
:caption: Liquid Motors

Liquid Motor Usage <liquidmotor.rst>

.. toctree::
:maxdepth: 3
:caption: Generic Motors

Generic Motor Usage <genericmotor.rst>

.. toctree::
:maxdepth: 3
Expand Down
20 changes: 10 additions & 10 deletions rocketpy/motors/hybrid_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,16 +302,16 @@ class Function. Thrust units are Newtons.
None
"""
super().__init__(
thrust_source,
dry_mass,
dry_inertia,
nozzle_radius,
center_of_dry_mass_position,
nozzle_position,
burn_time,
reshape_thrust_curve,
interpolation_method,
coordinate_system_orientation,
thrust_source=thrust_source,
dry_inertia=dry_inertia,
nozzle_radius=nozzle_radius,
center_of_dry_mass_position=center_of_dry_mass_position,
dry_mass=dry_mass,
nozzle_position=nozzle_position,
burn_time=burn_time,
reshape_thrust_curve=reshape_thrust_curve,
interpolation_method=interpolation_method,
coordinate_system_orientation=coordinate_system_orientation,
)
self.liquid = LiquidMotor(
thrust_source,
Expand Down
20 changes: 10 additions & 10 deletions rocketpy/motors/liquid_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,16 @@ class Function. Thrust units are Newtons.
"nozzle_to_combustion_chamber".
"""
super().__init__(
thrust_source,
dry_mass,
dry_inertia,
nozzle_radius,
center_of_dry_mass_position,
nozzle_position,
burn_time,
reshape_thrust_curve,
interpolation_method,
coordinate_system_orientation,
thrust_source=thrust_source,
dry_inertia=dry_inertia,
nozzle_radius=nozzle_radius,
center_of_dry_mass_position=center_of_dry_mass_position,
dry_mass=dry_mass,
nozzle_position=nozzle_position,
burn_time=burn_time,
reshape_thrust_curve=reshape_thrust_curve,
interpolation_method=interpolation_method,
coordinate_system_orientation=coordinate_system_orientation,
)

self.positioned_tanks = []
Expand Down
Loading