|
28 | 28 | root = stk.new_object_root() |
29 | 29 | root.new_scenario("HohmannTransfer") |
30 | 30 |
|
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: |
32 | 32 |
|
33 | 33 | # + |
34 | 34 | from ansys.stk.core.stkengine.experimental.jupyterwidgets import GlobeWidget |
|
72 | 72 | print(element_types) |
73 | 73 | # - |
74 | 74 |
|
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: |
76 | 76 |
|
77 | 77 | # + |
78 | 78 | from ansys.stk.core.stkobjects.astrogator import SEGMENT_TYPE |
|
81 | 81 | initial_state.set_element_type(ELEMENT_TYPE.KEPLERIAN) |
82 | 82 | # - |
83 | 83 |
|
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: |
85 | 85 |
|
86 | 86 | initial_state.element.periapsis_radius_size = 6700.00 |
87 | 87 | initial_state.element.eccentricity = 0.00 |
|
92 | 92 |
|
93 | 93 | # ## Set up the parking orbit of the satellite |
94 | 94 | # |
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. |
96 | 96 |
|
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 |
99 | 100 |
|
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: |
101 | 102 |
|
102 | 103 | # + |
103 | | -from ansys.stk.core.utilities.colors import Color, Colors |
| 104 | +from ansys.stk.core.utilities.colors import Colors |
104 | 105 |
|
105 | 106 |
|
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 |
108 | 108 | # - |
109 | 109 |
|
110 | 110 | # ## Define the target sequence for solving transfer orbit |
111 | 111 | # |
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. |
113 | 113 |
|
114 | 114 | start_transfer_sequence = satellite.propagator.main_sequence.insert(SEGMENT_TYPE.TARGET_SEQUENCE, "Start Transfer", "-") |
115 | 115 |
|
|
125 | 125 | delta_v1.set_maneuver_type(MANEUVER_TYPE.IMPULSIVE) |
126 | 126 | # - |
127 | 127 |
|
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: |
129 | 129 |
|
130 | 130 | # + |
131 | 131 | from ansys.stk.core.stkobjects.astrogator import ATTITUDE_CONTROL, CONTROL_MANEUVER, PROFILE_MODE, TARGET_SEQ_ACTION |
|
157 | 157 | first_impulse_differential_corrector.max_iterations = 50 |
158 | 158 | first_impulse_differential_corrector.mode = PROFILE_MODE.ITERATE |
159 | 159 |
|
160 | | -# Finally, run all active profiles in the target sequence: |
| 160 | +# Finally, set the mode of the target sequence to run all active profiles: |
161 | 161 |
|
162 | 162 | start_transfer_sequence.action = TARGET_SEQ_ACTION.RUN_ACTIVE_PROFILES |
163 | 163 |
|
164 | 164 | # ### Propagate the satellite to the end of the transfer orbit |
165 | 165 |
|
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: |
167 | 167 |
|
168 | 168 | 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" |
170 | 170 | propagate_transfer.stopping_conditions.add("Apoapsis") |
171 | 171 | propagate_transfer.stopping_conditions.remove("Duration") |
172 | 172 |
|
| 173 | +# This segment is colored using red to differentiate it from the parking segment: |
| 174 | + |
| 175 | +propagate_transfer.properties.color = Colors.Red |
| 176 | + |
173 | 177 | # ### Final impulse to circularize the orbit |
174 | 178 | # |
175 | 179 | # For the final impulse, create a new target sequence: |
|
181 | 185 | delta_v2 = end_transfer_sequence.segments.insert(SEGMENT_TYPE.MANEUVER, "Last Impulse", "-") |
182 | 186 | delta_v2.set_maneuver_type(MANEUVER_TYPE.IMPULSIVE) |
183 | 187 |
|
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: |
185 | 189 |
|
186 | 190 | delta_v2.maneuver.set_attitude_control_type(ATTITUDE_CONTROL.THRUST_VECTOR) |
187 | 191 | delta_v2.enable_control_parameter(CONTROL_MANEUVER.IMPULSIVE_CARTESIAN_X) |
|
209 | 213 | last_impulse_differential_corrector.enable_display_status = True |
210 | 214 | last_impulse_differential_corrector.mode = PROFILE_MODE.ITERATE |
211 | 215 |
|
212 | | -# Finally, run all active profiles in the target sequence: |
| 216 | +# Finally, set the mode of the target sequence to run all active profiles: |
213 | 217 |
|
214 | 218 | end_transfer_sequence.action = TARGET_SEQ_ACTION.RUN_ACTIVE_PROFILES |
215 | 219 |
|
216 | 220 | # ## Propagation along the final orbit |
217 | 221 | # |
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. |
219 | 223 |
|
220 | 224 | propagate_final_orbit = satellite.propagator.main_sequence.insert(SEGMENT_TYPE.PROPAGATE, "Final State Propagate", "-") |
221 | 225 | propagate_final_orbit.properties.color = Colors.Green |
|
0 commit comments