@@ -66,12 +66,13 @@ See more details in the
66
66
accurate results, use the ``SolidMotor ``, ``HybridMotor `` or ``LiquidMotor `` classes.
67
67
68
68
69
+ .. _load_from_eng_file :
70
+
69
71
The ``load_from_eng_file `` method
70
72
---------------------------------
71
73
72
74
The ``GenericMotor `` class has a method called ``load_from_eng_file `` that allows
73
75
the user to build a GenericMotor object by providing just the path to an .eng file.
74
-
75
76
The parameters available in the method are the same as the ones used in the
76
77
constructor of the GenericMotor class. But the method will automatically read
77
78
the .eng file and extract the required information if the user does not
@@ -106,3 +107,63 @@ note that the user can still provide the parameters manually if needed.
106
107
The ``load_from_eng_file `` method is a very useful tool for simulating motors \
107
108
when the user does not have all the information required to build a ``SolidMotor `` yet.
108
109
110
+
111
+ The ``list_motors_dataset `` function
112
+ ------------------------------------
113
+
114
+ RocketPy includes a set of pre-registered solid rocket motors in the ``.eng `` format,
115
+ which are stored in the ``rocketpy/datasets/motors/ `` directory. These motors can be used
116
+ directly to create ``GenericMotor `` objects, making it easier to get started with simulations
117
+ without needing to search for external motor files.
118
+
119
+ The ``list_motors_dataset `` function allows users to quickly inspect which pre-registered
120
+ motors are currently available. It returns a list of motor names that can be used with
121
+ the ``load_motor_from_dataset `` function.
122
+
123
+ .. jupyter-execute ::
124
+
125
+ from rocketpy.utilities import list_motors_dataset
126
+
127
+ # List all available motors in the dataset
128
+ motors = list_motors_dataset()
129
+ print(motors)
130
+
131
+
132
+ The ``load_motor_from_dataset `` function
133
+ ----------------------------------------
134
+
135
+ The ``load_motor_from_dataset `` function loads a pre-registered motor by name,
136
+ returning a ``GenericMotor `` object.
137
+
138
+ Internally, it uses the ``load_from_eng_file ``
139
+ method from the ``GenericMotor `` class to parse the corresponding ``.eng `` file.
140
+ Therefore, it applies the same assumptions described previously in the
141
+ :ref: `load_from_eng_file <load_from_eng_file >` section. This includes default values for parameters such as
142
+ ``chamber_radius ``, ``nozzle_radius ``, and ``dry_mass ``.
143
+
144
+ .. jupyter-execute ::
145
+
146
+ from rocketpy.utilities import load_motor_from_dataset
147
+
148
+ # Load a motor using its dataset name
149
+ motor = load_motor_from_dataset("Cesaroni_M1670")
150
+
151
+ # Print motor info
152
+ motor.info()
153
+
154
+
155
+ The ``show_motors_dataset `` function
156
+ -----------------------------------------
157
+
158
+ The ``show_motors_dataset `` function is a utility that prints the list of
159
+ available pre-registered motors directly to the terminal or notebook output,
160
+ including how many motors are available.
161
+ It is helpful for quick visual inspection when an explicit return value is not needed.
162
+
163
+ .. jupyter-execute ::
164
+
165
+ from rocketpy.utilities import show_motors_dataset
166
+
167
+ # Show the list of available motors (prints to output)
168
+ show_motors_dataset()
169
+
0 commit comments