Simorgh Flight Software
General Introduction:
This project is a complete and professional simulator for the central computer of a CubeSat. In other words, it is the brain that controls all satellite operations in space. This software is written as if it were actually going to be mounted on a real satellite and operate in Earth's orbit. The version you see here is the third and most advanced version. Many new and complex features have been added that are used in real, professional satellites.
Software Components:
1. Attitude Determination and Control System (ADCS)
This section is responsible for knowing where the satellite is in space and which direction it is pointing. Then, if it is misaligned, it corrects the attitude.
Simulated Sensors:
- Gyroscope: Measures the satellite's rotation rate. Our model includes noise and error to be more realistic.
- Sun Sensor: Detects the direction of the sun. When the satellite goes into Earth's shadow, this sensor becomes blind (just like in reality).
- Magnetometer: Measures Earth's magnetic field and uses it for orientation.
- Star Tracker: A camera that sees stars and compares them with a star map to determine the satellite's attitude with very high accuracy (less than 0.01 degrees).
Sensor Data Processing:
We use an advanced 7-state Extended Kalman Filter (EKF). This filter combines data from all sensors and provides a very accurate estimate of the satellite's attitude. Even if one sensor fails or has noise, the system still outputs the correct result.
Actuators (Devices that rotate the satellite):
- 4 Reaction Wheels: Similar to a toy gyroscope. When they spin, they rotate the satellite in the opposite direction. Our controller is an LQR (Linear Quadratic Regulator), which is a highly optimal mathematical method for attitude control. It achieves the fastest and smoothest rotation with minimal energy consumption.
- 3 Magnetorquers: These are electromagnets that interact with Earth's magnetic field to cancel out excess torque from the wheels. This prevents the wheels from saturating.
Operational Modes:
- Detumbling: When the satellite first separates from the rocket, it is usually tumbling. This mode dampens the rotation.
- Sun Acquisition: The satellite rotates to point its solar panels at the sun to charge the battery.
- Earth Pointing: The normal mode where the camera points toward Earth and takes pictures.
2. Propulsion System
Our satellite has 8 cold gas thrusters. These thrusters move the satellite by expelling compressed gas (e.g., nitrogen).
Propulsion Model Features:
- Tank Pressure Calculation: Tank pressure is calculated based on tank temperature and remaining gas.
- Fuel Consumption Calculation: Each time a thruster fires, the amount of gas expelled is calculated using the specific impulse equation.
- Orbital Delta-V: We can command the satellite from the ground to perform maneuvers and change its orbit by firing the appropriate thrusters.
3. Power Management System
This section acts like a precise accountant. It ensures that there is always enough power and that the battery never drains completely.
Solar Panels:
- Our model calculates the effect of the sun incidence angle. If the sun shines at an oblique angle, less power is generated.
- Temperature effects are also considered. A hot panel has lower efficiency.
- When the satellite goes into Earth's shadow, panel power drops to nearly zero.
Battery:
- A simple chemical model of a Lithium-Ion battery is implemented.
- Charge and discharge current is calculated based on the difference between generated and consumed power.
- Battery voltage changes non-linearly.
- Battery temperature affects its performance.
Load Management:
- If battery voltage drops below a certain threshold, non-essential subsystems (e.g., the camera) are automatically turned off.
- If the situation becomes critical, the satellite enters safe mode and only performs vital functions.
4. Thermal Control System
Space is a place of extreme cold and heat. The side facing the sun can reach 120 degrees Celsius, while the side in shadow can reach -100 degrees Celsius.
Thermal Network:
We divided the satellite into 10 thermal nodes (e.g., battery node, processor node, panel node, etc.). Each node has a heat capacity (how much heat it retains), and there is thermal resistance between nodes (how much heat transfers from one to another).
Heaters:
We have three electric heaters:
- Battery Heater: Turns on below 5 degrees Celsius, turns off above 10 degrees Celsius.
- Gyroscope Heater: The gyroscope needs a constant temperature for accuracy.
- Radio Heater: The radio does not operate properly in extreme cold.
5. Communications System
This section is responsible for the satellite's communication with the ground station.
Physical Layer (Radio):
The AX.25 protocol is used, which is a standard for amateur satellite communications. Data packets are encapsulated in frames with specific start and end bytes, and a 16-bit CRC code is added for error detection.
Telemetry Encapsulation:
Data sent from the satellite to the ground (e.g., battery voltage, temperatures, satellite status) is packaged according to the CCSDS standard. This standard is used by NASA and the European Space Agency.
File Transfer:
For sending large images and scientific data, we use the CFDP (CCSDS File Delivery Protocol) Class 2. This protocol ensures that the file arrives completely and without errors. If the transmission is interrupted, it will resume sending the remainder of the file later.
Encryption:
All sensitive commands and telemetry are encrypted using the AES-256 algorithm in GCM mode. This means:
- No one can eavesdrop on commands.
- No one can send fake commands.
- No one can tamper with the data.
Beacon:
The satellite sends a short status message every 60 seconds, containing its general status: "I am alive, my battery is at X level, I am in Y mode."
6. Orbit and Navigation
SGP4 Propagator:
This is a very accurate mathematical model for predicting the satellite's position in orbit. We use a TLE (Two-Line Element) file, the same type that NASA publishes for all satellites. This model accounts for the following effects:
- Earth's oblateness (Earth is not perfectly spherical, it is slightly flattened)
- Atmospheric drag (at 500 km altitude, there is still some atmosphere)
- Solar radiation pressure (sunlight exerts a very small pressure)
GPS:
We have a simulated GPS receiver that provides position with accuracy of a few meters and time with microsecond accuracy. This time is used to synchronize the satellite's internal clock.
7. Fault Tolerance and Safety
In space, cosmic radiation can flip bits in memory (a zero becomes a one). This means the satellite's code could suddenly change and malfunction.
Error Detection and Correction (EDAC) Memory:
For every 32-bit word, we store an additional 7 bits. If a single bit flips, the system detects it and automatically corrects it. If two bits flip, the system at least detects that an error has occurred.
Triple Modular Redundancy (TMR):
We have three identical computers all performing exactly the same task. The final output is determined by voting among the three computers. If one fails, the other two compensate.
Watchdog Timer:
A timer that the satellite must reset every few seconds. If the software freezes and cannot reset the timer, the watchdog resets the entire system.
Safe Mode:
If critical conditions occur (e.g., battery voltage drops too low or temperature rises too high), the satellite enters Safe Mode. In this mode:
- The camera and non-essential equipment are turned off.
- The satellite orients itself so that the solar panels face the sun.
- It only waits for commands from the ground.
Emergency Shutdown:
If the situation becomes extremely bad (e.g., the battery is being destroyed), the satellite shuts down almost completely, leaving only the central computer running at minimal power.
8. Real-Time Operating System (RTOS) Scheduler
The satellite must perform certain tasks exactly on time. For example, attitude control must run every 100 milliseconds. If it is delayed, the satellite could lose control.
We have implemented a priority-based scheduler:
- Each task has a priority (from 0, the highest, to 15, the lowest).
- Each task has a period (e.g., every 100 ms, every 1 second, every 10 seconds).
- The scheduler always selects the task with the highest priority that is ready to run.
Scheduled Tasks:
- Attitude Control: Priority 0, every 100 ms
- Sensor Reading: Priority 1, every 100 ms
- Kalman Filter Update: Priority 1, every 100 ms
- Power Management: Priority 2, every 1 second
- Thermal Control: Priority 2, every 1 second
- Communications: Priority 3, every 500 ms
- Data Storage: Priority 4, every 10 seconds
- Mission Planning: Priority 5, every 60 seconds
9. Mission Planner
This section decides when the satellite should take pictures.
Inputs:
- List of ground targets (geographic coordinates)
- Minimum sun angle for a good picture
- Priority of each target
- Battery and memory status
Outputs:
- Exact start time for the next imaging session
- Satellite pointing angle for target acquisition
The planner schedules such that:
- The camera is on when the satellite passes over the target.
- The battery has sufficient charge.
- There is free memory to store the picture.
- The sun is at a suitable angle to illuminate the target.
10. Deployment Sequence
When the satellite separates from the rocket, everything is folded and stowed. They must deploy in a specific order.
Deployment Steps:
- Second 180: Separation from the launch vehicle
- 8 seconds later: UHF antenna deployment (for initial communication)
- 20 seconds later: First solar panel deployment
- 28 seconds later: Second solar panel deployment
- 40 seconds later: X-Band antenna deployment (for high-speed communication)
- 45 seconds later: Magnetometer boom deployment
Many systems remain off until this sequence is complete to prevent damage.
11. File Management and Storage
The satellite has a simulated flash memory card.
File Structure:
- Telemetry File: All satellite status data is stored every 10 seconds.
- Science Files: Each image or scientific data set is stored in a separate file.
- Housekeeping File: Overall statistics such as number of resets, minimum and maximum records.
Features:
- File search by name
- Deletion of old files if space becomes low
- Checksum calculation to ensure data integrity
Statistics and Reports
The software constantly records the following statistics:
- Number of reboots: How many times the satellite has reset.
- Number of entries to Safe Mode: Indicates how many times critical conditions occurred.
- Number of emergency shutdowns: The worst-case scenario.
- Minimum recorded battery voltage: Indicates battery health.
- Maximum processor temperature: Indicates whether the cooling system is working properly.
- Total energy generated and consumed: Satellite energy balance.
- Number of communication packets sent and received.
Summary
This software is a complete, accurate, and professional implementation of everything a real satellite needs:
- Precise and optimal attitude control with Kalman filter and LQR controller
- Realistic orbital model with SGP4
- Non-linear power and thermal management models
- Secure, standard communications with military-grade encryption
- Fault tolerance against radiation with Triple Modular Redundancy and EDAC memory
- Real-time scheduling for timely execution of critical tasks
- Autonomous mission planning for intelligent imaging
This code is ready to run on actual satellite hardware (e.g., radiation-hardened processors like the LEON 3) and manage a complete space mission.
erfan mohammadi