Reputation: 41
I'm trying to make an application that calculates ISS flyovers.
I figured out how to actually get the flyover, but I am struggling with figuring out how to calculate the apparent magnitude of the space station during those flyovers. I've looked at Is there any way to calculate the visual magnitude of a satellite (ISS)? and Calculating the Phase Angle between the Sun / ISS and an observer on the earth.
I figured out how to calculate the solar phase angle, but I cannot figure out how to get the formula provided by Is there any way to calculate the visual magnitude of a satellite (ISS)? working. I have the phase angle in degrees and the distance to the satellite in km. This is the formula:
Mag = Std. Mag - 15 + 5*LOG(Range) - 2.5*LOG(SIN(B) + (pi-B)*COS(B))
For the ISS I use -1.8 as the std.mag. https://stackoverflow.com/users/2949204/liam-kennedy provided this formula and seems to know how to get it working, but I can't for my life.
Note: I am doing this in C# and know my phase angle is correct, but even doing it with Python and pyephem I wasn't getting anything close to Heavens-Above's results. Setting B to 113, std.mag to -1.8, and range to 485 is giving me 11.25, yet on Heavens-Above with the exact same data they get -3.0.
Here is the code I am using
var B = phaseAngle;
var magnitude = intrinsicMagnitude - 15 + 5 * Math.Log(distanceToSatellite) - 2.5 * Math.Log(Math.Sin(B) + (Math.PI - B) * Math.Cos(B));
EDIT: I solved this problem here: https://astronomy.stackexchange.com/questions/28744/calculating-the-apparent-magnitude-of-a-satellite/28765#28765
Moderator please mark this solved.
Upvotes: 2
Views: 937
Reputation: 89593
Both Math.Sin()
and Math.Cos()
take radians as their argument, not degrees — so you'll want to take your value 113 for B
and do something like B * Math.PI / 180.0
. In fact you'll want to do it all three places that B
is used, since otherwise it won't make sense to compare its value to Math.PI
.
Upvotes: 1
Reputation: 2164
I usually use the equation found at https://mostlymissiledefense.com/2012/08/21/space-surveillance-the-visual-brightenss-and-size-of-space-objects-august-21-2012/. Yours is similar. But the first thing I would check is your use of the LOG()
function. LOG()
calculates the natural log and I suspect what you wanted was the base 10 logarithm - e.g. LOG10()
.
Upvotes: 1