Solar Panel Battery Charging

Hello community,

I am attempting to build a code that calculates the amount of charge in A*hr a battery can receive during windows of visibility with the Sun. My current code propagates TLEs and computes the visibilities, then I input panel area, efficiency, duration of event, battery voltage, and compute the total charge received.

However, to make it more realistic I want to add a cos(theta) term that is the angle between the normal vector to the panel (arbitrary) and the Sun-S/C line. However, I am having trouble figuring out how to set up this normal vector, and from there computing both the distance to the Sun (for received power) and the direction of the vector from s/c to Sun.

Any suggestions? My thought was to convert from EME2000 to a Sun centered frame and find that distance to the origin, but not sure how to approach that.