Jump to content

PHase Angle calculation for KOS


Recommended Posts

Hi all,

I'm trying to write my own KOS Hohmann Transfer script and I'm having trouble. I've managed to gather the True Anomaly, the Argument of Periapsis and the Longitude of Ascending Node of the vessel and the target. I've calculated the required phase angle for the insertion burn and I'll have no (foreseeable) trouble calculating how to perform it correctly. My problem is I can't get my current phase angle correctly.

What I have right now is this:

set Angle1 to obt:lan+obt:argumentofperiapsis+obt:trueanomaly. //the ships angle to universal reference direction.

set Angle2 to target:obt:lan+target:obt:argumentofperiapsis+target:obt:trueanomaly. //target angle

set Angle1 to Angle1 - 360*floor(Angle1/360). //normalization

set Angle2 to Angle2 - 360*floor(Angle2/360).//^

set Angle3 to abs(Angle2-Angle1).

Angle 3 is intended to be the current phase angle. As it is, it simply shows the shortest angle. I've been trawling over my math books and a few forums without success. I'm stuck. I don't know how to get the current prograde phase angle. Can someone help out?

Edited by SanderB
question answered
Link to comment
Share on other sites

Set your branch cut after subtracting angles, not before:

Assuming these lines are good:

set Angle1 to obt:lan+obt:argumentofperiapsis+obt:trueanomaly. //the ships angle to universal reference direction.

set Angle2 to target:obt:lan+target:obt:argumentofperiapsis+targ et:obt:trueanomaly. //target angle

Then:

set Angle3 = Angle2 - Angle1.

set Angle3 = Angle3 - 360 * floor(Angle3/360).

Now 0 <= Angle3 < 360, and describes the number of degrees your target is ahead of your ship.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...