Skip to content

Commit 8993108

Browse files
Merge branch 'master' into develop
2 parents 5b59e5d + dfee9fe commit 8993108

10 files changed

Lines changed: 159 additions & 104 deletions

File tree

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
author = "RocketPy Team"
2525

2626
# The full version, including alpha/beta/rc tags
27-
release = "1.0.0"
27+
release = "1.0.1"
2828

2929

3030
# -- General configuration ---------------------------------------------------

docs/user/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ If you want to choose a specific version to guarantee compatibility, you may ins
1919

2020
.. code-block:: shell
2121
22-
pip install rocketpy==1.0.0
22+
pip install rocketpy==1.0.1
2323
2424
2525
Optional Installation Method: ``conda``

rocketpy/prints/rocket_prints.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ def rocket_geometrical_parameters(self):
9494
"Rocket Center of Dry Mass - Nozzle Exit: "
9595
+ "{:.3f} m".format(
9696
abs(
97-
self.rocket.center_of_dry_mass_position - self.rocket.motor_position
97+
self.rocket.center_of_dry_mass_position
98+
- self.rocket.nozzle_position
9899
)
99100
)
100101
)

rocketpy/rocket/aero_surface.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -427,12 +427,13 @@ def final_shape(x):
427427

428428
# Evaluate final geometry parameters
429429
self.shape_vec = [nosecone_x, nosecone_y]
430-
self._length = nosecone_x[-1]
431-
print(
432-
"Due to the chosen bluffness ratio, the nose cone length was reduced to {:.3f} m.".format(
433-
self.length
430+
if abs(nosecone_x[-1] - self.length) >= 0.001: # 1 milimiter
431+
self._length = nosecone_x[-1]
432+
print(
433+
"Due to the chosen bluffness ratio, the nose cone length was reduced to m.".format(
434+
self.length
435+
)
434436
)
435-
)
436437
self.fineness_ratio = self.length / (2 * self.base_radius)
437438

438439
return None

rocketpy/rocket/rocket.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,16 @@ class Rocket:
109109
Rocket.motor : Motor
110110
Rocket's motor. See Motor class for more details.
111111
Rocket.motor_position : float
112-
Position, in m, of the motor's nozzle exit area relative to the user
113-
defined rocket coordinate system. See
114-
:doc:`Positions and Coordinate Systems </user/positions>`
115-
for more information
112+
Position, in meters, of the motor's coordinate system origin
113+
relative to the user defined rocket coordinate system.
114+
See :doc:`Positions and Coordinate Systems </user/positions>`
115+
for more information.
116116
regarding the rocket's coordinate system.
117+
Rocket.nozzle_position : float
118+
Position, in meters, of the motor's nozzle exit relative to the user
119+
defined rocket coordinate system.
120+
See :doc:`Positions and Coordinate Systems </user/positions>`
121+
for more information.
117122
Rocket.center_of_propellant_position : Function
118123
Position of the propellant's center of mass relative to the user defined
119124
rocket reference system. See
@@ -697,14 +702,15 @@ def add_motor(self, motor, position):
697702
self.motor_position = position
698703
_ = self._csys * self.motor._csys
699704
self.center_of_propellant_position = (
700-
self.motor.center_of_propellant_mass - self.motor.nozzle_position
701-
) * _ + self.motor_position
705+
self.motor.center_of_propellant_mass * _ + self.motor_position
706+
)
702707
self.motor_center_of_mass_position = (
703-
self.motor.center_of_mass - self.motor.nozzle_position
704-
) * _ + self.motor_position
708+
self.motor.center_of_mass * _ + self.motor_position
709+
)
705710
self.motor_center_of_dry_mass_position = (
706-
self.motor.center_of_dry_mass_position - self.motor.nozzle_position
707-
) * _ + self.motor_position
711+
self.motor.center_of_dry_mass_position * _ + self.motor_position
712+
)
713+
self.nozzle_position = self.motor.nozzle_position * _ + self.motor_position
708714
self.evaluate_dry_mass()
709715
self.evaluate_total_mass()
710716
self.evaluate_center_of_dry_mass()

rocketpy/simulation/flight.py

Lines changed: 13 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,10 @@ def __init_equations_of_motion(self):
11751175

11761176
@cached_property
11771177
def effective_1rl(self):
1178-
nozzle = self.rocket.motor_position
1178+
"""Original rail length minus the distance measured from nozzle exit
1179+
to the upper rail button. It assumes the nozzle to be aligned with
1180+
the beginning of the rail."""
1181+
nozzle = self.rocket.nozzle_position
11791182
try:
11801183
rail_buttons = self.rocket.rail_buttons[0]
11811184
upper_r_button = (
@@ -1189,7 +1192,10 @@ def effective_1rl(self):
11891192

11901193
@cached_property
11911194
def effective_2rl(self):
1192-
nozzle = self.rocket.motor_position
1195+
"""Original rail length minus the distance measured from nozzle exit
1196+
to the lower rail button. It assumes the nozzle to be aligned with
1197+
the beginning of the rail."""
1198+
nozzle = self.rocket.nozzle_position
11931199
try:
11941200
rail_buttons = self.rocket.rail_buttons[0]
11951201
lower_r_button = rail_buttons.position
@@ -1379,7 +1385,7 @@ def u_dot(self, t, u, post_processing=False):
13791385
)
13801386
# c = -self.rocket.distance_rocket_nozzle
13811387
c = (
1382-
-(self.rocket.motor_position - self.rocket.center_of_dry_mass_position)
1388+
-(self.rocket.nozzle_position - self.rocket.center_of_dry_mass_position)
13831389
* self.rocket._csys
13841390
)
13851391
a = b * Mt / M
@@ -1634,7 +1640,7 @@ def u_dot_generalized(self, t, u, post_processing=False):
16341640
r_CM_ddot = Vector([0, 0, r_CM_z.differentiate(t, order=2)])
16351641
## Nozzle gyration tensor
16361642
r_NOZ = (
1637-
-(self.rocket.motor_position - self.rocket.center_of_dry_mass_position)
1643+
-(self.rocket.nozzle_position - self.rocket.center_of_dry_mass_position)
16381644
* self.rocket._csys
16391645
)
16401646
S_noz_33 = 0.5 * self.rocket.motor.nozzle_radius**2
@@ -2436,23 +2442,10 @@ def aerodynamic_spin_moment(self):
24362442
# Kinetic Energy
24372443
@funcify_method("Time (s)", "Rotational Kinetic Energy (J)")
24382444
def rotational_energy(self):
2439-
# b = -self.rocket.distanceRocketPropellant
2440-
b = (
2441-
-(self.rocket.motor_position - self.rocket.center_of_dry_mass_position)
2442-
* self.rocket._csys
2443-
)
2444-
mu = self.rocket.reduced_mass
2445-
Rz = self.rocket.dry_I_33
2446-
Ri = self.rocket.dry_I_11
2447-
Tz = self.rocket.motor.I_33
2448-
Ti = self.rocket.motor.I_11
2449-
I1, I2, I3 = (Ri + Ti + mu * b**2), (Ri + Ti + mu * b**2), (Rz + Tz)
2450-
# Redefine I1, I2 and I3 time grid to allow for efficient Function algebra
2451-
I1.set_discrete_based_on_model(self.w1)
2452-
I2.set_discrete_based_on_model(self.w1)
2453-
I3.set_discrete_based_on_model(self.w1)
24542445
rotational_energy = 0.5 * (
2455-
I1 * self.w1**2 + I2 * self.w2**2 + I3 * self.w3**2
2446+
self.rocket.I_11 * self.w1**2
2447+
+ self.rocket.I_22 * self.w2**2
2448+
+ self.rocket.I_33 * self.w3**2
24562449
)
24572450
rotational_energy.set_discrete_based_on_model(self.w1)
24582451
return rotational_energy
@@ -2610,40 +2603,6 @@ def stability_margin(self):
26102603
return [(t, self.rocket.stability_margin(m, t)) for t, m in self.mach_number]
26112604

26122605
# Rail Button Forces
2613-
@cached_property
2614-
def effective_1rl(self):
2615-
"""Original rail length minus the distance measured from nozzle exit
2616-
to the upper rail button. It assumes the nozzle to be aligned with
2617-
the beginning of the rail."""
2618-
nozzle = (
2619-
self.rocket.motor_position - self.rocket.center_of_dry_mass_position
2620-
) * self.rocket._csys # Kinda works for single nozzle
2621-
try:
2622-
rail_buttons = self.rocket.rail_buttons[0]
2623-
upper_r_button = (
2624-
rail_buttons.component.buttons_distance + rail_buttons.position
2625-
)
2626-
except IndexError: # No rail buttons defined
2627-
upper_r_button = nozzle
2628-
effective_1rl = self.rail_length - abs(nozzle - upper_r_button)
2629-
return effective_1rl
2630-
2631-
@cached_property
2632-
def effective_2rl(self):
2633-
"""Original rail length minus the distance measured from nozzle exit
2634-
to the lower rail button. It assumes the nozzle to be aligned with
2635-
the beginning of the rail."""
2636-
nozzle = (
2637-
self.rocket.motor_position - self.rocket.center_of_dry_mass_position
2638-
) * self.rocket._csys
2639-
try:
2640-
rail_buttons = self.rocket.rail_buttons[0]
2641-
lower_r_button = rail_buttons.position
2642-
except IndexError: # No rail buttons defined
2643-
lower_r_button = nozzle
2644-
effective_2rl = self.rail_length - abs(nozzle - lower_r_button)
2645-
return effective_2rl
2646-
26472606
@cached_property
26482607
def frontal_surface_wind(self):
26492608
"""Surface wind speed in m/s aligned with the launch rail."""

rocketpy/utilities.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ def apogee(mass):
573573
source = np.array(list(zip(x, y)), dtype=np.float64)
574574

575575
retfunc = Function(
576-
source, inputs="Rocket Dry Mass (kg)", outputs="Estimated Apogee AGL (m)"
576+
source, inputs="Rocket Mass without motor (kg)", outputs="Apogee AGL (m)"
577577
)
578578
if plot:
579579
retfunc.plot(min_mass, max_mass, points)
@@ -638,7 +638,9 @@ def liftoff_speed(mass):
638638
source = np.array(list(zip(x, y)), dtype=np.float64)
639639

640640
retfunc = Function(
641-
source, inputs="Rocket Dry Mass (kg)", outputs="Liftoff Speed (m/s)"
641+
source,
642+
inputs="Rocket Mass without motor (kg)",
643+
outputs="Out of Rail Speed (m/s)",
642644
)
643645
if plot:
644646
retfunc.plot(min_mass, max_mass, points)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
setuptools.setup(
2525
name="rocketpy",
26-
version="1.0.0",
26+
version="1.0.1",
2727
install_requires=necessary_require,
2828
extras_require={
2929
"env_analysis": env_analysis_require,

tests/conftest.py

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,10 @@ def cesaroni_m1670(): # old name: solid_motor
111111

112112

113113
@pytest.fixture
114-
def calisto(cesaroni_m1670): # old name: rocket
114+
def calisto_motorless():
115115
"""Create a simple object of the Rocket class to be used in the tests. This
116-
is the same rocket that has been used in the getting started guide for
117-
years. The Calisto rocket is the Projeto Jupiter's project launched at the
118-
2019 Spaceport America Cup.
119-
120-
Parameters
121-
----------
122-
cesaroni_m1670 : rocketpy.SolidMotor
123-
An object of the SolidMotor class. This is a pytest fixture too.
116+
is the same rocket that has been used in the getting started guide for years
117+
but without a motor.
124118
125119
Returns
126120
-------
@@ -136,60 +130,71 @@ def calisto(cesaroni_m1670): # old name: rocket
136130
center_of_mass_without_motor=0,
137131
coordinate_system_orientation="tail_to_nose",
138132
)
133+
return calisto
134+
135+
136+
@pytest.fixture
137+
def calisto(calisto_motorless, cesaroni_m1670): # old name: rocket
138+
"""Create a simple object of the Rocket class to be used in the tests. This
139+
is the same rocket that has been used in the getting started guide for
140+
years. The Calisto rocket is the Projeto Jupiter's project launched at the
141+
2019 Spaceport America Cup.
142+
143+
Parameters
144+
----------
145+
calisto_motorless : rocketpy.Rocket
146+
An object of the Rocket class. This is a pytest fixture too.
147+
cesaroni_m1670 : rocketpy.SolidMotor
148+
An object of the SolidMotor class. This is a pytest fixture too.
149+
150+
Returns
151+
-------
152+
rocketpy.Rocket
153+
A simple object of the Rocket class
154+
"""
155+
calisto = calisto_motorless
139156
calisto.add_motor(cesaroni_m1670, position=-1.373)
140157
return calisto
141158

142159

143160
@pytest.fixture
144-
def calisto_liquid_modded(liquid_motor):
161+
def calisto_liquid_modded(calisto_motorless, liquid_motor):
145162
"""Create a simple object of the Rocket class to be used in the tests. This
146163
is an example of the Calisto rocket with a liquid motor.
147164
148165
Parameters
149166
----------
167+
calisto_motorless : rocketpy.Rocket
168+
An object of the Rocket class. This is a pytest fixture too.
150169
liquid_motor : rocketpy.LiquidMotor
151170
152171
Returns
153172
-------
154173
rocketpy.Rocket
155174
A simple object of the Rocket class
156175
"""
157-
calisto = Rocket(
158-
radius=0.0635,
159-
mass=14.426,
160-
inertia=(6.321, 6.321, 0.034),
161-
power_off_drag="data/calisto/powerOffDragCurve.csv",
162-
power_on_drag="data/calisto/powerOnDragCurve.csv",
163-
center_of_mass_without_motor=0,
164-
coordinate_system_orientation="tail_to_nose",
165-
)
176+
calisto = calisto_motorless
166177
calisto.add_motor(liquid_motor, position=-1.373)
167178
return calisto
168179

169180

170181
@pytest.fixture
171-
def calisto_hybrid_modded(hybrid_motor):
182+
def calisto_hybrid_modded(calisto_motorless, hybrid_motor):
172183
"""Create a simple object of the Rocket class to be used in the tests. This
173184
is an example of the Calisto rocket with a hybrid motor.
174185
175186
Parameters
176187
----------
188+
calisto_motorless : rocketpy.Rocket
189+
An object of the Rocket class. This is a pytest fixture too.
177190
hybrid_motor : rocketpy.HybridMotor
178191
179192
Returns
180193
-------
181194
rocketpy.Rocket
182195
A simple object of the Rocket class
183196
"""
184-
calisto = Rocket(
185-
radius=0.0635,
186-
mass=14.426,
187-
inertia=(6.321, 6.321, 0.034),
188-
power_off_drag="data/calisto/powerOffDragCurve.csv",
189-
power_on_drag="data/calisto/powerOnDragCurve.csv",
190-
center_of_mass_without_motor=0,
191-
coordinate_system_orientation="tail_to_nose",
192-
)
197+
calisto = calisto_motorless
193198
calisto.add_motor(hybrid_motor, position=-1.373)
194199
return calisto
195200

0 commit comments

Comments
 (0)