Satellite state machine

Nine modes can be distinguished in the logic of the satellite’s payload operation. Five of them, that is the default logic, are shown in the diagram below.

KRAKsat state machine

Mode name

Mode ID

IDLE

0

DETUMBLING

1

DETUMBLING_F

2

EXPERIMENT

3

EXPERIMENT_F

4

MANUAL

5

DIAGNOSTIC

6

DIAGNOSTIC_F

7

IDLE_FOR_TIME

8

CURRENT_MODE

9

DETUMBLING_SR_MODE

10

Mode structure definition

Property

Description

mode_id

The id of the mode.

init_function

The function that is executed within initialization of the mode.

exit_function

The function that is executed immediately on the exit of the mode.

condition_exit

The function that returns state enum when at least one of stop conditions of the mode is fulfilled.

condition_entry

The function that returns state enum when all of begin conditions of the mode are fulfilled.

do_custom_function

The function that contains logic that is executed not in 1min/1s/200ms timer exception.

do_1min_cycle

The function that contains logic that is executed in 1min timer exception.

do_1000ms_cycle

The function that contains logic that is executed not in 1s timer exception.

do_200ms_cycle

The function that contains logic that is executed not in 200ms timer exception.

timer_1s

The default value that determines the maximum time of the mode duration [s].

timer_prescaler

The value that is prescaler for property timer_1s.

is_timer_active

The property that determines if timer timer_1s is active.

next_mode

The mode that will be set as a following mode if condition_entry equals SUCCESS.

failure_mode

The mode that will be set as a following mode if condition_entry equals FAIL.

IDLE mode is a low power consumption mode that is set as a middle mode in which the state machine waits for the fulfilment of the next mode’s begin conditions.

Property

Description

mode_id

0

init_function

None

exit_function

None

condition_exit

The stop condition is equal to the begin condition of the next mode

condition_entry

None

do_custom_function

None

do_1min_cycle

IMU magnetometer sensor refresh

do_1000ms_cycle

None

do_200ms_cycle

None

timer_1s

n/a

timer_prescaler

1

is_timer_active

False

next_mode

Diagnostic

failure_mode

Diagnostic

Diagnostic algorithm

The diagnostic algorithm is used to validate proper functioning of satellite's hardware. This procedure toggles certain actuators in predefined intervals. Simultaneously, measurements from the IMU and the temperature sensor that is attached to the payload container are taken.

Timeline

Step

15 s

Only measurements

10 s

ADCS magnetorquer X

10 s

ADCS magnetorquer Y

10 s

ADCS magnetorquer Z

15 s

Only measurements

10 s

F.R.W. electromagnets phase 0

10 s

F.R.W. electromagnets phase 1

10 s

F.R.W. electromagnets phase 2

10 s

F.R.W. electromagnets phase 3

F.R.W. control algorithms

F.R.W. control algorithms are designed to control electromagnets in order to accelerate the ferrofluid. Its custom function is turned on by interruption from timer 5. F.R.W. can work in 9 different modes which are listed in the table below. More information about control system of the Ferrofluid Reactio Wheel can be found in: Jan Życzkowski, "Ferrofluid reaction wheel for nanosatellites orientation control", Master Thesis, AGH University of Science and Technology, Cracow 2019, supervisor: Adam Piłat.

Control mode

mode ID

FRW_BAISIC_CLOCKWISE

0

FRW_BAISIC_ANTICLOCKWISE

1

FRW_ACC_CLOCKWISE

2

FRW_ACC_ANTICLOCKWISE

3

FRW_STEP_CLOCKWISE

4

FRW_STEP_ANTICLOCKWISE

5

FRW_PID_DUTY

6

FRW_PID_FREQ

7

FRW_LIST_MODE

8

FRW_ControlBasicClockwise works as a universal control. It is possible to change its parameters:

Parameter

Details

pwm_duty

duty of coils PWM

period

period with which 4 coils are working, in ms. Period of the is F.R.W. two times larger

pwm_direct

direction of the current going through coils (it is not the direction for F.R.W.)

control duty

percentage of time every phase is tuned on during cycle (e.g. 25 - one-step, 37 - one and half-step, 50 - two-step)

To control F.R.W. in opposite direction use function: FRW_ControlBasicAntiClockwiseFunction.

FRW Baisic control diagram

Detumbling algorithm

Detumbling modes high level logic

Detumbling high level logic

Detumbling algorithm

The payload detumbling algorithm uses magnetorquers in all three satellite axes. A magnetorquer is an electromagnet which due to current flow creates a magnetic moment which interfaces with the Earth'a magnetic field. This creates a torque acting on the satellite. Thus, being able to control the current flowing through the coil (the words coil and electromagnet will be used interchangeably) enables controling the angular velocity of the satellite. The equation used to calculate the torque created by the electromagnet is shown below:

M=μ×B\vec{M}=\vec{\mu} \times \vec{B}

Where M\vec{M}is the created torque, μ\vec{\mu}is the magnetic moment and B\vec{B} is the Earth's magnetic field's induction.

The operation of a magnetorquer

The algorithm is based on the so-called Angular Rate Feedback algorithm. The equation used to calculate the needed current in each of the coils is shown below (the current in each coil is one of the components of the current vector):

B˙=B×ω\dot{\vec{B}} = \vec{B}\times\omega
i=kB˙B2\vec{i} = -k \frac{\dot{\vec{B}}}{ \left\lVert B \right\rVert ^2}

The optimal value of k was chosen after conducting simulations on a model of the satellite. An appropriate PWM signal is passed on the inputs of H-bridges, which control the current of the magnetorquers.

One cycle of the algorithm consists of five steps; the time interval between those steps is 200 ms (so the whole algorithm cycle is 1s).

  • Step 1: At the beginning of this step, the current in all coils is always zero. The magnetic field induction (B) is measured (because no current flows through the magnetorquers, their magnetic field has no influence on the measurement). Also the angular velocity of the satellite is acquired. The output current of the coils is calculated using the above equation and the current of the coils is changed.

  • Step 2, 3, 4: In each of these steps the magnetic field induction in the satellite-oriented reference frame is estimated and the angular velocity is measured. Apart from that, the operations are the same as in step 1

  • Step 5: The current of the coils is set to 0, so that the magnetic field induction can be measured in step 1. Return to step 1.

The estimation of the magnetic field induction in the satellite-oriented reference frame is conducted as follows: it is assumed that it is constant in the Earth-oriented frame and it changes because of the non-zero angular velocity of the satellite (which is measured). So, the magnetic field induction can be estimated as:

B(t+Δt)B(t)+B˙Δt,\vec{B}(t+\Delta t) \approx \vec{B}(t) + \dot{\vec{B}}\Delta t,

where:

Δt=200ms.\Delta t = 200 ms.

More information about detumbling system can be found in: Artur Hadasz, "Simulation of stabilization algorithms and building a prototype of a stabilization system for picosatellites using magnetorquers", BSc Thesis, AGH University of Science and Technology, Cracow 2018, supervisor: Paweł Zagórski and in the work: Piotr Mikołajek, "Design and simulation of a picosatellite low Earth orbit magnetic field based attitude determination system", BSc Thesis, AGH University of Science and Technology, Cracow 2018, supervisor: Paweł Zagórski.

Last updated

Was this helpful?