<<

BRNO UNIVERSITY OF TECHNOLOGY VYSOKÉ UČENÍ TECHNICKÉ V BRNĚ

FACULTY OF INFORMATION TECHNOLOGY FAKULTA INFORMAČNÍCH TECHNOLOGIÍ

DEPARTMENT OF COMPUTER GRAPHICS AND MULTIMEDIA ÚSTAV POČÍTAČOVÉ GRAFIKY A MULTIMÉDIÍ

BERESHEET LUNAR LANDING SIMULATION SIMULACE PŘISTÁNÍ NA MĚSÍCI

BACHELOR’S THESIS BAKALÁŘSKÁ PRÁCE

AUTHOR JAKUB KARPÍŠEK AUTOR PRÁCE

SUPERVISOR doc. Ing. PETER CHUDÝ, Ph.D. MBA VEDOUCÍ PRÁCE

BRNO 2020 Brno University of Technology Faculty of Information Technology Department of Computer Graphics and Multimedia (DCGM) Academic year 2019/2020

Bachelor's Thesis Specification

Student: Karpíšek Jakub Programme: Information Technology Title: Beresheet Lunar Landing Simulation Category: Modelling and Simulation Assignment: 1. Research commercial lunar lander mission: Beresheet. 2. Research lunar landing problem and descent trajectory physics. 3. Perform computation of optimal descent trajectory. 4. Design and implement visualization environment, for which you create or download from relevant sources basic 3D models and 3D engine for descent maneuver interpretation. 5. Evaluate achieved results and discuss potential further improvements. Recommended literature:

According to supervisor's recommendations.

Requirements for the first semester: Items 1, 2, 3 and partially item 4. Detailed formal requirements can be found at https://www.fit.vut.cz/study/theses/ Supervisor: Chudý Peter, doc. Ing., Ph.D. MBA Head of Department: Černocký Jan, doc. Dr. Ing. Beginning of work: November 1, 2019 Submission deadline: May 28, 2020 Approval date: May 15, 2020

Bachelor's Thesis Specification/22727/2019/xkarpi06 Page 1/1

Powered by TCPDF (www.tcpdf.org) Abstract The goal of this bachelor’s thesis was to compute the optimal lunar descent trajectory for the Beresheet and develop a visualization environment for interpreting lunar descents. The optimal descent trajectory was computed using Bocop, an optimal control problem solver, and the environment was implemented in Java, using the LibGDX 3D engine. The optimal descent trajectory was found and it enables soft landing with 29.2 kg (6.8%) of fuel left. Created environment enables users to see lunar descent trajectories in an intuitive way and to interact with the visualization.

Abstrakt Cílem této bakalářské práce bylo vypočítat optimální trajektorii sestupu na Měsíc pro kosmickou loď Beresheet a vyvinout prostředí pro vizualizaci sestupových trajektorií na Měsíc. Optimální trajektorie byla vypočtena použitím programu Bocop, který řeší prob- lémy optimálního řízení, a prostředí bylo vytvořeno v Javě s použitím 3D enginu LibGDX. Byla nalezena optimální trajektorie, která splňuje všechna kritéria použitelnosti, umožňu- jící hladké přistání s palivovou rezervou 29.2 kg (6.8%). Vytvořené prostředí umožňuje uživatelům vidět trajektorii sestupu na Měsíc v intuitivním zobrazení a také jednoduše zasahovat do probíhající vizualizace.

Keywords Beresheet, lunar landing, simulation, optimal descent trajectory, optimal control, bocop, libgdx

Klíčová slova Beresheet, přistání na Měsíci, simulace, optimální trajektorie sestupu, optimální řízení, bocop, libgdx

Reference KARPÍŠEK, Jakub. Beresheet Lunar Landing Simulation. Brno, 2020. Bachelor’s thesis. Brno University of Technology, Faculty of Information Technology. Supervisor doc. Ing. Peter Chudý, Ph.D. MBA Rozšířený abstrakt Na začátku roku 2019 se Izraelská soukromá firma SpaceIL pokusila přistát na Měsíci s kosmickou lodí Beresheet. Byl to velmi sledovaný pokus o přistání, jelikož by se jednalo o první Izraelské přistání na Měsíci a první přistání soukromé firmy vůbec. Mise byla bohužel neúspěšná – při závěrečném sestupu k povrchu došlo k selhání a kosmická loď byla zničena. Tato bakalářská práce se zabývá výpočtem optimální sestupové trajektorie pro kos- mickou loď Beresheet z kruhové oběžné dráhy 210 km nad povrchem Měsíce a návrhem a implementací vizualizačního prostředí pro vizualizaci přistání na Měsíci. V první části práce byla nastudována mise Beresheet a z dostupných zdrojů byly získány technické parametry kosmické lodi Beresheet a astronomických těles vyskytujících se ve výpočtech – Měsíce a Země. Přistávací manévr byl omezen na pohyb v jedné rovině se třemi stupni volnosti, čímž došlo ke značnému zjednodušení výpočtů. Pro výpočet byly definovány dvě vztažné polární souřadné soustavy – jedna inerciální se středem vtěžišti Měsíce a druhá rotující se středem v těžišti kosmické lodi. Trajektorie byla rozdělena na čtyři fáze – deorbitace, plutí, brzdění a vertikální sestup. Toto rozdělení umožnilo definování milníků trajektorie a odlišných omezení jednotlivých stavových a řídicích veličin v každé fázi. Pohybové rovnice byly odvozeny s použitím literatury z Newtonovy klasické mechaniky. Výpočet optimální sestupové trajektorie byl identifikován jako problém optimálního řízení. Řídicími prvky jsou tah motoru a úhlové zrychlení způsobené systémem řízení nák- lonu. Tento výpočet byl proveden nástrojem Bocop1, který je k výpočtu takových prob- lémů určený. V nástroji bylo nutné definovat stavový a řídicí vektor, meze jednotlivých veličin, počáteční a koncové podmínky, konstanty, pohybové rovnice a užitkovou funkci. Jako užitková funkce byla zvolena maximalizace finální hmotnosti kosmické lodi. Výsledná optimální trajektorie splňuje všechny podmínky proveditelnosti, minimalizuje rizika, která by mohla vést k neúspěšné misi a zajišťuje palivovou rezervu 29.2 kg (6.8%) po přistání. Pro kontrolu byly zkoumány alternativní trajektorie, ale žádná lepší nebyla nalezena, což zvyšuje pravděpodobnost, že nalezená trajektorie je optimální. Pro zajímavost byla opti- mální sestupová trajektorie porovnána se skutečnou trajektorií z mise Beresheet. Vizualizační prostředí bylo implementováno v Javě s použitím frameworku LibGDX2, který poskytuje abstrakce grafické knihovny OpenGL a umožňuje jednoduchý vývoj 2D i 3D aplikací. Vyvinutou aplikaci lze spustit na počítači s operačním systémem nebo Windows○R . Aplikace umožňuje uživateli nahrát trajektorii a následně vizualizovat let kosmické lodi Beresheet po této trajektorii ve 3D prostředí. Navíc je možné do vizualizace zasahovat a měnit parametry jako čas a rychlost animace, úhel pohledu a další. Trajektorii lze nahrát jako sled souřadnic ve 3-rozměrném prostoru buď v polární nebo kartézské souřadné soustavě. Je nutné doplnit sled časů, ve kterých se kosmická loď v jednotlivých souřadnicích nachází. Rozšířením je poté možnost nahrání sledu hmotnosti, rychlosti a otáčení v průběhu trajektorie. Tato data jsou pak zobrazena v čase během vizualizace pro lepší přehled o trajektorii. Otáčení je navíc promítnuto i do vizualizace. Během práce byly vypracovány všechny zadané úkoly a bylo dosaženo uspokojivých výsledků. Výsledná optimální trajektorie minimalizuje jak spotřebu paliva, tak i rizika spojená s misí. Vyvinuté prostředí pro vizualizaci umožňuje pochopení trajektorie intuitivní cestou a naplňuje záměr určený před započetím práce.

1http://www.bocop.org/ 2https://libgdx.badlogicgames.com/index.html Beresheet Lunar Landing Simulation

Declaration I hereby declare that this term project was prepared as an original work by the author under the supervision of doc. Ing. Peter Chudý, Ph.D. MBA. I have listed all the literary sources, publications and other sources, which were used during the preparation of this project.

...... Jakub Karpíšek May 27, 2020

Acknowledgements I would like to thank doc. Ing. Peter Chudý, Ph.D. MBA. for willingness and valuable advice during work on this assignment. I would also like to thank my wife and parents for their help and support. Contents

1 Introduction 5

2 Commercial Lunar Lander Mission: Beresheet 7 2.1 Google Lunar XPRIZE ...... 7 2.2 Mission launch ...... 8 2.3 Mission trajectory ...... 10

3 Lunar Landing Problem 13 3.1 Lunar Lander in coordinate system ...... 13 3.2 Descent trajectory definition ...... 15 3.3 Orbital dynamics definitions ...... 17

4 Descent Trajectory Physics 19 4.1 Newton’s laws of motion ...... 19 4.2 Derivation of the equations of motion ...... 20 4.3 The equations of motion ...... 22

5 Optimal Descent Trajectory Computation 24 5.1 Optimal control problem solver: Bocop ...... 24 5.2 Optimization problem theory ...... 25 5.3 Optimal control problem implementation ...... 28 5.4 Results ...... 32

6 Design and Implementation of Visualization Environment for Descent Trajectory Interpretation 35 6.1 Application overview ...... 35 6.2 Application implementation ...... 36

7 Evaluation 39

8 Conclusion 42

Bibliography 43

A Astronomical Bodies and in Beresheet Mission 46

B Additional Specifications 48

C Contents of Associated Media Drive 49

1 List of Figures

2.1 The Beresheet spacecraft and the launch configuration with a 13.1 meters tall payload fairing in the background. Taken from [23].8 2.2 The Beresheet spacecraft at advanced stage of development. Taken from [22]. 10 2.3 The Beresheet phasing loop trajectory planned (left) and actual (right) in the - rotating coordinate frame with the Moon always at the top. Taken from [22]...... 11 2.4 Lunar orbit insertion and circularization maneuvers...... 12

3.1 Cartesian coordinate system (left) and polar coordinate system (right). . . . 14 3.2 Two-dimensional inertial and rotating polar frames of reference...... 15 3.3 The Beresheet rotation axes demonstrated on the 3D model used in the developed visualization application. 3D model taken from [20]...... 16 3.4 The four descent phases (left) and orbital dynamics definitions (right). . . 17 3.5 Examples of orbital maneuvers...... 18

4.1 Two-body system in an inertial frame of reference. Taken from [4], page 4. . 20 4.2 The Lunar Lander in the frame of reference...... 22

5.1 The Bocop GUI in a definition tab and boundary conditions settings. . 25 5.2 Global convexity of function. Taken from [12], page 22...... 27 5.3 Illustration of midpoint method. Taken from [8]...... 28 5.4 The optimal descent trajectory profile...... 33 5.5 Time history of altitude during the optimal descent trajectory...... 33 5.6 Time history of central angle during the optimal descent trajectory...... 33 5.7 Time history of mass during the optimal descent trajectory...... 33 5.8 Time history of radial velocity during the optimal descent trajectory. . . . . 34 5.9 Time history of tangential velocity during the optimal descent trajectory. . 34 5.10 Time history of throttle command during the optimal descent trajectory. . . 34 5.11 Time history of pitch angle during the optimal descent trajectory...... 34

6.1 Application’s visualization, main menu, controls and loading screens. . . . . 36 6.2 Bezier curve with knots and control points...... 38

7.1 Braking phase comparison with nominal, double and quadruple thrust. . . . 40 7.2 Comparison of the optimal descent and the real Beresheet mission trajectories. 41

A.1 The Earth. Source: [18]...... 46 A.2 The Moon. Source: [19]...... 46 A.3 The Falcon 9 rocket in block 5 version. Taken from [5]...... 47

2 List of tables

2.1 Maneuvers as planned before launch. Taken from [22]...... 11

5.1 Constant values used in computations. Taken from [9, 17]...... 30 5.2 Initial values of the problem...... 31 5.3 State variable bounds of the problem...... 31 5.4 Phase breakdown of the computed optimal descent trajectory...... 33

A.1 Earth specifications. Taken from [9, 17]...... 46 A.2 Moon specifications. Taken from [9, 17]...... 46 A.3 The Falcon 9 specifications. Taken from [7]...... 47

B.1 LEROSTM2b technical specifications. Taken from [21]...... 48 B.2 The Beresheet maneuvers with computed velocity and mass differences [22]. 48

3 Nomenclature

훼 Spacecraft angular acceleration

∆푣 Change in velocity

ˆ푖휃 The 휃 component of rotating polar reference frame unit vector

ˆ푖푟 The r component of rotating polar reference frame unit vector

ˆ푖푥 The X component of inertial cartesian reference frame unit vector

ˆ푖푦 The Y component of inertial cartesian reference frame unit vector

휇퐸 Earth’s gravitational parameter

휇푀 Moon’s gravitational parameter

휔 Spacecraft angular velocity

휓 Spacecraft pitch angle

휃 Angular coordinate in polar coordinate system

푎휃 Spacecraft acceleration tangential component

푎푟 Spacecraft acceleration radial component

퐼푠푝 Engine specific impulse

푘퐸 Spacecraft engine throttle command

푚 Spacecraft mass

푟 Radial coordinate in polar coordinate system

푅퐸 Earth’s equatorial radius

푅푀 Moon’s equatorial radius

푇푚푎푥 Spacecraft engine maximum thrust

푣휃 Velocity tangential component

푣푟 Velocity radial component

푉푒푥 Engine exhaust velocity

4 Chapter 1

Introduction

More than sixty years have passed since humans first started to send objects to the . Beginning with the Sputnik 1, which became the first artificial satellite of the Earth in 1957 and Gagarin, who became the first human to orbit the Earth in 1961. In 1966, man managed to soft land a spacecraft on another celestial body for the first time, when the Luna 9 landed on the surface of the Moon. Then in 1969, the Apollo program set a great milestone with placing men on the surface of the Moon for the first time in history, in their Apollo 11 mission. To date, the last human mission to the Moon took place in 1972. After that, the human exploration fast growing trend came to a surprising halt. Since then, over forty successful and unsuccessful uncrewed missions to the Moon took place, including impactors, orbiters and landers, bringing China, Japan, India, ESA1 and recently even Israel to the scene. Though only China has managed to join USA and USSR in having successfully soft landed on the Moon. Today, the Moon is receiving more attention again. NASA2, for example, is planning to land humans on the surface of the Moon again by 2024 in their [16], for the first time in fifty-two years, and use the Moon as a springboard for exploring other astronomical bodies. We now find ourselves in an era, when space travel will likely become more usual than ever before. Until recently, the space has been a domain only for government institutions. Now, however, even private companies can be seen in this field, increasing the number of planned space missions even more. Astrodynamic computations are essential for these missions. Trajectory is one of the main factors that influences spacecraft’s proportions and components when it is being designed. Knowing the optimal trajectory minimizes the amount of fuel and life support supplies needed for the mission and enables optimal use of spacecraft’s cargo space. It can be seen, that simulating a lunar landing is a relevant topic. In this work, the optimal descent trajectory of the Israeli Beresheet mission is researched. In addition, a 3D environment is developed for visualization of the resulting optimal descent trajectory. The goal is to find an optimal solution and create an intuitive environment, that would easethe process of understanding the trajectory data. In chapter number2, the Beresheet mission is described, including the spacecraft’s specifications and launch information. Chapter number3 presents the Lunar landing prob- lem, descent trajectory phases and orbital mechanics definitions, relevant to the thesis. In chapter number4, the equations of motion, needed for computing the optimal trajectory,

1European Space Agency 2National Aeronautics and Space Administration

5 are derived. Chapter number5 presents the documentation of optimal descent trajectory computation using Bocop optimal control problem solver, and presents computed results in form of graphs. In chapter number6 the visualization environment, implemented with the LibGDX 3D engine, is presented and its implementation details are described. In chapter number7 the reader can find evaluation of achieved results and comparison with real trajec- tory of the Beresheet mission. Conclusion can be found in chapter number8. AppendixA shows specifications of the Earth, the Moon and the launch vehicle of the Beresheet mis- sion – the Falcon 9 rocket. AppendixB lists tables with specifications, that would not fit the text continuity. In appendixC the contents of associated media drive are listed.

6 Chapter 2

Commercial Lunar Lander Mission: Beresheet

This chapter begins with the overview of the Google Lunar XPRIZE competition. Then the Beresheet mission overview is described, along with launch configuration and brief introduction of the launch vehicle. At the end the planned trajectory of the Beresheet mission is described in detail.

2.1 Google Lunar XPRIZE

The XPRIZE is a nonprofit foundation since 1994, which has, to this day, designed and operated seventeen competitions in the domain areas of Space, Oceans, Learning, Health, Energy, Environment, Transportation, Safety and Robotics. Their goal is to inspire and guide scientists, engineers, academics and other innovators to spur new ideas and break- through technology, which will create a positive future across a set of domains [29]. In 2007, XPRIZE announced the Google Lunar XPRIZE competition, sponsored by Google, with a mission to

“spur affordable access to the Moon and give space entrepreneurs a legitimate platform to develop long-term business models around lunar transportation and to inspire the next generation of scientists, engineers, space explorers and ad- venturers to enter the STEM1 fields” [30].

Offering a $30-million prize purse to private companies, that would take part and succeed in the program. The objective for the competitors is to:

∙ Soft-land a craft on the Moon.

∙ Move 500 m along a deliberate path on or above the surface.

∙ Transmit two “mooncasts”.

∙ Complete a data uplink exercise as set by XPRIZE.

According to [30], 45 teams have registered to the competition, five of which have become finalists, including Israeli SpaceIL. Unfortunately, none of the competitors was able tomake

1Science, Technology, Engineering and Mathematics

7 Figure 2.1: The Beresheet spacecraft and the Nusantara Satu launch configuration with a 13.1 meters tall Falcon 9 payload fairing in the background. Taken from [23]. a launch attempt to reach the Moon before the March 31, 2018 deadline and XPRIZE has terminated the program with the prize unclaimed. Regardless, many of the teams have continued to pursue the goal and planned to launch in following years. First of them to launch became SpaceIL on February 22, 2019 when they launched their Beresheet spacecraft on top of the SpaceX Falcon 9 rocket. Unfortunately, on April 11, 2019, the Beresheet crashed into the Moon’s surface during a soft landing attempt. Although the Google Lunar XPRIZE was no longer taking place, XPRIZE has decided to recognize SpaceIL’s achievement with a $1 million Moonshot award for becoming the first privately funded company to enter the lunar orbit and to attempt a lunar landing [30].

2.2 Mission launch

The Beresheet spacecraft was launched on top of the SpaceX Falcon 9 rocket. It shared the Falcon 9 with the Nusantara Satu Indonesian geostationary and Air Force Research Laboratory S5 satellite, which was to be deployed by the Nusantara Satu later. The Beresheet was mounted directly on top of the Nusantara Satu, as it can be seen in Figure 2.1. Thanks to this configuration SpaceIL mission designers were able to choose the launch time, because it was possible to meet designated orbit for all three spacecrafts, if proper time of day was selected [22].

8 Falcon 9 vehicle The Falcon 9 is a two-stage rocket vehicle powered by liquid oxygen (LOX) and rocket-grade kerosene (RP-1). The Falcon 9 can be flown in two configurations: either with fairing, or with SpaceX Dragon spacecraft. The current version is called Block 5 and is operating since spring 2018. It is 70 meters tall and 3.7 meters wide at its diameter. It is capable to deliver a 22,800 kg payload to LEO2, 8,300 kg to GTO3 or 4,020 kg to . The first stage is propulsed by nine Merlin engines with a total thrust of 7,686 kN at lift-off. It is unique by its ability to soft land on ground or on autonomous drone ship in ocean, after its primary mission is done, and be re-used. This ability greatly reduces cost of each launch. The second stage is propulsed by one Merlin Vacuum engine with a thrust of 981 kN in vacuum and this stage is not recovered after mission. Specifications taken from [7]. For picture of the Falcon 9 rocket and more specifications see AppendixA.

Nusantara Satu The primary payload of the launch was the 4,100-kilogram communication satellite Nusan- tara Satu. Expected to operate for at least 15 years it will provide communications links to rural parts of Indonesia and expand broadband internet services to this regions. After the Falcon 9 drops the satellite off at a super-GTO, it will use its own engines to reach its final geostationary slot. Once it arrives there, it will deploy its subsatellite, S5,whichis a 60-kilogram spacecraft, that will detect and track objects near and in the geostationary belt [10].

Beresheet spacecraft The Beresheet is a Lunar Lander spacecraft designed to reach the Moon with its own propul- sion system, once deployed at Geosynchronous Transfer Orbit (GTO). It is a four-legged circular craft, measuring 1.5 meters in height and 2 meters in diameter. Launch mass is 582 kg with dry vehicle mass of 150 kg. The main propulsion system is the LEROSTM2b engine with 456 N of thrust and 318 s specific impulse. For more specifications of the engine see Table B.1. Additional 8 small thrusters are used for attitude control. The spacecraft is equipped with solar panels on top deck, that provide power. It also carries imagers, magnetometer to study the Moon’s magnetic field and a laser retroreflector – a smallex- perimental tool, provided by NASA – intended for testing its navigation capabilities. Taken from [13, 15]. A photograph of the Beresheet spacecraft can be seen in Figure 2.2.

Launch The Beresheet was launched on February 22, 2019 at 01:45 UTC from Cape Canaveral Air Force Station launch pad SLC 40 in . After about 157 seconds, at about 67 km altitude, the first stage engines were cut off and stage separation occurred. The second stage engine was then ignited and continued to burn for another 319 seconds, which brought the vehicle into LEO, 165 km above the Earth. After coasting for almost 19 minutes, at t+27:03, the second stage engine ignited for the last time and burned for 65 seconds, injecting the satellites into a super-GTO with an apogee of about 60,000 km. The Beresheet deployment

2Low Earth Orbit 3Geostationary Transfer Orbit

9 Figure 2.2: The Beresheet spacecraft at advanced stage of development. Taken from [22]. was executed about 6 minutes later at t+33:39 at about 720 km altitude. The Nusantara Satu deployment occurred 11 minutes later at t+44:38 at about 3,250 km altitude [6].

2.3 Mission trajectory

In this section the planned trajectory for the Beresheet spacecraft from super-GTO to lunar orbit is described and compared to the actual as-flown trajectory.

Planned trajectory The Beresheet mission trajectory was designed to use a series of phasing orbits to accomplish an encounter with the Moon. It included four different apogee altitudes with multiple revolutions at each altitude to precisely time the encounter. The plan included slight changes in maneuvers and number of phasing loops for different launch days to arrive at the Moon on the same day. For launch on February 22, 2019 the spacecraft was planned to spend 4 loops in the initial super-GTO with ∼60,000 km apogee, 5 loops in orbit with ∼111,000 km apogee, 2 loops in orbit with ∼275,000 km apogee and 1.5 loops in orbit with ∼390 000 km apogee. Figure 2.3 (left) shows planned phasing loop trajectory. When the lunar encounter, planned for April 4, 2019, would occur, the plan was to execute a lunar orbit insertion (LOI) maneuver (see Figure 2.4) and capture the spacecraft into a 290 × 10, 000 km lunar orbit. Over the course of next seven days the Beresheet would perform several maneuvers to reach lunar parking orbit 210 × 210 km. Finally the periselene would be lowered to 15 km, where the terminal descent would begin. The landing was targeted for April 11, 2019 at about 20:00 UTC in Mare Serenitatis [22]. Table 2.1

10 Figure 2.3: The Beresheet phasing loop trajectory planned (left) and actual (right) in the Earth-Moon rotating coordinate frame with the Moon always at the top. Taken from [22].

Table 2.1: Maneuvers as planned before launch. Taken from [22].

Separation 2/22/2019 70,000 215 Start Time ApoAlt aft PeriAlt aft # Maneuver [UTC] [km] [km] 1 AM1 2/22/2019 68,715 215 2 AM2 2/24/2019 68,710 600 Earth 3 PM1 2/25/2019 117,300 530 Orbit 4 PM2 3/07/2019 275,000 1,600 5 PM3 3/20/2019 390,000 1,500 6 OPM 3/21/2019 392,000 1,800 7 LOI1 4/04/2019 10,000 290 8 LOI1A 4/05/2019 10,000 285 Lunar 9 LOI2 4/07/2019 750 285 Orbit 10 LOI2A 4/08/2019 750 210 11 LOI2B 4/09/2019 210 210 12 DM1 4/10/2019 210 15

11 Figure 2.4: Lunar orbit insertion and circularization maneuvers. shows an overview of planned Beresheet maneuvers. Apogee maneuvers AM1 and AM2 raise perigee. Perigee maneuvers PM1–PM3 raise apogee. Out-of-plane maneuver OPM adjusts the arrival time at LOI. LOI1–LOI2B refer to maneuvers in lunar orbit. DM1 is the descent maneuver.

As-flown trajectory The actual followed trajectory varied from nominal. The phasing loop trajectory offers good amount of flexibility and can be re-planned when mission anomalies occur. Thetime and date of lunar encounter is fixed so in case of anomalies orbit periods of phasing loops are adjusted such that the spacecraft arrives at lunar encounter at correct time. After launch, the AM1 maneuver was waived, because perigee altitude was satisfactory after insertion. The AM2 maneuver was executed as planned and raised perigee to about 650 km. The PM1 maneuver was delayed twice due to spacecraft performance issues, but it did not cause a threat to the mission. The trajectory was adjusted by adding loops in the super-GTO orbit and raising apogee values of subsequent loops, as it can be seen in Figure 2.3 (right). LOI1 maneuver was executed nominally and the Beresheet was captured into a lunar orbit with 10,000 km apolune height. The rest of LOI maneuvers were executed nomi- nally [22].

Landing The landing started according to plan on April 11, 2019 and for 11 minutes was nomi- nal. Then a failure was indicated by one of the two inertial measurement units, which led to a series of events including mission computer resets and main engine shutdown. Un- fortunately the mission was lost, as the Beresheet impacted the surface at much greater velocity than it could withstand. The last telemetry from the Beresheet sent just before impact showed vertical velocity of 143.3 m/s, horizontal velocity of 946.7 m/s and altitude of 149 meters [22].

12 Chapter 3

Lunar Landing Problem

The lunar landing problem is defined by first stating the assumptions. Reference frames are then defined for the problem and the descent trajectory phases are introduced. Atthe end, orbital dynamics, needed for later computations, are presented.

Assumptions As in [12], pages 41–42, the Moon will be assumed to be spherical, without an atmosphere. It rotates about its axis once in every 27.3217 days [17], which results in surface velocity of approximately 4.6 m/s. This rotation would be a factor if the goal was to target a specific landing site, because the site would move relative to the inertial frame. Since the target is not considered, it is reasonable to neglect the Moon’s rotation, because the difference in fuel-usage would be no more than 0.3%. A purely Newtonian gravity model is used, therefore gravity perturbations due to gravity of the Earth and the Sun are neglected, as well as the perturbations caused by oblateness of the Moon, which is assumed spherical. Constant vehicle exhaust velocity will be assumed, as the properties of the engine do not change drastically during the maneuvers of lunar landing. Constant values used for computations, such as the lunar equatorial radius and the lunar gravitational parameter, can be found in Table A.2.

3.1 Lunar Lander in coordinate system

In order to be able to determine the exact position of the Lunar Lander, it must be placed in a frame of reference. For purposes of this thesis, three frames of reference are used: an inertial polar frame of reference for determining the Lunar Lander’s position, a rotating po- lar frame of reference for determining the Lunar Lander’s attitude and an inertial cartesian frame of reference. The first two are used, when the optimal descent trajectory isbeing computed, because it provides mathematical simplifications for that task. The last oneis used for displaying the descent trajectory in the developed visualization environment, as the LibGDX 3D engine uses cartesian coordinate system. The Lunar Lander is simplified to a point mass. The motion is restricted to three degrees of motion (single plane), because the trajectory remains in one plane, when optimal solution is researched. This will simplify the computations. The x-y plane was selected as the plane of motion.

13 Figure 3.1: Cartesian coordinate system (left) and polar coordinate system (right).

Cartesian coordinate system The cartesian coordinate system, (illustrated in Figure 3.1), is a system of 푛 axes, which are mutually perpendicular. Two-dimensional coordinate system has two axis, usually denoted as 푥 and 푦. The 푥 and 푦 coordinates may lie anywhere in the interval (−∞, ∞). Ordered pair of (푥, 푦) is called a vector. The system is defined by an origin (0, 0) and two unit vectors – 푥ˆ and 푦ˆ. Position vector ⃗푝 is defined as:

⃗푝 = 푥푥ˆ + 푦푦ˆ (3.1) where 푥 and 푦 are the values of perpendicular projection from the point 푃 to the axis [26].

Polar coordinate system The polar coordinate system, (illustrated in Figure 3.1), is a system where a point 푃 in space is represented as an ordered pair (푟, 휃), where 푟 is the radial distance from origin and 휃 is the counterclockwise angle between positive part of 푥–axis and the vector going from the origin to the point 푃 [27]. The 푟 and 휃 lie within the intervals:

푟 ∈ ⟨0, ∞⟩ , 휃 ∈ ⟨0, 2휋⟩ (3.2)

Conversion between cartesian and polar coordinate systems is made using following equa- tions:

푥 = 푟 · cos 휃 (3.3) 푦 = 푟 · sin 휃 (3.4)

Frames of reference

The inertial polar frame of reference is defined by unit vectors ˆ푖푥 and ˆ푖푦, with origin in the Moon’s center of gravity 퐺푀 . The rotating frame of reference shares origin with the inertial frame and is defined by unit vectors ˆ푖푟 and ˆ푖휃, while ˆ푖푟 always points at the direction

14 of Lunar Lander’s center of mass and ˆ푖휃 remains perpendicular to ˆ푖푟. It is referred to as “rotating polar frame”, because it uses polar coordinate system and rotates. It rotates with the same rate the Lunar Lander 퐿퐿 revolves around the Moon. Both frames of reference are illustrated in Figure 3.2. The position vector ⃗푟 of the Lunar Lander is defined in inertial and rotating frames respectively: √︁ 2 2 ⃗푟 = (푥ˆ푖푥) + (푦ˆ푖푦) (3.5)

⃗푟 = 푟ˆ푖푟 (3.6)

Figure 3.2: Two-dimensional inertial and rotating polar frames of reference.

Beresheet spacecraft attitude The Beresheet spacecraft is free to rotate in three dimensions. According to aircraft prin- ciples these rotations are called roll, pitch and yaw and are rotations about x, y and z axes respectively. The x, y and z axes originate in spacecraft’s center of mass. The Beresheet’s rotation axes are demonstrated in Figure 3.3. For purposes of this thesis the Beresheet’s rotation was restricted only to its y axis.

3.2 Descent trajectory definition

The descent trajectory computation in this thesis begins at a lunar parking orbit 210 × 210 km, in other words 210 km above the Moon’s surface. It is convenient to partition the descent into four phases: de-orbit, coast, brake and vertical descent phase, as suggested in [12], page 124. Partitioning enables to propose different constraints for each phase and makes the descent profile safer with bigger margin for errors. Illustration of the descent phases can be seen in Figure 3.4.

De-orbit phase The descent begins with a de-orbit burn. The objective of de-orbit phase is to place the Lunar Lander on an elliptical orbit with a perilune altitude 15 km above the Moon’s surface. As researched in [12], the chosen value 15 km is reasonable for couple reasons: On one hand, the lower the targeted perilune is, the more fuel is saved, but on the other hand, the higher

15 z

yaw

x y roll pitch

Figure 3.3: The Beresheet rotation axes demonstrated on the 3D model used in the devel- oped visualization application. 3D model taken from [20]. the targeted perilune is, the safer the coast is. Perigee lower than 15 km could result in a collision with mountainous terrain. It is desired, that the Lunar Lander has an option to safely fly by, if, for any reason, an error occurs during the coast phase or braking phase initiation. Minimizing the time, the spacecraft is on a collision course with the Moon, increases mission success chances.

Coast phase The coast phase begins with shutting the main engine down. During this phase, the altitude is lowered from 210 km to 15 km, while main engine remains shut down. For braking purposes, the spacecraft needs to arrive at the end of this phase in engine-first position.

Braking phase The braking phase starts near perilune and its main task is to greatly decrease the Lunar Lander’s velocity and bring it just 500 m above the Moon’s surface in vertical legs-down position, so the Lunar Lander is prepared to soft land.

Vertical descent phase The objective of vertical descent phase is to slowly descent, while measuring its altitude. At start of this phase the Lunar Lander is already moving slow enough to be able to land right away in case of wrong measurements. In this thesis it is assumed that the measurements are correct and the Beresheet will soft land at planned altitude.

16 Figure 3.4: The four descent phases (left) and orbital dynamics definitions (right).

3.3 Orbital dynamics definitions

When a spacecraft is orbiting a celestial body in an elliptical orbit, the main body occupies one of the focus points of that ellipse, called occupied focus. The spacecraft’s state can be described by a following set of variables: radius 푟, central angle 휃, and velocity, defined by its radial 푣푟 and tangential 푣휃 components. The maximum width of ellipse is major axis, and its length is 2푎. The maximum width in direction perpendicular to major axis is minor axis, with length 2푏. The closest orbit approach point the to the occupied focus is called periapsis. In case of the Moon this point is called perilune. The vector from the occupied focus to perilune is the perilune radius vector, 푟푝, and the distance from perilune to the Moon’s surface will be referred to as perilune altitude, ℎ푝. The farthest orbit point is apoapsis and for the Moon is called apolune. Similarly we define apolune radius vector, 푟푎, and apolune altitude, ℎ푎. Defined variables can also be seen in Figure 3.4.

Orbital period The orbital period is computed using the following equation from [4], page 16: √︃ 푎3 푇 = 2휋 (3.7) 휇 where 푎 is the length of semi-major axis and 휇 is gravitational parameter of main body.

Orbital velocity The orbital velocity on elliptical orbit is computed using following equation from [11], page 6: √︃ (︂2 1)︂ 푣 = 휇 − (3.8) 푟 푎 which can be, for circular orbit, simplified to:

√︂휇 푣 = (3.9) 푟

17 Figure 3.5: Examples of orbital maneuvers.

Orbital maneuvers An efficient way of changing periapsis or apoapsis radius is to provide velocity increment at the opposite apsis. When the variation ∆푟 of apsis radius is known, new length of semi– major axis can be computed as 푎2 = 푎1 + ∆푟/2 and subsequently the required ∆푣 can be computed as:

∆푣 = 푣2 − 푣1 (3.10) where 푣1 and 푣2 represent the spacecraft’s velocity before and after the burn respectively. Examples of orbital maneuvers are illustrated in Figure 3.5. The relationship between velocity change, caused by thrust, and mass can be, according to [12], expressed as an integral of thrust acceleration magnitude:

∫︁ 푡푓 푇푚푎푥푘퐸 ∆푣 = 푑푡 (3.11) 푡0 푚 where 푚 represents spacecraft’s mass, 푇푚푎푥 spacecraft’s maximum thrust and and 푘퐸 space- craft’s thrust command. 푘퐸 ∈ ⟨0, 1⟩ ∧ 푘퐸 ∈ R.

Periapsis altitude Being able to compute periapsis altitude is necessary for knowing when to terminate the de- orbit burn. To compute periapsis radius with knowledge about spacecraft’s current state, a following equation from [12], page 104, is used: 2 2 푟 푣휃 푟푝 = (︃ √︂ )︃ (3.12) (︁ 2 )︁2 (︁ )︁2 푟푣휃 푟푣푟푣휃 휇 1 + 휇 − 1 + 휇 where 푣푟 and 푣휃 are spacecraft’s vertical and tangential velocity components respectively. Computing the periapsis altitude is then rather simple:

ℎ푝 = 푟푝 − 푅푒푞 (3.13) where 푅푒푞 is the equatorial radius of the main body.

18 Chapter 4

Descent Trajectory Physics

Physical description of the problem, needed for computing the optimal descent trajectory, is derived in this chapter. First, the Newton’s laws of motion are presented, then the derivation steps are described, and in the end, the equations of motion are introduced.

4.1 Newton’s laws of motion

The three Newton’s laws of motion and the law of universal gravitation are used as a base for deriving the equations of motion. Rest of the section is taken from [4], page 3.

First law Every object continues in its state of rest or of uniform motion in a straight line unless it is compelled to change that state by forces impressed upon it.

The first law requires the identification of an inertial system with respect towhichitis possible to define the absolute motion of the object.

Second law The rate of change of momentum is proportional to the force impressed and is in the same direction as that force.

It can be expressed as: 푑⃗푝 퐹⃗ = (4.1) 푑푡 where 퐹⃗ is the resultant of the forces acting on the object and 푝 = 푚⃗푣 is its momentum. For a constant-mass system, it is:

퐹⃗ = 푚⃗푎 (4.2) and for a variable-mass system, it is:

퐹⃗ = 푚⃗푎 +푚⃗푣 ˙ (4.3) where ⃗푎 is the acceleration of the mass measured in an inertial frame of reference.

19 Third law To every action there is always opposed an equal reaction.

Newton’s law of universal gravitation Two bodies, the masses of which are 푀 and 푚, respectively, attract one another along the line joining them with a force proportional to the product of their masses and inversely proportional to the square of the distance between them.

푀푚 퐹 = 퐺 (4.4) 푟2 where 퐺 is the universal gravitational constant and 푟 mutual distance.

4.2 Derivation of the equations of motion

The Moon landing can be simplified to a two-body problem, where the two bodies are the Moon and the Lunar Lander. These bodies interact with each other and the equations of motion can be derived from Newton’s laws of motion. Section inspired by [4], pages 5–13.

Figure 4.1: Two-body system in an inertial frame of reference. Taken from [4], page 4.

Having a system of two bodies of masses 푚1 and 푚2, 푚1 > 푚2, where the bodies are spherically symmetrical and no other forces than gravitational are present, the position of 푚2 relative to 푚1 can be described as:

⃗푟 = 푅⃗2 − 푅⃗1 (4.5) where 푅1 and 푅2 describe the positions of 푚1 and 푚2 respectively in an inertial frame F푖 (Figure 4.1). Their mutual distance is 푟 = ‖⃗푟‖ and following equations describe their mutual velocity and acceleration: ˙ ˙ ˙ ⃗푟 = 푅⃗2 − 푅⃗1 (4.6) ¨ ¨ ¨ ⃗푟 = 푅⃗2 − 푅⃗1 (4.7) Using Newton’s second law of motion (eq. 4.2) and law of universal gravitation (eq. 4.4), ¨ and considering that ⃗푎 ⇔ 푅⃗, the motion of each mass can be described as: ¨ 푚1푚2 푚 푅⃗ = 퐺 ⃗푟 (4.8) 1 1 푟3 ¨ 푚1푚2 푚 푅⃗ = −퐺 ⃗푟 (4.9) 2 2 푟3

20 By subtracting eq. 4.9 from eq. 4.8, one obtains:

푚1 + 푚2 ⃗푟¨ = −퐺 ⃗푟 (4.10) 푟3 As stated in [4], since one of the masses is several orders of magnitude larger than other, it is possible to let 푀 be the mass of the Moon and 푚 be the mass of the Lunar Lander, 푚1 = 푀 and 푚2 = 푚, with 푀 ≫ 푚. and simplify the equation of relative motion 4.10 to: 휇 ⃗푟¨ = − ⃗푟 (4.11) 푟3 where 휇 = 퐺푀 is the primary body gravitational parameter. The unit vectors of rotating polar frame, relative to inertial frame, are defined as:

ˆ푖푟 = cos(휃)ˆ푖푥 + sin(휃)ˆ푖푦 (4.12)

ˆ푖휃 = − sin(휃)ˆ푖푥 + cos(휃)ˆ푖푦 (4.13) taking the time derivative, one gets:

˙ ˙ ˆ푖푟 = 휃ˆ푖휃 (4.14) ˙ ˙ ˆ푖휃 = −휃ˆ푖푟 (4.15)

The position vector is defined simply as:

⃗푟 = 푟ˆ푖푟 (4.16)

The velocity vector is defined as a sum of its radial and tangential components:

⃗푣 = 푣푟ˆ푖푟 + 푣휃ˆ푖휃 (4.17)

By computing the first derivative of position vector, and applying equations 4.16, 4.14 and 4.17: 푑⃗푟 푑 ˙ ⃗푣 = = (푟ˆ푖 ) =푟 ˙ˆ푖 + 푟ˆ푖 =푟 ˙ˆ푖 + 푟휃˙ˆ푖 (4.18) 푑푡 푑푡 푟 푟 푟 푟 휃 the radial and tangential components of the velocity vector can be defined as:

푣푟 =푟 ˙ (4.19) ˙ 푣휃 = 푟휃 (4.20)

In a similar way by computing the first derivative of the velocity vector:

푑⃗푣 푑2⃗푟 ⃗푎 = = = (¨푟 − 푟휃˙)ˆ푖 + (푟휃¨ + 2푟 ˙휃˙)ˆ푖 (4.21) 푑푡 푑푡 푟 휃 the radial and tangential components of the acceleration vector can be defined as:

푎푟 =푟 ¨ − 푟휃˙ (4.22) ¨ ˙ 푎휃 = 푟휃 + 2푟 ˙휃 (4.23)

As stated in [4], page 12, when there are other forces acting upon the spacecraft besides the gravitational pull from the primary body, such as thrust of the engine in this case, and

21 Figure 4.2: The Lunar Lander in the frame of reference. gravitational perturbations due to other celestial bodies are neglected, the equation 4.11 can be extended to: 휇 ⃗푟¨ = − ⃗푟 + ⃗푎 (4.24) 푟3 푡 where ⃗푎푡 is the acceleration caused by engine thrust (see Figure 4.2). The ⃗푎푡 can be split into its components using equations 4.22 and 4.23: 휇 푎 = − + 푎 cos 휓 (4.25) 푟 푟2 푡 푎휃 = 푎푡 sin 휓 (4.26) where 휓 is the spacecraft pitch angle, defined as the counterclockwise angle between axis 푖푟 and acceleration vector ⃗푎푡 (see Figure 4.2). As stated in [12], page 54, with the use of Newton’s second law of motion (eq. 4.2), the acceleration vector can be described as: 푇푚푎푥푘퐸 ⃗푎 = (4.27) 푡 푚 where 푇푚푎푥 is the maximum engine thrust, 푘 is the engine throttle command and 푚 is the Lunar Lander mass. Remembering that:

푣푟 =푟 ˙ ⇒ 푣˙푟 =푟 ¨ (4.28) ˙ ˙ ¨ 푣휃 = 푟휃 ⇒ 푣˙휃 =푟 ˙휃 + 푟휃 (4.29) the system of first-order ordinary differential equations, describing the evolution of thestate of the spacecraft, can be defined. It can be found in the following section.

4.3 The equations of motion

Equations presented in section below are used for the computation of the optimal descent trajectory.

22 Translational dynamics of motion in polar form In polar form, the position of the spacecraft is defined by 푟, the distance from main body’s center, and 휃, the central angle (see Figure 4.2). The velocity of the spacecraft is defined by its radial and tangential components, 푣푟 and 푣휃. The translational dynamics, as presented in [12], page 57, are then governed by:

푟˙ = 푣푟 (4.30) 푣휃 휃˙ = (4.31) 푟 2 푣 휇 푇푚푎푥푘퐸 푣˙ = 휃 − + cos 휓 (4.32) 푟 푟 푟2 푚 푣푟푣휃 푇푚푎푥푘퐸 푣˙ = − + sin 휓 (4.33) 휃 푟 푚

2 푣휃 휇 Last two equations were derived using equations 4.25 and 4.27. Terms 푟 and 푟2 represent centrifugal and gravitational acceleration respectively. Fractions with goniometric functions represent acceleration caused by engine thrust.

Rotational kinematics As stated in [12], page 58, in cases where the vehicle rotates about an axis, which is normal to the plane of translational motion, the rotational equations of motion can be described as:

푣휃 휓˙ = 휔 − (4.34) 푟 휔˙ = 훼 (4.35) where 휔 is the inertial angular velocity and 훼 the inertial angular acceleration, which can be regulated by firing the attitude control system (ACS) thrusters.

Loss of mass Finally the mass flow needs to be accounted for. Mass flow due to main engine firingis significantly larger than mass flow due to ACS firing. According to[12], page 58, the ACS can thus be neglected in the mass flow equation and an indirect method of accounting for ACS firing is presented later during implementation of objective function (section 5.3). The mass flow equation is:

푇푚푎푥푘 푚˙ = − (4.36) 푉푒푥

23 Chapter 5

Optimal Descent Trajectory Computation

The optimal descent trajectory is computed in this chapter. First, the optimal control solver Bocop is presented. Then the optimization problem theory and methods for solving these problems are discussed. Follows description of implementation of the problem in Bocop and presentation of the results.

5.1 Optimal control problem solver: Bocop

The Bocop1 is an open-source toolbox for solving optimal control problems. It implements a local optimization method. The direct approach transforms optimal control problem into a finite dimensional optimization problem (NLP). This is achieved by discretization intime applied to the state and control variables and the dynamics equation. Taken from [2], page 6. An optimal control problem in Bocop is defined as:

⎧ 푀푖푛퐽(푡 , 푦(푡 ), 푡 , 푦(푡 ), 휋) ⎪ 0 0 푓 푓 Objective ⎪ ⎨⎪ 푦˙(푡) = 푓(푡, 푢(푡), 푦(푡), 푦(푡), 휋) Dynamics (푃 ) Φ푙 ≤ Φ(푡0, 푦(푡0), 푡푓 , 푦(푡푓 ), 휋) ≤ Φ푢 Boundary conditions ⎪ 푦푙 ≤ 푦 ≤ 푦푢, 푢푙 ≤ 푢 ≤ 푢푢, 푧푙 ≤ 푧 ≤ 푧푢, 휋푙 ≤ 휋 ≤ 휋푢 Bounds ⎪ ⎩ 푔푙 ≤ 푔(푡, 푢(푡), 푦(푡), 푧(푡), 휋) ≤ 푔푢 Path constraints where 푦(·) represents the state variables, 푢(·) the control, 푧(·) the optional algebraic vari- ables and 휋 the optional variables to be optimized. Taken from [2], page 10.

Bocop GUI The Bocop features a user-friendly GUI (see Figure 5.1) for easier manipulation. There are four tabs, which lead the user through the process of defining and solving the problem. Definition tab enables user to define the optimal control problem by providing dimen- sions and names for variables and constants and setting bounds, initial and final conditions to variables. It also includes a choice of discretization method, where in this thesis the midpoint method was selected. Starting Point enables user to set a starting point for the discretized NLP problem, which may strongly influence the result, since the solver uses a local method.

1http://www.bocop.org/

24 Figure 5.1: The Bocop GUI in a definition tab and boundary conditions settings.

Optimization has various options settings for the NLP solver, for example batch opti- mization or choosing existing solution as a starting point. Visualization finally enables user to preview the contents of a solution file, generated after optimization, in graphical representation, such as state and control variables in time. Taken from [2], pages 7–8. As stated in [2], page 10, the problem 푃 in Bocop is defined by: ∙ 4 functions (C/C++) corresponding to 퐽, 푓, Φ, 푔: criterion, dynamics, boundarycond and pathcond.

∙ 3 definition files in plain, text that are automatically filled when using the GUI: problem.def for general definition and settings problem.bounds for setting bounds problem.constants contains optional constant variables and values. At first, in Definition, the state vector from equations 4.30–4.36 is defined:

푟 푦(푡) = [푟(푡), 휃(푡), 푣푟(푡), 푣휃(푡), 휓 (푡), 휔(푡), 푚(푡)] (5.1) and then the control vector is defined:

푢(푡) = [푘퐸(푡), 훼(푡)] (5.2)

5.2 Optimization problem theory

Optimization is the act of achieving the best possible result under given circumstances. Decisions are made in order to either minimize effort or maximize benefit. The effort or the benefit can usually be described as a function of certain variables. Optimization is

25 the process of finding the maximum or minimum value of that function. Ifapoint 푥* corresponds to the minimum value of a function 푓(푥), it also corresponds to the maximum value of a function −푓(푥). Optimization can be thus taken as minimization [1], page 2.

Optimization problem statement An optimization problem is in [1], page 3, stated as:

Find 푥 = (︀푥1, 푥2, . . . , 푥푛)︀ (5.3) which minimizes 푓(푥) (5.4) subject to the constraints 푔푗(푥) ≤ 0 (5.5) for 푗 = 1, . . . , 푚, and 푙푗(푥) = 0 (5.6) for 푗 = 1, . . . , 푝. The vector 푥 is variable, 푓(푥) is the objective function, 푔푗(푥) are the inequality constraints and 푙푗(푥) are the equality constraints. The number of variables 푛 and the number of constraints 푝+푚 need not to be related. If 푝+푚 = 0 the problem is called an unconstrained optimization problem.

Objective function If the objective function is globally convex, then found local minimum is also global min- imum. If the function is non convex, found local minimum is not necessarily the global minimum. The objective function for the optimal descent trajectory problem is nonconvex. Thus more optimal solutions exist, one of which is global optimum, other are local optimum solutions [12], page 22. A graphical representation of this phenomenon is shown in Figure 5.2. There is a local minimum at point 푥* if 휀 > 0 exists such that 푓(푥*) ≤ 푓(푥) for all 푥 within interval ⟨푥* − 휀, 푥* + 휀⟩. There is a global minimum at point 푥* if 푓(푥*) ≤ 푓(푥) for all 푥 within 푋, where 푋 is the domain of 푥.

Finding a minimum A local minimum of a single-variable function can be found by computing its first and second derivative. If a function has local minimum at 푥*, then the first derivative at that point 푓 ′(푥*) must either be equal to 0 or be non–existing. That point would be called a critical point. Critical point can correspond to any local extremum, therefore the Second Derivative Test needs to be performed. The test states that if 푓 ′′(푥*) > 0, there is local minimum at point 푥*. In multivariable case a point 푥* is critical, if the gradient is equal to zero: ∇푓(푥*) = 0. The Second Derivative Test is now generalized: first, the Hessian is formed, which is a matrix of second partial derivatives at 푥*. For a function of 푛 variables, the Hessian is a 푛 × 푛 matrix 퐻, and the entry in 푖-th column and 푗-th row of 퐻 is 2 훿 푓 * 퐻푖푗 = (푥 ) (5.7) 훿푥푖훿푥푗

26 Figure 5.2: Global convexity of function. Taken from [12], page 22.

The multi-variable Second Derivatives Test is now stated as: If 푥* is a critical point of 푓 and the Hessian 퐻 is positive definite, then 푥* is local minimum of 푓.A positive definite matrix is symmetrical and its determinant and eigenvalues are positive. From [14].

Optimal control problem Optimization problems, that include input or control, fall into a subset called optimal control problems. Therefore finding the optimal trajectory is an optimal control problem with the control being thrust and attitude control system. 푛 푚 Let 푥(푡) ∈ R be the state of continuous system and 푢(푡) ∈ R be the control. The system is governed in time by a following differential equation:

푥˙(푡) = 푓(푥(푡), 푢(푡), 푡) (5.8)

To solve the optimal control problem, we are trying to find such history of control 푢(푡), that minimizes the objective function, which can be defined as

∫︁ 푡푓 퐽 = 푓(푥(푡), 푢(푡), 푡)푑푡 (5.9) 푡0 where 푡0 and 푡푓 are beginning and end of the problem respectively [12], pages 25–26.

Solving optimal control problem Optimal control problems can be solved either analytically or numerically. The analytical solution is most of the times very difficult or impossible. Therefore the latter isused commonly. Numerical methods are divided into two categories: direct and indirect. Indirect methods use estimate of the costate which may be also very difficult or impossible to make. Direct methods optimize the objective function directly, and are used most often. These methods start from an initial guess of the state and control and proceed to find a local minimum of the objective function. If the problem is proven to be convex, then the found local minimum is also global minimum. It has to be kept in mind, that if the problem is

27 y

yn+1

yn

P

x

xn xn + h/2x n+1

Figure 5.3: Illustration of midpoint method. Taken from [8]. highly nonconvex, a good initial guess is crucial in finding good local optimum solution. A direct method is also used in this thesis [12], pages 28–29.

Midpoint method The used optimal control problem solver offers a selection between multiple methods for solving differential equations. In this thesis the midpoint method was selected. It is a modification of the Euler’s method, that is one-step, which means the new state is determined only by the state in previous step. Its objective is to solve following differential equation: 푦˙ = 푓(푥, 푦), 푦(푥0) = 푦0 (5.10) where 푦 is function of 푥. Following equations are used in midpoint method:

푘1 = 푓(푥푖, 푦푖) (5.11) 1 1 푘 = 푓(푥 + ℎ, 푦 + ℎ푘 ) (5.12) 2 푖 2 푖 2 1 푦푖+1 = 푦푖 + ℎ푘2 (5.13) where ℎ is size of the step and 푖 = 0, . . . , 푛 − 1. Midpoint method is geometrically represented in Figure 5.3. First, the point 푃 (mid- point) is found by computing the derivative at [푥푛, 푦푛] and finding a point in this direction at 푥푛 + ℎ/2. Approximate value at 푥푛+1 can be then obtained by using the derivative at 푃 as a direction to head from [푥푛, 푦푛]. Red arrows represent directional field. Taken from [8], page 149.

5.3 Optimal control problem implementation

The problem implementation in Bocop is described in this section.

28 Trajectory segmentation The trajectory is segmented into four phases as mentioned before: de-orbit, coast, brake and vertical descent. To compute the optimal descent trajectory with such segmentation, each phase will be computed separately with different constraints for each phase and3 knots linking the phases. The variables 푡1, 푡2 and 푡3 represent the time locations of the first, second and third knot respectively. Variables 푡0 and 푡푓 represent start and end.

Control Variable Constraints

0 ≤ 푘퐸(푡) ≤ 1 푓표푟 푡0 ≤ 푡 ≤ 푡1 (De-orbit phase) (5.14)

푘퐸(푡) = 0 푓표푟 푡1 ≤ 푡 ≤ 푡2 (Coast phase) (5.15)

0.4 ≤ 푘퐸(푡) ≤ 1 푓표푟 푡2 ≤ 푡 ≤ 푡3 (Braking phase) (5.16)

0.4 ≤ 푘퐸(푡) ≤ 1 푓표푟 푡3 ≤ 푡 ≤ 푡푓 (Vertical descent phase) (5.17) ∘ ∘ −0.5 ≤ 훼(푡) ≤ 0.5 푓표푟 푡0 ≤ 푡 ≤ 푡푓 (All phases) (5.18)

The throttle bound during coast phase is set to 0, to prevent changes of periapsis during this phase. Lower throttle bound for last two phases of descent was selected to be non– zero to prevent a case when the engine is shut down and fails to restart. This would be fatal when the spacecraft is on a collision course with the Moon. Therefore it is safer to keep the engine from shutting down. The bounds for angular acceleration were chosen the same as in [12], page 100, where the reasonable estimate, taking into account the vehicle specifications, was made.

Event Constraints

− + 푦 (푡1) = 푦 (푡1) (5.19) − + 푦 (푡2) = 푦 (푡2) (5.20) − + 푦 (푡3) = 푦 (푡3) (5.21)

푡0 < 푡1 < 푡2 < 푡3 < 푡푓 (5.22)

The state 푦 remains unchanged at the knots. The 푦− and 푦+ denote the values just prior to and after the knot respectively. The last constraint ensures that events are sequential.

Constants The constants used for the optimal trajectory computation are presented in Table 5.1. Engine exhaust velocity 푉푒푥 was computed by using specific impulse 퐼푠푝 of the Beresheet engine (see Table B.1 for engine specifications) and a following equation:

푉푒푥 = 퐼푠푝 · 푔퐸 (5.23)

2 where 푔퐸 is gravitational acceleration of the Earth and is equal to 9.8 푚/푠 .

Initial values According to mission plan, the descent is initiated at a 210×210 km circular lunar orbit. The initial radius 푟(푡0) can be simply computed as 푅푀 + ℎ. From radius, the spacecraft’s

29 initial speed 푣(푡0) is computed using equation 3.9. The radial component of velocity 푣(푡0) is equal to 0 since the spacecraft is moving about a circular orbit, therefore the tangential component 푣휃(푡0) is equal to 푣(푡0). Initial central angle 휃(푡0) and initial pitch angle 휓(푡0) were selected. Table 5.1: Constant values used in computations. Taken from [9, 17].

푇푚푎푥 456 N 푉푒푥 3, 116.4 푚/푠 6 푅푀 1.7381 · 10 푚 12 3 2 휇푀 4.902800076 · 10 푚 /푠 6 푅퐸 6.3781 · 10 푚 14 3 2 휇퐸 3.98600436233 · 10 푚 /푠

Initial mass

Finally it is important to know initial mass 푚(푡0) of the spacecraft, which, unfortunately, can not be found in any mission description documents. Therefore at least an approximate value was computed by computing the values of necessary ∆푣 of the spacecraft (eq. 3.8 and 3.10), for executing all maneuvers prior to initiating the lunar descent, and converting that ∆푣 to amount of depleted mass (eq. 3.11). As seen in Table 2.1, the spacecraft was deployed on an insertion super-GTO of 68, 715× 215 km and it arrived at a circular 210 × 210 km lunar orbit, before initiating the lunar descent. The change of mass between these two events needs to be computed. Computing the ∆푣 and ∆푚 for each of the periapsis and apoapsis maneuvers, both in the Earth’s orbit and the Moon’s orbit, is quite straightforward with the use of equations 3.8, 3.10 and 3.11. The maneuvers are considered impulsive burns. The lunar orbit insertion (LOI) burn needs to be included. In article [24], a LOI ∆푣 was researched for a spacecraft with engine thrust of 450 N, which is very close to the Beresheet spacecraft thrust – 456 N. Therefore it is safe to use the value from [24] as an approximation for the Beresheet LOI burn. It can be seen in [24], page 211, that in best case it takes about 355.55 m/s of ∆푣 to capture the spacecraft into a lunar orbit with orbital period of about 12.235 hours, which corresponds to about 8, 681 × 290 km orbit. From this point the spacecraft executes remaining burns necessary to reach the target orbit of 210 × 210 km. The mass of burned fuel up to this point is 192.586 kg, the initial mass 푚(푡0) is then computed to be 389.414 kg. Table B.2 shows ∆푣 and corresponding amount of depleted mass for each maneuver. All initial values for the computation can be seen in Table 5.2.

State Variable Bounds The state variable bounds are presented to maintain feasibility of the mission, so the vari- ables do not reach invalid values at any time. The boundary conditions need to be associated with specific state variables in boundarycond.tpp file, using few simple C commands. State variable bounds can be seen in Table 5.3.

30 Table 5.2: Initial values of the problem.

푟(푡0) 1, 948, 100 푚 ∘ 휃(푡0) 0 푣푟(푡0) 0 푚/푠 푣휃(푡0) 1, 586.414 푚/푠 ∘ 휓(푡0) −90 푚(푡0) 389.414 kg

Table 5.3: State variable bounds of the problem.

Variable Lower bound Upper bound Note 푟(푡) 1, 738, 100 푚 - Above surface, 푟(푡) ≥ 푅푀 푣푟(푡) - 0 푚/푠 Descend 푣휃(푡) 0 푚/푠 - Move forward 휓(푡) −90∘ 0∘ 휔(푡) −10∘/푠 10∘/푠 푚(푡) 150 kg - 푚(푡) ≥ 푚푑푟푦

Final conditions

Final conditions are set for several variables at time 푡푓 . The radius condition is set, so the spacecraft lands on surface. To ensure soft landing, spacecraft needs to land with zero horizontal velocity and near zero vertical velocity. The attitude of the spacecraft needs to be near vertical, in legs down position.

푟(푡푓 ) = 1, 738, 100 푚 (5.24)

푣휃(푡푓 ) = 0 푚/푠 (5.25)

0 ≤ 푣푟(푡푓 ) ≤ 0.5 푚/푠 (5.26) ∘ −0.5 ≤ 휓(푡푓 ) ≤ 0.5 (5.27)

Objective function The objective function needs to be specified in criterion.tpp file. The objective is to minimize fuel depletion, in other words maximize mass. In preliminary analysis it was found that the angular acceleration was fluctuating rapidly, which would unnecessarily deplete fuel of attitude control thrusters. The cost of angular acceleration command was therefore included in the cost to be minimized, as suggested in [12], page 100. This is included by adding an integral of a constant 퐶, times the square of angular acceleration. The value of C was given a small value, such as 10−3, to minimize the impact on the cost. The objective function is following: ∫︁ 푡푓 2 퐽푚푖푛 = −푚(푡푓 ) + 퐶 [훼(푡)] 푑푡 (5.28) 푡0 Finally the dynamics need to be specified in dynamics.tpp file. That is done by coding the equations 4.30–4.36 in C language.

31 De-orbit phase

The objective of de-orbit burn is to lower the perilune height ℎ푝 to a desired value – in this case 15 km above surface. To meet this objective, an additional state variable ℎ푝 is temporarily added to the state vector and its state is computed by equations 3.12 and 3.13. The final condition for this phase is:

ℎ푝(푡1) ≤ 15, 000 푚 (5.29)

Coast phase The objective of coast phase is to bring the spacecraft near perilune. The vehicle follows the descent coast trajectory until its altitude is below a specified value, then the braking phase begins. The target altitude is selected slightly above perilune height, to leave some margin for error of the optimization software. Pitch is constrained so the spacecraft arrives in engine-first position to the braking phase. Thrust is constrained to 0 in this phaseand final conditions for this phase are:

푟(푡2) ≤ 푅푀 + 15, 100 푚 (5.30) ∘ 휃(푡2) = −90 (5.31)

Breaking phase The objective of breaking phase is to null most of the velocity and prepare the vehicle for landing. At the end of this phase, the vehicle should be able to land immediately, in case of incorrect measurements, therefore near-zero vertical attitude in legs-down position is also required. Multiple final conditions are introduced for this phase:

푟(푡3) = 1 738 600 m Altitude 500 m 푣푟(푡3) ≥ −2 m/s Near-zero vertical speed 푣휃(푡3) ≤ 0.5 m/s Near-zero horizontal speed −0.5∘ ≤ 휓 ≤ 0.5∘ Vertical attitude

Vertical descent phase The objective of vertical descent phase is to finish the descent and ensure soft landing. The horizontal velocity is constrained to 0 during this phase. Final conditions for this phase equal to final conditions for the whole descent, at time 푡푓 , which can be found earlier in this section 5.3.

5.4 Results

The optimal descent trajectory for the Beresheet Lunar Lander was computed to take 5,025.3 s (a little under 84 minutes) during which the spacecraft burns 210.2 kg of fuel, and soft lands with a safe margin 29.2 kg of unburnt fuel (about 6.8%). The spacecraft gradually performs the four planned phases, during which it reduces its velocity and soft lands with vertical attitude in legs down position, which is considered a successful landing. Detailed information about each phase can be seen in Table 5.4.

32 Table 5.4: Phase breakdown of the computed optimal descent trajectory.

Downrange Vertical Phase Duration ∆푣 ∆푚 ∆휃 distance distance [푠] [푚/푠] [푘푔] [푑푒푔] [푘푚] [푘푚] De-orbit 36 41.2 5.26 1.61 50.28 0.018 Coast 3,499 0 0 176.1 5,341.73 194.91 Braking 1,426.3 2,268.7 198.69 43.2 1,309.05 14.57 Vertical descent 64.3 104.8 6.19 0 0 0.51 Total 5,025.3 2,391.1 210.15 220.93 6,702.11 210

Results shown in Figures 5.4–5.11 were plotted using the open source tool Gnuplot2. The descent begins by de-orbit phase, coast phase starts at about 푡 = 36 푠, braking phase begins at about 푡 = 3, 535 푠 and vertical descent phase starts at about 푡 = 4, 961 푠.

210 210

180 180

150 150

120 120

90 90 Altitude [km] Altitude [km] 60 60

30 30

0 0 0 40 80 120 160 200 240 0 1000 2000 3000 4000 5000 Central angle [deg] Time [s]

Figure 5.4: The optimal descent trajectory Figure 5.5: Time history of altitude during profile. the optimal descent trajectory.

240 400

200 350

160 300

120

250 Mass [kg] 80

Central angle [deg] 200 40

0 150 0 1000 2000 3000 4000 5000 0 1000 2000 3000 4000 5000 Time [s] Time [s]

Figure 5.6: Time history of central angle dur- Figure 5.7: Time history of mass during the ing the optimal descent trajectory. optimal descent trajectory. 2http://gnuplot.sourceforge.net/

33 0 1800

-10 1600

-20 1400

-30 1200

-40 1000

-50 800

-60 600

Radial velocity [m/s] -70 400 Tangential velocity [m/s] -80 200

-90 0 0 1000 2000 3000 4000 5000 0 1000 2000 3000 4000 5000 Time [s] Time [s]

Figure 5.8: Time history of radial velocity Figure 5.9: Time history of tangential veloc- during the optimal descent trajectory. ity during the optimal descent trajectory.

1 0

0.9 -10

0.8 -20 0.7 -30 0.6 -40 0.5 -50 0.4 -60 0.3 Pitch angle [deg] -70

Throttle command [1] 0.2

0.1 -80

0 -90 0 1000 2000 3000 4000 5000 0 1000 2000 3000 4000 5000 Time [s] Time [s]

Figure 5.10: Time history of throttle com- Figure 5.11: Time history of pitch angle dur- mand during the optimal descent trajectory. ing the optimal descent trajectory.

34 Chapter 6

Design and Implementation of Visualization Environment for Descent Trajectory Interpretation

For purposes of visualizing the computed optimal descent trajectory a visualization applica- tion was developed. In this chapter the design and implementation details of the application are presented.

6.1 Application overview

Motivation The general idea of the application is to provide the user with a tool, which would help him/her to easily understand the trajectory. The application would display the Moon and the Beresheet spacecraft in 3D space, where all the objects and their mutual distances are on the same scale. Once the trajectory would be loaded from dataset, the user would be able to see an animation of the spacecraft following the trajectory from start to end, and he would also be able to interact with the animation to for example change its pace or jump into different point in time.

Design On application startup, a main menu is loaded. Here the user is first asked to provide a path to directory with trajectory dataset. Then the user can choose to either display the list of available user interface controls, or to proceed to the visualization screen. If the latter one is chosen, a screen with a 3D scene is displayed. The scene shows 3D models of the Moon, the Beresheet spacecraft, and the trajectory on the same scale. For better illustration, the Moon is covered with a texture, created from real Moon imagery. By default, an animation of the lunar descent is played in real time, and state variable information is displayed in top left corner, for better knowledge of current state of the descent. A user interface is provided in form of buttons and a slider, that enables the user to pause/resume the visualization, change the time flow to forward/backward, jump to different time using slider, change the visualization speed and adjust the camera view angle, or return to the main menu. Application screens can be seen in Figure 6.1.

35 Figure 6.1: Application’s visualization, main menu, controls and loading screens.

6.2 Application implementation

The application was developed using the LibGDX framework built on top of Java SE 81 environment. The LibGDX was chosen because it supports creating 3D graphical output for Java applications. The trajectory is loaded from dataset previously computed by the optimization and smoothed out using Bézier curve algorithm before being displayed as a line in space. The Moon and the Beresheet spacecraft are loaded as 3D objects.

LibGDX The LibGDX2 is a free open source game development framework providing an API that works on all supported platforms. When the application is targeting multiple platforms at the same time, including desktop, mobile, and web, the API is abstract enough that the code and assets can be mostly shared. The LibGDX is using OpenGL (graphics library) for rendering on all platforms and offers users class abstractions as Mesh, Texture, Shader, PerspectiveCamera and more. The main entry point of a LibGDX application is Application interface, which sets up a window and manages graphics, audio, input and files of the application. Application can be instantiated as a desktop, android, HTML5 or iOS application. The application logic is

1https://www.oracle.com/java/technologies/javase-jdk8-downloads.html 2https://libgdx.badlogicgames.com/index.html

36 implemented in a class implementing ApplicationListener, which provides methods create, render, pause, resume, dispose and resize, that are called by Application in corresponding events. For further information please refer to the LibGDX documentation [31]. Discussed application was developed for desktop use, but could easily be extended for use on other platforms by adding a launcher that uses different Application implementation. It uses Game abstract implementation of ApplicationListener, which in addition enables to easily switch between multiple application screens.

Implementation details The application consists of four screens: main menu screen – which loads on startup, controls screen – which informs user about ways of controlling the visualization, loading screen – which is only displayed while assets are being loaded and 3D models created, and visualization screen – which is the main screen, displaying the visualization. The visualization screen consists of 3D scene, representing the bodies and trajectory in space, which uses PerspectiveCamera to be displayed, and a 2D layer, rendered on top of the 3D scene, which provides a user interface and displays additional information about current state of the descent. Perspective cameras are commonly used in 3D graphics, because they display the world in an intuitive way to the user, as more distant objects appear smaller. Opposed to that orthographic cameras display more distant objects the same size as the closer ones, which can be used for example for creating 2D games, but would feel very unintuitive in 3D world. The Moon is represented by a sphere covered with color texture, downloaded from [28], which was created by NASA’s Scientific Visualization Studio from real images taken by LRO3. The Beresheet spacecraft is represented by a 3D model, downloaded from Thingi- verse [20], created by royyehu, licenced under CC BY 4.0. The model was painted gold to represent golden layers of insulation, the spacecraft was covered in before launch. Both of the 3D models are loaded into the application using the LibGDX AssetManager, which enables asynchronous loading. The trajectory is loaded from a file in form of three-dimensional points in polaror cartesian coordinate system. If the input is in polar coordinate system, the points are converted to cartesian coordinate system using equations 3.3 and 3.4. Then the trajectory is smoothed out using the Bézier curve algorithm (discussed later). For this purpose the LibGDX offers class Bezier, which supports linear, quadratic and cubic curves. Obtained points are then used to create a mesh and the trajectory is displayed in form of line. A time history (list of times) needs to be provided to the application in order for it to know how fast to clear individual sections of the trajectory. Additional state information about the spacecraft during lunar descent can be loaded, such as mass, pitch and velocity in time, and displayed in top left corner during the visualization. The user interface in whole application was created with the use of VisUi4 user interface toolkit for the LibGDX, which provides skin for typical ui elements such as buttons, labels, etc. and also FileChooser class – a window in which the user provides the path to trajectory source files. The application is using model-view-controller (MVC) architecture, which ensures that the user input changes the model first, and the change effects the view displayed to the user. 3Lunar Reconnaissance Orbiter is a NASA spacecraft mapping the Moon’s surface. 4https://github.com/kotcrab/vis-ui

37 Bézier curve algorithm The input trajectory may not always have sufficient amount of points and if such trajectory would be displayed, sharp changes of direction could be observed at certain places. To improve user experience, the input trajectory is approximated by a smooth curve. For this purpose a Bézier curve algorithm was used in the application. From [3]: Bézier curve (also called Bézier spline) is a line, that passes through a set of points, or knots. It is a collection of polygonal segments, which can be linear, quadratic, cubic or higher order polynomials. The cubic Bézier curve is in [3] defined as

3 2 2 3 B(푡) = (1 − 푡) P0 + 3(1 − 푡) 푡P1 + 3(1 − 푡)푡 P2 + 푡 P3, 푡 ∈ [0, 1] (6.1) where points P0 and P3 correspond to the knots and points P1 and P2 are control points, which determine the curve’s shape. To create a smooth curve, the first and second deriva- tives must be continuous across the spline boundaries, which for the left boundary of i–th segment can be written as:

′ ′ B푖(0) = B푖−1(1) (6.2) ′′ ′′ B푖 (0) = B푖−1(1) (6.3)

The first and second derivatives are defined as:

′ 2 2 2 2 B (푡) = −3(1 − 푡) P0 + 3(1 − 4푡 + 3푡 )P1 + 3(2푡 − 3푡 )P2 + 3푡 P3 (6.4) ′′ B (푡) = 6(1 − 푡)P0 + 3(−4 + 6푡)P1 + 3(2 − 6푡)P2 + 6푡P3 (6.5)

After simplifying these equations and taking into account that P0,푖 = P3,푖−1 = K푖, the following pair of equations is obtained:

2K푖 = P1,푖 + P2,푖−1 (6.6)

−2P1,푖 + P2,푖 = P1,푖−1 − 2P2,푖−1 (6.7)

These equations are only defined at the internal knots, therefore two following boundary ′′ ′′ conditions are defined for the end knots: B0(0) = 0 and B푛−1(1) = 0 (the spline is linear at the end knots). The equations for the endpoints are:

K0 − 2P1,0 + P2,0 = 0 (6.8)

P1,푛−1 − 2P2,푛−1 + 퐾푛 = 0 (6.9)

The set of equations 6.6–6.9 can be used to compute the individual segments of Bézier curve. For illustration of Bézier curve see Figure 6.2.

Figure 6.2: Bezier curve with knots and control points.

38 Chapter 7

Evaluation

In this chapter the optimal descent trajectory is evaluated first, then it is compared to the real trajectory, followed during the Beresheet mission, and in the end short evaluation of visualization environment is given.

Optimal descent trajectory The computed optimal descent trajectory meets all proposed criterions and is considered feasible, thus can be evaluated as successful. To verify the correctness of computational model, the best way would be to compare the trajectory to the Beresheet mission planned trajectory, or to real flight data. Unfortunately the former is not available and the latter can not be used for verification, since the descent resulted in a crash. Follows a best effort verification. The optimal descent trajectory consists of four phases, each of which willbe evaluated separately. The de-orbit phase was expected to lower the perilune height to about 15 km and last only few dozens of seconds. The perilune was lowered successfully and the maneuver took 36 seconds to complete, therefore the result shows no signs of errors. The coast phase has brought the vehicle near the perilune as expected. Since the spacecraft travels during this phase almost 180∘ in longitude, roughly from apolune to perilune, without applying any thrust, the duration of the phase can be expected to be slightly less than a half of orbit period. The spacecraft is orbiting a 210×15 km ellipse, the period is thus 7,143 s (eq. 3.7). The coast phase takes a little less than half of that time – 3,499 s – which suggests the model is correct. The difference is caused by phase start 36 seconds after apolune and phase ending sooner than reaching the perilune. The braking phase of the optimal descent trajectory begins with a horizontal section, lasting for about 600 seconds, during which the vertical velocity remains zero. This solution appeared to be unintuitive and sub-optimal, therefore some alternatives were examined to verify the solution. The flatness of the section was caused by setting the upper boundfor vertical velocity to 0. When the bound was removed, a 10 km raise in altitude appeared instead of the flat section, but it did not result in additional fuel savings. Next avariant with initiating the braking phase up to 800 seconds earlier was examined, but this also did not result in additional fuel savings. Neither of alternatives resulted in better solution, therefore the presented solution appears to be optimal. To see whether the flat section would disappear if higher thrust was available, two fictional scenarios were examined: first with twice the Beresheet’s thrust – 912N–and second with four times the Beresheet’s thrust – 1824 N. The optimal braking phase for

39 16 0

14 -10

12 -20 10 -30 8 -40 6 Altitude [km] -50 4 nominal Radial velocity [m/s] nominal 2 x2 -60 x2 x4 x4 0 -70 3500 3800 4100 4400 4700 5000 3500 3800 4100 4400 4700 5000 Time [s] Time [s]

1800 nominal 1600 x2 1400 x4

1200

1000

800

600

400 Tangential velocity [m/s] 200

0 3500 3800 4100 4400 4700 5000 Time [s]

Figure 7.1: Braking phase comparison with nominal, double and quadruple thrust. both of the scenarios was computed and compared to the original braking phase of the optimal descent trajectory. As it can be seen in Figure 7.1, with higher engine capabilities the trajectory would actually look more intuitive, which suggests that the long horizontal section is only a coincidence, but not a fault in model. The vertical descent phase remains vertical and takes about 64.3 seconds, which seems adequate. The best effort to evaluate the computed optimal descent trajectory was made andno irregularities were found that would suggest the model is incorrect.

Comparison with the real trajectory followed during the Beresheet mission The real descent trajectory was obtained by sampling the telemetry displayed in live broad- cast from the Beresheet lunar landing [25] on youtube. The sampling begins about 33.5 km above surface, because at that moment the telemetry first appeared in the live broadcast. It is imperfect, because the telemetry was unavailable several times in the broadcast, but it is good enough for visual comparison. The comparison of trajectories starts at a point, where the optimal descent trajectory reached 33.5 km altitude. As Figure 7.2 shows, compared trajectories differ significantly, but that was expected since the real one led toacrash.

40 35 400 optimal optimal 375 30 real real 350

25 325

300 20 275 15 250 Mass [kg] Altitude [km] 10 225 200 5 175

0 150 2900 3200 3500 3800 4100 4400 4700 5000 2900 3200 3500 3800 4100 4400 4700 5000 Time [s] Time [s]

0 2000 optimal 1800 -15 real -30 1600 1400 -45 1200 -60 1000 -75 800 -90 600

Radial velocity [m/s] -105 400 Tangential velocity [m/s] -120 optimal 200 real -135 0 2900 3200 3500 3800 4100 4400 4700 5000 2900 3200 3500 3800 4100 4400 4700 5000 Time [s] Time [s]

Figure 7.2: Comparison of the optimal descent and the real Beresheet mission trajectories.

Visualization environment The goal was to create an environment, that would enable to visualize a lunar descent trajectory while enabling the user to interact with the visualization. The environment was tested by loading the computed optimal descent trajectory. It was observed, that the trajectory, relative to the Moon, was displayed as expected, confirming correct scale of the Moon in the scene. A user interface enables interactions with the visualization, as planned. The environment is ready to be used for intended purpose and therefore the goal is considered as fulfilled.

41 Chapter 8

Conclusion

The goal of this bachelor’s thesis was to compute the optimal descent trajectory for the com- mercial Lunar Lander Beresheet and develop an environment for visualizing the Beresheet lunar landing. Both of these goals were fulfilled. The assignment also included research of the Beresheet mission, research of orbital mechanics, derivation of equations of motion and evaluation of achieved results. All of the assignments were also fulfilled. The computed optimal descent trajectory meets all feasibility criterions, reduces risk that could endanger mission success and brings the Beresheet spacecraft to a safe landing with 29.2 kg (6.8%) of fuel left. The descent maneuver takes about 84 minutes to complete. Alternative trajectories were examined, but no better was found. In the end it was compared with the real Beresheet mission trajectory. Developed visualization environment is a desktop application that can be launched on Linux or Windows○R operating systems. It provides an intuitive trajectory visualization enabling users to easily understand computed lunar descent trajectories. Relevant 3D model of the Beresheet spacecraft and a Moon texture created from real LRO1 images were downloaded and used to provide the best experience. This assignment has taught me many things from astrodynamics, optimization and implementation of 3D application, which I am grateful for and I would like to use the gained knowledge to pursue even greater tasks in my master’s thesis. Future extensions to this thesis may include computing the optimal descent trajectory in six degrees of motion, taking into account a specific landing site and comparing the optimal trajectory with the mission plan, if it is released in the future. The visualization environment could be improved by adding a displacement map to the model of the Moon, to distinguish mountains and craters, and by adding a flame animation to the spacecraft, to see when it is applying thrust.

1Lunar Reconnaissance Orbiter is a NASA spacecraft mapping Lunar surface.

42 Bibliography

[1] Astolfi, A. Optimization [online]. 2006 [cit. 2020-03-18]. Available at: http://www3.imperial.ac.uk/pls/portallive/docs/1/7288263.PDF.

[2] Bonnans, F., Martinon, P., Giorgi, D., Grélard, V., Maindrault, S. et al. BOCOP 2.2.0 - User Guide [online]. 2019 [cit. 2020-01-25]. Available at: https://files.inria.fr/bocop/UserGuide-BOCOP.pdf.

[3] Brieda, L. Smooth Bézier Spline Through Prescribed Points [online]. 2012 [cit. 2020-05-07]. Available at: https://www.particleincell.com/2012/bezier-splines/.

[4] Colasurdo, G. Astrodynamics [online]. Polytechnic University of Turin, 2006 [cit. 2020-02-26]. Available at: http: //dma.ing.uniroma1.it/users/lss_mo/MATERIALE/AvanziniColasurdoAstrodynamics.pdf.

[5] Corp., S. E. T. Falcon User’s Guide [online]. 2019 [cit. 2020-04-11]. Available at: https://www.spacex.com/sites/spacex/files/falcon_users_guide_10_2019.pdf.

[6] Corp., S. E. T. Nusantara Satu Mission Press Kit [online]. 2019 [cit. 2020-04-11]. Available at: https://www.spacex.com/sites/spacex/files/nusantara_satu_press_kit.pdf.

[7] Corp., S. E. T. Falcon 9 [online]. 2020 [cit. 2020-04-11]. Available at: https://www.spacex.com/falcon9.

[8] Fajmon, B., Hlavičková, I., Novák, M. and Vítovec, J. Numerická matematika a pravděpodobnost. Vysoké učení technické v Brně, 2014 [cit. 2020-03-20].

[9] Folkner, W. M., Williams, J. G. and Boggs, D. H. The Planetary and Lunar Ephemeris DE 421 [online]. 2009 [cit. 2020-02-25]. Available at: https://ipnpr.jpl.nasa.gov/progress_report/42-178/178C.pdf.

[10] Graham, W. SpaceX launches Indonesian satellite launch and Israeli moon mission [online]. [cit. 2020-04-11]. Available at: https://www.nasaspaceflight.com/2019/02/ spacex-indonesian-launch-israeli-moon-mission/.

[11] Hamme, W. V. V. Orbital Mechanics [online]. 2020 [cit. 2020-03-17]. Available at: http://faculty.fiu.edu/~vanhamme/ast3213/orbits.pdf.

[12] Hawkins, A. M. Constrained Trajectory Optimization of a Soft Lunar Landing from a Parking Orbit. Cambridge, 2005. Masters Thesis. Massachusetts Institute of Technology. Dept. of Aeronautics and Astronautics. Available at: https://dspace.mit.edu/handle/1721.1/32431.

43 [13] Krebs, G. D. Beresheet (SpaceIL Lunar Lander) [online]. [cit. 2020-04-10]. Available at: https://space.skyrocket.de/doc_sdat/beresheet.htm.

[14] Lambers, J. Maximum and Minimum Values [online]. 2009 [cit. 2020-03-19]. Available at: http://www.math.sci.hokudai.ac.jp/~s.settepanella/teachingfile/ Calculus/Calculus1/pagine/lecture8.pdf.

[15] NASA. Beresheet [online]. [cit. 2020-04-10]. Available at: https://nssdc.gsfc.nasa.gov/nmc/spacecraft/display.action?id=2019-009B.

[16] NASA. Humanity’s return to the moon [online]. [cit. 2020-05-09]. Available at: https://www.nasa.gov/specials/artemis/.

[17] NASA. Moon Fact Sheet [online]. [cit. 2020-02-25]. Available at: https://nssdc.gsfc.nasa.gov/planetary/factsheet/moonfact.html.

[18] NASA. Earth [online]. 2012 [cit. 2020-05-08]. Available at: https://images.nasa.gov/details-PIA18033.

[19] NASA. Full Moon [online]. 2017 [cit. 2020-05-08]. Available at: https://images.nasa.gov/details-GSFC_20171208_Archive_e001861.

[20] royyehu. Beresheet SpaceIL 3D model [online]. April 2019 [cit. 2020-05-06]. Available at: https://www.thingiverse.com/thing:3570931.

[21] satsearch. LEROS 2b [online]. [cit. 2020-03-03]. Available at: https://satsearch.co/products/moog-inc-leros-2b. [22] Shyldkrot, H., Shmidt, E., Geron, D., Kronenfeld, J., Loucks, M. et al. THE FIRST COMMERCIAL LUNAR LANDER MISSION: BERESHEET. In:. August 2019.

[23] Society, T. P. Beresheet, S5 and Nusantara Satu with payload fairing [online]. [cit. 2020-04-11]. Available at: https://www.planetary.org/multimedia/space-images/ spacecraft/beresheet-s5-and-nusantara-satu.html. [24] Song, Y.-J., Park, S.-Y., Kim, H.-D., Lee, J.-H. and Sim, E.-S. Analysis of Delta-V Losses During Lunar Capture Sequence Using Finite Thrust. Journal of Astronomy and Space Sciences. september 2011, vol. 28, p. 203–216, [cit. 2020-04-05]. DOI: 10.5140/JASS.2011.28.3.203. Available at: https://www.researchgate.net/publication/258495488_Analysis_of_Delta- V_Losses_During_Lunar_Capture_Sequence_Using_Finite_Thrust. [25] SpaceIL. LIVE broadcast - Beresheet lands on the Moon Fasten your seatbelts, we are about to land. [online]. YouTube, April 2019 [cit. 2020-05-21]. Available at: https://www.youtube.com/watch?v=HMdUcchBYRA&t=1318s.

[26] Stover, C. and Weisstein, E. W. Cartesian Coordinates [online]. [cit. 2020-02-26]. From MathWorld–A Wolfram Web Resource. Available at: https://mathworld.wolfram.com/CartesianCoordinates.html.

[27] Stover, C. and Weisstein, E. W. Polar Coordinates [online]. [cit. 2020-02-26]. From MathWorld–A Wolfram Web Resource. Available at: http://mathworld.wolfram.com/PolarCoordinates.html.

44 [28] Wright, E. and Petro, N. CGI Moon Kit [online]. 2019 [cit. 2020-05-06]. Available at: https://svs.gsfc.nasa.gov/4720.

[29] XPRIZE, F. About Us [online]. [cit. 2020-04-09]. Available at: https://xprize.org/about/mission.

[30] XPRIZE, F. The new space race [online]. [cit. 2020-04-09]. Available at: https://lunar.xprize.org/prizes/google-lunar.

[31] Zechner, M. and Sweet, N. Libgdx API [online]. 2010-2020 [cit. 2020-05-06]. Available at: https://libgdx.badlogicgames.com/ci/nightlies/docs/api/.

45 Appendix A

Astronomical Bodies and Launch Vehicle in Beresheet Mission

The Earth

Table A.1: Earth specifications. Taken from [9, 17].

Equatorial radius 6, 378.1 푘푚 Gravitational 3.98600436233 · 1014 푚3/푠2 parameter Surface gravity 9.8 푚/푠2 Escape velocity 11.2 푘푚/푠 Atmospheric pressure 1 푏푎푟

Figure A.1: The Earth. Source: [18].

The Moon

Table A.2: Moon specifications. Taken from [9, 17].

Equatorial radius 1, 738.1 푘푚 Gravitational 4.902800076 · 1012 푚3/푠2 parameter Surface gravity 1.62 푚/푠2 Escape velocity 2.38 푘푚/푠 Atmospheric pressure 3 · 10−15 푏푎푟 (vacuum) Mean orbital radius 378, 000 푘푚 Mean orbital velocity 1.022 푘푚/푠

Figure A.2: The Moon. Source: [19].

46 The Falcon 9

Table A.3: The Falcon 9 specifications. Taken from [7].

Manufacturer SpaceX Height 70 푚 Diameter 3.66 푚 Weight (fuelled) 594, 054 푘푔 Stages 2 Propellant Liquid oxygen & RP-1 Propulsion (1푠푡푠푡푎푔푒) 9×Merlin 1D engine Propulsion (2푛푑푠푡푎푔푒) MVac engine Thrust (1푠푡푠푡푎푔푒) 7, 686 푘푁 (sea level) Thrust (2푛푑푠푡푎푔푒) 981 푘푁 (vacuum) Payload to LEO 22, 800 푘푔 Payload to GTO 8, 300 푘푔 Payload to Mars 4, 020 푘푔

Figure A.3: The Falcon 9 rocket in block 5 version. Taken from [5].

47 Appendix B

Additional Specifications

Table B.1: LEROSTM2b technical specifications. Taken from [21].

Manufacturer Moog Inc. Propellant MMH/MON 푇 367–456 N 퐼푠푝 318 s Mass 5.0 kg Diameter 334 mm

Table B.2: The Beresheet maneuvers with computed velocity and mass differences [22].

Separation 70,000 215 - - ApoAlt aft PeriAlt aft ∆푣 ∆푚 Maneuver [km] [km] [m/s] [kg] AM1 68,715 215 0 0 AM2 68,710 600 24.05 4.48 Earth PM1 117,300 530 167.82 30.28 Orbit PM2 275,000 1,600 176.87 30.20 PM3 390,000 1,500 39.67 6.54 LOI1 8,681 290 355.55 55.00 Lunar LOI2 750 285 379.67 52.24 Orbit LOI2A 750 210 14.80 1.91 LOI2B 210 210 93.78 11.90 Total: 1,251.21 192.586

48 Appendix C

Contents of Associated Media Drive

∙ /xkarpi06-BP.pdf - pdf version of the thesis.

∙ /thesis.zip - compressed source files of the thesis.

∙ /vis_env/ - directory containing source files of the visualization environment

∙ /vis_env/odt/ - directory containing the optimal descent trajectory dataset

∙ /bocop/ - directory containing the source files of the optimization problem

∙ /bin/ - directory containing the executables for running the visualization environment

49