Generic Model of a Satellite Attitude Control System

A generic model of a nanosatellite attitude control and stabilization system was developed on the basis of magnetorquers and reaction wheels, which are controlled by PID controllers with selectable gains. This approach allows using the same architectures of control algorithms (and software) for several satellites and adjusting them to a particular mission by parameter variation. The approach is illustrated by controlling a satellite attitude in three modes of operation: detumbling after separation from the launcher, nominal operation when the satellite attitude is subjected to small or moderate disturbances, and momentum unloading after any reaction wheel saturation. The generic control algorithms adjusted to each mode of operation were implemented in a complete attitude control system. The control system model was embedded into a comprehensive simulation model of satellite flight. The simulation results proved the efficiency of the proposed approach.


Introduction
The advancements in miniaturization of sensors and mechanical devices and computing hardware and software lead to enhanced performance of small satellites. The novel concepts of cooperating satellites flying in a formation give prospects for a further increase of the possibility of providing services similar to those offered now by large and expensive spacecraft and also of offering new services or functionalities [1]. An important requirement for satellite operation in all flight phases, crucial for collaboration in formation flying, is effective attitude stabilization and control.
Satellite control torques may be generated in a passive or active way. Passive attitude control does not consume power but may be applied only for dumping of unwanted satellite motion resulting from external disturbances [2]. Active control provides higher control authority than passive methods and allows performing rotational maneuvers by using actuators on board a spacecraft. The most commonly used satellite actuators are magnetorquers and reaction wheels [3][4][5], sometimes also thrusters [6], but for attitude control, they are rarely used due to fuel mass and volume penalty and its irreversible depletion. When low pointing accuracy is suffi-cient, magnetorquers may be the only actuators used for attitude control [7,8]. CubeSats attitude control systems are overviewed in [9]. Most CubeSats use reaction wheels and magnetorquers, although passive magnetic stabilization is also applied, especially in small units.
After separation from a launcher, the satellite may tumble, i.e., spin with a high angular rate, which [10][11][12] may be moderate, like 0.1 rad/s in each axis, but also may be above 95rad/s (600°/s). In nominal operating conditions, a satellite is subjected to various disturbances, which require quick and effective reactions by the attitude control system, usually using reaction wheels as actuators. Uncontrolled reaction wheels saturate, i.e., they reach the limits of maximal angular velocity, due to large external disturbances or when counteracting disturbing torques accumulate satellite angular velocities for a long time. In this research, three modes of ACS operation are considered: detumbling, nominal, and momentum unloading. In the detumbling mode, usually only magnetorquers are used, as the reaction wheels may quickly saturate. However, in [4,10,13], reaction wheels were considered also for CubeSat detumbling. In [14], B-dot and bang-bang B-dot control laws were applied for magnetorquers, and bang-bang B-dot provided quicker stabilization but with a higher final angular velocity error than the B-dot one. In [15], satellite angular velocity feedback was implemented for the detumbling mode.
The nominal control laws provide stabilization counteracting external disturbances, which, even when small (like gravity-gradient) but acting for a long time, may drift a satellite away from its required attitude. Another control task in the nominal mode is satellite rotational maneuvers. As primary actuators, reaction wheels are commonly used in the nominal mode, as they may assure a high attitude accuracy and force a relatively quick response (although slower than thrusters). To control reaction wheels, proportionalderivative (PD) controllers are used [16][17][18][19][20][21][22][23][24], sometimes with modifications like including additional nonlinear terms [16,23]. The control laws for the nominal mode are often developed using a simplified satellite model (for instance, only rotational motion is considered neglecting disturbance torques) before being applied to nonlinear systems [16].
In such a case, reaction wheels require diminishing their momentum. For small satellites in low Earth orbits (LEO), magnetorquers are used to unload momentum, as cheap, reliable, and effective torque-generating devices [3]. In [24,25], the crossproduct control law was applied to control three reaction wheels, and in [3], its modification called a revisited-product control law was investigated. A more general approach was presented in [5] to control a set of three or more reaction wheels.
For each mode of operation, the signals from the control law block should be passed as input to particular actuators. It may be achieved in various ways, for instance, using one type of actuators only (reaction wheels in the nominal mode or magnetorquers in the detumbling mode) and then minimizing the control effort [3,4].
The main objective of the study was to develop an attitude control system to be implemented on board CubeSats for prospective formation flying. The ease of applicability to similar satellite sizes was the main requirement to diminish the cost of control system development and tuning. This explains why the traditional PID approach was implemented with focus on flexibility of implementation to similar satellites and scalability for a number of actuators. To evaluate feasibility of the developed concept, a comprehensive WUT simulation model of a satellite flight was supplemented by a control system model, allowing evaluation of the control quality. The paper will describe the satellite simulation model, and then next, the generic structure of the control system will be presented. The simulation results will confirm the efficiency of the proposed control system and algorithms.

Satellite Simulation Model
The satellite simulation software developed at the Warsaw University of Technology ( Figure 1) contains satellite dynamic and kinematic equations, models of sensors and actuators, and algorithms of the navigation and control system. The modular structure allows flexibility in model extension and modifications. The model operates in the time domain.
A satellite bus is modeled as a rigid body with six degrees of freedom and time-varying mass and inertia. The dynamic equations of motion are derived in the Body Frame Fixed (BFF) coordinate system (Figure 2), the kinematic equations are derived in the Earth Centered Inertial (ECI) coordinate system, and the control loads are calculated first in local actuator coordinate systems and then transferred to BFF (Figure 2).
The rigid spacecraft dynamic equations of motion are described as External loads where t is time, x = ½U V W P Q R T is the satellite state vector composed of components of satellite linear v F and angular ω F velocity vectors, and load vectors composed of force F T ð Þ and moment M T ð Þ components. Indices refer to the following: G: gravity; A: aerodynamics; SRP: solar radiation pressure; M: magnetic field (acting on the bus); R: reaction wheels (or other momentum exchange devices); T: propulsion (not used in this study); Q: magnetorquers.
The inertia matrix AðtÞ has the form where m, S x , S y , S z , I xx , I yy , I zz , I xy , I yz , and I xz are the satellite mass, static mass moments, and moments and products of inertia, respectively. The Bðt, xÞ matrix is calculated as where The satellite kinematic equations for position and attitude have the form where r FI = x FI y FI z FI ½ T is the satellite position in the inertial coordinate system (ECI), v F = U V W ½ T is the satellite linear velocity in the satellite body frame, ω F = P Q R ½ T is the satellite angular velocity in the satellite body frame, q I = q 0 q 1 q 2 q 3 ½ T is the quaternion of a satellite attitude in the inertial frame, and C I F is the matrix of transformation from the satellite body to inertial frame in the form Matrix Q is composed of satellite angular velocities and has the form It is assumed that on a satellite, N control actuators are mounted, producing torques M Ci only, so the total control torque is where M Ci is the torque generated by the i-th actuator (reaction wheel or magnetorquer) in the BFF coordinate system. A reaction wheel is modelled as a flywheel fixed to the satellite body spinning with angular velocity Ω R and moment   International Journal of Aerospace Engineering of inertia I Rx . Its angular momentum in the actuator coordinate system is where H R is the angular momentum of the reaction wheel, I Rx is the moment of inertia of the reaction wheel about its spin axis, Ω R is the spin velocity of the reaction wheel, and ω R = ω Rx ω Ry ω Rz Â Ã T is the satellite angular velocity in the actuator coordinate system. A torque acting on the satellite due to a single reaction wheel (in the BFF frame) is calculated as Angular velocity Ω R of a reaction wheel is the control variable for the generated torque.
The reaction wheel is driven by an electric motor, the dynamics of which in general is described by combined electromechanical equations. As control signals, COTS (commercial off-the-shelf) reaction wheels use current, torque, or angular velocity, and their control electronics converts them to the input voltage of the motor. In this study, it is assumed that the armature current i a is a control variable, and the reaction wheel model is described by mechanical state equations in the form where i R is the armature current, k R is the motor torque constant, and b R is the viscous friction coefficient of the motor shaft.
The torque from a magnetorquer is a crossproduct of the magnetic dipole generated by a coil and the Earth magnetic field vector: where Earth magnetic field in the magnetorquer coordinate system. A magnetic dipole is calculated as where D 0 is the nominal dipole moment of the magnetorquer at a given nominal voltage and u Q is the control variable of a magnetorquer.

Attitude Control System
The general architecture of a satellite attitude control system investigated in this study is shown in Figure 3. The blocks "actuators" and "satellite" (Figure 3) are the models described in the previous chapter used for simulation of bus and actu-ators dynamics. "Sensors" are not considered in this study. The block "current state" data contains state variables of a satellite, reaction wheels and magnetorquers, quaternion q I = q 0 q 1 q 2 q 3 ½ T representing satellite attitude in the inertial frame, vector ω F = P Q R ½ T of a satellite angular velocity expressed in the satellite body coordinate system, vector Ω RW of reaction wheels angular velocities, and vector u M of the magnetorquer control signal. The required values of these quantities, denoted with index cmd, are taken from the block named "flight management." The differences between the required and current states are inputs to the satellite attitude control system (ACS), composed of two blocks denominated in Figure 3 as "satellite attitude control" and "reaction wheel desaturation." The task of the satellite attitude control block is to bring a satellite to the required attitude state and/or to keep it at that state. The task of the reaction wheel desaturation block is to decelerate them to angular velocities determined by vector Ω cmd . The desaturation process should not influence significantly the satellite rotational dynamics, so it is included as a separate line of control.
For both control blocks, full PID control is envisaged and implemented in the algorithm.
where σ is the vector of the differences between the required and current values; K Pð * Þ , K Dð * Þ , and K Ið * Þ are the proportional, derivative, and integral gain matrices, respectively; and ð * Þ is the index of the actuator used. The applied PID control is illustrated in Figure 4 showing the selection of actuators and control gain matrix for three system operating modes: detumbling, nominal, and momentum unloading.
3.1. Detumbling Mode. The detumbling mode is activated after separation of the satellite from the launch vehicle or at any time when the satellite's angular velocity is too large. The satellite angular velocity is reduced by the attitude controller, and the momentum management controller is inactive. In the detumbling mode, only magnetorquers are used for spacecraft stabilization, and PID is reduced to differential control related to the actual value of satellite angular velocity as the required satellite velocity reduction ω cmd = 0. The gain matrix K DQ depends on the magnetorquer arrangement, magnetic field vector, satellite inertia, and orbital period (similar to [15]) and is calculated as where N Q is the number of magnetorquers, International Journal of Aerospace Engineering nominal dipole moments D 0i of magnetorquers, G MTQ is the matrix (3 × N Q ) representing the configuration of magnetorquers in the satellite body frame (the "+" in the superscript indicates a pseudoinverse or an inverse of matrix , T orb is the orbital period of the satellite, and I is the matrix of the satellite moment of inertia matrix about its center of mass.
When the specified low angular velocity is achieved, the attitude control system is switched from the detumbling mode to the more precise nominal mode.

Nominal
Mode. The nominal mode is used to maintain or change satellite attitude as required with adequate accuracy, despite external disturbances. The control is performed by reaction wheels in a full PID form In (17), the attitude error vector σ is calculated as a rotation from the actual attitude q I = q 0 q 1 q 2 q 3 ½ T to the commanded attitude q Icmd = q 0c q 1c q 2c q 3c ½ T in a quaternion notation as [24] q 0e q 1e q 2e q 3e −q 3c q 2c −q 1c q 0c , The derivative of attitude error _ σ R is the difference of satellite angular velocities:   The gain matrices K PR , K DR , and K IR are calculated as where N R is the number of reaction wheels; R = diag k R1 ⋯ k RN R À Á is the diagonal matrix (N R × N R ) containing reaction wheel motor constants; G RW is the matrix (3 × N R ) representing the configuration of reaction wheels, relative to satellite body axes; and ω n , ζ, and T are the required linear control bandwidth, dumping ratio, and time constant of the integral controller, respectively.

Momentum Unloading
Mode. The momentum unloading mode is used to prevent reaction wheel saturation by reducing their angular velocities. In the momentum unloading mode, reaction wheels are used for satellite attitude control, and simultaneously, magnetorquers are switched on for reaction wheel desaturation. The mode is activated when the velocity of at least one reaction wheel exceeds its design limit. However, for better mission performance, the momentum unloading system may be switched on from time to time to reduce accumulating wheel rotating velocity.
In the momentum unloading mode, the control of reaction wheels should assure satellite attitude control and diminish the spin of reaction wheels, so the total reaction wheel control u R in this mode is done as where u RS is applied to perform the first task and u RR the second one.
As the integral term in PID might slow down the control reaction, for satellite attitude control u RS in the momentum unloading mode, the PD controller for reaction wheels is used: with modified P and D gain matrices (eq. (20) and (21)) calculated here as To decelerate angular velocities of reaction wheels to a specified value Ω cmd , u RR is calculated as where Ω e = Ω cmd − Ω RW is the reaction wheel angular velocity error vector, and matrix K RR is calculated as where k R is the scalar control gain. The magnetorquers are also controlled by the D controller: and gain K DQ is calculated as [3,24,25] where k Q is the scalar control gain. Proper selection of control gains k Q and k R in the momentum unloading mode results in lower disturbances of spacecraft attitude and shorter duration of the reaction wheel desaturation process.

Simulation Study
To investigate the efficiency of the developed attitude control system, a simulation study was done for the generic satellite mass data given in Table 1.
The initial satellite orbit elements are provided in Table 2.  Three configurations of reaction wheels: orthogonal, pyramidal, and tetrahedral ( Figure 5), were investigated accompanied by a set of three orthogonal magnetorquers.
The reaction wheel parameters used in simulations are based on Sinclair RW-0.03 data [26] and are given in Table 3.
The major parts of simulations were performed for the orthogonal configuration of reaction wheels as the most commonly used one [9]. The other two configurations were investigated mainly for validating the scalability of the developed algorithms.
The matrices G RW describing reaction wheel configuration, used in equations (20), (21), (22) and (25) The set of magnetorquers contains three devices in an orthogonal configuration with nominal dipoles as in [27]: in the O F x F and O F y F axes, D 01 = D 02 = 0:2 Am 2 , and in the O F z F axis, D 03 = 0:24 Am 2 .
For the detumbling mode, the constant part of the gain matrix was calculated purely based on the satellite inertia and orbital parameters as per equation (16). The selective parameters for the nominal (equations (20), (21), (22)) and momentum unloading (equations (28) and (30)) modes were chosen using the trial and error method. The attitude controller parameters were set to ω n = 0:8 rad/s, ζ = 1, and T = 12:5 s. For the nominal mode, the aim was to allow relatively quick maneuvers without significant overshoot of the attitude and sufficiently high pointing accuracy for the initial wheel rates of 0 rpm/s. The gains in the momentum unloading mode, k Q = k R = 0:05, were chosen to have relatively small values in order to limit the deviation from the required attitude during that phase.
The simulation rationale for all cases was to check the applicability of the algorithms developed. In particular, for the detumbling mode, the ability to suppress the satellite rotation was verified. For the normal operating mode, the ability to maintain or change the satellite attitude was investigated, for various angular velocities and configurations of reaction wheels. For the momentum unloading case, the ability to desaturate high rates of reaction wheels was verified.

Detumbling Mode.
The detumbling mode of the ACS operation was simulated to verify the effectiveness of reducing the satellite's high value of 10°/s per axis of initial angular velocity, which may appear after separation from the launcher. The magnetorquers were actuators used in this mode. The time profiles of the satellite angular velocity module and magnetorquer dipole moments module are presented in Figures 6(a) and 6(b).
The satellite angular velocity was reduced below 0.5°/s after 3200 s and below 0.2°/s after 6000 s, i.e., in time about 9% longer than the orbital period which was 5500 s. The result is satisfying, in terms, for instance, of the requirement formulated in [10] that a satellite should detumble in about one orbital period from the initial angular velocity of 5.73°/s per axis.
As indicated by other simulations, using the detumbling mode controller did not reduce the satellite rate below 0.2°/s. To cross this threshold, the ACS nominal operation mode should be used.

Nominal Mode.
In the simulations of the nominal mode, only reaction wheels were active. The quantities monitored for this mode are satellite Euler angles: Ψ (yaw), Θ (pitch),  7 International Journal of Aerospace Engineering and Φ (roll), angular rates of reaction wheels, and optionally satellite angular velocity. The list of scenarios simulated for the nominal mode of ACS operation is given in Table 4.
The simulation of case 1 illustrates the transition from detumbling to nominal mode. The initial angular velocity vector is assumed to be 0.5°/s per axis, which is the residual of the detumbling mode. The requirement was to keep the zero Euler angles, i.e., Ψ = 0°, Θ = 0°, and Φ = 0°.
At the beginning of the control, there was an increase in the reaction wheel angular rate, but after 10 seconds (Figure 7), the satellite angular rate was reduced from 0.5°/s to almost 0°/s in each axis, which was the result of reaction wheel activity. At that moment, the velocities of the first and the second reaction wheels were stabilized at 120 rpm. The third wheel stabilized at 30 rpm, because the satellite moment of inertia about the respective axis was lower than those on X and Y axes which are approximately equal.
The simulation case 2 was performed to investigate attitude control system performance for different initial reaction wheel rates. In this case, the initial attitude was Ψ = 0°, Θ = 0°, and Φ = 0°and initial angular velocity vector was 0°/s per axis. The satellite was required to keep this status for 100 s and then change attitude to Ψ = 120°, Θ = 60°, and Φ = 150°. The simu-lation was performed for a set of 3 orthogonal reaction wheels, for 3 different initial velocities of reaction wheels.
In case 2 for initial RW rates 0 and 2000 rpm, the performance is acceptable. The high initial reaction wheel rate such as 4000 rpm does not allow achieving a large commanded angle of rotation, which may be the result of reaction wheel saturation, as the second reaction wheel reached the maximal angular velocity of 6200 rpm (Figure 8). The remedy is that for the required large satellite attitude variation, the maneuver should be divided into a few smaller attitude changes to avoid high angular velocity of reaction wheels. Another solution could be to use different values of bandwidth and dumping in the gain matrices for this controller.
The case 3 simulation was performed to check the ACS performance for the cases similar for a time-varying nadir commanded attitude. In the first 100 seconds, the commanded attitude was Ψ = 0°, Θ = 0°, and Φ = 0°. After that, the commanded satellite attitude was varying for nadir pointing. The simulation was performed for 3 different sets of initial reaction wheel velocities (0, 2000, and 4000 rpm). The results are presented in Figures 9(a) and 9(b).
In this case, the control system response is similar to that in case 2. The system has a better performance for lower    International Journal of Aerospace Engineering initial reaction wheel rates, as the commanded attitude was reached more quickly and with better accuracy. For initial rates of 4000 rpm, the commanded attitude is not achieved and a significant pointing error occurs. It may be a symptom of reaction wheel saturation, as a result of summing up the angular velocities of reaction wheels and satellite, which makes the controller ineffective.
The simulation case 4 was performed to verify whether the developed control laws may be also used for reaction wheel configurations other than the orthogonal one. Initial satellite angular velocity vector was 0°/s per axis. The pyramid and tetrahedron configurations of four reaction wheels were investigated. In control gain calculations, the configurations differ by matrices G RW . In these cases, the satellite was expected to change attitude from initial Ψ = 0°, Θ = 0°, and Φ = 0°to the commanded one: Ψ = 120°, Θ = 60°, and Φ = 150°. The results are presented in Figures 10(a) and 10(b).
For both configurations, the maneuver was completed after about 15 seconds. The satellite motion was different for each configuration, but the final results were similar. The overshoot for pyramid configuration was larger on the pitch axis than for the tetrahedron configuration, but on the roll axis, an opposite tendency occurred.
The systems using 4 reaction wheels reach the commanded attitude significantly earlier with smaller overshoot than the one with 3 reaction wheels (case no. 3), as using more reaction wheels allows to generate a higher torque on the satellite. The performance of reaction wheel arrays is different; however, in both cases, the maximal speed achieved by any reaction wheel was similar (above 2000 rpm for the 1 st wheel of the pyramid configuration and for the 2 nd wheel of the tetrahedron configuration).
The results presented in Figure 10(a) illustrate that for different configurations, the performance of the control system may be similar. This poses a difficult task for the designer which configuration should be chosen if 4 reaction wheels are used. A wider set of scenarios would indicate more differ-ences between those 2 configurations. However, a detailed comparison between different reaction wheel configurations is not covered in this study.

Momentum Unloading Mode.
In this mode of ACS operation, both reaction wheels and magnetorquers are active. To verify the effectiveness of diminishing reaction wheel angular velocities, a desaturation process was performed for initial velocities of reaction wheels equal to 6000 rpm which is near their maximal value of operation-6200 rpm. Although it is a rather unrealistic value in practice, this case was studied to check the efficiency of the control. Simulations were done for orthogonal and pyramid configurations of reaction wheels.
For the orthogonal configuration of three reaction wheels (Figures 11(a) and 11(b)), their spin velocities were reduced to near zero values after 6400 s, i.e., 115% of the orbital period, which is a satisfying result. During the control, the rates of reaction wheels were not decreasing monotonically. It may be attributed to the fact that magnetorquers were operating close to their saturation region for most of the time. The satellite pointing error was decreasing with decreasing rates of reaction wheels. It may be explained by viscous dumping of reaction wheel rotation (providing residual torque) which was not compensated for in the momentum unloading mode.
To verify whether it is possible to apply control laws developed during this study to more than three reaction wheels, the simulation for a set of 4 reaction wheels in the pyramid configuration was performed.
The desaturation process was successful for this case too (Figures 12(a) and 12(b)), as angular rates of all four reaction wheels were reduced to near zero. It took more time compared to the operation of 3 orthogonal reaction wheels, most likely due to the fact that a system of 4 reaction wheels has a higher total angular momentum to be reduced. This might also result in a higher initial pointing error.

10
International Journal of Aerospace Engineering 4.4. Simulation Result Summary. The objective of the simulation study was to verify whether the attitude control system developed on the basis of linear control may be applied to the nonlinear satellite model. Three modes of operations were simulated, and the results of the control are satisfactory.
In the detumbling mode, the satellite angular velocity was reduced even for very high initial angular velocities, such as 10°/s per axis. The other simulation results indicated that using only magnetorquers for high accuracy pointing in the presence of external torque acting on the satellite may not be effective, which suggests that reaction wheels should be used in the final tuning of satellite attitude.
The simulations for the nominal mode of operation indicated that the control algorithm, applied in this mode, provides sufficient attitude control. The control algorithm developed in this study may be applied to various configurations of reaction wheels, which was illustrated by simulation results for orthogonal, pyramid, and tetrahedron reaction wheel configurations. The study revealed limits of using reaction wheels at high angular rates. As varying external loads acting on a satellite results in increase of reaction wheel angular velocities, the momentum unloading mode is necessary to maintain the required performance of reaction wheel actuation during a mission.