Full text
MASTER FINAL THESIS Development of missions with OpenSatKit for Communications with CubeSats Author: Bernat Olivé Roig Director /Co-director: Juan José Alins Delgado / Jorge Mata Diaz Degree: Master in Aerospace Engineering Examination session: Spring, 2021 Document: Report
UNIVERSITAT POLITÈCNICA DE CATALUNYA MASTER THESIS Development of missions with OpenSatKit for communications with CubeSats Author: Bernat OLIVÉ ROIG Director: Dr. Juan José ALINS DELGADO Codirector: Jorge MATA DIAZ A thesis submitted in fulfillment of the requirements for the Master’s Degree in Aerospace Engineering in the Escola Superior d’Enginyeria Industrial, Aeroespacial i Audiovisual de Terrassa Secció d’Enginyeria Aeroespacial de Terrassa June 22, 2021
iii Declaration of Authorship I, Bernat OLIVÉ ROIG, declare that this thesis titled, “Development of missions with OpenSatKit for communications with CubeSats” and the work presented in it are my own. I confirm that: • This work was done wholly or mainly while in candidature for a master degree at this University. • Where any part of this thesis has previously been submitted for a degree or any other qualification at this University or any other institution, this has been clearly stated. • Where I have consulted the published work of others, this is always clearly attributed. • I have acknowledged all main sources of help. Signed: Bernat Olivé Roig Date: June 22, 2021
v UNIVERSITAT POLITÈCNICA DE CATALUNYA Abstract DISEN Research Group Secció d’Enginyeria Aeroespacial de Terrassa Master’s Degree in Aerospace Engineering Development of missions with OpenSatKit for communications with CubeSats by Bernat OLIVÉ ROIG English: This thesis has been carried out with the aim of laying the basis for the development of CubeSat missions, from the software point of view. With special emphasis to the communication system, either from the satellite to a ground station or between different satellites. The first part of this document is focused on the OpenSatKit tool. A description of its architecture, to understand how its layered system works, is provided. In addition to this, this first part describes the various applications that are part of the OpenSatKit tool, as well as their functions and services. All of this is illustrated by several examples. The second part of this document explains the type of mission we want to carry out with our cubeSATs. A general example of a simple mission called SIMSAT is explained part by part in order to see how all the applications described in the first part of the document fit together to create a complete mission. In the third and last part of this document, two main ways of approaching the communication scheduling of our mission are studied: programming the mission from time sequences and from limit checkers. Finally, a mixture of the two methodologies is created to achieve the best result.
vi Català: Aquesta tesi s’ha realitzat amb l’objectiu d’establir les bases per al desenvolupament de missions CubeSat, des del punt de vista del software. Amb especial èmfasi en el sistema de comunicació, ja sigui des del satèl·lit a una estació de terra o entre diferents satèl·lits. La primera part d’aquest document es centra en l’eina OpenSatKit. Es proporciona una descripció de la seva arquitectura, per entendre com funciona el seu sistema per capes. A més d’això, aquesta primera part descriu les diverses aplicacions que formen part de l’eina OpenSatKit, així com les seves funcions i serveis. Tot això ho il·lustren diversos exemples. La segona part d’aquest document explica el tipus de missió que volem dur a terme amb els nostres cubesATS. Un exemple general d’una missió simple anomenada SIMSAT s’explica part per part per tal de veure com les diverses aplicacions descrites a la primera part del document encaixen juntes per crear una missió completa. En la tercera i última part d’aquest document, s’estudien dues maneres principals d’enfocar la programació de la comunicació de la nostra missió: la programació de la missió a partir de seqüències de temps i de verificadors de límit. Finalment, es crea una mescla de les dues metodologies per aconseguir el millor resultat.
vii Contents Declaration of Authorship iii Abstract v 1 Introduction to OpenSatKit Tool 1 1.1 Motivation ................................... 1 1.2 OSK arquitecture ............................... 3 1.3 COSMOS Command & Control ....................... 4 1.3.1 Launcher ................................ 5 1.3.2 Command and Telemetry Server .................. 5 1.3.3 Telemetry Viewer ........................... 5 1.3.4 Command Sender .......................... 6 1.3.5 Packet Viewer ............................. 7 1.3.6 Script Runner ............................. 8 1.3.7 Table Manager ............................ 8 1.4 42 Simulator .................................. 8 1.5 CFS on Linux ................................. 9 1.5.1 CFE services .............................. 10 Software Bus Service: ......................... 10 Time Management Service: ..................... 11 Event Messages Service: ....................... 12 Table Management Service: ..................... 12 Executive Service: ........................... 13 1.5.2 CFS applications ........................... 13 1.5.3 Runtime Environment Apps .................... 13 Kit Command Ingest ......................... 13 Kit Telemetry Output ......................... 13 Kit Scheduler ............................. 14 1.5.4 Data/File Management Apps .................... 14 File Manager ............................. 14 Data Storage .............................. 14 Housekeeping ............................. 14 Trivial File Transfer Protocol and CCSDS File Delivery Protocol 14 1.5.5 Autonomy Apps ........................... 15 Stored Command ........................... 15 Limit Checker ............................. 15 1.5.6 Attitude Determination and Control Apps ............ 15 42 Interface .............................. 15 42 Flight Software .......................... 15 1.5.7 Maintenance Apps .......................... 15 Memory Dwell ............................ 15 Memory Manager .......................... 15 1.5.8 Health & Safety Apps ........................ 15
viii Checksum ............................... 15 Health & Safety ............................ 15 2 Introduction to cubeSAT missions 17 2.1 Table service configuration .......................... 17 2.2 SIMSAT mission example .......................... 20 2.2.1 Establishing the first app configuration .............. 21 Configure data collection directories ................ 21 Verify cFS applications ........................ 21 Configure mission specific cFS applications ............ 22 2.2.2 Science instrument (ISIM) configuration .............. 22 Power instrument ........................... 22 Science Data Collector ........................ 23 Fault simulator ............................ 23 2.2.3 Ground pass contact ......................... 24 Download the information ..................... 24 Transfer protocols (TFTP and CFDP) ................ 25 3 Configuration of the final mission 27 3.1 LEO satellite mission ............................. 28 3.1.1 Mission period ............................ 28 3.1.2 Area of Sight of the mission ..................... 29 3.2 Mission configuration approaches ..................... 30 3.2.1 Time sequence approach ....................... 30 Stored Command Table configuration ............... 31 ATS Table configuration ....................... 33 RTS Table configuration ....................... 33 3.2.2 Limit checkers approach ....................... 34 Watch Points Definition Table configuration ........... 35 Watchpoints for satellite GPS position ............... 37 BitMask uses ............................. 38 Action Points Definition Table configuration ........... 41 3.3 Final solution configuration ......................... 43 3.3.1 Data Storage configuration ..................... 43 3.3.2 Download protocols ......................... 45 TFTP configuration .......................... 45 CFTP configuration .......................... 45 4 Conclusions 47 4.1 Table Configuration flow diagram ..................... 47 4.2 Final conclusions ............................... 48 A Table Configuration codes 49 A.1 Stored Command ATS code with C language ............... 49 A.2 Stored Command RTS050 code with C language ............. 51 A.3 Stored Command RTS049 code with C language ............. 52 A.4 Limit Checker Watchpoint definition code with C language ....... 54 A.5 Limit Checker Actionpoint definition code with C language ...... 56 Bibliography 59
1 Chapter 1 Introduction to OpenSatKit Tool 1.1 Motivation Since the first launch, in 1958, the number of artificial satellites orbiting the Earth has only grown. This is due the principal ability of a communication satellite: to amplify radio telecommunication signals, creating communication channels capable of covering any area of the earth’s surface. The ability to generate this channels allowed us to base our communications technology increasingly on space. The relationship between space and communications generated a feedback cycle in terms of investment that had its maximum exponent from around 2010. It is from this year that we can see how the number of satellites that are put into orbit increases exponentially (Figure 1.1). The maximum responsible for this increase is the irruption of nanosatellites, or cubeSats. FIGURE 1.1: Number of active satellites from 1957 to 2020. (Mazareanu, 2021) A CubeSat, or U-class spacecraft, is a miniaturized satellite (called nanosatellites) used for space research. It is cube-shaped and have very small and manageable dimensions (from 10 cm3to 120 cm3). Although its design began to take shape in 1999, it was not until the 2010s that its use began to become popular. Due its relatively
2Chapter 1. Introduction to OpenSatKit Tool small volume, CubeSats can be build and put into orbit with a cost that oscillates between $65.000 and $100.000 (Beck, 2015), much cheaper than a conventional satellite. (Figure 1.2) FIGURE 1.2: CubeCat-1, developed by NanoSat Lab, from ETSETB, UPC. (UPC, 2018) This has led to the use of CubeSats by schools and universities around the world, making CubeSat a viable option for research projects and increasing the number of nanosatellites performed by research centers and undergoing unprecedented expansion (Figure 1.3). FIGURE 1.3: Number of nanosatellites launched in Europe by organizations. (Kulu, 2021) Since the popularization of cubeSats, the development of spacecraft flight software was performed by large organizations that made its own customized solutions.
1.2. OSK arquitecture 3 This is important because we have to take into account that one of the satellite characteristics, accentuated in cubeSATs, is the simplicity of its on-board processor. This simplicity used to force the software engineers to design the flight software very oriented in the specific mission of each satellite. So, this means that we had a lot of flight softwares, unfeasible to reuse into other satellites due their individual orientation. But this situation changed in January 2015, when the National Aeronautics and Space Administration (NASA) Goddard Space Flight Center (GSFC) relased the open source of their developed Core Flight System (CFS). CFS is a reusable flight software architecture that provides a portable and extendable platform with a product line deployment model. As a flight software, cFS needs satellite hardware and a ground station to communicate. NASA decided to integrate cFS into a more complete system called Open- SatKit (OSK). OpenSatKit is an emulator of all the components needed for a satellite mission, where cFS is the stone key but not the only one. Other applications are added in order to simulate all the aspects that an flight software needs to operate. (McComas, 2019) 1.2 OSK arquitecture The OSK open source kit has been developed in order to provide a fully functioning flight-ground system able to run on a desktop computer. OpenSatKit is composed, at a high level, for three different components: (Figure 1.4) •Aerospace’s COSMOS: User interface for command and control of embedded systems, it is used to simulate ground system. •42 Simulator: Simulator that provides spacecraft attitude and orbit dynamics and control, used to simulate satellite location. •Core Flight System (cFS): Flight Software components able to operate in a computer desktop, specifically in Linux environment. The software obtained with cFS is not a simulation, and that means that can be exported in any device or system. FIGURE 1.4: OpenSatKit starter block diagram. (McComas, 2021) OpenSatKit is installed and launched in a Linux computer environment, and it is designed to start by launching COSMOS. In the customized COSMOS Launcher GUI it is possible to access to Core Flight System (cFS), and 42 Simulator can be run through cFS interface. (McComas and Melton, 2017)
4Chapter 1. Introduction to OpenSatKit Tool 1.3 COSMOS Command & Control Ball Aerospace COSMOS is a command and control system based on open source. It has been designed to test and operate any kind of embedded system, either isolated equipment (power supplies, oscilloscopes, switched power strips, UPS devices, etc), a single board (Arduinos, Raspberry Pi, Beaglebone, etc) or an entire satellite system. (BallAerospace, 2021b) FIGURE 1.5: Aerospace Ball COSMOS architecture and context diagram. (BallAerospace, 2021b) In order to fulfill its purpose, COSMOS is made up of a number of different tools, able to provide functionality such as automated procedures, telemetry display and graphing, logged data analysis extraction, limits monitoring, command and telemetry handbook creation, and binary file editing (Figure 1.5). It is not necessary to invoke this tools directly, but being able to access them individually, in many cases makes it easier to see the development of the mission. Of all the tools that make up the COSMOS system, only 7 of them will be needed and studied for this project. With the rest of the tools, different components or even the same mission of this report can be controlled and monitored in a more extensive and accurate way. However, this thesis is focused especially in the Core Flight System software. That is why only the basic tools for using cFS are described. (Melton, 2017)
1.3. COSMOS Command & Control 5 1.3.1 Launcher Launcher is the first and principal COSMOS tool, intended to be the main center of any mission control configuration. It acts as a graphical interface for launching each of the tools that make up the COSMOS system. It is also capable of launching "cFS Starter Kit", the main OSK window. 42 simulator can not be started though Launcher tool, has to be activated with "cFS Starter Kit" main screen. Besides that, it is able to perform CRC verification across the COSMOS core files and any project’s files to make sure nothing has been modified. The same configuration works across all platforms, and in Linux has this aspect, as we can see in Figure 1.6. FIGURE 1.6: Aerospace COSMOS Launcher tool graphic interface. (BallAerospace, 2021b) 1.3.2 Command and Telemetry Server Command and Telemetry Server is the tool in charge to connect COSMOS to targets for real-time commanding and telemetry processing. It means that COSMOS is connected to everything in the system that needs to receive commands and send status. In our specific project, the most relevant utility of this tool is the display of command packets and telemetry packets, due its capacity to log all the communications between different applications. (see Figure 1.7) 1.3.3 Telemetry Viewer Telemetry Viewer is a very useful tool that provides a way to organize telemetry data into different screens. This screens can be generated and configured by users. This easy and user-friendly way to visualize telemetry data makes this tool useful to check system status and operation. COSMOS has other tools to access visually to the telemetry data, like Telemetry Grapher (see Figure 1.8). But our project is mostly based on Packet Viewer tool for this kind of visualizations (see Section 1.3.5).
6Chapter 1. Introduction to OpenSatKit Tool FIGURE 1.7: Aerospace COSMOS Command and Telemetry Server tool graphic interface. (BallAerospace, 2021b) FIGURE 1.8: Aerospace COSMOS Telemetry Grapher tool graphic interface. (BallAerospace, 2021b) 1.3.4 Command Sender Command Sender is a key tool that can send individual FSW commands using a GUI form (Figure 1.9). Commands are sorted by Target list, which allows to target specific cFS application, and Command list, which allows to choose specific command name and then fill out a form with the command parameters. It is also useful because the GUI has a Command History form, that can be used to resend the same or slightly modified commands. Besides this, COSMOS has another tool called Command Sequence that allows user to configure a sequence of commands edited by Command Sender parameters.
1.3. COSMOS Command & Control 7 FIGURE 1.9: Aerospace COSMOS Command Sender tool graphic interface. (BallAerospace, 2021b) 1.3.5 Packet Viewer If Command Sender is the COSMOS key tool to send individual commands to FSW applications, Packet Viewer is the principal tool to visualize telemetry used in this project. Unlike Telemetry Viewer or Telemetry Grapher, Packet Viewer contains all defined targets, packets, and telemetry items with no extra configuration necessary. Besides this, the GUI has a search bar that allows to jump to the packet containing any telemetry item in the system. (Figure 1.10) FIGURE 1.10: Aerospace COSMOS Packet Viewer tool graphic interface. (BallAerospace, 2021b)
8Chapter 1. Introduction to OpenSatKit Tool 1.3.6 Script Runner Aerospace COSMOS system has a very powerful tool to send commands and check telemetry in form of code. Its Script Runner tool can execute code based on Ruby language and COSMOS APIs. (RubyCommunity, 2021; BallAerospace, 2021a) This is very useful because allows the user to test different mission procedures mixing tools from COSMOS with the full power of the Ruby programming language. And it has all the comforts of a code editor (debugger for step execution, code completion, syntax checking, and more). (Figure 1.11) In Section 2.2 an example of a mission programmed with Ruby language in Scrip Runner is described. FIGURE 1.11: Aerospace COSMOS Script Runner tool graphic interface. (BallAerospace, 2021b) 1.3.7 Table Manager Table Manager is a COSMOS tool, in form of GUI, able to display and edit binary files. OpenSatKit system generates binary files (in .dat format) for most of the cFS and cFE applications. Table Manager divides any of this binary file into several internal tables in order to read the data more comfortably. It is necessary to dispose of the binary file itself and of the definition file, in charge of traduce the file into a table format. OSK provides definition files for most of the cFE binary files and a limited number of cFS application binary files. (Figure 1.12) 1.4 42 Simulator OpenSatKit system also incorporates 42 Simulator, an open source program developed by NASA, able to simulate spacecraft attitude and orbit dynamics and control. This simulator can be on or off, but it need to have the cFS running.
1.5. CFS on Linux 9 It is not the purpose of this project to delve into 42 utilities and configurations. But is important to know that it connects directly to cFS software and can simulate a spacecraft hardware command and telemetry, indispensable to test the correct operation of a mission. FIGURE 1.12: Aerospace COSMOS Table Manager tool graphic interface. (BallAerospace, 2021b) 1.5 CFS on Linux The project of this report bases its innovation into Core Flight System (cFS). The cFS is a re-usable spacecraft flight software architecture, released in 2015 as an open source code by NASA Goddard. It is heavily based on previous flight software mission architectures (like LRO and SDO missions), taking advantage of NASA experience in these missions and integrating the most notable characteristics of each one of them. (McComas, 2019) Unlike COSMOS and 42 Simulator, Core Flight System is not a simulator, everything developed with it can be exported on a real device, changing the "connections" with ground system and flight system. The cFS is structured in three different layers with an API between each layer: (Figure 1.13) •Platform Abstraction Layer: This layer is in charge of support portability by decoupling the higher levels from hardware and operating system implementation details. The access to all the platform is managed through two APIs: the Operating System Abstraction Layer (OSAL) and the Platform Support Package (PSP). •Executive Services Layer: This layer contains the core Flight Executive (cFE). CFE provides 5 different services, created by NASA Goddard team, which have been determined as the most common among all FSW projects for satellite missions. Although they are previously established services, all of these contain tunable compile-time parameters allowing developers to scale the cFE to their needs.
10 Chapter 1. Introduction to OpenSatKit Tool •Application Layer: This outer layer contains the final applications that the user can use to create and modify the flight software for missions for the desired purpose, as well as libraries, which can be shared among multiple applications. FIGURE 1.13: CFS layered architecture schematic. (McComas, 2019) 1.5.1 CFE services When OpenSatKit was released, in 2015, NASA Goddard team, with years of experience in developing flight mission software, decided to create 5 services that they saw were common in the vast majority of missions they had carried out. These services are the following: Software Bus Service: The Software Bus provides an inter-application message service using a publish- and-subscribe CCSDS standards. All applications can publish their messages and can subscribe into other applications messages. Normally applications create a FIFO queue during its initialization, and subscribe into different necessary applications, however any app can subscribe and unsubscribe to messages at any time. By default messages format are defined with the Consultative Committee for Space Data Sysytems packet standard. We can see in Figures 1.14,1.15,1.16 the distribution of the message components into its different headers. All messages between applications will be defined with these 2 packet headers (Figure 1.15 and Figure 1.16). As an important parts from Primary Header, cFS uses the first 16 bits to uniquely identify a message, for example the bit of Packet Type determines if the message is a Telemetry message (0) or a Command message (1). From these 16 bits, the last 11 are used as a “App ID” CCSDS packet identifier.
17 Chapter 2 Introduction to cubeSAT missions OpenSatKit and Core Flight System have been developed to provide a functioning flight-ground system. This system can be integrated in a simple device or in a system in charge of a specific operation, but the main purpose for which OpenSatKit has been made is to provide a flight software for an entire satellite mission. There are so many satellites that can use flight software designed with Open- SatKit, but in this project we are gonna focus into a cubeSAT data collect mission. In this chapter the basis of how to structure a mission for a simple satellite are established, taking SIMSAT mission as an example. 2.1 Table service configuration An important concept we have to take into account is that OpenSatKit uses a table programming system for the manage and configuration of cFS applications. This programming system is carried out by cFE Table Management Service (Section 1.5.1). We assume as a "table" a binary file of logical groups of parameters that are managed as a named entity. OpenSatKit has a very oriented and simple interface, so if we want to configure some complex application parameters or change the behaviour of a FSW algorithm, we can program it in a independent file. FIGURE 2.1: OpenSatKit folders scheme for binary tables location.
18 Chapter 2. Introduction to cubeSAT missions This independent file can be redacted in C language (.c file) and then converted into a binary table (.tbl file) in order to make the creation of these files more accessible. This is possible due the OSK configuration, we can see in Figure 2.1 the folders distribution of OpenSatKit system. If we take as an example that we want to establish a temperature limit in Limit Checker cFS application (LC), we have to go into the following directory: (Open- SatKit /cfs/apps/lc/fsw/tables). There we can create, write and save our document in C language. OpenSatKit comes with a series of C files by default in each application, this default documents can serve as a basis to write correctly the files of each app. In Section 3some of these documents are shown and discussed, especially those related to apps that will be used in the mission of this project (Stored Command and Limit Checker). But here we only have to take into account that if we run our C file (using ./cmake.sh command in cfs folder), it will be able to generate a binary file "table" in the following directory: (OpenSatKit/cfs/build/exe/cpu1/cf). This binary file is the one that Table Service Application, from cFE, uses to configure cFS applications. We can see in Figure 2.2 the scheme of the functioning of the cFE Table Service App. When the application receives a command, uses the configuration of the Table Service Library to carry out the command orders. As important factors we can see that all changes and actions carried out by Table Service are displayed in their Housekeeping packet and registered in a table registry. COSMOS Packet Viewer can be a good tool to see Housekeeping information (Figure 2.3) and have a control of what is happening in real time in Table Service App. And COSMOS Table Manager (Section 1.3.7) can be a good tool to see the record of all operations that have been carried out by the application, using as a default file the one named cfe_tbl_reg.txt. FIGURE 2.2: Scheme of the Table Service Application functioning. Due to its importance and the configuration capacity of a binary table, there is a protocol that must be followed before a cFS application can execute a binary table. If one of these tables was misconfigured, or had been generated by a C file with critical errors in the code, the resulting error could paralyze the entire mission. That is why the processing of each binary table must follow these 3 steps:
2.1. Table service configuration 19 FIGURE 2.3: Housekeeping of cFE Table Service App in COSMOS Packet Viewer. 1. Load Table. 2. Validate Table. 3. Activate Table. FIGURE 2.4: Load Binary Table sequence diagram. A user can load, validate and activate a binary table through cFE Table Service application, through cFS Table Management application and through COSMOS
20 Chapter 2. Introduction to cubeSAT missions Command Sender, pointing to target CFE_TBL. Although it can be done in three different ways, the result will be exactly the same. Besides this, we have to take into account that, when initializing the OpenSatKit and run the cFS, all the existing binary tables are loaded and validated. 2.2 SIMSAT mission example The purpose of this project is to configure an entire real satellite mission. Regardless of the peculiarity of each mission, OpenSatKit was made in order to reuse the different applications. This means that we can establish an outline with the basic steps that the vast majority of missions must follow. These basic steps can be summarized, in its simple expression, in 3 different steps: (Figure 2.5) FIGURE 2.5: Brief mission phases schematic. 1. Step 1: Establish app configuration. 2. Step 2: Collect Data. 3. Step 3: Download Data Collected. Step 1 can be performed before the launch or the start of the mission, or in any case with a connection between the satellite and the ground station. Most of the mission are steps 2 and 3, repeated until the end of the mission. OpenSatKit comes with aSimpleSat Reference Mission, a code file written in Ruby language, that provides the basic structure to properly configure these 3 steps. This code can be run with COSMOS Script Runner (Section 1.3.6), but we have to take into account that COSMOS simulates the ground station. So if we want a mission able to work regardless of ground connection, we need to configure with Table Service configuration. Then, we are going to analyze different configurations that we have to take into account if we want to comply with these steps.
2.2. SIMSAT mission example 21 2.2.1 Establishing the first app configuration Configure data collection directories The first important configuration we have to take into account is the creation of the file directories. These types of missions are designed with the objective of the information data collected by the satellite is saved in the form of different text files. We have to establish where the satellite saves information while is capturing it, and in which direction of the ground station it is downloaded. OpenSatKit system comes with a default directory configured. For the satellite files the directory is located in the same place where the binary tables (.tbl files) are. In this directory exists a folder named simsat, and inside it another folder called rec. There is where the recorded files by satellite instrument are saved. (Figure 2.6) For the ground station download destination the directory established is the following: (OpenSatKit/cosmos/cfs_kit/ground). Directories are not a fixed constants, it can be changed at any time, but it is good to set and fix a folder where you can go to find all the needed files. (Figure 2.6) FIGURE 2.6: Directory locations for information collected by satellite. These information files are generated by the science instrument or instruments located inboard of the satellite. This project is not focused on the different science instruments that a satellite can carry over, but for more information see Section 2.2.2. Verify cFS applications It is important to establish a first app configure before to star a mission, we must make sure that all applications work properly. All cFS applications has a default mechanism in order to verify if they are on and if they are working correctly. Through COSMOS Command Sender (Section 1.3.4) we can send a command that every application has: NOOP (No-Operation). This command does not execute any operation, just checks the correct functioning of the application. When an application receives a NOOP command, logs an event message to indicate that it is properly working. When we send a NOOP command we can check it in Event Message terminal (Figure 1.17), a message No-op command with the name of the application appears if is sent successfully.
22 Chapter 2. Introduction to cubeSAT missions Another way to check the NOOP verification is though Packet Viewer (Section 1.3.5). Every Housekeeping application has an important item in it called Application Command Counter. This item keep an account of the valid commands sent, if the NOOP command is sent successfully, the App Command Counter increases by one. FIGURE 2.7: No-operation command executed in Command Sender (left) and checked in Packet Viewer (right). A NOOP command can be sent at any moment of a mission, checking if the applications are running correctly, but is important to validate especially before starting the mission. Configure mission specific cFS applications Some cFS applications need to be configured depending on the type of mission we want to carry out, this is described in detail in Section 3. These applications has to be configured though Table Service configuration, and they must also be verified with the Section 2.2.1 process. 2.2.2 Science instrument (ISIM) configuration A crucial part of the much of the missions of a CubeSat is the data collection. Normally, a CubeSat is equipped with an instrument able to collect science data. In this project, all the flight software is build relying on a simulation, both ground station and satellite. In the case of the satellite science instrument, OpenSatKit provides a simulator called ISIM (Instrument Simulator) app. The purpose of ISIM app is to simulate a science instrument behaviour. It is able to create science data files, in (.txt) format, and moves them to downlink directory, specified in Section 2.2.1. ISIM has three different important aspects: Power instrument The power instrument can be switch on and switch off though POWER_ON and POWER_OFF commands. In order to be more realistic ISIM takes 20 seconds to power on. Because of that, it has 3 telemetry status: Off,Initializing and Ready. Some parameters that manages the ISIM behaviour can be configured through a specific table using the table service. For example, the number of cycles that Initializing state lasts is one of these parameters, that comes in 20 seconds by default.
2.2. SIMSAT mission example 23 Science Data Collector Besides power state of the instrument, ISIM has the Science Data Collector state, that indicates if the instrument is collecting data, and only has two telemetry status: Enabled and Disabled. Science Data Collector can be enabled with START command and disabled with STOP command. ISIM can only enable Sciencs Data Collector if the power instrument is in Ready state. Fault simulator At last, ISIM has a fault simulator. Fault has two different status: True and False. You can put a fault state into True with SET_FAULT command, and put into False with CLEAR_FAULT command. Data files generated during a FAULT condition are corrupted (have wrong data) until the FAULT condition is disabled. A FAULT condition can be registered in Data Storage (Section 1.5.4) and used as a turning point to act, using Limit Checker and Stored Command, as can be seen in Section 3.2.2. FIGURE 2.8: SIMSAT operations screen, from COSMOS Telemetry Viewer.
24 Chapter 2. Introduction to cubeSAT missions In Figure 2.8 we can see the SIMSAT operations screen, obtained from COSMOS Telemetry Viewer (Section 1.3.3). This screen is very useful to keep a basic control of everything that is happening in real time in our mission. If we focus on the top of the screen we can see the ISIM states. These states can be changed with commands sent through COSMOS Command Sender (Section 1.3.4). We can see an item called Sci Images. This item keeps a count of the files that ISIM creates, these files are the ones saved into the satellite directory (Figure 2.6). We can see more information in the screen of the Figure 2.8, and it is discussed in Section 3. 2.2.3 Ground pass contact The last part of a generic CubeSat mission configuration is the related to ground pass contact. For this we have to establish some concepts. The first one is the Area of Sight. We denominate Area of Sight the area where the satellite can establish a communication with the ground station (see Figure 2.9). When the satellite enters to this area we said that it reaches the Acquisition of Signal (AOS) point, and when the satellite leaves this area we said that it reaches the Lost of Signal (LOS) point. This project does not focus into the attitude and control operations that the satellite has to do inside the Area of Sight to point its communication antenna to the ground station. So we assume that while the satellite is in the Area of Sight it has connection to the ground station. FIGURE 2.9: Area of Sight illustrated concept. Download the information When the satellite reaches the AOS point it has to start downloading all the science data files stored in it. It is important to finish the downloading before reaching the LOS point, or the communication between satellite and ground station will be lost. Also it is important to remove from the satellite all the files correctly sent to the ground station. CubeSat On Board Computers (OBC) used to be very simple, so we
2.2. SIMSAT mission example 25 can not accumulate information from various turns. We need to start over with a clean state. Transfer protocols (TFTP and CFDP) There are so many protocols to download science data files from satellite to ground station, OpenSatKit comes with two different protocols: Trivial File Transfer Protocol and CCSDS File Delivery Protocol (TFTP and CFDP) (Section 1.5.4). Trivial File Transfer Protocol is the most generic one and requires less configuration. It has two principal commands: GET_FILE which copy a file from satellite to ground station, and PUT_FILE which copy a file from ground station to the satellite. We have to introduce the directory and the name of the file that we want to copy and the destination directory as parameters. This protocol does not have more default commands, so if we want to delete the copied files we need to do it though File Manager application (Section 1.5.4), with the command DELETE_ALL_FILES, and inserting the directory as a parameter. CCSDS File Delivery Protocol is defined by CCSDS standards (CCSDS, 2020a), and it is a transfer protocol specially oriented for use in a space ambit. Requires a bit more configuration, but a better result can be achieved. However, it needs Telemetry Output (KIT_TO) application (Section 1.5.3) to load a binary table with the configuration. All these different configurations are discussed and compared in Section 3.3.2.
3.2. Mission configuration approaches 33 ATS Table configuration Absolute Time Sequence stored commands are useful due their capacity to store a big amount of commands. Due this, it is a time sequence intended to be used only once, without repetitions of the same, it has not been designed so that it can call itself. However, it can call a RTS command, so using a ATS is a good method to start a mission, programming an absolute time when the mission must begin. In Apendix A.1 we have an example code of an absolute time sequence called "SC.ATS_TBL2". It is a command sequence that stars at Mission Elapsed Time 1002640 seconds, 30 seconds later sends a NOOP command in a ISIM application, 2 seconds later sends a power on instrument command to ISIM, 23 seconds after this sends a start science data command to ISIM, 65 seconds later sends a stop science data command to ISIM and 5 seconds later sends a power off instrument to ISIM. RTS Table configuration Relative Time Sequence stored commands have much more versatility, being able to start other RTS with commands. This is a very powerful ability that makes up for the small number of commands an RTS can hold. And an RTS can not only call another RTS, but can call itself as a last command, this action translates into a starting over, since the times between orders here are relative. (Figure 3.8) FIGURE 3.8: Diagram of an RTS concatenation example. Another interesting point of RTS is that, by no depending on an absolute initial time, can be called from another application at any time. However, as an optimization measure, RTS of commands has to be enabled before to start. There is a command called ENABLE_RTS that, entering the ID number can enable a RTS table, preparing it to be started with the START_RTS command. For greater comfort, and thinking about concatenations, there are ENABLE_RTS_GROUP and START_RTS_GROUP
34 Chapter 3. Configuration of the final mission commands, to enable and start a group of RTS at the same time. STOP_RTS and STOP_RTS_GROUP are commands that can be sent at any time with the objective of stop immediately one or more RTS. In Appendix A.2 we can see a C code used to configure an RTS command. This RTS is used when satellite reaches AOS point. We can see 4 commands points (CMD#_TIME) separated each for an interval of 2 seconds. 3.2.2 Limit checkers approach Base a mission configuration to time-tagged commands with SC app is very useful, and allows a large number of different commands within a single application, but it presents an important problem: we have to calculate the time steps with a very small margin of error. A mismatch of a few seconds can increase lap after lap and completely uncoordinate mission times. In the same way, an unexpected satellite movement can variate the orbit period of the lap for a few seconds, producing the same chain reaction. To not depend on commands separated by big time steps we can base our mission approach into limits checker. CFS has an application specially designed for this purpose: Limit Checker (Section 1.5.5). Limit Checker detects telemetry changes and it is able to start Relative Time Sequences, so this approach needs Stored Command and its time sequences, but the utility of LC allows to obtain more accurate results. FIGURE 3.9: LC application software context. Limit Checker has to be configured through Table Service configuration. As can be seen in Figure 3.9, there are two different types of definition Tables: Watchpoint Definition Tables (WDT) and Actionpoint Definiton Tables (ADT). In Limit Checker tables directory (OpenSatKit /cfs/apps/lc/fsw/tables) we can find two different type of C language files: a file to define watchpoints and a file to define actionpoints.
3.2. Mission configuration approaches 35 Figure 3.9 also shows us how Limit Checker is connected, through Software bus, to these mission-specific applications: •IN applications: Applications subscribed to LC packets and messages. – Stored Command (SC): Actions taken by LC as defined in the ADT are sent to the cFS Stored Command application, to initialize RTS. – Housekeeping (HK): Housekeeping and Telemetry Output are subscribed to Limit Checker in order to receive messages from it. •OUT applications: Applications that send Watchpoint packets and messages to LC by the Software Bus. – Scheduler (SCH): The Scheduler application sends housekeeping requests and periodic commands to evaluate Actionpoints states. – Command Ingest (CI): Command Ingest application is used to send the commands of the ground station. – Table Services (TBL): Table Services application is used to update new LC tables. In a similar way to Stored Command application (SC), there are Definition Table, files written in C language, and Results Tables, binary files generated through C files. Watch Points Definition Table configuration The Watch Points Table defines and configures all the Limit Checker watchpoints. A watchpoint reads an indicated telemetry data value and compares it with a predefined constant threshold limit. The comparison result can be: • True: if the comparison agree. • False: if the comparison does not agree. • Error: if the comparison can not be done. • Stale: if the comparison is done with a non actual telemetry value. FIGURE 3.10: Example of watchpoint definition programmed in C language. In Figure 3.10 we can see a watchpoint programmed in C language. We can see 8 different configuration parameters. The first one indicates the data type of the read
36 Chapter 3. Configuration of the final mission telemetry data. There are 12 different data types, in function of the number of bits (from 8 to 32) and the endianness (big endian and little endian). For this project we only need: • LC_DATA_UBYTE: for 8 bit unsigned byte. • LC_DATA_UWORD_LE: for 16 bit unsigned word, with little endian byte order. • LC_DATA_UDWORD_LE: for 32 bit unsigned double word, with little endian byte order. FIGURE 3.11: Big-endian example (left) and little-endian example (right). The OperatorID indicates which type of comparison the watchpoint makes. 3 types of comparisons can be made: • LC_OPER_GT: compares if the telemetry value read is greater than the predefined constant value. • LC_OPER_LT: compares if the telemetry value read is greater than the predefined constant value. • LC_OPER_EQ: compares if the telemetry value read is equal to the predefined constant value. All this information can be found through COSMOS Packet Viewer (Section 1.3.5), selecting an item and viewing its details. In Figure 3.12 we can see an example of a telemetry data that indicates if GPS of the 42 simulator is enabled. The MessageID is the hexadecimal message that indicates the telemetry packet that the command points to (the same that in Figure 3.6). WatchpointOffset is an important concept that indicates in which byte the telemetry information of the packet starts. In the example of the Figure 3.12 that information starts at bit 1824, this means byte 228, as indicated in Figure 3.10. ResultAgeWhenStale is the number of changes in telemetry data when the watchpoint comparison result becomes stale. The use of zero as this parameter results in bypassing the stale process for the watchpoint. (Smith, 2012)
3.2. Mission configuration approaches 37 ComparisonValue indicates the constant associated to the limit with which the telemetry data should be compared. CustomFuncArgument is an optional data that can be used for any mission-defined purpose, but is not used in a missions like the one of this project. However the BitMask is a very useful and important tool, that needs a separate study (see Section 3.2.2 BitMask uses). FIGURE 3.12: Exampe of telemetry data packet information used by LC watchpoint. Watchpoints for satellite GPS position Limit Checker application is a powerful tool to compare telemetry data, so we decide to compare the satellite GPS position (Longitude, Latitude and Altitude) with a constants set by us as limits. These limits are based on the calculation of the Section 3.1.2. If we locate our ground station in Terrassa, and we determine the Terrassa GPS position as: • Latitude: 41.563215o • Longitude: 2.008875o And we know that our Area of Sight has an angle of 20.5oin each direction we can have the following AOS point and LOS point limits: • Latitude: From 21.063215oto 62.063215o • Longitude: From -18.49125oto 22.508875o
38 Chapter 3. Configuration of the final mission Converted into radians: • Latitude: From 0.36762 rad to 1.08321 rad. • Longitude: From -0.32273 rad to 0.39285 rad. However, we have to take into account that GPS position, divided into 3 different telemetry items (LNG, LAT and ALT) does not come in housekeeping messages by default. We need to modify the tables relative to 42 simulator (osk_42_lib) in order to enable that I42 cFS application sends GPS position data by a data packet. BitMask uses If we configure I42 to send the GPS position we can have 3 different items into the SENSOR_DATA_PKT: LNG for the longitud, LAT for the latitude and ALT for the altitude. If we focus in every of this 3 data items, we can observe that they have a littleendian byte order, a float data type and, the most important characteristic: all of them are messages with a 64 bit size. This is a problem, because as we have seen before the existing data types that a watchpoint can read are compressed between 8 and 32. A watchpoint can not read float numbers of 64 bits length. Here is where bitmasks come into play. A bitmask is a binary data expressed with an hexadecimal format used to operate with a data in an AND (&) operation. AND operation takes two equal-length binary representations and multiply them. Thus, if both bits in the compared position are 1, the bit in the resulting binary representation is 1 (1 × 1 = 1); otherwise, the result is 0 (1 × 0 = 0 and 0 × 0 = 0). In order to be able to use 64 bits messages in watchpoint tables we are going to represent the GPS position telemetry information with IEEE 754 Standard. This standard is designed association IEEE (Institute of Electrical and Electronics Engineers) and is used to represent real numbers (floating point) in binary code. (Yashkardin, 2021) This standard, in 64 bits binary number, divide the number in 3 parts: •Sign bit: (1 bit) Indicating if the float number is positive or negative. •Offset exponent: (11 bits) Indicating the float number exponent. •Mantissa: (52 bits) Indicating the rest of the float number. This number division allows us to represent a very wide spectrum of numbers using 64 bits, in Figure 3.13 we can see an example, taking the following float number (-3.009999999) and representing it in binary code using IEEE 754 Standard, in 64 bits. Our objective is to compare two float numbers using the separations marked by IEEE 754 Standard. First of all, comparing the sign of each number, if the sign is different we automatically know that the negative number is smaller. If the sign is equal we compare the exponent, seeing which one is smaller than the other. And finally, if the sign and exponents are equal we can compare the rest of the numbers.
3.2. Mission configuration approaches 39 FIGURE 3.13: Float number into decimal using IEEE 754 Standard. (Grondin, 2021) Knowing this, we can divide the telemetry message into small packets that match the data types formats (8, 16 and 32 bits). For this we decided to split the message into a 16 bits packet, containing the sign bit, the exponent bits and the first 4 bits of the mantissa, and another 32 bits message and 16 bits message, containing the rest of the mantissa. We can see a graphic scheme of this division in Figure 3.14. FIGURE 3.14: Telemetry message divided into watchpoint analyzable packets. So we are going to analyze this 3 different packets apart (16 first bits, 32 mantissa bits and 16 mantissa bits). However we have to take into account that they are in little-endian format, which makes that the WatchpointOffset be inverted. In Figure 3.15 we can see the WatchpointOffset of every EEE 754 Standard group. In this case, where we are configuring watchpoints pointing to Longitude GPS telemetry data (LNG) we need to point into byte number 210 in a watchpoint 16 bytes data type. Now we just need to split the 16 first bits packet in order to differentiate the sign, the exponent and the 4 first bits of mantissa. To do that we need to use bitmasks.
40 Chapter 3. Configuration of the final mission FIGURE 3.15: WatchpointOffset byte for every EEE 754 Standard group for LNG telemetry item. To differentiate the sign bit, we need a bitmask with an hexadecimal value of 0x8000. This value, converted into binary format is a bit 1 followed by 15 zeros. If we "multiply" this number to the 16 first bits packet we are automatically converting into zero all the bits excepts the first one, that can be a 0 or an 1. If the result of the first bit is 1 we are going to know that the sign of the float number is negative. If the result of the first bit is 0 our float number is positive. A similar method is used for the 11 bits of the exponent, using an hexadecimal value of 0x7FF0 as a bitmask, that converts automatically into 0 the first and the last 4 bits. And 0x000F to identify the last 4 bits of the mantissa. In Appendix A.4 we can see an example of watchpoint definitions code with C language. In this example longitude data of the I42 (LNG) are readed, and compared with 2 different values, named Enter AOS (-3.1299) and Leave AOS (-3.0099). To do that 8 different watchpoints have been created: •Watchpoint #1: Compares the sign of the float number, looking at the 16 first bits packet, with a bitmask of 0x8000. It will be true if the value is greater than 0x0000 (true if it is 0x8000: negative). •Watchpoint #2: Compares the exponent bits, looking at the 16 first bits packet, with a bitmask of 0x7FF0. It will be true if the value is equal to 0x4000 (true if exponential is 0). •Watchpoint #3: Compares the 4 first mantissa bits, looking at the 16 first bits packet, with a bitmask of 0x000F. It will be true if the value is lower than 0x000A, the equivalent of the 4 first mantissa bits of 3.1299 (we know that float number is negative, so a lower value of the mantissa implies a greater float number).
3.2. Mission configuration approaches 41 •Watchpoint #4: Compares the rest of the mantissa bits, looking at the 32 mantissa bits packet. Uses the same logic than in Watchpoint #3, being true if the binary value is small that the equivalent to 3.1299. The Watchpoints number #5, #6, #7 and #8 follow the same logic but comparing with (-3.0099) float number. We must emphasize that in this example the 16 mantissa bits packet it is not used. This is because the GPS telemetry information changes so fast than being so much accurate is counterproductive. We just need to compare the 32 first mantissa bits to obtain a correct value, the last 16 bits change too fast and without a clear reference. Action Points Definition Table configuration The Action Points Table defines and configures all the Limit Checker actionpoints. An actionpoint defines the equations used to evaluate watchpoint states and the actions to be taken, like start an RTS command. Actionpoints have 4 different states: • Pass: If the result of the watchpoints evaluation is False. • Fail: If the result of the watchpoints evaluation is True. • Error: If the watchpoints evaluation can not be done. • Stale: If the result of the watchpoints evaluation is is done with a non actual telemetry value. It can be a bit counter-intuitive, but has to be clear that a True result in a watchpoints evaluation results into a Fail actionpoint state, and in the same way a False result in a watchpoints evaluation results into a Pass actionpoint state. Actionpoints starts RTS in a Fail state. We can see, in Figure 3.16, the different parameters needed to define an actionpoint: FIGURE 3.16: Example of actionpoint definition programmed in C language. The first characteristic, DefaultState, indicates the default state of the action point, it can be Unused, Active, Passive, Disabled or Permanently off. An actionpoint with
42 Chapter 3. Configuration of the final mission a Passive state evalues watchpoint states, but does not perform any action. The MaxPassiveEvent indicates the maximum number of events before filter RTS not started because actionpoint is passive. The MaxPassToFailEvents indicates the maximum number of events before filter actionpoint result transition from pass to fail. And the MaxFailToPassEvents indicates the maximum number of events before filter actionpoint result transition from fail to pass. A zero value disable these options. In the case of the Figure 3.16 we can see that we only have a 1 in MaxPassTo- FailEvents, this means that we only need a True evaluation result to consider the state from Pass to Fail. The RTSId indicates the ID of the RTS that actionpoint are going to execute if the result of the corresponding watchpoint evaluation is True. It is important to notice that this RTS has to be previously enabled. (Section 3.2.1) MaxFailBeforeRTS indicates how many times in a row the watchpoints evaluation must be True to start an RTS. This avoids isolated incorrect results, in the Figure 3.16 we can see how the limit needs to be broken 5 times in a row to start the RTS. The EventType is the type of message that are going to show if the actionpoint state becomes Fail. It can be Informational, Debug, Error or Critical. In the same way, the EventID is the ID of the event message showed if the actionpoint state becomes Fail, and the EventText is the message itself. The RPNEquation is the equation used for the evaluation of the watchpoints. The actionpoints operators are AND, OR, XOR, NOT, and EQUAL. The watchpoints evaluation are made with equations expressed in Reverse Polish Notation (RPN), also known as postfix notation. (Smith, 2012) For example, in the case of Figure 3.16 we have an evaluation (0, 1, 2, 3, 4, AND, AND, AND, AND, EQUAL). This results in the following steps: • Step 1: The result from the operation AND between watchpoint #0 and watchpoint #1. • Step 2: The result from from the operation AND between Step 1 and watchpoint #2. • Step 3: The result from from the operation AND between Step 2 and watchpoint #3. • Step 4: The result from from the operation AND between Step 2 and watchpoint #4. • Step 5: Compare the results from Step 4 to TRUE. • Equation result: The result from Step 5. In Appendix A.5 we can see an actionpoints definition code, write in C language. This code uses the watchpoints defined in Appendix A.4 to evaluate them and decided when the satellite is inside the Area of Sight and when not.
49 Appendix A Table Configuration codes A.1 Stored Command ATS code with C language 1 2#include " cfe . h" 3#include " c f e_ t b l_ f il e def . h" 4 5#include "sc_platform_cfg.h" /*defines table buffer size */ 6#include " sc_msgdefs . h" /*defines SC command code values */ 7#include " sc_msgids . h" /*defines SC packet msg ID ’ s */ 8 9 10 /* 11 ** Arbitrary spacecraft time for s t a r t of sample ATS 12 */ 13 #define TEST_TIME 1002640 14 15 /* 16 ** Execution time for each sample command 17 */ 18 #define CMD1_TIME (TEST_TIME + 30) 19 #define CMD2_TIME (TEST_TIME + 32) 20 #define CMD3_TIME (TEST_TIME + 55) 21 #define CMD4_TIME (TEST_TIME + 120) 22 #define CMD5_TIME (TEST_TIME + 125) 23 24 /* 25 ** Create execution time as two 16 bit values 26 */ 27 #define CMD1_TIME_A (( uint16 ) ( ( uint32 ) CMD1_TIME >> 16) ) 28 #define CMD2_TIME_A (( uint16 ) ( ( uint32 ) CMD2_TIME >> 16) ) 29 #define CMD3_TIME_A (( uint16 ) ( ( uint32 ) CMD3_TIME >> 16) ) 30 #define CMD4_TIME_A (( uint16 ) ( ( uint32 ) CMD4_TIME >> 16) ) 31 #define CMD5_TIME_A (( uint16 ) ( ( uint32 ) CMD5_TIME >> 16) ) 32 33 #define CMD1_TIME_B ( ( uint16 ) ( ( uint32 ) CMD1_TIME) ) 34 #define CMD2_TIME_B ( ( uint16 ) ( ( uint32 ) CMD2_TIME) ) 35 #define CMD3_TIME_B ( ( uint16 ) ( ( uint32 ) CMD3_TIME) ) 36 #define CMD4_TIME_B ( ( uint16 ) ( ( uint32 ) CMD4_TIME) ) 37 #define CMD5_TIME_B ( ( uint16 ) ( ( uint32 ) CMD5_TIME) ) 38 39 /* 40 /** Define function codes ( not found in . [ hc ] sources 41 */ 42 #define ISIM_NOOP 0x00 43 #define ISIM_PON_INST 0x04 44 #define ISIM_POF_INST 0x05 45 #define ISIM_START_SCI_DATA 0x07 46 #define ISIM_STOP_SCI_DATA 0x08
50 Appendix A. Table Configuration codes 47 48 /* 49 *Define ISIM labels 50 */ 51 #define ISIM_CMD_MID 0x19C0 52 53 /* 54 ** Calculate checksum for each sample command 55 */ 56 #define CMD1_XSUM 0x00E7 57 #define CMD2_XSUM 0x00E3 58 #define CMD3_XSUM 0x00E0 59 #define CMD4_XSUM 0x00EF 60 #define CMD5_XSUM 0x00E2 61 62 /* 63 ** Optional command data values 64 */ 65 #define CMD2_ARG 1 66 #define CMD3_ARG 1 67 68 69 /* 70 ** Command packet segment flags and sequence counter 71 ** − 2 bits of segment flags (0 xC000 = start and end of packet ) 72 ** − 14 bi ts of sequence count ( unused for command packets ) 73 */ 74 #define PKT_FLAGS 0xC000 75 76 77 /* 78 ** Length of cmd pkt data ( in bytes minus one ) that follows primary header ( thus , 0xFFFF = 64k) 79 */ 80 #define CMD1_LENGTH 1 81 #define CMD2_LENGTH 1 82 #define CMD3_LENGTH 1 83 #define CMD4_LENGTH 1 84 #define CMD5_LENGTH 1 85 86 /* 87 ** Sample ATS_TBL1 Table Header 88 */ 89 static CFE_TBL_FileDef_t CFE_TBL_FileDef __attribute__ ( ( __used__ ) ) = 90 { 91 "ATS_Table2" ,"SC. ATS_TBL2" ,"SC ISIM ATS_TBL2" , 92 " sc_ats2 . tbl " , (SC_ATS_BUFF_SIZE *sizeof(uint16)) 93 } ; 94 95 96 /* 97 ** Sample ATS_TBL1 Table Data 98 */ 99 uint16 ATS_Table2 [SC_ATS_BUFF_SIZE] = 100 { 101 /*cmd num, <−−−− cmd exe time −−−−> <−−−−−−−−−−−−−−−−−−−−−−−−−−−− cmd pkt primary header −−−−−−−−−−−−−−−−−−−−−−−−−−−−> <−−−−− cmd pkt 2nd header −−−−> <−− opt data −−−> */ 102 1 , CMD1_TIME_B, CMD1_TIME_A, CFE_MAKE_BIG16(ISIM_CMD_MID) , CFE_MAKE_BIG16(PKT_FLAGS) , CFE_MAKE_BIG16(CMD1_LENGTH) , ( (ISIM_NOOP << 8) | CMD1_XSUM) ,
A.2. Stored Command RTS050 code with C language 51 103 2 , CMD2_TIME_B, CMD2_TIME_A, CFE_MAKE_BIG16(ISIM_CMD_MID) , CFE_MAKE_BIG16(PKT_FLAGS) , CFE_MAKE_BIG16(CMD2_LENGTH) , ( ( ISIM_PON_INST << 8) | CMD2_XSUM) , 104 3 , CMD3_TIME_B, CMD3_TIME_A, CFE_MAKE_BIG16(ISIM_CMD_MID) , CFE_MAKE_BIG16(PKT_FLAGS) , CFE_MAKE_BIG16(CMD3_LENGTH) , ( ( ISIM_START_SCI_DATA << 8) | CMD3_XSUM) , 105 4 , CMD4_TIME_B, CMD4_TIME_A, CFE_MAKE_BIG16(ISIM_CMD_MID) , CFE_MAKE_BIG16(PKT_FLAGS) , CFE_MAKE_BIG16(CMD4_LENGTH) , ( ( ISIM_STOP_SCI_DATA << 8) | CMD4_XSUM) , 106 5 , CMD5_TIME_B, CMD5_TIME_A, CFE_MAKE_BIG16(ISIM_CMD_MID) , CFE_MAKE_BIG16(PKT_FLAGS) , CFE_MAKE_BIG16(CMD5_LENGTH) , ( ( ISIM_POF_INST << 8) | CMD5_XSUM) , 107 0 , 0 , 0 , 0 , 0 , 0 , 0 108 } ; 109 110 /************************/ 111 /*End of File Comment */ 112 /************************/ A.2 Stored Command RTS050 code with C language 1/************************************************************************ 2** OSK Placeholder 3** This RTS is gonna execute when S a t e l l i t e enters Area Of Sight ( reaches AOS point ) 4*************************************************************************/ 5 6#include " cfe . h" 7#include " c f e_ t b l_ f il e def . h" 8 9#include "sc_platform_cfg.h" /*defines table buffer size */ 10 #include " sc_msgdefs . h" /*defines SC command code values */ 11 #include " sc_msgids . h" /*defines SC packet msg ID ’ s */ 12 13 #include " s c_t ft p . h" 14 15 /* 16 ** Execution time for each sample command 17 */ 18 #define CMD1_TIME 2 19 #define CMD2_TIME 2 20 #define CMD3_TIME 2 21 #define CMD4_TIME 2 22 23 24 /* 25 ** Sample cFE Table Header 26 */ 27 static CFE_TBL_FileDef_t CFE_TBL_FileDef __attribute__ ( ( __used__ ) ) = 28 { 29 "RTS_Table050" ,"SC. RTS_TBL050" ,"SC Sample RTS_TBL050" , 30 " sc_rts050 . tbl " , (SC_RTS_BUFF_SIZE *sizeof(uint16)) 31 } ; 32 33 34 /* 35 ** Sample RTS Table Data 36 */ 37 uint16 RTS_Table050 [SC_RTS_BUFF_SIZE] = 38 {
52 Appendix A. Table Configuration codes 39 /*cmd time , <−−−−−−−−−−−−−−−−−−−−−−−−−−−− cmd pkt primary header −−−−−−−−−−−−−−−−−−−−−−−−−−−−> <−−−−− cmd pkt 2nd header −−−−> <−− opt data −−−> */ 40 CMD1_TIME, CFE_MAKE_BIG16(0 x18BB ) , CFE_MAKE_BIG16(0 xC000 ) , CFE_MAKE_BIG16(0 x0005 ) , CFE_MAKE_BIG16(0 x9B02 ) , 0 , 0 , 41 CMD2_TIME, CFE_MAKE_BIG16(0 x19C0 ) , CFE_MAKE_BIG16(0 xC000 ) , CFE_MAKE_BIG16(0 x0001 ) , CFE_MAKE_BIG16(0 xE205 ) , 42 CMD3_TIME, CFE_MAKE_BIG16(0 x19C0 ) , CFE_MAKE_BIG16(0 xC000 ) , CFE_MAKE_BIG16(0 x0001 ) , CFE_MAKE_BIG16(0 xEF08 ) , 43 CMD4_TIME, CFE_MAKE_BIG16(0 x18B3 ) , CFE_MAKE_BIG16(0 xC000 ) , CFE_MAKE_BIG16(0 x0095 ) , CFE_MAKE_BIG16(0 x2703 ) , CFE_MAKE_BIG16(0 x0200 ) , CFE_MAKE_BIG16(0 x0000 ) , CFE_MAKE_BIG16(0 x302E ) , CFE_MAKE_BIG16(0 x3231 ) , 0 , 0 , 0 , 0 , 0 , 0 , CFE_MAKE_BIG16(0 x2F63 ) , CFE_MAKE_BIG16(0 x662F ) , CFE_MAKE_BIG16(0 x7369 ) , CFE_MAKE_BIG16(0x6D73 ) , CFE_MAKE_BIG16(0 x6174 ) , CFE_MAKE_BIG16(0 x2F72 ) , CFE_MAKE_BIG16(0 x6563 ) , CFE_MAKE_BIG16(0 x2F00 ) , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , CFE_MAKE_BIG16(0 x6366 ) , CFE_MAKE_BIG16(0 x735F ) , CFE_MAKE_BIG16(0 x6B69 ) , CFE_MAKE_BIG16(0 x742F ) , CFE_MAKE_BIG16(0 x6772 ) , CFE_MAKE_BIG16 (0 x6F75 ) , CFE_MAKE_BIG16(0 x6E64 ) , CFE_MAKE_BIG16(0 x2F00 ) , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 44 } ; 45 46 /************************/ 47 /*Description of the execution of this RTS 48 49 CMD1_TIME: Disable APP_STATE 50 CMD2_TIME: ISIM Science OFF 51 CMD3_TIME: ISIM Power OFF 52 CMD4_TIME: Start Downland f i l e s from SAT ’/ cf/simsat/rec /’ to GND ’ cfs _kit/ground/’ 53 54 */ 55 /************************/ A.3 Stored Command RTS049 code with C language 1 2/************************************************************************ 3** OSK Placeholder 4** This RTS is gonna execute when S a t e l l i t e ex its Area Of Sight ( reaches LOS point ) 5*************************************************************************/ 6 7#include " cfe . h" 8#include " c f e_ t b l_ f il e def . h" 9 10 #include "sc_platform_cfg.h" /*defines table buffer size */ 11 #include " sc_msgdefs . h" /*defines SC command code values */ 12 #include " sc_msgids . h" /*defines SC packet msg ID ’ s */ 13 14 #include " s c_t ft p . h" 15 16 /* 17 ** Execution time for each sample command 18 */ 19 #define CMD1_TIME 0 20 #define CMD2_TIME 10 21 #define CMD3_TIME 1 22 #define CMD4_TIME 21 23 #define CMD5_TIME 2
A.3. Stored Command RTS049 code with C language 53 24 #define CMD6_TIME 2 25 #define CMD7_TIME 2 26 27 /* 28 ** Sample cFE Table Header 29 */ 30 static CFE_TBL_FileDef_t CFE_TBL_FileDef __attribute__ ( ( __used__ ) ) = 31 { 32 "RTS_Table049" ,"SC. RTS_TBL049" ,"SC Sample RTS_TBL049" , 33 " sc_rts049 . tbl " , (SC_RTS_BUFF_SIZE *sizeof(uint16)) 34 } ; 35 36 37 /* 38 ** Sample RTS Table Data 39 */ 40 uint16 RTS_Table049 [SC_RTS_BUFF_SIZE] = 41 { 42 /*cmd time , <−−−−−−−−−−−−−−−−−−−−−−−−−−−− cmd pkt primary header −−−−−−−−−−−−−−−−−−−−−−−−−−−−> <−−−−− cmd pkt 2nd header −−−−> <−− opt data −−−> */ 43 CMD1_TIME, CFE_MAKE_BIG16(0 x18BB ) , CFE_MAKE_BIG16(0 xC000 ) , CFE_MAKE_BIG16(0 x0005 ) , CFE_MAKE_BIG16(0x9A02) , CFE_MAKE_BIG16(0 x0100 ) , CFE_MAKE_BIG16(0 x0000 ) , 44 CMD2_TIME, CFE_MAKE_BIG16(0 x18BB ) , CFE_MAKE_BIG16(0 xC000 ) , CFE_MAKE_BIG16(0 x0005 ) , CFE_MAKE_BIG16(0 x9F07 ) , CFE_MAKE_BIG16(0 x0000 ) , CFE_MAKE_BIG16(0 x0100 ) , 45 CMD3_TIME, CFE_MAKE_BIG16(0 x19C0 ) , CFE_MAKE_BIG16(0 xC000 ) , CFE_MAKE_BIG16(0 x0001 ) , CFE_MAKE_BIG16(0 xE304 ) , 46 CMD4_TIME, CFE_MAKE_BIG16(0 x19C0 ) , CFE_MAKE_BIG16(0 xC000 ) , CFE_MAKE_BIG16(0 x0001 ) , CFE_MAKE_BIG16(0 xE007 ) , 47 /*CMD5_TIME, CFE_MAKE_BIG16(0 x18BB ) , CFE_MAKE_BIG16(0 xC000 ) , CFE_MAKE_BIG16(0 x0005 ) , CFE_MAKE_BIG16(0 x9907 ) , CFE_MAKE_BIG16(0 x0600 ) , CFE_MAKE_BIG16(0 x0000 ) , 48 CMD6_TIME, CFE_MAKE_BIG16(0 x18BB ) , CFE_MAKE_BIG16(0 xC000 ) , CFE_MAKE_BIG16(0 x0001 ) , CFE_MAKE_BIG16(0 x920F ) , 49 CMD7_TIME, CFE_MAKE_BIG16(0 x188C ) , CFE_MAKE_BIG16(0 xC000 ) , CFE_MAKE_BIG16(0 x0049 ) , CFE_MAKE_BIG16(0xA20F) , CFE_MAKE_BIG16(0 x2F63 ) , CFE_MAKE_BIG16(0 x662F ) , CFE_MAKE_BIG16(0 x7369 ) , CFE_MAKE_BIG16(0x6D73 ) , CFE_MAKE_BIG16(0 x6174 ) , CFE_MAKE_BIG16(0 x2F72 ) , CFE_MAKE_BIG16(0 x6563 ) , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 */ 50 51 } ; 52 53 /************************/ 54 /*Description of the execution of this RTS 55 56 CMD1_TIME: DS SET_APP_STATE 57 CMD2_TIME: DS SET_FILE_STATE with TBL_IDX 1 ( Enables Event messages . dat ) 58 CMD3_TIME: ISIM Power ON 59 CMD4_TIME: ISIM Science ON 60 61 CMD5_TIME: DS SET_FILE_STATE with TBL_IDX 6 ( Enables Combo pkt 2 of HK . dat ) 62 CMD6_TIME: DS SEND_FILE_INFO 63 CMD7_TIME: FM SEND_DIR_PKT to SAT 64 65 */ 66 /************************/
54 Appendix A. Table Configuration codes A.4 Limit Checker Watchpoint definition code with C language 1 2/************************************************************************* 3** Exported Data 4*************************************************************************/ 5/* 6** Table f i l e header 7*/ 8static CFE_TBL_FileDef_t CFE_TBL_FileDef __attribute__ ( ( __used__ ) ) = 9{ 10 "LC_DefaultWDT" , LC_APP_NAME " . " LC_WDT_TABLENAME, 11 "LC watchpoint definition table " ," lc_def_wdt . tbl " , 12 (sizeof(LC_WDTEntry_t) *LC_MAX_WATCHPOINTS) 13 } ; 14 15 /* 16 ** Default watchpoint definition table (WDT) data 17 */ 18 LC_WDTEntry_t LC_DefaultWDT[LC_MAX_WATCHPOINTS] = 19 { 20 /*#0 ( I42 simulator GPS Enabled ) */ 21 { 22 . DataType = LC_DATA_UBYTE, 23 . OperatorID = LC_OPER_EQ, 24 . MessageID = 0x09E1 , 25 . WatchpointOffset = 228 , 26 . BitMask = LC_NO_BITMASK, 27 . CustomFuncArgument = 0 , 28 . ResultAgeWhenStale = 0 , 29 . ComparisonValue . Unsigned8 = 1 , 30 } , 31 32 /*#1 ( I42 LNG Sign Comparison [ −] Enter AOS) */ 33 { 34 . DataType = LC_DATA_UWORD_LE, 35 . OperatorID = LC_OPER_GT, 36 . MessageID = 0x09E1 , 37 . WatchpointOffset = 210 , 38 . BitMask = 0x8000 , 39 . CustomFuncArgument = 0 , 40 . ResultAgeWhenStale = 0 , 41 . ComparisonValue . Unsigned16 = 0x0000 , 42 } , 43 44 /*#2 ( I42 LNG Exponent Comparison [E0] Enter AOS) */ 45 { 46 . DataType = LC_DATA_UWORD_LE, 47 . OperatorID = LC_OPER_EQ, 48 . MessageID = 0x09E1 , 49 . WatchpointOffset = 210 , 50 . BitMask = 0x7FF0 , 51 . CustomFuncArgument = 0 , 52 . ResultAgeWhenStale = 0 , 53 . ComparisonValue . Unsigned16 = 0x4000 , 54 } , 55 56 /*#3 ( I42 LNG 4 f i r s t mantissa b its Comparison [ <3.1299] Enter AOS) */ 57 {
A.4. Limit Checker Watchpoint definition code with C language 55 58 . DataType = LC_DATA_UWORD_LE, 59 . OperatorID = LC_OPER_LT, 60 . MessageID = 0x09E1 , 61 . WatchpointOffset = 210 , 62 . BitMask = 0x000F , 63 . CustomFuncArgument = 0 , 64 . ResultAgeWhenStale = 0 , 65 . ComparisonValue . Unsigned16 = 0x000A , 66 } , 67 68 /*#4 ( I42 LNG 32 mantissa bits Comparison [ <3.1299] Enter AOS) */ 69 { 70 . DataType = LC_DATA_UDWORD_LE, 71 . OperatorID = LC_OPER_LT, 72 . MessageID = 0x09E1 , 73 . WatchpointOffset = 206 , 74 . BitMask = LC_NO_BITMASK, 75 . CustomFuncArgument = 0 , 76 . ResultAgeWhenStale = 0 , 77 . ComparisonValue . Unsigned32 = 0x0A3D70A3 , 78 } , 79 80 /*#5 ( I42 LNG Sign Comparison [ −] Leave AOS) */ 81 { 82 . DataType = LC_DATA_UWORD_LE, 83 . OperatorID = LC_OPER_GT, 84 . MessageID = 0x09E1 , 85 . WatchpointOffset = 210 , 86 . BitMask = 0x8000 , 87 . CustomFuncArgument = 0 , 88 . ResultAgeWhenStale = 0 , 89 . ComparisonValue . Unsigned16 = 0x0000 , 90 } , 91 92 /*#6 ( I42 LNG Exponent Comparison [E0] Leave AOS) */ 93 { 94 . DataType = LC_DATA_UWORD_LE, 95 . OperatorID = LC_OPER_EQ, 96 . MessageID = 0x09E1 , 97 . WatchpointOffset = 210 , 98 . BitMask = 0x7FF0 , 99 . CustomFuncArgument = 0 , 100 . ResultAgeWhenStale = 0 , 101 . ComparisonValue . Unsigned16 = 0x4000 , 102 } , 103 104 /*#7 ( I42 LNG 4 f i r s t mantissa b its Comparison [ <3.0099] Leave AOS) */ 105 { 106 . DataType = LC_DATA_UWORD_LE, 107 . OperatorID = LC_OPER_LT, 108 . MessageID = 0x09E1 , 109 . WatchpointOffset = 210 , 110 . BitMask = 0x000F , 111 . CustomFuncArgument = 0 , 112 . ResultAgeWhenStale = 0 , 113 . ComparisonValue . Unsigned16 = 0x0009 , 114 } , 115 116 /*#8 ( I42 LNG 32 mantissa bits Comparison [ <3.0099] Leave AOS) */ 117 { 118 . DataType = LC_DATA_UDWORD_LE, 119 . OperatorID = LC_OPER_LT,
56 Appendix A. Table Configuration codes 120 . MessageID = 0x09E1 , 121 . WatchpointOffset = 206 , 122 . BitMask = LC_NO_BITMASK, 123 . CustomFuncArgument = 0 , 124 . ResultAgeWhenStale = 0 , 125 . ComparisonValue . Unsigned32 = 0x147AE147 , 126 } 127 } ; /*end LC_DefaultWDT */ 128 129 /************************/ 130 /*End of File Comment */ 131 /************************/ A.5 Limit Checker Actionpoint definition code with C language 1/************************************************************************* 2** Exported Data 3*************************************************************************/ 4/* 5** Table f i l e header 6*/ 7static CFE_TBL_FileDef_t CFE_TBL_FileDef __attribute__ ( ( __used__ ) ) = 8{ 9"LC_DefaultADT" , LC_APP_NAME " . " LC_ADT_TABLENAME, 10 "LC actionpoint definition table " ," lc_def_adt . tbl " , 11 (sizeof(LC_ADTEntry_t) *LC_MAX_ACTIONPOINTS) 12 } ; 13 14 /* 15 ** Default actionpoint definition table (ADT) data 16 */ 17 LC_ADTEntry_t LC_DefaultADT [LC_MAX_ACTIONPOINTS] = 18 { 19 /*#0 ( I42 : Leaving AOS area ) */ 20 { . DefaultState = LC_APSTATE_ACTIVE, 21 .MaxPassiveEvents = 0, 22 .MaxPassFailEvents = 1, 23 .MaxFailPassEvents = 0, 24 . RTSId = 49 , 25 .MaxFailsBeforeRTS = 5, 26 . EventType = CFE_EVS_INFORMATION, 27 . EventID = LC_BASE_AP_EID + 0 , 28 . EventText = { " Leaving AOS area " } , 29 .RPNEquation = { /*(WP_0) */ 30 0 , 1 , 2 , 3 , 4 , 31 LC_RPN_AND, 32 LC_RPN_AND, 33 LC_RPN_AND, 34 LC_RPN_AND, 35 LC_RPN_EQUAL 36 } 37 } , 38 39 /*#1 ( I42 : Entering AOS area ) */ 40 { . DefaultState = LC_APSTATE_ACTIVE, 41 .MaxPassiveEvents = 0, 42 .MaxPassFailEvents = 1, 43 .MaxFailPassEvents = 0, 44 . RTSId = 50 ,
A.5. Limit Checker Actionpoint definition code with C language 57 45 .MaxFailsBeforeRTS = 5, 46 . EventType = CFE_EVS_INFORMATION, 47 . EventID = LC_BASE_AP_EID + 0 , 48 . EventText = { " Entering AOS area " } , 49 .RPNEquation = { /*(WP_0) */ 50 0 , 5 , 6 , 7 , 8 , 51 LC_RPN_AND, 52 LC_RPN_AND, 53 LC_RPN_AND, 54 LC_RPN_AND, 55 LC_RPN_EQUAL 56 } 57 } 58 } ; /*end LC_DefaultADT */ 59 60 /************************/ 61 /*End of File Comment */ 62 /************************/