This repository includes demonstration program of power generation of solar array panel (SAP) on space station.
And SAP can be rotated by solar alpha rotary joint (SARJ). In this demo, SARJ angle can be selected.
- Clone the source
$ cd /path/to/ros2_ws
$ mkdir src
$ cd src
$ git clone https://github.com/space-station-os/demo_sarj_power_generation.git
- Compile the source
$ cd /path/to/ros2_ws
$ colcon build
$ source install/setup.bash
Launch three terminals. Terminal 1: SARJ angle optimization node
$ ros2 run demo_sarj_power_generation select_sarj_angle
Terminal 2: Dynamics & power generation node
$ ros2 run demo_sarj_power_generation power_generation
Terminal 3: Record
$ source rosbag_record.sh
Simulation result is recorded as a rosbag file in the directory "rosbag2_out". You can check it by
$ rqt_bag rosbag2_out/rosbag2_YYYY-MM-DD_hh_mm_ss/
The earth orbit around the Sun and the space station's orbit and attitude are simulated.
Three axis shows space station body fixed (SSBF) frame.
The earth rotetes around the Sun. Its orbit is perfect circle. The space station rotetes around the earth. Its orbit is perfect circle. Orbital elements such as altitde, RAAN and inclination can be set. Initial attitude is set as Euler angle Z->Y->X [rad]. And angular velocity is set as roll, pitch, yaw [rad].
There are two types of space station attitude control. It can be set as a parameter when running.
- 0: No control. As time passes, the attitude changes based on angular velocity.
- 1: LVLH. Z-axis of SSBF points the center of the earth, X-axis corresponds to velocity vector and Y-axis is their cross product.
Shade of the space station by the earth is simulated.
And SAP angle to the sun is calculated.
If the space station is not in shade by the earth, its SAP can generate power.
Its amount depends on the SAP angle to the sun. The angle between the normal vector of the solar cell and the vector in the sun direction is
The space station has SARJ. It can rotate SAP along Y-axis.
SAP generates power by sunlight.
The amount of electricity generated by the SAP depends on the orientation of the normal vector of the SAP and the vector in the direction of the sun. It is maximum when both are parallel.
There are two ROS nodes. “power_generation” simulates orbit, attitude, and power generation of the space station. “select_sarj_angle” gets sun direction vector @SSBF, calculates optimal SARJ angle and publish it as “/terget_sarj_angle”. Then “power_generation” subscribes it and set SARJ angle.
power_generation node
- pub:
- /sarj_angle: SARJ angle [rad]
- /simu_time: simulation time [s]
- /soc: battery state of charge (SoC) [kWh]
- /ss_attitude: space station attitude quaternion.
- /ss_in_sunlight: if 1, space station gets sunlight. if 0, it is behind the earth.
- /sun_direction_ssbf: normalized sun direction vector on SSBF
- sub:
- /target_sarj_angle: target SARJ angle [rad]
select_sarj_angle node
- pub:
- /target_sarj_angle
- sub:
- /sun_direction_ssbf
You can check them by using rosbag or rqt_plot.
power_generation node has parameters. Space station parameters and default value:
- ss_altitude=400000: altitude of space station orbit [m].
- ss_raan=10[deg]: RAAN of space station orbit [rad].
- ss_inclination=20[deg]: inclination of space station orbit [rad].
- ss_init_euler_angle=[0, 0, 0]: atitude of space station as Euler angle [rad].
- ss_init_w_vec=[0, 0.02, 0]: angular velocity of space station [rad/s].
- attitude_control_plan=0:
- 0: no control
- 1: LVLH
Simulation parameters and default value:
- simu_timestep=20: timestep of simulation [s]
- speed_rate=20: rate of simulation
- publish_period=200: pubish period [s]
These parameters can be set by like:
ros2 run demo_sarj_power_generation power_generation --ros-args -p simu_timestep:="2.0"
If runing only power_generation node, SARJ angle is always zero. So SAP cannnot generate power efficiently.
This plot shows change of battery SoC.
On the other hand, if running select_sarj_angle node too, optimal SARJ angle is set and SAP can generate power efficienty.
- Make 3D space station model as URDF and show it by rviz2