This was my second add-on for Orbiter. I wrote it very long ago, and I had compiled it for the newest Orbiter version. It simulates the behavior of a Solar Sail of Area SAT_AREA, specular coefficient PS and diffusion coefficient PD (this values can be changed on the scenario file, although the size of the mesh visible will be always the same). I base my calculations on chapter 3 of this document Dynamic Modeling and Attitude Control of Solar Sail Spacecraft, by Dr. Bong Wie.

Dr. Wie shows that the force that act upon the sail (due to photon flux), can be decomposed on a Normal and a Transversal Force. The Normal Force is normal to the Sail and always opposite to the Sun, and the transversal lies on a projection of a line to the sun in the Sail. The amount of this forces were calculated on Dr. Wie formula’s, so I had to calculate only the direction.

The Normal is straightforward, I only had to use

vessel->AddForce(_V(0.0,0.0,Fn),_V(0.0,0.0,0.0));

where Fn is the amount (taking care of the direction if the angle against the direction of the Sun was greater than PI/2).

The Transversal was trickier. I took the vector of the Global Position of the Sail (the Sun is the origin on Orbiter on Global calcs)

vessel->GetGlobalPos(vPos);

Then normalized it

R = sqrt((vPos.x * vPos.x) + (vPos.y * vPos.y) + (vPos.z * vPos.z)); vPosN = _V(vPos.x/R,vPos.y/R,vPos.z/R);

And then, putting this new vector on the sail, calculate its position locally on the sail (the x and the y of this will form the direction of the transversal force)

vP2 = vPos + vPosN;vessel->Global2Local(vP2,vD2); r2 = sqrt((vD2.x * vD2.x) + (vD2.y *vD2.y)); vD2 = _V(vD2.x/r2,vD2.y/r2,0);

Also, for the calculations on the forces, we need the angle of the normal to the sail against the Sun. I uses this formula v1â€¢v2 = cos(angle)|v1||v2| . I already has the direction of the Sun normalized on VPosN, the second is a normal of size 1 (so is normalized also), which I get with

vessel->GlobalRot(_V(0.0,0.0,1,0),vDir) ;

So the angle is

angle = acos(AdotB); // I build the AdotB as the dot product between vPosN and vDir;

Finally, I had to take care of the border conditions. If the PD of the Sail is null (PS=1), the Sail is perfectly specular and there is no transversal force. Also, the Solar Sail only works on high altitudes (1000km on the earth), so I applied the forces only when vessel->GetAltitude() is greater than this limits.