1 Introduction

According to Bouwmeester and Guo (2010), most common small satellites can be classified as picosatellites (mass between 0.1 and 1.0 kg) and nanosatellites (mass between 1.0 and 10.0 kg). Among small satellites, the CubeSat meet the specific standard considered in this work. The CubeSat Project arose in 1999 from a collaboration between California Polytechnic State University and Stanford University’s Space Systems Development Laboratory (The CubeSat Program 2014). The aim was to standardize the design of such small satellites in order to reduce costs and development. Nowadays, the CubeSat Project is a joint effort of more than a 100 universities, schools and private companies, developing pico- and nanosatellites that can carry scientific, private and governmental payloads aboard. Basically, a 1U CubeSat is a 10 cm sided cube weighting up to 1.33 kg. Once the CubeSat standard is adopted, the developer has to assure reliable operation of all the system by meeting the tests minimum requirements listed in the specifications standards (The CubeSat Program 2014). One of the main requirements to be fulfilled is the geometrical specification in order to fit in the Poly Picosatellite Orbital Deployer, so called P-POD, assembled aboard the Launch Vehicle (LV). Other requirements include, but are not limited to, materials, propulsion, energy (maximum stored energy equals 100 Wh), magnetic coat, mass budget, electrical system, vibrations, thermal and operations. Larger CubeSats are allowed, provided they are limited to a combination of the 1U units. Thus, a satellite consisting of 2 or 3 cubes is called 2U and 3U, respectively. Requirements of a given disposition can be derived from the smaller units. For example, the maximum mass of a 3U CubeSat is 4 kg. If one considers the definition (Bouwmeester and Guo 2010), the 3U CubeSat would belong to the nanosatellite class.

This paper is inserted in the SERPENS Program (acronym in Portuguese for Space System for Research and Experiments Using Nanosatellites), started in August 2013, officially introduced in December 2013 when several schools of Aerospace Engineering (AE) joined the program. The main goals of the SERPENS Program are: to promote and to consolidate the new AE courses in Brazil, to enable professors and researches of the AE courses to work on a space program, as well as professionals of other institutions, to involve and capacitate students and young professionals in a real design and development of space technology. This joint venture includes the University of Brasilia (UnB), the Federal University of Santa Catarina (UFSC), the Federal University of ABC (UFABC) and the Federal University of Minas Gerais (UFMG), the Reference Center in Embedded Systems and Aerospace of the Federal Fluminense Institute (CRSEA/IFF), and, more recently, the Federal University of Santa Maria (UFSM). Besides, other institutes also take part of the project namely the Northern Center of the National Institute for Space Research (CRN/INPE) and the Technological Integrated Systems Laboratory (LSI-tec), as well as international partners namely the University of Vigo (UVigo), the University of Rome La Sapienza, the American Morehead State University and the California Polytechnic State University. The SERPENS Program is supported by the Brazilian Space Agency (AEB) and UFSC is in charge of technical management of the current mission.

Therefore, the main objective of this paper is to present the early steps of the ADCS development that meets the requirements of the SERPENS-2 Mission. In Sect. 2, SERPENS-2 mission is presented in detail. In Sect. 3, the features of sensors, actuators and algorithms of the ADCS are presented. Section 4 introduces the mathematical modeling of the system. Section 6 presents preliminary simulation results, aiming to provide proof of concept for the ADCS. Final remarks are presented in Sect. 7.

2 SERPENS-2 mission

As the follow-up of the former mission, the SERPENS-2 will be a 3U CubeSat to operate at a 400 km altitude orbit with inclination from 45\(^{\circ }\) to 60\(^{\circ }\). The attitude requirements for SERPENS-2 are related to high level mission objectives as follow:

Detumbling: random attitude motions can occur after orbit injection, due to disconnection of the launcher and environmental perturbations. Active control will be used to reduce this effect.

Communication: no restriction for the requirements, provided omnidirectional antennas will be used.

Power supply: ideally solar panels can be systematically pointed to the Sun, seeking to maximize energy generation during an orbit period. This should generate attitude requirements, but this resource will not be available in this mission. However, there is the need of modelling the inertia moment of the satellite in case extended solar panels are used (to be decided).

Payload: the experiments to be carried on in SERPENS-2 are: (i) South Atlantic magnetic anomaly detection; (ii) X and Gamma rays detection; (iii) testing of a pulsed plasma thruster (PPT).

2.1 Attitude requirements to experiments

The mission comprises three experiments which are related to the attitude as described in the sequel.

Experiment i: this experiment does not impose additional requirements to the satellite attitude, once only the magnitude of Earth magnetic field is the focus;

Experiment ii: X and Gamma ray sensors shall not point to Earth or any other shiny sources (Sun and Moon) during the acquisition period. Thus, satellite attitude must be controlled with respect to local vertical local horizontal reference frame (LVLH), with orientation depending on the sensors assembly. However, LVLH is a non-inertial frame, spinning with angular velocity equal to the orbital one.

Experiment iii: attitude control is necessary to assure the suitable pointing of thrust vector during the experiment. PPT should be assembled in the middle of the satellite and the test aims to verify if it is capable of arising the CubeSat orbit despite the drag and decaying with time. The thruster to be tested has high frequency shooting (practically continuous), being able to work during weeks. The satellite must be stabilized continuously during the PPT action, keeping the thrust in the same direction than the velocity vector. A minimal pointing precision of 5\(^{\circ }\) to 10\(^{\circ }\) for the velocity vector direction was settled as sufficient for the experiment to be successfully carried on. Considering the velocity vector is oriented tangent to the satellite trajectory, control requirements related to the PPT are also to be considered in LVLH reference frame.

3 SERPENS-2 mission magnetic ADCS proposal

The control torque to be used is that originated from interaction to geomagnetic field. The magnetic control can be passive (Gerhardt and Palo 2010), by the presence of a magnetic bar, or active, with magnetic dipole moment control, both inside the satellite, so as to generate the desired control moments. In this paper, the active magnetic control is to be used, provided its simplicity, as the technology is suitable for CubeSats with Attitude Control Systems (ACS).

At the desired orbit for the mission, the main perturbation torques acting on the vehicle are gravity gradient, aerodynamic drag, radiation pressure and those related to residual magnetic field (due to embedded electronics). Those torques magnitude orders are \(10^{-8}\,\text {N}\,\text {m}\) for a 600 km altitude orbit (Gerhardt and Palo 2010). Thus, control law must also mitigate those perturbations.

Some authors (Wisniewski 2000; Wisniewski and Blanke 1999; Zhou 2010; Yang 2016, 2017) emphasize that purely magnetic control of a satellite can be used for both stabilization and attitude tracking. It will be tested for stabilization in the LVLH reference frame, being useful for the experiments (ii) and (iii).

3.1 Control System Hardware

Sensors: the precision demanded by the PPT, regarding attitude determination can be achieved with the use of magnetometers (3 axes), gyros (3 axes) and solar sensor.

Actuators: the demanded active magnetic control system can be achieved with 3 magnetorquers (3 axes configuration) and hardware to allow current inversion. These actuators will be used to point and stabilize the satellite in order to meet the experiment requirements. Magnetorquers can be obtained with a copper wire coil, capable of generating a magnetic dipole. Its interaction with Earth magnetic field produces the control torque. This solution is suitable for small satellites application because of its low cost, manufacturing and integration simplicity, reduced mass and volume and low energy consumption. Beside this, the coils are easily integrated to CubeSat structure or can use a separated dedicated platform. Control torque is obtained directly with the use of the onboard computer and only simple devices are required for current control.

3.2 Attitude and mission phases for experiments

Figure 1 shows a reference for the discussion that follows. One can see the reference frame fixed to the 3U CubeSat body.

Fig. 1
figure 1

Fixed reference frame at the 3U CubeSat body

The thruster is to be positioned in the middle of the CubeSat, centered at (0, 0, 0), with the thrust pointed to \(+x\) direction. X and Gamma rays detectors are positioned in the satellite body so as to have their field of view (FOV) pointed to \(+y\) and \(-y\).

Fig. 2
figure 2

Reference frame fixed to the body (x, y, z) and fixed to the orbit (LVLH or rpy—roll, pitch, yaw)

According to Fig. 2, the experiments must be carried out in two phases, namely

Phase 1: Experiments i and ii are performed. The satellite is stabilized by means of the active magnetic control. According to Fig. 2, z axis must be controlled to keep it pointing to the center of Earth (pointed nadir). This configuration assures the sensors will not point to Earth. There are no requirements for x and y pointing, being even desirable a rotation about z axis to provide with a Celestial Sphere sweeping. Meanwhile, the rotation about z axis can produce gyroscopic effect (inclination to inertial stabilization) that may harm nadir pointing.

Phase 2: Experiment iii (PPT) is performed. According to Fig. 2, \(+x\) axis is controlled in order to keep this pointing during all the experiment.

3.3 ADCS operation modes

The operation modes for the attitude control are defined by the phases of the mission described in Sect. 3.2, along with detumbling classical stage.

Mode 1—Detumbling: this mode applies the “Bdot” control in order to reduce high angular rates (Stickler and Alfriend 1976).

Mode 2—Acquisition 1: after detumbling, this mode is activated in order to drive the satellite to the required attitude for experiments (i) and (ii) (Fig. 2).

Mode 3—Control 1: after attitude of Mode 2 is acquired, Mode 3 is activated in order to keep (stabilize) this attitude during the performance of experiments (i) and (ii). Also, experiment (iii) will use this control mode.

Nominal attitude in Phases 1 and 2 is essentially unstable, but active magnetic control should keep the required attitude in each Phase.

4 Mathematical modeling

A 3U CubeSat is composed by three aligned cubes with standardized dimension and mass (The CubeSat Program 2015): y axis: 34.05 cm; x and z axis: \(10 \times 10\,\text {cm}\), and total mass of 3.9 kg. For modeling the satellite body, a homogeneous distribution of mass is considered. In this case, considering symmetries, the satellite inertia matrix is: \(I_0 =\mathrm {diag}(I_{0,x},I_{0,y},I_{0,z})\), with \(I_{0,x} = I_{0,z} = 0.0409\,\text {kg}\,\text {m}^2\), and \(I_{0,y} = 0.0065\,\text {kg}\,\text {m}^2\).

To improve this model, a PPT thruster is included. According to the manufacturer (Clyde Space 2015), the thruster has dimensions \(9 \times 9 \times 3\,\text {cm}\) and mass less than 0.28 kg. Its inertia moment was calculated considering it as a 3 cm thick and homogeneous plate located at satellite center (thruster aligned with \(+z\) axis, accelerates in z direction). Thus, the whole satellite inertia matrix was calculated preliminarily from a symmetric and homogeneous parallelepiped with 3.6 kg, plus the thruster inertia matrix, considering a central plate, mass 0.3 kg, dimensions and position described previously. Then, the inertia matrix \(I_{\text {sat}}^{b}\) is given by \(I_{\text {sat}}^{b} = \mathrm {diag}(I_x, I_y, I_z)\), with \(I_x = I_z = 0.0414\,\text {kg}\,\text {m}^2\) and \(I_y = 0.0065\,\text {kg}\,\text {m}^2\). This matrix is considered in CubeSat rotational model.

Below, let the coordinate systems be defined as follows:

Inertial system\(O_iX_1X_2X_3\): the inertial system has origin at Earth center, \(O_iX_3\) axis is parallel to Earth rotation axis pointing to celestial North Pole, \(O_iX_1\) axis points to Vernal Equinox at midnight on January 1st, 2000, and \(O_iX_2\) axis completes the right-handed system.

Orbit system\(O_orpy\): directly related to LVLH frame, this system has origin at the satellite center of mass, its axes have directions shown in Fig. 2, with y axis (yaw) pointing to Earth center, p axis (pitch) pointing perpendicularly to the orbital plane, anti-parallel to orbital angular moment, and r axis (roll) parallel to satellite velocity vector, tangent to the circular orbit. In the case in which Euler angles are zero, the body system axes coincide with this system.

Body system\(O_bx_1x_2x_3\): the body system has origin at satellite center of mass and its axes are coincident with vehicle principal inertia axes. The attitude between orbital and body systems is given by direction cosine matrix \(\varvec{R}_o^b\). Rotations in ZYX sequence are used to transform orbital to body system, composing \(\varvec{R}_o^b\) matrix, from which quaternions and Euler angles can be calculated. Sensors in experiment 2, X and Gamma rays detectors, are assumed to be pointed to \(+x_2\) (0, 1, 0) and \(-x_2\) \((0,-1,0)\), according to Fig. 1. The half angle field of view of these sensors is \(18^\circ \). Ovchinnikov et al. (2014) describes an experiment with these sensors.

4.1 Dynamic model

The satellite dynamics, which represents angular velocities behaviour under action of torques, is represented by a rigid body dynamics and modeled by Euler equations (Gravdahl 2014):

$$\begin{aligned} \varvec{I}_{\text {sat}}^{b} \dot{\varvec{\omega }}_{ib}^{b} + \varvec{\omega }_{ib}^{b} \times \varvec{I}_{\text {sat}}^{b} \varvec{\omega }_{ib}^{b} = \varvec{N}_{c}^{b} + \varvec{N}_{d}^{b}, \end{aligned}$$
(1)

where \(\varvec{I}_{\text {sat}}^b\) is the inertia matrix of the satellite expressed in the body system, \(\varvec{\omega }_{ib}^b\)is the angular velocity of body axes related to inertial system, expressed in the body system, \(\varvec{N}_c^b\) is the control torque given by magnetic coils, and \(\varvec{N}_d^b\) represents the disturbance torques (e.g. gravity gradient, aerodynamics etc.).

Equation (1) describes the dynamics with respect to the inertial system, yet it is of interest to refer the dynamics to the orbit system, yielding the equations of motion for a nadir-pointing satellite (Yang 2012). Then, let \(\varvec{\omega }_{ib}^b\) and its derivative be given by

$$\begin{aligned} \begin{array}{ccl} \varvec{\omega }_{ib}^b &{}=&{} \varvec{\omega }_{ob}^b + \varvec{R}_o^b \varvec{\omega }_{io}^o \\ \dot{\varvec{\omega }}_{ib}^b &{}\approx &{} \dot{\varvec{\omega }}_{ob}^b - \varvec{\omega }_{ob}^b \times \varvec{R}_o^b \omega _{io}^o \end{array} \end{aligned}$$
(2)

where \(\varvec{R}_o^b \in \mathbb {R}^{3\times 3}\) is the attitude matrix with respect to the orbit system; and \(\varvec{\omega }_{io}^o = \left( 0, -\omega _o, 0 \right) ^T\) is the orbital rate with respect to the inertial system. Note that \(\dot{\varvec{\omega }}_{io}\approx 0\) for orbit eccentricity approximately zero and hence can be neglected. Then, considering \(\varvec{\omega }_{io}^b=\varvec{R}_o^b\varvec{\omega }_{io}^o\), substituting (2) in (1) yields

$$\begin{aligned} \varvec{I}_{\text {sat}}^b \dot{\varvec{\omega }}_{ob}^{b}= & {} \varvec{I}_{\text {sat}}^b \varvec{\omega }_{ob}^{b} \times \varvec{\omega }_{io}^b + \varvec{I}_{\text {sat}}^b \varvec{\omega }_{ob}^{b} \times \varvec{\omega }_{ob}^{b} + \varvec{I}_{\text {sat}}^b \varvec{\omega }_{io}^b\times \varvec{\omega }_{ob}^{b} + \varvec{I}_{\text {sat}}^b \varvec{\omega }_{ob}^{b}\times \varvec{\omega }_{io}^b \nonumber \\&+ \varvec{I}_{\text {sat}}^b \varvec{\omega }_{io}^b \times \varvec{\omega }_{io}^b + \varvec{N}_{c}^{b} + \varvec{N}_{d}^{b} \end{aligned}$$
(3)

Because the control design objective is written in the LVLH frame and the Earth magnetic field has a local effect that varies with the local horizon, Eq. 3 is more suitable for control design than Eq. 1 (Yang 2012).

4.2 Kinematic model

The satellite body orientation evolution in orbit is given by the angular velocities, and described by Bråthen (2013)

$$\begin{aligned} \dot{\varvec{q}}_o^b = \frac{1}{2} \varvec{\varOmega }(\varvec{\omega }_{ob}^b) \varvec{q}_o^b, \end{aligned}$$
(4)

where

$$\begin{aligned} \varvec{q}_o^b \equiv \left[ \begin{array}{cc} \varvec{\varrho }^T&q_4 \end{array} \right] ^T = \left[ \begin{array}{cccc} q_1&q_2&q_3&q_4 \end{array} \right] ^T, \end{aligned}$$

is the quaternion vector which describes the attitude of the body with respect to the orbit system, and \(\varvec{\varOmega }(\varvec{\omega }_{ob}^b)\) is the anti-symmetric matrix of angular velocities, where \(\varvec{\omega }_{ob}^b \in \mathbb {R}^3\), defined as:

$$\begin{aligned} \varvec{\varOmega }(\varvec{\omega }_{ob}^b) \equiv \begin{bmatrix} 0&\quad \omega _3&\quad -\omega _2&\quad \omega _1 \\ -\omega _3&\quad 0&\quad \omega _1&\quad \omega _2 \\ \omega _2&\quad -\omega _1&\quad 0&\quad \omega _3 \\ -\omega _1&\quad -\omega _2&\quad -\omega _3&\quad 0, \end{bmatrix} \end{aligned}$$
(5)

4.3 Magnetic actuation

As for the actuation, the CubeSat SERPENS-2 is solely magnetically controlled by magnetorquers. However, the behavior of such devices is intrinsically nonlinear and time varying as the actuation results from the interaction between the magnetic dipole momentum generated by a set of three orthogonal current-driven coils and the local geomagnetic field. Accordingly, the control problem becomes nontrivial, yet attitude stabilization has been shown to be achievable applying modern control techniques for a wide range of orbit inclinations (Wisniewski 2000; Lovera et al. 2002; Lovera and Astolfi 2004; Silani and Lovera 2005; Yang 2016; Coelho et al. 2016).

Thus, in order to model the magnetic actuation in the dynamic equation of motion, let the control torque be described as:

$$\begin{aligned} \varvec{N}_{c}^b(t)= & {} \varvec{m}^b(t) \times \varvec{b}^b(t) \nonumber \\= & {} \left[ \varvec{b}^b(t) \times \right] ^T \varvec{m}^b(t), \end{aligned}$$
(6)

where \(\varvec{m}^b(t)\in \mathbb {R}^3\) is the magnetic dipole momentum, in \(Am^2\), generated by the magnetorquers; \(\varvec{b}^b(t)\in \mathbb {R}^3\) is the geomagnetic field seen from the body frame, and \(\left[ \cdot \times \right] \) is a cross-product operator defined as:

$$\begin{aligned} \left[ \varvec{v} \times \right] \equiv \left[ \begin{array}{ccc} 0 &{} -v_3 &{} v_2 \\ v_3 &{} 0 &{} -v_1 \\ -v_2 &{} v_1 &{} 0 \end{array} \right] , \end{aligned}$$
(7)

It can be verified in (6) that the performed control torque only exists in the plane perpendicular to the local geomagnetic field vector, meaning that only two axes can be controlled at once. Indeed, as \(\left[ \varvec{b}^b(t)\times \right] \) is structurally singular, full controllability is lost at each time instant. It also turns out that parallel components are ineffective to perform the desired maneuver (Wisniewski 2000). For convenience, therefore, we can define a mapping formula in order to obtain \(\varvec{u}\rightarrow \varvec{m} \perp \varvec{b}\), where \(\varvec{u} \in \mathbb {R}^3\) is the control input vector. This mapping formula can be defined as (Wisniewski and Blanke 1999):

$$\begin{aligned} \varvec{m}^b(t) = \frac{\varvec{u}(t) \times \varvec{b}^b(t)}{\Vert \varvec{b}^b(t) \Vert }. \end{aligned}$$
(8)

Substituting (8) in (6), and rearranging the terms, yields

$$\begin{aligned} \varvec{N}_{c}^b= & {} \frac{\left[ \varvec{b}^b(t)\times \right] ^T \left[ \varvec{b}^b(t)\times \right] ^T}{\Vert \varvec{b}^b(t)\Vert } \varvec{u}(t) = \mathcal {B}(t)\varvec{u}(t), \end{aligned}$$
(9)

where the magnetic control matrix \(\mathcal {B}(t) \ge \varvec{0} \in \mathbb {R}^{3 \times 3}\) is given by

$$\begin{aligned} \mathcal {B}(t)= & {} \frac{1}{\Vert \varvec{b}^b(t)\Vert } \left[ \begin{array}{ccc} -\,b_2^2(t)-b_3^2(t) &{} b_1(t)b_2(t) &{} b_1(t)b_3(t) \\ b_1(t)b_2(t) &{} -\,b_1^2(t)-b_3^2(t) &{} b_2(t)b_3(t) \\ b_1(t)b_3(t) &{} b_2(t)b_3(t) &{} -\,b_1^2(t)-b_2^2(t). \end{array} \right] \end{aligned}$$
(10)

An important remark is given in Lovera and Astolfi (2004), Lemma 1, that average controllability is guaranteed for sufficiently small angular rates \(\varvec{\omega }\) in the sense of

$$\begin{aligned} \bar{\mathcal {B}} = \lim _{T \rightarrow \infty } \frac{1}{T} \int _{0}^{T} \mathcal {B}(t) dt > \mathbf 0 , \end{aligned}$$
(11)

for all trajectories of the systems (1) and (3). Henceforth, result in (11) is considered in the control design in the sequel.

The reference attitude for computing the magnetic field of Eq. (11) is the attitude of the LVLH frame.

5 Control design

Control laws for modes 1, 2 and 3 are introduced. The first mode concerns the imminent scenario after deployment in which the satellite is likely to be tumbling, i.e. experiencing high angular rates and, hence, the detumbling control generates a magnetic momentum needed for damping the kinetic energy. After the detumbling phase, angular rates are rather reduced within the nominal range enabling the control for modes 2 and 3. Then, a model-based state-feedback approach can be applied using modern control theory techniques.

5.1 Detumbling

This control technique requires no state feedback, but only magnetic field measurements. Let the magnetic moment \(\varvec{m}^b\) applied to coils be given by the control law (Gravdahl 2014; Arantes 2005):

$$\begin{aligned} \varvec{m}^b = -\,k \dot{\varvec{b}}^b - \varvec{m}_d, \end{aligned}$$
(12)

where \(\dot{\varvec{b}}^b\) is the variation of Earth magnetic field sensed by the satellite, k is the controller gain, and \(\varvec{m}_d\) represents the satellite residual magnetic moment. All variables are represented in the body frame. Thus, the applied torque to the satellite by the magnetic coils \(\varvec{N}_c^b\) corresponds to

$$\begin{aligned} \varvec{N}_c^b = (-\,k \dot{\varvec{b}}^b - \varvec{m}_d)\times \varvec{b}^b, \end{aligned}$$
(13)

By the assumption of variation in magnetic field is caused by only satellite rotation, the value of \(\dot{\varvec{b}}^b\) can be expressed as:

$$\begin{aligned} (\dot{\varvec{b}}^b )\approx \varvec{b}^b \times \varvec{\omega }_{ib}^b. \end{aligned}$$
(14)

5.2 PD controller

As aforementioned, modes 2 and 3 can be accomplished by means of a model-based state-feedback controller. For the controller design, a PD-control law is chosen as the basic structure.

By linearizing the equations of motion (3) and (4) about an equilibrium state given by \(\bar{\varvec{\omega }}_{ob}^b=(0,0,0)^T\) and \(\bar{\varvec{q}}_o^b=(0,0,0,1)^T\) (Yang 2012), let the satellite model be described by a linear time invariant system in the state-space form:

$$\begin{aligned} \dot{\varvec{x}}(t) = \varvec{A}\varvec{x}(t) + \varvec{B}\varvec{u}(t). \end{aligned}$$
(15)

Recalling Eq. (11), the input matrix \(\varvec{B}\) for the magnetic control problem can be obtained as discussed in (Wisniewski 2000; Lovera and Astolfi 2004) as follows:

$$\begin{aligned} \varvec{B} = \left[ \begin{array}{c} \varvec{0}_{3\times 3} \\ (\varvec{I}_{\text {sat}}^b)^{-1}\bar{\mathcal {B}} \end{array} \right] . \end{aligned}$$
(16)

Then, let the control law be defined as:

$$\begin{aligned} \mathbf u (t)= & {} - \left[ \begin{array}{cc} \varvec{K}_P&\varvec{K}_D \end{array} \right] \left[ \begin{array}{c} \varvec{\varrho }_o^b(t) \\ \varvec{\omega }_{ob}^b(t) \end{array} \right] \nonumber \\= & {} -\, \varvec{K}\varvec{x}(t). \end{aligned}$$
(17)

Therefore, the static gain \(\varvec{K}\) can be obtained from the steady-state solution of the LQR problem given by

$$\begin{aligned} \varvec{K} = \varvec{R}^{-1} \varvec{B}^T \varvec{P}, \end{aligned}$$
(18)

where \(\varvec{P}\) is the unique positive definite solution to the Algebric Riccati Equation (ARE)

$$\begin{aligned} \varvec{P}\varvec{A} + \varvec{A}^T \varvec{P} - \varvec{P}\varvec{B}\varvec{R}^{-1}\varvec{B}^T\varvec{P} + \varvec{Q} = \varvec{0}, \end{aligned}$$
(19)

and \(\varvec{Q}\ge \varvec{0}\), \(\varvec{R}> \varvec{0}\), with appropriate dimensions, are design matrices that relate the state transient energy and the control input energy, respectively.

6 Results

The simulation was carried out considering a circular orbit with 400 km in altitude and \(45^{\circ }o\) in inclination. The feedback attitude is idealized and it was given by simulated quaternions, since no attitude estimation method was implemented at this point.

The simulation code was developed by the authors in the MATLAB/Simulink platform.

The simulation of detumbling control was executed considering the dimensions of SERPENS-2 satellite, described previously. The maximum magnetic moment m generated by each coil is

$$\begin{aligned} m=niA, \end{aligned}$$
(20)

where n is the number of windings, i is the maximum electric current and A is the enclosed area. For this simulation, \(n = 250\) windings, \(i = 0.1\,\hbox {A}\) and \(A~=~0.006\,\hbox {m}{}^2\), which are typical values for magnetic actuators in CubeSats (Jensen and Vinther 2010; Bråthen 2013). These values result in a total magnetic moment \(m = 0.15\,\text {A}\text {m}^2\). The controller gain k was adjusted in k = 10,000. IGRF-12 model was used to obtain the Earth magnetic field values (Thébault 2015). Gravity gradient torque is implemented as a disturbance torque.

Given \(m_d = \begin{bmatrix} 0&0&0.001\end{bmatrix}^T \text {Am}^2\) and initial angular velocity \(\omega _{ob}^b = \begin{bmatrix} 15&15&15 \end{bmatrix}^T{}^\circ /\text {s}\), Fig. 3 shows the angular velocity evolution along four orbits. Figure 4 shows the magnetic moment generated by coils in each axis. Figure 5 shows the evolution of each quaternion component. The graphs show that detumbling control can dissipate the satellite rotation within three orbits, for the given initial conditions, keeping angular velocity values lower than \(0.3^\circ /\text {s}\). However, the attitude evolution, shown by the quaternion, is still erratic.

Fig. 3
figure 3

Satellite angular velocity

Fig. 4
figure 4

Magnetic moment generated in each coil

Fig. 5
figure 5

Quaternions evolution

Figure 6 shows the evolution of the quaternion, angular velocity and control dipole moment, when the PD-Controller is activated. This simulates the control modes 2 and 3 of Sect. 3.3. The initial condition is an angular velocity compatible with the final state of the detumbling controller.

Fig. 6
figure 6

Attitude control performance, example figure

In Fig. 6, the nadir pointing (alignment with the LVLH) can be obtained in about 3 orbits. After, this attitude is maintained. The control amplitude is feasible, since it is smaller than \(m = 0.15\,\text {A}\,\text {m}^2\).

Attitude maneuvers are programmed to be carried out between experiments, and there are no experiments planned to be carried out while an attitude maneuver is in progress, so there is no major requirement on attitude stabilization time. Besides, most of publications in the field show an orbit stabilization within 3 or 4 orbital periods. So, the results of Fig. 6 are very reasonable.

Simulation of detumbling phase for simulated 4 orbit periods takes about 6.6 s of CPU time, while for control phase, it takes about 18 s, considering total simulated time of 5 orbits. These CPU times were obtained in an Intel Core i5, 8 Gb RAM running Windows 7 and Intel Core i7, 8 Gb RAM running Ubuntu 16, respectively.

One shall see that this simulation is still a preliminary test, since the following effects are not included: sensor noise and external perturbations.

The controllers required for the Phases 1 and 2 of Fig. 2 are essentially the same. The control law only needs to perform nadir pointing. However, in practice, there are the following issues that are not addressed in the former simulation: in Phase 2, the residual torque caused by thruster misalignment is not considered; in Phase 1, the proposed controller is not able to induce rotation around the z axis of the body.

7 Conclusions

SERPENS-2 mission was presented in general aspects and, specifically, attitude requirements were presented and discussed.

An ADCS proposal for this mission was formulated in terms of hardware, software, and its implementation (phases and operation modes).

The advantages of this proposal are the ADCS exclusive configuration for two mission phases, together with simplicity of hardware and software needed to fulfill the mission. This means reduction of costs, mass, size, and energy consumption.

Satellite and main torques modeling, in terms of attitude dynamics, were carried out. The simulations for first attitude control mode, detumbling, presented satisfactory results. These results showed the initial angular velocity dissipation, slowing down the satellite to values within \(0.3^\circ /\text {s}\) in each axis, from which other control modes can actuate.

Simulation of an attitude regulator is shown. It is related to a pure magnetic control with a proportional derivative structure, tuned with linear quadratic optimization. The control is designed to regulate the vector part of the quaternion in the local horizontal local vertical frame, acquiring nadir pointing. This configuration can be used to control the attitude for two objectives of the mission. Tracking error converges to zero with feasible control amplitude in the absence of sensor noise.

The future developments involve the insertion of an attitude estimator in the feedback loop, as well as the inclusion of perturbations, like the residual torque caused by thruster misalignment.