Skip to content

Commit bdff699

Browse files
committed
feat: apply suggestions
1 parent 88838fd commit bdff699

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

examples/stk_engine/hohmann_transfer_using_targeter.py

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
root = stk.new_object_root()
2929
root.new_scenario("HohmannTransfer")
3030

31-
# Once created, it is possible to plot the scenario by running:
31+
# Once created, it is possible to show a 3D graphics window by running:
3232

3333
# +
3434
from ansys.stk.core.stkengine.experimental.jupyterwidgets import GlobeWidget
@@ -72,7 +72,7 @@
7272
print(element_types)
7373
# -
7474

75-
# The segment type is also required for specifying the initial state of the satellite. List the supported segment types by running:
75+
# An initial state segment is required to specify the initial state of the satellite. To see the list of different segment types, run:
7676

7777
# +
7878
from ansys.stk.core.stkobjects.astrogator import SEGMENT_TYPE
@@ -81,7 +81,7 @@
8181
initial_state.set_element_type(ELEMENT_TYPE.KEPLERIAN)
8282
# -
8383

84-
# Now, set at least six of the previous elements. Since the initial orbit of the satellite is a
84+
# A total of six orbital parameters are required to specify the initial state of the satellite. Considering the data provided in this example, it is possible to assign the following parameters:
8585

8686
initial_state.element.periapsis_radius_size = 6700.00
8787
initial_state.element.eccentricity = 0.00
@@ -92,24 +92,24 @@
9292

9393
# ## Set up the parking orbit of the satellite
9494
#
95-
# The parking orbit is the temporary orbit that the satellite follows before starting any maneuver. Modelling a parking orbit requires to create a new segment in the main sequence. This segment must be of the propagate type. The total duration of the propagation is set in this example for 7200 seconds.
95+
# The parking orbit is the temporary orbit that the satellite follows before starting any maneuver. Modelling a parking orbit requires creating a new segment in the main sequence. This segment must be of the propagate type. To be consistent with the assumptions of the Hohmann transfer, the segment should be propagated using an Earth Point Mass propagator. The total duration of the propagation is set in this example for 7200 seconds.
9696

97-
inital_state_propagate = satellite.propagator.main_sequence.insert(SEGMENT_TYPE.PROPAGATE, "Initial State Propagate", "-")
98-
inital_state_propagate.stopping_conditions["Duration"].properties.trip = 7200
97+
parking_orbit_propagate = satellite.propagator.main_sequence.insert(SEGMENT_TYPE.PROPAGATE, "Parking Orbit Propagate", "-")
98+
parking_orbit_propagate.propagator_name = "Earth point mass"
99+
parking_orbit_propagate.stopping_conditions["Duration"].properties.trip = 7200
99100

100-
# Additional configurations, like the name for this propagation and its color can also be declared in this step:
101+
# Additional configurations, like the color used to visualize the orbit of the satellite, can also be declared by running:
101102

102103
# +
103-
from ansys.stk.core.utilities.colors import Color, Colors
104+
from ansys.stk.core.utilities.colors import Colors
104105

105106

106-
inital_state_propagate.propagator_name = "Earth point mass"
107-
inital_state_propagate.properties.color = Colors.Blue
107+
parking_orbit_propagate.properties.color = Colors.Blue
108108
# -
109109

110110
# ## Define the target sequence for solving transfer orbit
111111
#
112-
# The target sequence is the set of steps defining the complete maneuver.
112+
# The target sequence is used to find the magnitude of each $\Delta v$ so that the satellite can achieve its desired altitude.
113113

114114
start_transfer_sequence = satellite.propagator.main_sequence.insert(SEGMENT_TYPE.TARGET_SEQUENCE, "Start Transfer", "-")
115115

@@ -125,7 +125,7 @@
125125
delta_v1.set_maneuver_type(MANEUVER_TYPE.IMPULSIVE)
126126
# -
127127

128-
# This first impulse takes place in the direction of the velocity vector at the periapsis. For this reason, it is convenient to define the thrust impulse in the Velocity-Normal-CoNormal (VNC) frame. By selecting the VNC frame, the velocity vector is now aligned with the X-axis.
128+
# This first impulse takes place in the direction of the velocity vector at the periapsis. For this reason, it is convenient to define the thrust impulse in the Velocity-Normal-CoNormal (VNC) frame. By selecting the VNC frame, the velocity vector is now aligned with the X-axis. The magnitude of the burn will be determined using the radius of apoapsis after the maneuver, so radius of apoapsis is added as a result to the maneuver segment:
129129

130130
# +
131131
from ansys.stk.core.stkobjects.astrogator import ATTITUDE_CONTROL, CONTROL_MANEUVER, PROFILE_MODE, TARGET_SEQ_ACTION
@@ -157,19 +157,23 @@
157157
first_impulse_differential_corrector.max_iterations = 50
158158
first_impulse_differential_corrector.mode = PROFILE_MODE.ITERATE
159159

160-
# Finally, run all active profiles in the target sequence:
160+
# Finally, set the mode of the target sequence to run all active profiles:
161161

162162
start_transfer_sequence.action = TARGET_SEQ_ACTION.RUN_ACTIVE_PROFILES
163163

164164
# ### Propagate the satellite to the end of the transfer orbit
165165

166-
# Once the impulse is solved, the maneuver is complete. The next step is to propagate the satellite to the end of the transfer orbit. This is done by adding a new propagation segment to the main sequence:
166+
# After the first maneuver, the next step is to propagate the satellite to the end of the transfer orbit. This is done by adding a new propagation segment to the main sequence:
167167

168168
propagate_transfer = satellite.propagator.main_sequence.insert(SEGMENT_TYPE.PROPAGATE, "Transfer Orbit", "-")
169-
propagate_transfer.properties.color = Colors.Red
169+
propagate_transfer.propagator_name = "Earth point mass"
170170
propagate_transfer.stopping_conditions.add("Apoapsis")
171171
propagate_transfer.stopping_conditions.remove("Duration")
172172

173+
# This segment is colored using red to differentiate it from the parking segment:
174+
175+
propagate_transfer.properties.color = Colors.Red
176+
173177
# ### Final impulse to circularize the orbit
174178
#
175179
# For the final impulse, create a new target sequence:
@@ -181,7 +185,7 @@
181185
delta_v2 = end_transfer_sequence.segments.insert(SEGMENT_TYPE.MANEUVER, "Last Impulse", "-")
182186
delta_v2.set_maneuver_type(MANEUVER_TYPE.IMPULSIVE)
183187

184-
# Again, define the thrust in the direction of the local velocity vector:
188+
# Again, define the thrust in the direction of the local velocity vector. This time, eccentricity is used as a result since the desired orbit at the end of the transfer is circular:
185189

186190
delta_v2.maneuver.set_attitude_control_type(ATTITUDE_CONTROL.THRUST_VECTOR)
187191
delta_v2.enable_control_parameter(CONTROL_MANEUVER.IMPULSIVE_CARTESIAN_X)
@@ -209,13 +213,13 @@
209213
last_impulse_differential_corrector.enable_display_status = True
210214
last_impulse_differential_corrector.mode = PROFILE_MODE.ITERATE
211215

212-
# Finally, run all active profiles in the target sequence:
216+
# Finally, set the mode of the target sequence to run all active profiles:
213217

214218
end_transfer_sequence.action = TARGET_SEQ_ACTION.RUN_ACTIVE_PROFILES
215219

216220
# ## Propagation along the final orbit
217221
#
218-
# Once the last impulse has been applied, it is possible to propagate the satellite along its final parking orbit. Start by creating a new propagation segment in the main sequence. Propagate the satellite for a total of 86400 seconds.
222+
# Once the last impulse has been applied, it is possible to propagate the satellite along its final orbit. Start by creating a new propagation segment in the main sequence. Propagate the satellite for a total of 86400 seconds.
219223

220224
propagate_final_orbit = satellite.propagator.main_sequence.insert(SEGMENT_TYPE.PROPAGATE, "Final State Propagate", "-")
221225
propagate_final_orbit.properties.color = Colors.Green

0 commit comments

Comments
 (0)