en:stabilization

This shows you the differences between two versions of the page.

en:stabilization [2019/11/07 16:42] golikov [Lesson 04] |
en:stabilization [2020/03/25 16:28] |
||
---|---|---|---|

Line 1: | Line 1: | ||

- | ====== Lesson 04. Stabilization mode ====== | ||

- | ==== Why do we need stabilization mode ==== | ||

- | |||

- | Satellite stabilization mode means maintaining a zero angular velocity. This mode is necessary, for example, to obtain clear images or transfer them to a ground receiving point, when the data transmission time is long and the satellite antenna is not allowed to deviate from the ground receiving point. The theory described in this lesson is also suitable for maintaining any desired angular velocity (not only zero velocity), and for such tasks as tracking a moving object. | ||

- | |||

- | ==== How to implement stabilization mode ==== | ||

- | |||

- | You can change the satellite’s angular velocity using flywheels, jet engines, electromagnetic coils, and gyrodyne engines. In this example we consider the control over the control moment using the flywheel. The action of this device is based on the Law of conservation of angular momentum. For example, when the flywheel engine spins in one direction, the spacecraft (SC), respectively, begins to rotate in the other direction. It happens under the action of the same unwinding moment, but directed in the opposite side in accordance with the Newton's Third Law. If, under the influence of external factors, the spacecraft begins to turn in a certain direction, it is enough to increase the rotation speed of the flywheel in the same direction. So, the unwanted rotation of the spacecraft will stop because the flywheel will "take" the rotational moment instead of the satellite. . The information about the angular velocity of the satellite will be received by use of angular velocity sensor. In this example, we consider how to calculate control commands for the flywheel from the indications of the angular velocity sensor and data on the speed of the flywheel. It is needed for the satellite to stabilize or maintain the required angular velocity | ||

- | |||

- | ===== Theory ===== | ||

- | |||

- | ==== Analogies between translational and rotational motion ==== | ||

- | The analogue of the Law of conservation of momentum for rotational motion is the Law of conservation of angular momentum or the Law of conservation of kinetic momentum: | ||

- | |||

- | $\sum\limits_{i=1}^{n}{{{J}_{i}}\cdot {{\omega }_{i}}}=const \label{eq:1}$ | ||

- | |||

- | In general, the rotational motion of a satellite is described by laws similar to thosefor translational motion. For example, for each parameter in the translational motion there is a similar parameter for the rotational motion: | ||

- | |||

- | ^ Translational motion ^ Analogy ^ Rotational motion ^ | ||

- | | Force | $F\leftrightarrow M$ | Momentum | | ||

- | | Distance | $S\leftrightarrow \alpha$ | Angle | | ||

- | | Speed | $V\leftrightarrow\omega$ | Angular velocity | | ||

- | | Acceleration | $a\leftrightarrow\epsilon$ | Angular acceleration | | ||

- | | Weight | $m\leftrightarrow J$ | Moment of inertia | | ||

- | |||

- | The laws of motion also look similar. | ||

- | |||

- | ^ Title of law ^ Translational motion ^ Rotational motion ^ | ||

- | | Newton's second law | $F=m\cdot a$| $M=J\cdot \epsilon$| | ||

- | | kinetic energy | $E=\frac{m\cdot {{V}^{2}}}{2}$| $E=\frac{J\cdot {{\omega}^{2}}}{2}$ | | ||

- | | law of momentum conservation| $\sum\limits_{i=1}^{n}{{{m}_{i}}\cdot {{V }_{i}}}=const$ | $\sum\limits_{i=1}^{n}{{{J}_{i}}\cdot {{\omega }_{i}}}=const$ | | ||

- | |||

- | ==== Derivation of ratio for required angular velocity of flywheel ==== | ||

- | |||

- | Let us write the law of conservation of kinetic moment of the system ‘satellite + flywheel’ for the moments of time "1" и "2": | ||

- | |||

- | ${{J}_{s}}\cdot {{\omega }_{s1}}+{{J}_{m}}\cdot {{\omega }_{m1}}={{J}_{s}}\cdot {{\omega }_{s2}}+{{J}_{m}}\cdot {{\omega }_{m2}}$ | ||

- | |||

- | The absolute speed of the flywheel, i.e. the flywheel speed in an inertial coordinate system (for example, associated with the Earth) is the sum of the satellite angular velocity and the angular velocity of the flywheel relative to the satellite, i.e. flywheel angular velocity: | ||

- | |||

- | ${{\omega }_{mi}}={{\omega }_{si}}+{{{\omega }'}_{mi}}$ | ||

- | |||

- | Please note: the flywheel can measure its own angular velocity relative to the satellite body or relative angular velocity. | ||

- | |||

- | Let usxpress the desired speed of the flywheel which must be set | ||

- | |||

- | ${{J}_{s}}\cdot {{\omega }_{s1}}+{{J}_{m}}\cdot \left( {{\omega }_{s1}}+{{{{\omega }'}}_{m1}} \right)={{J}_{s}}\cdot {{\omega }_{s2}}+{{J}_{m}}\cdot \left( {{\omega }_{s2}}+{{{{\omega }'}}_{m2}} \right) $ | ||

- | |||

- | $ \left( {{J}_{s}}+{{J}_{m}} \right)\left( {{\omega }_{s1}}-{{\omega }_{s2}} \right)=-{{J}_{m}}({{\omega }_{m1}}-{{\omega }_{m2}}) $ | ||

- | |||

- | $ {{\omega }_{m2}}={{\omega }_{m1}}+\frac{{{J}_{s}}+{{J}_{m}}}{{{J}_{m}}}\left( {{\omega }_{s1}}-{{\omega }_{s2}} \right) $ | ||

- | |||

- | Denote the relation $\frac{{{J}_{s}}+{{J}_{m}}}{{{J}_{m}}}$ as $k_d$. | ||

- | |||

- | Operation of the algorithm does not require the exact value of $\frac{{{J}_{s}}+{{J}_{m}}}{{{J}_{m}}}$ because the flywheel cannot instantly set the required angular velocity. Also, the precision of measurements is not absolute: the satellite’s angular velocity measured with an angular velocity sensor is not accurate, since measurements always contain measurement noise. Note that measurement of the angular velocity and command issuing to the flywheel occur with some minimum time step. All these limitations lead to the fact that $k_d$ should be experimentally selected. If it does not work we build detailed computer models which take into account all the above limitations. In our case, the coefficient $k_d$ will be selected experimentally. | ||

- | |||

- | $ {{\omega }_{m2}}={{\omega }_{m1}}+{{k}_{d}}\left( {{\omega }_{s1}}-{{\omega }_{s2}} \right) $ | ||

- | |||

- | The angular velocity $\omega_{s2}$ at time "2" is the target angular velocity; we denote it by $\omega_{s\_goal}$. Thus, if the satellite is supposed to maintain the angular velocity $\omega_{s\_goal}$, then knowing the current angular velocity of the satellite and the current angular velocity of the flywheel, it is possible to calculate the desired velocity of the flywheel to maintain the "rotation with constant speed" mode: | ||

- | |||

- | ${{\omega }_{m2}}={{\omega }_{m1}}+{{k}_{d}}\left( {{\omega }_{s1}}-{{\omega }_{{s\_goal}}} \right)$ | ||

- | |||

- | Using the rotation mode with a constant speed, it is possible to make the satellite turn at any angle if the satellite is rotated at a constant speed for a certain time. Then the time that the satellite needs to rotate at a constant speed $\omega_{s\_goal}$ to turn to the required angle $\alpha$ is determined by dividing these values: | ||

- | |||

- | $t=\frac{\alpha}{\omega_{{s\_goal}}}$ | ||

- | |||

- | If the satellite is required to be stabilized, then $\omega_{s\_goal}=0$ and the expression becomes simpler: | ||

- | |||

- | ${{\omega }_{m2}}={{\omega }_{m1}}+{{k}_{d}}\cdot {{\omega }_{s1}}$ | ||

- | |||

- | ===== Python implementation ===== | ||

- | |||

- | ==== Sample of Python code using the formula: ==== | ||

- | <code python> | ||

- | |||

- | # request for angular velocity sensor (AVS) and flywheel data | ||

- | hyro_state, gx_raw, gy_raw, gz_raw = hyro_request_raw(hyr_num) | ||

- | mtr_state, mtr_speed = motor_request_speed(mtr_num) | ||

- | |||

- | # conversion of angular velocity values in degrees/sec | ||

- | gx_degs = gx_raw * 0.00875 | ||

- | |||

- | # if AVS is set up with the z axis, then the angular velocity | ||

- | # of the satellite coincides with the readings of the AVS along the z axis, otherwise | ||

- | # it is necessary to change the sign: omega = - gz_degs | ||

- | omega = gz_degs | ||

- | |||

- | mtr_new_speed = int(mtr_speed+ kd*(omega-omega_goal)) | ||

- | </code> | ||

- | |||

- | ==== Example of complete code of the satellite stabilization program in Python: ==== | ||

- | |||

- | <code python> | ||

- | # Differential feedback coefficient. | ||

- | # The coefficient is positive if the flywheel is located with the z axis up | ||

- | # and AVS is also z-axis up. | ||

- | # The coefficient is chosen experimentally, depending on the form | ||

- | # and the mass of your satellite. | ||

- | kd = 200.0 | ||

- | # The time step of the algorithm, sec | ||

- | time_step = 0.2 | ||

- | # Target satellite angular velocity, degrees/sec | ||

- | # For stabilization mode is equal to 0.0 degrees/sec | ||

- | omega_goal = 0.0 | ||

- | # Flywheel number | ||

- | mtr_num = 1 | ||

- | # Maximum allowed flywheel speed, rpm | ||

- | mtr_max_speed = 7000 | ||

- | # Number of AVS (angular velocity sensor) | ||

- | hyr_num = 1 | ||

- | |||

- | |||

- | # Functions for determining the new flywheel speed. | ||

- | # New flywheel speed is made up of | ||

- | # current flywheel speed and speed increments. | ||

- | # Incrementing speed in proportion to angle error | ||

- | # and error in angular velocity. | ||

- | # mtr_speed - flywheel current angular speed, rpm | ||

- | # omega - current satellite angular velocity, degrees/sec | ||

- | # omega_goal - target angular velocity of the satellite, degrees/sec | ||

- | # mtr_new_speed - required angular velocity of the flywheel, rpm | ||

- | def motor_new_speed_PD(mtr_speed, omega, omega_goal): | ||

- | mtr_new_speed = int(mtr_speed | ||

- | + kd*(omega-omega_goal) | ||

- | ) | ||

- | if mtr_new_speed > mtr_max_speed: | ||

- | mtr_new_speed = mtr_max_speed | ||

- | elif mtr_new_speed < -mtr_max_speed: | ||

- | mtr_new_speed = -mtr_max_speed | ||

- | return mtr_new_speed | ||

- | |||

- | |||

- | # The function includes all devices | ||

- | # to be used in the main program. | ||

- | def initialize_all(): | ||

- | print "Enable motor №", mtr_num | ||

- | motor_turn_on(mtr_num) | ||

- | sleep(1) | ||

- | print "Enable angular velocity sensor №", hyr_num | ||

- | hyro_turn_on(hyr_num) | ||

- | sleep(1) | ||

- | |||

- | |||

- | # The function disables all devices | ||

- | # to be used in the main program. | ||

- | def switch_off_all(): | ||

- | print "Finishing..." | ||

- | print "Disable angular velocity sensor №", hyr_num | ||

- | hyro_turn_off(hyr_num) | ||

- | motor_set_speed(mtr_num, 0) | ||

- | sleep (1) | ||

- | motor_turn_off(mtr_num) | ||

- | print "Finish program" | ||

- | |||

- | |||

- | # The main function of the program in which remaining functions are called up. | ||

- | def control(): | ||

- | initialize_all() | ||

- | # Initialize flywheel status | ||

- | mtr_state = 0 | ||

- | # Initialize the status of the AVS | ||

- | hyro_state = 0 | ||

- | |||

- | for i in range(1000): | ||

- | print "i = ", i | ||

- | |||

- | # Аngular speed sensor (AVS) and flywheel requests. | ||

- | hyro_state, gx_raw, gy_raw, gz_raw = hyro_request_raw(hyr_num) | ||

- | mtr_state, mtr_speed = motor_request_speed(mtr_num) | ||

- | |||

- | # Processing the readings of the angular velocity sensor (AVS), | ||

- | # calculation of the satellite angular velocity. | ||

- | # If the error code of the AVS is 0, i.e. there is no error | ||

- | if not hyro_state: | ||

- | gx_degs = gx_raw * 0.00875 | ||

- | gy_degs = gy_raw * 0.00875 | ||

- | gz_degs = gz_raw * 0.00875 | ||

- | # if AVS is set up with the z axis, then the angular velocity | ||

- | # of the satellite coincides with the readings of the AVS along the z axis, otherwise | ||

- | # it is necessary to change the sign: omega = - gz_degs | ||

- | omega = gz_degs | ||

- | print "gx_degs =", gx_degs, \ | ||

- | "gy_degs =", gy_degs, "gz_degs =", gz_degs | ||

- | elif hyro_state == 1: | ||

- | print "Fail because of access error, check the connection" | ||

- | elif hyro_state == 2: | ||

- | print "Fail because of interface error, check your code" | ||

- | |||

- | # Processing the flywheel and setting the target angular velocity. | ||

- | if not mtr_state: # if the error code is 0, i.e. no error | ||

- | print "Motor_speed: ", mtr_speed | ||

- | # setting of new flywheel speed | ||

- | mtr_new_speed = motor_new_speed_PD(mtr_speed,omega,omega_goal) | ||

- | motor_set_speed(mtr_num, mtr_new_speed) | ||

- | |||

- | sleep(time_step) | ||

- | |||

- | switch_off_all() | ||

- | </code> | ||

- | |||

- | ===== Tasks ===== | ||

- | |||

- | 1. Change the program so that the satellite rotates at a constant speed. | ||

- | 2. Change the program so that the satellite works according to the flight timeline: | ||

- | * stabilization within 10 seconds | ||

- | * 180 degree rotation in 30 seconds | ||

- | * stabilization within 10 seconds | ||

- | 3. Rewrite the program in C and get it working. | ||

en/stabilization.txt · Last modified: 2020/03/25 16:28 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International