Hardware-in-the-Loop Simulation for Spacecraft Formation Flying

This paper presents a hardware-in-the-loop (HITL) simulation approach for multiple spacecraft formation flying. Considering a leader-follower formation flying configuration, a Fuzzy Logic controller is developed first to maintain the desired formation shape under external perturbations and the initial position offsets. Cold-gas on/off thrusters are developed to be introduced to the simulation loop, and the HITL simulations are conducted to validate the effectiveness of the proposed simulation configuration and Fuzzy Logic control.


Introduction
Multiple spacecraft formation flying (MSFF) missions have been areas of increased interest in the recent years.NASA and the U.S. Air Force have identified MSFF as an enabling technology for future missions.This is due to many inherent advantages the distributed design adds to the mission.By distributing payload on several spacecraft, (1) redundancy is added to the system that minimizes the risk of total mission failure; (2) several cooperating spacecraft can solve assignments which are more difficult and expensive, or even impossible with a single spacecraft; (3) the launch costs can be reduced by deploying small spacecraft in clusters or using inexpensive rocket vehicles.
The ability to accurately control the relative position of the spacecraft in formation is key to the success of such missions.This results in stringent requirements on control algorithms and measurement systems.Several control strategies have been developed for spacecraft formation flying, for example, LQR [1], decentralized control [2], intelligent control [3], Fuzzy control [4], adaptive control [5][6][7], synchronization control [8][9][10], and so forth.
Once a controller is developed for formation flying mission, it must be verified in order to apply it.One approach is to conduct hardware experiments, for example, TPF mission experiments at the Jet Propulsion Laboratory (JPL) [10].However, this kind of hardware experiment is extremely expensive and time consuming.Here we propose a substitute approach for this purpose, for example, hardwarein-the-loop (HITL) simulation where some key components are replaced by physical systems and the rest can be done in pure numerical simulation.For the proposed hardware-inthe-loop simulation strategy in this paper, a cold-gas thruster system will be developed to replace the control actuator simulation block.
The remainder of this paper is organized as follows.In Section 2, dynamics modeling of formation flying is briefly introduced.Section 3 presents Fuzzy Logic control design.Section 4 presents the development of cold-gas thruster system and some test results.HITL simulation results are presented in Section 4.3 .Finally, Section 5 offers some conclusions.

Dynamics Modeling
Dynamics modeling of spacecraft in formation has been studied in the previous work such as [4,5,9].Considering the leader (L) and the follower (F ) spacecraft shown in Figure 1, the relative motion can be described by [4]   where q [x(t) y(t) z(t)] T ∈ R 3 is the relative position vector; is the Coriolis-like matrix given by (2) where and where m f and m l are the mass of the follower and the leader spacecraft, respectively; the orbit angular velocity ω = θ = n(1 + e cos θ) 2 /(1 − e 2 ) 3/2 ; the orbit angular acceleration ω = θ = −2n 2 e sin θ(1 + e cos θ) 3 /(1 − e 2 ) 3 with orbital elements: semimajor axis a, eccentricity e, true anomaly θ, and mean motion n = μ/a 3 is the total, constant disturbance force difference vector.
It was found that some special formation shapes (relative trajectory) can be formed if the initial conditions satisfy some relations [4].For example, the formation shape will be symmetric with respect to x-axis if ẋ(0) = (−n(2 + e)/ (1 + e)(1 − e) 3 )y(0).In this paper, this symmetric relative motion will be considered as the desired formation shape to maintain.
It has been shown previously [4,11] that due to offsets in initial conditions and orbital perturbations such as J 2 , solar pressure, the closed formation shape cannot be kept, as shown in Figure 2. The simulation parameters are given in Table 1.The relative position errors are up to 25 m, 3 m, and 0.5 m in three axes after 50 hours.Obviously, active control is needed.

Fuzzy Logic Control
Fuzzy Logic control [4] will be applied to spacecraft formation flying mission to maintain the desired symmetric formation shape under external perturbations and tested using our hardware-in-the-loop simulation facility.The implementation of Fuzzy Logic control needs determination of fuzzy variables and membership functions, establishment of fuzzy rules, fuzzy inference, and defuzzification.

Fuzzy Variables, Fuzzy Sets, and Membership Functions.
Here, we choose the relative position errors (e x , e y , e z ) and relative velocity errors ( ėx , ėy , ėz ) as the fuzzy variables (fuzzy inputs) to the Fuzzy Logic controller.The fuzzy sets for these two fuzzy variables are listed in Table 2 and consist of NL, NS, ZE, PS, and PL.Two kinds of membership functions, Triangular and Trapezoidal, are used for fuzzy variables.Figure 3 illustrates the position error and velocity error membership functions.

Fuzzy Inference System and Fuzzy
Rules.In our study, we use the Sugeno-type (or Takagi-Sugeno-type) fuzzy inference.Sugeno-type and Mamdani-type fuzzy inferences are similar in many aspects and the main difference is that the Sugeno output membership functions are either linear or constant.The five constant output membership functions are given in Table 3.
Fuzzy rules consist of 25 If-Then rule statements as shown in Table 4.Those rules are formed according to the common sense of how to control a system with position error and velocity error information [12].Figure 4 shows the fuzzy surface of control output with respect to relative position error and relative velocity error.

Defuzzification.
By applying the fuzzy rules and the fuzzy inference system, the fuzzy output can be obtained.To determine exactly how much control force should be applied, defuzzification of the rules is needed.Defuzzification converts the fuzzy value to a single number and is the reverse process of fuzzification.For Segeno-type fuzzy inference used in this paper, the defuzzification is realized by weighted averaging of all rule outputs as [12] where z i and w i is the output level and the firing strength (weight) of the ith rule, respectively.The defuzzification results will be a value between −1 and +1, where −1 denotes the negative maximal control  and +1 the positive maximal control.Considering the on-off thrusters used in this work, the maximal control is defined as the maximal thrust firing time with constant amplitude (acceleration), that is, ±0.005 m/s 2 .

Simulation Results
. Fuzzy Logic control is then used to maintain the desired symmetric formation shape. Figure 5 shows the simulation results with the control interval of  200 seconds and the maximum thruster firing time of 2 seconds.The position errors have been controlled within ±0.1 m in all three axes using Fuzzy Logic control.To reduce the fuel consumption, the control interval is increased from 200 seconds to 1000 seconds but keep the maximum thruster firing time unchanged.The results are shown in Figure 6.
Comparing Figure 6 with Figure 5, it can be clearly seen that much less fuel is needed to maintain the desired formation shape; however the position errors go up to be within ±0. 5 m in all three axes.A tradeoff must be made between the control performance and the fuel consumption.

Hardware-in-the-Loop (HITL) Simulation
4.1.Cold-Gas Thruster Development.Hardware-in-the loop simulation is proposed to test control strategies for spacecraft formation flying where we will replace some simulation blocks with real hardware.In this work, we will replace control actuator block with a cold-gas thruster.The hardware consists of a thruster and its associated electronics, as shown in   Acculab ATILON ATL-8201-I, is used to measure the thrust and the measurement is sent to computer via RS-232 serial port and to MATLAB program.This scale has a maximum weight capacity of 8200 g, an accuracy of 0.1 g, and update time ∼ 0.1 seconds.MATLAB and SIMULINK is used to run thruster tests and HITL simulations with the Real-Time Workshop (RTW).Two types of SIMULINK S-Function blocks were used: one is to connect, read, format, and close the connection to the serial port and scale; the other is to connect to the DAC card's digital ports and send either 1 or 0, which corresponds to 5 V or 0 V digital output, to the ports.By sending out a ±5 V signal to DAQ card's digital port, the relay is turned on and consequently the thruster is "fired" for a specific amount of time.SIMULINK S-Function then gathers the thrust measurement from the serial port and the string data is converted to a thrust measurement for postprocessing.

Thrust versus Pressure
Test.Two types of thruster tests are conducted.The first one is to determine the relationship between the generated thrust and gas pressure.The thruster is run for duration between 1 seconds and 5 seconds, with pressures 12∼40 psi and 20∼100 psi for the SMC and Burkert valve, respectively.This test aims to show any dependencies between the thrust and inlet pressure of the valve.Figure 8 shows the result of an experimental run.Using these tests, a thrust versus pressure profile is generated for different setups.Small human error differences arose in the tests due to the fact that the pressure was adjusted manually on the regulator and might not been exactly the same for all runs.However, the errors are small, that is, less than 10 mN.All of the test runs show that the setups studied have a portion of their thrust profiles linearly dependent on pressure.The thrust ranged from 0.2 N to 1.4 N for Burkert and 0.018 N to 0.11 N for SMC thrusters over their respective pressure ranges.Plots of thrust-pressure profiles can be seen in Figure 9.

Thruster Characterization Test.
Thruster characterization tests are conducted by reading a digital pulse with a length of 20 seconds and duty cycle of 50%.In this test the on and off times are measured as well as the consistency of the thrust.The turn on time is defined as the time it takes to reach maximum thrust from 0 N, where as the off time is measured as time it takes to reach 0 N at the end of the burn time.The Burkert valves were tested at 60 psi where as SMC valves at 28 psi. Figure 10 shows the resulting thrust profiles.It can be seen that the turn on signal generated by the pulse at 5 seconds and ending at 15 seconds mark, as well as the resulting thrust profile for the same 10 seconds turn on time.The tests were repeated 5 times and a delay between the turn on time and the actual thrust can be seen.This delay is on the order of 0.4 seconds and 0.7 seconds for the Burkert and SMC thruster, respectively.
The lag is mainly due to the digital scale, which must stabilize the measurement before readout.The higher lag time of the SMC thruster is due to the solenoid valve itself.The valve might not turn on as fast therefore this lag difference would also contribute to the turn on time.In the following hardware-in-the-loop tests, the simulations will be run with control interval more than 200 seconds, which would make the delay insignificant.

HITL Simulation Results.
To validate the effectiveness of the proposed HITL simulations, we apply the designed Fuzzy Logic controller to maintain the desired formation flying shape.The basic idea is to replace the thruster SIMULINK block with the developed cold-gas thruster.The computed control command is sent to DAC card to turn on or off the thruster.The thrust measurement is sent back to the dynamic model in SIMULINK to form the closed loop.In order to compare with the simulation results, the parameters and initial conditions in Table 1 are used in the HITL simulations.Since only one high-accuracy scale is available, the cold-gas thruster is used in x-axis only.Thrusters for the other two axes are simulated by SIMULINK blocks and are of constant amplitude.The thruster operates at 60 psi to produce approximately force of 0.8 N. The HITL simulations are run for 15 hours for safety reason.Figures 11 and 12 show the simulation results for control interval of 200 seconds and 1000 seconds, respectively.For these two simulations, the maximum thruster firing time is 2 seconds.For comparison, the numerical simulation results are plotted in the same figures together with the HITL simulation results.It can be seen that the spacecraft stay in the desired formation shape with Fuzzy Logic controller, even with J 2 perturbation and initial position offsets.Also, the results show that the difference between the HITL and numerical simulations is small when compared.

Figure 1 :
Figure 1: Relative motion of spacecraft and the earth.

Figure 2 :Figure 3 :Figure 4 :
Figure 2: Relative motion of spacecraft in formation with J 2 perturbation and initial offsets.

Figure 8 :
Figure 8: On/off test of Burkert solenoid valve for pressure range 20-100 psi.

Figure 7 .
The thruster was constructed out of a solenoid valve and a nozzle.Two solenoid valves have been chosen: (a) Burkert type 0330 2-way normally opened valve; (b) SMC VDW21-5G valve.Four different nozzles were used, two for each type of valve.The solenoid valve was attached to a Nitrogen gas tank via air tubing and fittings.A twostage regulator is used to manually adjust the pressure of the gas.The electronics involved include a data acquisition and control (DAC) card (ADLINK PCI-9221), Velleman K6714 universal relay card, and a power supply.A digital scale,

Table 2 :
Fuzzy sets and output membership functions.

Table 3 :
Fuzzy output membership functions.