I have been working on a simulink model for attitude control of a solar sail spacecraft. The top-level model is illustrated below:
The spacecraft orientation is controlled by 4 triangular vanes located at the tips of the solar sail, and these vanes are commanded through a rotation around the corresponding solar sail diagonal. The 4 angles that define the rotation of each vane have been labeled 'control angles' in this model. The control angle is zero when the vane is in the same plane as the solar sail. Visual representation of the mechanical system is below:
The simmechanics implementation of this mechanical system is also represented below:
We can observe that the entire system is connected to the world frame via a 6DOF joint, because I want to simulate the free motion of the spacecraft in deep space. We can also observe two inputs to this system:
- torque: this is the final torque that acts on the spacecraft (disturbance and control) and actuates the top level joint to reflect the movement of the entire spacecraft
- control angles: this is a 4x1 vector containing the 4 control angles of the vanes. Note that the control torque resulting from the actuation is modelled separately in a simulink block and applied on the 6DOF joint, however this input is necessary here for 2 reasons: 1) because I want to study the effects of the torque produced by the angular acceleration of the vane on the attitude of the entire sailcraft; and 2) because I want the vanes to move in the Mechanics Explorer animation
The outputs included in this screenshot are the sail attitude and rotation rate, with a transport delay to avoid algebraic loops.
The connection between the vane and the sail is modelled by a revolute joint whose input is motion and whose torque is automatically calculated. The vane model and the joint properties are illustrated below:
The simulation runs without a problem (which means that there aren't any mismatches in reference frames for the base and follower of any joints in the model) until I try to connect the control angles output of the Actuation Model block (in the top level model) to the control angles input of the Vanes Saicraft Model.
What I have tried:
- Input some dummy control angles that come from outside the loop. Using the SignalEditor block I have even replicated the control angles produced by the loop and set that as input to the sail model. The simulation did not crash anymore if the angles came from outside, even though the actual signals were roughly the same. This makes me think that the problem is not sudden variations of the control angles.
- Changing the inertia properties of the sail. For now, the sail's inertia is a custom inertia, where I provide the inertia matrix and mass, but I tried to change it to "Calculated from geometry" as well. Vane's inertias are calculated from geometry. This did not fix the issue. The whole system is very light as well, and to make sure this is not the issue, I added a payload of 100kg connected to the 6DOF joint as well. Issue still not fixed.
- Giving initial conditions to the revolute joints (position 0 and velocity 0). The error was still thrown.
- Playing around with the solver. I have tried multiple variable-step solvers (initially the simscape recommended ones) as well as fixed-step solvers with very small step sizes. The error was still there.
- Searching the MATLAB forum for other questions with similar title. I tried the solutions in here, here, here and here. It did not solve the problem.
I have a few years experience with simulink but I have only started working with Simscape Multibody 2 weeks ago. At this point I am not sure if I am missing something in the assembly of the sail, if I am trying to solve a problem that simscape cannot compute, or if I am using the joint actuation incorrectly. The library also provides blocks for torques and forces, but even after reading through the documentation I did not understand the difference between using those and just applying the motion/force/torque as input on the joint. Do you think using any of these force/torque blocks would make a difference?
Any tips and advices are greatly appreciated.