Jump to content

[v1.2] The KSP TI-BASIC Project - KSP'ing with Calculators


Recommended Posts

The KSP TI-BASIC Project

Hello geeks of KSP!

I came up with the idea of developing a suite of KSP tools for the TI series of calculators. It has formulas and everything. It's for those that like to use TI calculators when playing KSP, and those that want to play like good sirs (rocket scientists) in KSP. Currently, I'm lead writer on this project, but anyone is welcome to write their own program and submit it to this project. Currently, the programs I'm posting on here are optimized for the TI-84 Plus C. Most of them will work on other TI programmable calculators (it depends on the exact coding) albeit with the catch that the text on the screen may go wonky due to the differing resolution and text display behavior between the 84+CSE and 84+SE/84+/83+, etc. That's due to the 84+CSE having a 320x240 color display versus the 84+SE's 96x64 monochrome display. These programs are coded in TI-BASIC, which is dirt-cheap easy to learn. Check this site (http://tibasicdev.wikidot.com) to learn about coding TI-BASIC.

Current (Packaged) Programs:

*HOHMANN- Calculates delta-v needed to transfer between two different (perfectly) circular orbits around a body using the two-burn method, aka a Hohmann transfer.

*STAGEDV- Calculates a stage's delta-v using the average Isp, the starting and ending mass of said stage.

*INCHANGE- Calculates the delta-v needed to make an inclination change of a particular magnitude at a particular circular orbit.

Future Programs:

*LAUORBIT- Calculates a launching spacecraft's orbital parameters using the rocket's altitude, velocity, and velocity vector at final burn-out. (IN DEVELOPMENT)

*JEBSTI84- An all-in one program taking all the programs listed above and combining them into one big program that will save a lot of RAM space per tool. (IN DEVELOPMENT)

*ORBDARK- Calculates (for a circular orbit) the amount of time spent in the shadow of a planet and has the option of calculating how much electricity you will need to survive that darkness. (IN DEVELOPMENT)

*KSPREFER- A program that lists all the physical, orbital, and science characteristics of each body in the stock KSP game, that can be used as a reference for other purposes. (IN PLANNING)

*INTPLANT- I intend this to be much like alexmun's Launch Window Planner, pork chop plot and everything, except it'll have support for custom bodies from PlanetFactory CE, with the catch of having to input a few more values. I however may have to split it into two versions, one exclusively for the 84+ CSE that will have the porkchop plot where you can view the various solutions and such, and the other for the 83+/84+/84+SE that will only give you the best solution, if there is one. (IN PLANNING)

Images:

I know y'all want images XD but not just yet. I'll post some in an update later today. However, for you to feast your eyes on for now, here's the coding for the HOHMANN program:

ClrHome

Disp " This is Jebediah's "

Disp " TI-84 Plus C SE "

Disp " "

Disp " "

Disp " "

Disp " "

Disp " Hit ENTER to Advance "

Pause

Goto 55

Lbl 55

ClrHome

Input "Old Altitude (km)=",R

Input "New Altitude (km)=",S

Goto 35

Lbl 35

Menu(" Select Body ","Kerbol",43,"Planets",44,"Custom Body",46)

Lbl 46

Input "Grav Param (mï€Â/s)=",U

Input "Equatorial Radius (km)=",T

Goto 8

Lbl 43

1.1723328*10^18→U

261600000→T

Goto 8

Lbl 44

Menu(" Select Body ","Moho",1,"Eve (1 Moon)",2,"Kerbin (2 Moons)",3,"Duna (1 Moon)",4,"Dres",5,"Jool (5 Moons)",6,"Eeloo",7)

Lbl 1

1.6860938*10^11→U

250→T

Goto 8

Lbl 2

Menu(" Select Body ","Eve",12,"Gilly",13,"Back to Menu",70)

Lbl 12

8.1717302*10^12→U

700→T

Goto 8

Lbl 13

8289449.8→U

13→T

Goto 8

Lbl 70

Goto 44

Lbl 3

Menu(" Select Body ","Kerbin",14,"Mun",15,"Minmus",16,"Back to Menu",70)

Lbl 14

3.5316000*10^12→U

600→T

Goto 8

Lbl 15

6.5138398*10^10→U

200→T

Goto 8

Lbl 16

1.7658000*10^9→U

60→T

Goto 8

Lbl 4

Menu(" Select Body ","Duna",17,"Ike",18,"Back to Menu",70)

Lbl 17

3.0136321*10^11→U

320→T

Goto 8

Lbl 18

1.8568369*10^10→U

130→T

Goto 8

Lbl 5

2.1484489*10^10→U

130→T

Goto 8

Lbl 6

Menu(" Select Body ","Jool",19,"Laythe",20,"Vall",21,"Tylo",22,"Bop",23,"Pol",24,"Back to Menu",70)

Lbl 19

6000→T

2.8252800*10^14→U

Goto 8

Lbl 20

1.9620000*10^12→U

500→T

Goto 8

Lbl 21

2.0748150*10^11→U

300→T

Goto 8

Lbl 22

2.8252800*10^12→U

600→T

Goto 8

Lbl 23

2.4868349*10^9→U

65→T

Goto 8

Lbl 24

7.2170208*10^8→U

44→T

Goto 8

Lbl 7

7.4410815*10^10→U

210→T

Goto 8

Lbl 8

√((U)/(1000R+1000T))(√((2(1000S+1000T))/(1000R+1000S+2000T))-1)→A

√((U)/(1000S+1000T))(1-√((2(1000R+1000T))/(1000R+1000S+2000T)))→B

ClrHome

Disp "ÃŽâ€v(m/s) Burn 1",A

Disp "ÃŽâ€v(m/s) Burn 2",B

Disp "Total ÃŽâ€v(m/s)",A+B

Pause

Goto 40

Lbl 40

ClrHome

Menu("Run Program Again?","Yes",41,"No",42)

Lbl 41

Goto 55

Lbl 42

Disp " THX 4 USING MY PRGM!!!<3 "

Disp " "

Disp " Written by David Boers "

Disp " "

Disp " "

Disp " "

Disp " Hit ENTER to Advance "

Pause

Stop

Edited by AppleDavidJeans
Updated Future Programs
Link to comment
Share on other sites

  • 2 months later...

The Developer's Corner

Welcome to the Dev's Corner. Here you can view my musings about the project and help get programs done faster.

Musings, Questions, & Issues:

The reason why most programs in this package (except for the STAGEDV) seem big in terms of space for such a simpleton task is the "Select Body" part of the program, which is this code here:


...
:Lbl 35
:Menu(" Select Body ","Kerbol",43,"Planets",44,"Custom Body",46)
:Lbl 46
:Input "Grav Param (m[SUP]3[/SUP]/s[SUP]2[/SUP])=",U
:Input "Equatorial Radius (km)=",T
:Goto 8
:Lbl 43
:1.1723328*10^18→U
:261600000→T
:Goto 8
:Lbl 44
:Menu(" Select Body ","Moho",1,"Eve (1 Moon)",2,"Kerbin (2 Moons)",3,"Duna (1 Moon)",4,"Dres",5,"Jool (5 Moons)",6,"Eeloo",7)
:Lbl 1
:1.6860938*10^11→U
:250→T
:Goto 8
:Lbl 2
:Menu(" Select Body ","Eve",12,"Gilly",13,"Back to Menu",70)
:Lbl 12
:8.1717302*10^12→U
:700→T
:Goto 8
:Lbl 13
:8289449.8→U
:13→T
:Goto 8
:Lbl 70
:Goto 44
:Lbl 3
:Menu(" Select Body ","Kerbin",14,"Mun",15,"Minmus",16,"Back to Menu",70)
:Lbl 14
:3.5316000*10^12→U
:600→T
:Goto 8
:Lbl 15
:6.5138398*10^10→U
:200→T
:Goto 8
:Lbl 16
:1.7658000*10^9→U
:60→T
:Goto 8
:Lbl 4
:Menu(" Select Body ","Duna",17,"Ike",18,"Back to Menu",70)
:Lbl 17
:3.0136321*10^11→U
:320→T
:Goto 8
:Lbl 18
:1.8568369*10^10→U
:130→T
:Goto 8
:Lbl 5
:2.1484489*10^10→U
:130→T
:Goto 8
:Lbl 6
:Menu(" Select Body ","Jool",19,"Laythe",20,"Vall",21,"Tylo",22,"Bop",23,"Pol",24,"Back to Menu",70)
:Lbl 19
:6000→T
:2.8252800*10^14→U
:Goto 8
:Lbl 20
:1.9620000*10^12→U
:500→T
:Goto 8
:Lbl 21
:2.0748150*10^11→U
:300→T
:Goto 8
:Lbl 22
:2.8252800*10^12→U
:600→T
:Goto 8
:Lbl 23
:2.4868349*10^9→U
:65→T
:Goto 8
:Lbl 24
:7.2170208*10^8→U
:44→T
:Goto 8
:Lbl 7
:7.4410815*10^10→U
:210→T
:Goto 8
...

That chunk of code accounts for 1354 out of the 2227 bytes in the HOHMANN program. From there, you can see the tyranny of mathematical programs like these in that the math part of the program, where the math is done, is only a small fraction of the code. Everything else is spent on defining values to use and making the program pretty and such. I'm using the code shown in every program since I can't create an external program to use as a "table of values", meaning I execute a program, the program branches out to another program that inputs values like the code shown does, then jump back to the original program at a particular point in said program. The reason for that has to do with the Lbl and prgmNAME commands. I use Labels to specify certain points in my program to jump to and forth as the calculator reads the code. Now, the prgmNAME, which runs another specified program when encountered, could be oh-so-simple and versatile to use, except that I can't specify when executing the prgmNAME command where in the program to start executing. It only runs the whole program at the beginning. It makes me wish for an additional argument to the command that specifies where in the program to start running, as in prgmXXXXXXXX,label##, so I have to resort to using that code. Basically, my issue here, until I release JEBSTI84, which takes all those tools into an all-in-one program that, since it only has to use the "Select Body" code once, will save lots of RAM per tool, is how to make the tools smaller in size by not having to use the same code multiple times.

Edited by AppleDavidJeans
Link to comment
Share on other sites

Hey, sounds cool. I've probably done a bunch of this in KSPTOT, let me know if I can answer questions to help you along. :-)

Thanks, Arrow. I'll be sure to let you know if I have any.

UPDATE: I just finished writing a program called INCHANGE that allows you to calculate the delta-v needed to make an inclination change of a particular magnitude at a particular orbital height. Currently undergoing testing.

Link to comment
Share on other sites

I'm currently working on a file that will be the backbone of the KSPREFER program that I'm gonna write. It's a table of values (technically a matrix, but intended to behave like one) that lists a body's characteristics. Here's an image:

UGLwlg3.png

Will contain 578 points of data (34 per body for a total of 17 bodies). The values are taken from KSP Wiki.

Edited by AppleDavidJeans
Link to comment
Share on other sites

Note about the 0.25 update: This project will not be affected by the 0.25 update since none of the physical or orbital characteristics of any body in the stock KSP game have been changed in the update. So as long as your TI-84 or 83 can support this project (aside from the wonky text behavior), you'll be fine.

Link to comment
Share on other sites

  • 2 years later...
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...