Model Articulating Spacecraft Solar Panels for Sun-Tracking
This example shows how to actively model sun-tracking solar panels on a nadir-pointing spacecraft. The attitude of the spacecraft is managed by the Attitude Profile block, configured for nadir-pointing. In this example, the body-z axis points towards nadir, and the body-x axis aligns with the velocity vector. The rest of the example shows how the solar panels are configured relative to the spacecraft bus.
This image shows the body axes of the panels in relation to the spacecraft bus. The panels are mounted along the body-y axis and can rotate around this axis. The z-axes of the panels are perpendicular to their photovoltaic surfaces. When not articulated, the panel body axes align with those of the spacecraft. To maximize sun exposure, the panels must rotate to align their z-axis towards the sun, constrained by rotation about the y-axis. The desired panel orientation is calculated using the Attitude Profile block.
![]()
Define Simulation Parameters
Set the initial time to November 14, 2024, 11:47:23 AM, UTC.
initialTime = datetime(2024, ... % Year 11, ... % Month 14, ... % Day 11, ... % Hour 47, ... % Minute 23); % Second
Convert the initial time to Julian date.
initialTimeJD = juliandate(initialTime);
Set simulation duration to 3 hours.
endTime = 3*3600; % sDefine the initial orbital elements of the spacecraft.
semiMajorAxis = 7000e3; % m eccentricity = 0; inclination = 35; % deg rightAscensionOfAscendingNode = 90; % deg argumentOfPeriapsis = 30; % deg trueAnomaly = 0; % deg
Specify the distance of the solar panels from the center of mass of the spacecraft along the body y axis.
panelY = 3.45; % mRun Simulink Model
The Simulink® model in this example consists of:
SpacecraftsubsystemPlanetary Ephemeris block
Solar panelssubsystem
Open the Simulink model to simulate a nadir pointing spacecraft with articulating solar panels tracking the Sun.
modelName = 'ModelArticulatingSpacecraftSolarPanelsforSunTrackingExample.slx';
open_system(modelName);![]()
Spacecraft
The Spacecraft subsystem consists of:
![]()
Attitudesubsystem
Orbit Propagator Numerical (high precision) Block
The Orbit Propagator Numerical block uses the EGM2008 spherical harmonics gravitational potential model to propagate the orbit from the initial state defined by the orbital elements.
Attitude subsystem
The Attitude subsystem outputs the quaternion relating the ICRF frame to the body frame of the spacecraft. This subsystem consists of the Attitude Profile block that computes the shortest quaternion rotation from the input attitude, to the desired attitude, assuming the spacecraft instantaneously achieves this orientation. The input attitude is set to the quaternion , so that the block output denotes the quaternion that relates the ICRF to the desired attitude.
![]()
The desired attitude is nadir pointing, with the spacecraft body-z axis pointing nadir and the body-x axis aligning with the ICRF velocity vector. Therefore, the primary alignment vector is the body-z axis, the primary constraint vector is the unit vector pointing towards nadir, the secondary alignment vector is the body-x axis, and the secondary constraint vector is the unit vector along the ICRF velocity direction. Accordingly, the Pointing mode parameter of the Attitude Profile block is set to "Point at nadir", automatically setting the primary constraint vector to the nadir direction. The primary and the secondary alignment vectors are set to the body-z and x axes, respectively. The secondary constraint vector, the unit ICRF velocity vector, is input through the port .
![]()
Planetary Ephemeris Block
The Planetary Ephemeris block outputs the position of the Sun relative to Earth in the ICRF. This subsystem requires the input to be the barycentric dynamical time (TDB), but the example inputs the UTC time. Because the Sun is about 150 million kilometers away and the difference between UTC and TDB is about 69 seconds, the mispointing error of the solar panels is negligible at 0.001 degrees.
![]()
Solar Panels Subsystem
The Solar panels subsystem includes the Solar panel (left) and Solar panel (right) subsystems and a Sun tracker subsystem.
Solar panel (left) and Solar panel (right) Subsystems
The left and right Solar panel subsystems calculate the position of the panels in ICRF. Their centers of mass is located 2.5 meters from the center of mass of the spacecraft bus along the body-y axis.
![]()
![]()
![]()
Sun tracker Subsystem
The Sun tracker subsystem calculates the attitude of the panels to align their z-axis with the Sun and outputs the rotation angle about the y-axis to achieve the desired attitude.
![]()
The Attitude Profile (panel to icrf) block calculates the shortest rotation from the current satellite attitude to the desired panel attitude and outputs the quaternion relating the final panel attitude with respect to ICRF. Panels rotate about their y-axis, with the z-axis as the surface normal. The panels rotate until their z-axis aligns with the sun vector. The primary alignment and constraint vectors are the y-axis, while the secondary alignment vector is the z-axis, and the secondary constraint vector is the unit vector from the satellite to the Sun.
![]()
The Attitude Profile (panel to body) block is configured similarly to the Attitude Profile (panel to icrf), except the input is set to an arbitrary vector and the input is set to the identity quaternion.The block outputs the quaternion that relates the satellite and panel body frames. The Rotation angle subsystem then deduces the rotation angle for the panels from this quaternion.
![]()
Simulate the Simulink model.
simOut = sim(modelName);
Plot Solar Panel Rotation Angle
Extract the rotation angle of the panel about the body-y axis
panelRotationAngle = simOut.yout{6}.Values.Data;Plot the rotation angle of the panel.
times = initialTime + seconds(simOut.tout); plot(times,panelRotationAngle,LineWidth=2); xlabel("Time"); ylabel("Rotation angle (deg)"); grid on;
Visualize in Satellite Scenario
Extract positions and attitude for the spacecraft.
spacecraftPosition = simOut.yout{1}.Values;
spacecraftAttitude = simOut.yout{2}.Values;Extract positions and attitude for the solar panels.
leftPanelPosition = simOut.yout{3}.Values;
rightPanelPosition = simOut.yout{4}.Values;
panelAttitude = simOut.yout{5}.Values;Create a satellite scenario with start and stop times spanning the simulation. Set the sample time to 60 seconds.
startTime = initialTime;
stopTime = startTime + seconds(tf);
sampleTime = 60; % s
sc = satelliteScenario(startTime,stopTime,sampleTime);Add the spacecraft to the scenario using the position timeseries and assign a 3D model for the spacecraft bus.
sat = satellite(sc,spacecraftPosition,Name="Spacecraft"); sat.Visual3DModel = 'bus.glb';
Set the orbit lead and trail times to one orbital period.
mu = 398600.4418e9; % m^3/s^2
period = 2*pi*sqrt((semiMajorAxis^3)/mu);
sat.Orbit.LeadTime = period;
sat.orbit.TrailTime = period;Add the panels to the scenario using the satellite function and the position timeseries. Assign 3D models for the panels.
leftPanel = satellite(sc,leftPanelPosition,Name="Left panel"); leftPanel.Visual3DModel = 'leftPanel.glb'; rightPanel = satellite(sc,rightPanelPosition,Name="Right panel"); rightPanel.Visual3DModel = 'rightPanel.glb';
Set the panel orbit lead and trail times of the panels to 0 seconds.
leftPanel.Orbit.LeadTime = 0; % s leftPanel.Orbit.TrailTime = 0; % s rightPanel.Orbit.LeadTime = 0; % s rightPanel.Orbit.TrailTime = 0; % s
Set the attitude profile for the spacecraft using the appropriate attitude timeseries output from the Simulink model.
pointAt(sat,spacecraftAttitude);
Set the attitude profile for the panels using the appropriate attitude timeseries output from the Simulink model.
pointAt(leftPanel,panelAttitude); pointAt(rightPanel,panelAttitude);
Launch a satellite scenario viewer.
v = satelliteScenarioViewer(sc);
![]()
Visualize the body axes of the spacecraft and the panels.
coordinateAxes(sat,Scale=3); coordinateAxes(leftPanel); coordinateAxes(rightPanel); camtarget(v,sat);
![]()
Play the scenario and set the camera target to the spacecraft. The solar panels in the visualization rotate about the y-axis to align the z-axis as closely as possible with the Sun.
play(sc); camtarget(v,sat);
![]()