Jump to content

TI-BASIC orbital Calculator


Recommended Posts

I have been developing a method to automatically calculate the orbital elements of a spacecraft with a Texas Instruments TI-84 Plus calculator. My script, which has been posted below, does not need (but can use) the apsides of an orbit to continue, operating on the Vis-Viva Equation. All that is needed is a reference altitude and velocity, the radius of the current body, and the Standard Gravitational Parameter of the current body. After only a week, the script has reached a high level of development, and can calculate Gilly's orbit with a 2%-13% error. As such, I feel it is ready for release and testing.

 

Feel free to change the program however you feel, as I want this script to be the greatest external orbit calculator it can be.

NEEDS:

  •  A Texas Instruments Zilog Z80-based calculator (or the means  to emulate one)
  • A way to transfer scripts to said calculator

BOSH. Google Drive Link.

Plain Text Code:

Spoiler

 

ClrHome
Disp "ORBIT FINDER----
Disp "VERSION 5.*","","","",""
Disp "***PRESS ENTER**
Pause

ClrHome
Disp "APOAPSIS?-------","([e] IF N/A)
Prompt Y

ClrHome
Disp "PERIAPSIS?------","([e] IF N/A)
Prompt X

ClrHome
Disp "ALT/VEL?--------
Prompt R
Prompt V

ClrHome
Disp "BODY RADIUS?----
Prompt C

ClrHome
Disp "STND GRAV PARAM?
Prompt K


If Y=[e] or X=[e]
Then

ClrHome
Disp "USING VISV CALCS
((2/(R+C))-(V^^2/K))^^-1->A

Disp "SEMIMAJOR AXIS--
Disp A
Pause

Goto N

Else
((X+C)+(Y+C))/2->A
Disp "USING AP/PE CALC
Disp "SEMIMAJOR AXIS--
Disp A
Pause
    
Lbl N
End

2pisqrt(A^^3/K)->P

ClrHome
Disp "PERIOD----------"
Disp P
Pause

((.5(C+R)VP)/(piA))->B

ClrHome
Disp "SEMIMINOR AXIS--
Disp B
Pause
sqrt(1-(B^^2/A^^2))->E

ClrHome
Disp "ECCENTRICITY----
Disp E
Pause
Disp "CALC AP and PE?,"",""
Disp "(F5 TO CONTINUE)
Repeat Ans
getKey->theta
End

P
If theta=15
then
A(1-E)->Y
A(1+E)->X
ClrHome
Disp "ORBIT ELEMENTS
Disp "AP=",X
Disp "PE=",Y
Disp "E=",E
Pause
Goto theta
Else
    
    
Lbl theta
End
Stop

 

Edited by Rory Yammomoto
Link to comment
Share on other sites

OK, this has a major problem. Eccentricity is not calculated correctly, and when calculating the apsides, the equations given seem to have a tendency to set your current altitude to the periapsis or apoapsis (whichever is closest, strangely; one would assume if its failing it would make a point that your orbit does not reach.) I need some help. I am accepting suggestions for improvements.

EDIT: Turns out that thee equation I am using is used only to compute SMA while at the apsides.

ANOTHER EDIT: the equation was input incorrectly. The program works anywhere now.

Edited by Rory Yammomoto
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...