Skip to content

Commit b69d40d

Browse files
committed
ENH: net thrust method extended to the rest of the motor classes
1 parent a0dac7d commit b69d40d

File tree

5 files changed

+44
-2
lines changed

5 files changed

+44
-2
lines changed

rocketpy/motors/empty_motor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def __init__(self):
1313
dry_inertia=(0, 0, 0),
1414
nozzle_radius=0,
1515
center_of_dry_mass_position=0,
16+
reference_pressure=0,
1617
dry_mass=0,
1718
nozzle_position=0,
1819
burn_time=1,

rocketpy/motors/hybrid_motor.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class HybridMotor(Motor):
2929
"combustion_chamber_to_nozzle".
3030
HybridMotor.nozzle_radius : float
3131
Radius of motor nozzle outlet in meters.
32+
HybridMotor.nozzle_area : float
33+
Area of motor nozzle outlet in square meters.
3234
HybridMotor.nozzle_position : float
3335
Motor's nozzle outlet position in meters, specified in the motor's
3436
coordinate system. See
@@ -147,7 +149,11 @@ class HybridMotor(Motor):
147149
HybridMotor.propellant_I_22 and HybridMotor.propellant_I_33 for
148150
more information.
149151
HybridMotor.thrust : Function
150-
Motor thrust force, in Newtons, as a function of time.
152+
Motor thrust force obtained from thrust source, in Newtons, as a
153+
function of time.
154+
HybridMotor.vacuum_thrust : Function
155+
Motor thrust force when the rocket is in a vacuum. In Newtons, as a
156+
function of time.
151157
HybridMotor.total_impulse : float
152158
Total impulse of the thrust curve in N*s.
153159
HybridMotor.max_thrust : float
@@ -181,6 +187,9 @@ class HybridMotor(Motor):
181187
Method of interpolation used in case thrust curve is given
182188
by data set in .csv or .eng, or as an array. Options are 'spline'
183189
'akima' and 'linear'. Default is "linear".
190+
HybridMotor.reference_pressure : int, float
191+
Atmospheric pressure in Pa at which the thrust data was recorded.
192+
It will allow to obtain the net thrust in the Flight class.
184193
"""
185194

186195
def __init__( # pylint: disable=too-many-arguments
@@ -197,6 +206,7 @@ def __init__( # pylint: disable=too-many-arguments
197206
grain_separation,
198207
grains_center_of_mass_position,
199208
center_of_dry_mass_position,
209+
reference_pressure=None,
200210
nozzle_position=0,
201211
burn_time=None,
202212
throat_radius=0.01,
@@ -258,6 +268,8 @@ class Function. Thrust units are Newtons.
258268
The position, in meters, of the motor's center of mass with respect
259269
to the motor's coordinate system when it is devoid of propellant.
260270
See :doc:`Positions and Coordinate Systems </user/positions>`.
271+
reference_pressure : int, float, optional
272+
Atmospheric pressure in Pa at which the thrust data was recorded.
261273
nozzle_position : int, float, optional
262274
Motor's nozzle outlet position in meters, in the motor's coordinate
263275
system. See :doc:`Positions and Coordinate Systems </user/positions>`
@@ -308,6 +320,7 @@ class Function. Thrust units are Newtons.
308320
dry_inertia=dry_inertia,
309321
nozzle_radius=nozzle_radius,
310322
center_of_dry_mass_position=center_of_dry_mass_position,
323+
reference_pressure=reference_pressure,
311324
dry_mass=dry_mass,
312325
nozzle_position=nozzle_position,
313326
burn_time=burn_time,
@@ -321,6 +334,7 @@ class Function. Thrust units are Newtons.
321334
dry_inertia,
322335
nozzle_radius,
323336
center_of_dry_mass_position,
337+
reference_pressure,
324338
nozzle_position,
325339
burn_time,
326340
reshape_thrust_curve,
@@ -340,6 +354,7 @@ class Function. Thrust units are Newtons.
340354
grain_separation,
341355
grains_center_of_mass_position,
342356
center_of_dry_mass_position,
357+
reference_pressure,
343358
nozzle_position,
344359
burn_time,
345360
throat_radius,
@@ -657,6 +672,7 @@ def from_dict(cls, data):
657672
nozzle_radius=data["nozzle_radius"],
658673
dry_mass=data["dry_mass"],
659674
center_of_dry_mass_position=data["center_of_dry_mass_position"],
675+
reference_pressure=data["reference_pressure"],
660676
dry_inertia=(
661677
data["dry_I_11"],
662678
data["dry_I_22"],

rocketpy/motors/liquid_motor.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class LiquidMotor(Motor):
2929
"combustion_chamber_to_nozzle".
3030
LiquidMotor.nozzle_radius : float
3131
Radius of motor nozzle outlet in meters.
32+
LiquidMotor.nozzle_area : float
33+
Area of motor nozzle outlet in square meters.
3234
LiquidMotor.nozzle_position : float
3335
Motor's nozzle outlet position in meters, specified in the motor's
3436
coordinate system. See
@@ -122,7 +124,11 @@ class LiquidMotor(Motor):
122124
LiquidMotor.propellant_I_22 and LiquidMotor.propellant_I_33 for
123125
more information.
124126
LiquidMotor.thrust : Function
125-
Motor thrust force, in Newtons, as a function of time.
127+
Motor thrust force obtained from thrust source, in Newtons, as a
128+
function of time.
129+
LiquidMotor.vacuum_thrust : Function
130+
Motor thrust force when the rocket is in a vacuum. In Newtons, as a
131+
function of time.
126132
LiquidMotor.total_impulse : float
127133
Total impulse of the thrust curve in N*s.
128134
LiquidMotor.max_thrust : float
@@ -143,6 +149,9 @@ class LiquidMotor(Motor):
143149
burn_out_time and the burn_start_time.
144150
LiquidMotor.exhaust_velocity : Function
145151
Propulsion gases exhaust velocity in m/s.
152+
LiquidMotor.reference_pressure : int, float
153+
Atmospheric pressure in Pa at which the thrust data was recorded.
154+
It will allow to obtain the net thrust in the Flight class.
146155
"""
147156

148157
def __init__(
@@ -152,6 +161,7 @@ def __init__(
152161
dry_inertia,
153162
nozzle_radius,
154163
center_of_dry_mass_position,
164+
reference_pressure=None,
155165
nozzle_position=0,
156166
burn_time=None,
157167
reshape_thrust_curve=False,
@@ -194,6 +204,8 @@ class Function. Thrust units are Newtons.
194204
The position, in meters, of the motor's center of mass with respect
195205
to the motor's coordinate system when it is devoid of propellant.
196206
See :doc:`Positions and Coordinate Systems </user/positions>`
207+
reference_pressure : int, float, optional
208+
Atmospheric pressure in Pa at which the thrust data was recorded.
197209
nozzle_position : float
198210
Motor's nozzle outlet position in meters, specified in the motor's
199211
coordinate system. See
@@ -236,6 +248,7 @@ class Function. Thrust units are Newtons.
236248
dry_inertia=dry_inertia,
237249
nozzle_radius=nozzle_radius,
238250
center_of_dry_mass_position=center_of_dry_mass_position,
251+
reference_pressure=reference_pressure,
239252
dry_mass=dry_mass,
240253
nozzle_position=nozzle_position,
241254
burn_time=burn_time,
@@ -500,6 +513,7 @@ def from_dict(cls, data):
500513
nozzle_radius=data["nozzle_radius"],
501514
dry_mass=data["dry_mass"],
502515
center_of_dry_mass_position=data["center_of_dry_mass_position"],
516+
reference_pressure=data["reference_pressure"],
503517
dry_inertia=(
504518
data["dry_I_11"],
505519
data["dry_I_22"],

rocketpy/motors/motor.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,6 +1227,7 @@ class GenericMotor(Motor):
12271227
therefore for more accurate results, use the ``SolidMotor``, ``HybridMotor``
12281228
or ``LiquidMotor`` classes."""
12291229

1230+
# pylint: disable=too-many-arguments
12301231
def __init__(
12311232
self,
12321233
thrust_source,
@@ -1236,6 +1237,7 @@ def __init__(
12361237
chamber_position,
12371238
propellant_initial_mass,
12381239
nozzle_radius,
1240+
reference_pressure=None,
12391241
dry_mass=0,
12401242
center_of_dry_mass_position=None,
12411243
dry_inertia=(0, 0, 0),
@@ -1282,6 +1284,8 @@ def __init__(
12821284
to the motor's coordinate system when it is devoid of propellant.
12831285
If not specified, automatically sourced as the chamber position.
12841286
See :doc:`Positions and Coordinate Systems </user/positions>`
1287+
reference_pressure : int, float, optional
1288+
Atmospheric pressure in Pa at which the thrust data was recorded.
12851289
dry_inertia : tuple, list
12861290
Tuple or list containing the motor's dry mass inertia tensor
12871291
components, in kg*m^2. This inertia is defined with respect to the
@@ -1338,6 +1342,7 @@ def __init__(
13381342
dry_inertia=dry_inertia,
13391343
nozzle_radius=nozzle_radius,
13401344
center_of_dry_mass_position=center_of_dry_mass_position,
1345+
reference_pressure=reference_pressure,
13411346
dry_mass=dry_mass,
13421347
nozzle_position=nozzle_position,
13431348
burn_time=burn_time,
@@ -1500,6 +1505,7 @@ def load_from_eng_file(
15001505
dry_mass=None,
15011506
burn_time=None,
15021507
center_of_dry_mass_position=None,
1508+
reference_pressure=None,
15031509
dry_inertia=(0, 0, 0),
15041510
nozzle_position=0,
15051511
reshape_thrust_curve=False,
@@ -1541,6 +1547,8 @@ def load_from_eng_file(
15411547
The position, in meters, of the motor's center of mass with respect
15421548
to the motor's coordinate system when it is devoid of propellant.
15431549
If not specified, automatically sourced as the chamber position.
1550+
reference_pressure : int, float, optional
1551+
Atmospheric pressure in Pa at which the thrust data was recorded.
15441552
dry_inertia : tuple, list
15451553
Tuple or list containing the motor's dry mass inertia tensor
15461554
nozzle_position : int, float, optional
@@ -1608,6 +1616,7 @@ def load_from_eng_file(
16081616
chamber_position=chamber_position,
16091617
propellant_initial_mass=propellant_initial_mass,
16101618
nozzle_radius=nozzle_radius,
1619+
reference_pressure=reference_pressure,
16111620
dry_mass=dry_mass,
16121621
center_of_dry_mass_position=center_of_dry_mass_position,
16131622
dry_inertia=dry_inertia,
@@ -1645,6 +1654,7 @@ def from_dict(cls, data):
16451654
chamber_position=data["chamber_position"],
16461655
propellant_initial_mass=data["propellant_initial_mass"],
16471656
nozzle_radius=data["nozzle_radius"],
1657+
reference_pressure=data["reference_pressure"],
16481658
dry_mass=data["dry_mass"],
16491659
center_of_dry_mass_position=data["center_of_dry_mass_position"],
16501660
dry_inertia=(

rocketpy/motors/solid_motor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,7 @@ def from_dict(cls, data):
808808
grain_separation=data["grain_separation"],
809809
grains_center_of_mass_position=data["grains_center_of_mass_position"],
810810
center_of_dry_mass_position=data["center_of_dry_mass_position"],
811+
reference_pressure=data["reference_pressure"],
811812
nozzle_position=data["nozzle_position"],
812813
burn_time=data["burn_time"],
813814
throat_radius=data["throat_radius"],

0 commit comments

Comments
 (0)