Chapter 4 – Satellites (Satellite Orbit)
Posted: March 23, 2013 Filed under: Satellites, ZX Spectrum Astronomy | Tags: Astronomy, Hyperbolic Orbit, Maurice Gavin, Orbit, Parabolic Orbit, Programming, Satellites, Sinclair Basic, ZX Spectrum Astronomy Leave a commentLaunch your own satellites
Earth Orbit, put a satellite into orbit about the Earth
Satellite Orbit, how to put a satellite into orbit around any planet.
Satellite Orbit
This program is based on the Earth Orbit program, but is extended to cope with modelling a satellite orbit around any planet, or even our Moon.
In addition to INPUTting the start height and initial velocity of the satellite, it is necessary to ENTER details of the planet itself, ie the diameter (in kilometres) and relative mass compared to Earth (Earth = 1). This information is included in the initial display (Figure 4.4) but you need not be confined to it. Various data should be tested including exotic features like tiny diameters and excessive mass. You should not expect the program to cope with all permutations, particularly for the ‘massive’ planet. Insufficient computation plus very rapid orbiting may produce strange results.
Figure 4.4
Sample worlds for a satellite to orbit.
The program recognises if a satellite is in a ‘parabolic’ or ‘hyperbolic’ orbit (open-ended) and thus lost to space. Similarly the Spectrum BEEPs a warning if the initial injection velocity proves too low and the satellite crashes on the surface of the planet.
The program specifically recognises one planet (Saturn) and DRAWs in the encircling ring system if this name is ENTERed in the N$. For the sake of clarity, it is advisable to place your satellite outside the Saturnian ring system.
The CLS command is not used, except against a new planet, and so multiple orbits can be overlaid upon one another until you are satisfied with a particular orbit. The information contained at the corners of the display, starting with the top left, is planet data, orbital period individually in minutes, hours and days and, at the bottom of the screen, the elapse time in minutes, x and y relative coordinate positions and the initial height and velocity in kilometres. An option to COPY the screen to the ZX printer is included. See Figures 4.5 and 4.6 for examples.
The program is an excellent way of gaining insight into the behaviour of, for example, the moons of Jupiter or Saturn, where a stronger gravitational field operates than on Earth.
To demonstrate, Jupiter’s moon Io is a similar distance from the centre of Jupiter as is our Moon from the centre of the Earth. Io orbits Jupiter in 1.8 days and our Moon takes 27.3 days (mean sidereal periods) to orbit the Earth. Try testing some set examples with data from a text book but do not expect any great accuracy as the results should be regarded as informative rather than precise.
Figure 4.5
The program recognises ‘Saturn’ and draws a ring system. Unfortunately, this satellite is launched from within the rings with insufficient velocity and crashes immediately on to the planet.
Figure 4.6
Third time lucky with these orbit attempts around a small mythical world. One satellite is lost to space, one crashes on the far side of the planet.
10 REM Satellite Orbit
20 GO SUB 1000
30 LET n$=a$(n)
40 LET k=d(n): LET m=m(n)
50 IF n150000 OR k9999 THEN GO TO 140
170 LET disk=(rd/125*16)*z
180 IF disk>40 THEN LET z=z/2: GO TO 170
190 IF n$=”Saturn ” AND disk*2.5>40 THEN LET z=z/2: GO TO 170
200 PRINT PAPER 4;AT 1,0;n$
210 PRINT INK 5;”diam=”;k;”km”‘”grav=”;m;”xE”
220 LET tm=.125/z: LET h=tm
230 LET w=vl: LET x=hi+rd
240 LET ho=x: LET y=0: LET v=0
250 FOR n=0 TO 255 STEP 2
260 PLOT 140,n-100
270 PLOT n,40: NEXT n
280 PRINT AT 16,0;”-x”;AT 16,30;”+x”;AT 3,16;”+y”
290 PRINT AT 19,23;”initial”;AT 20,19;”hgt=”;hi;”km”;AT 21,19;”vel=”;INT w;”km/mn”
300 INK 5
310 FOR j=0 TO PI/2 STEP .1
320 LET px=INT (SIN j*disk)
330 LET py=INT (COS j*disk)
340 PLOT 140-px,40+py
345 DRAW 0,-py*2
350 PLOT 140+px,40+py
355 DRAW 0,-py*2: NEXT j
360 CIRCLE 140,40,disk: INK 9
380 IF n$=”Saturn ” THEN FOR n=1.5 TO 2.5 STEP .2: CIRCLE 140,40,disk*n: NEXT n
390 LET r=x: LET x=x+h/4*v
400 LET s=y: LET y=y+h/4*w
410 GO SUB 580
420 LET x=r: LET v=v+2/4*b
430 LET y=s: LET w=w+h/4*c
440 GO SUB 610
450 FOR t=0 TO 4e4 STEP tm
460 LET x=x+h*v: LET y=y+h*w
470 GO SUB 580
480 IF x>0 AND y>2*ho THEN PRINT FLASH 1; PAPER 2;AT 0,0;”Velocity too high-LOST to space “: GO TO 510
490 IF d>rd THEN GO TO 530
500 PRINT FLASH 1; PAPER 3;AT 0,0;p$;AT 0,0;”Velocity too low-CRASH in “;t;”mn ”
505 PLOT FLASH 1;xx,yy
510 FOR n=45 TO -30 STEP -15: BEEP .5,n-30: NEXT n
520 PAUSE 50: PLOT FLASH 0;xx,yy: GO TO 740
530 LET v=v+h*b: LET w=w+h*c
540 PAPER 0
550 GO SUB 610
560 NEXT t
570 GO TO 130
580 LET e=x*x+y*y: LET d=SQR e
590 LET a=-g/e: LET b=a*x/d
600 LET c=a*y/d: RETURN
610 PRINT AT 19,0;”time=”;t;”mn ”
620 PRINT “x ax=”;INT x;”km ”
630 PRINT “y ax=”;INT y;”km ”
640 LET xx=x/125*16*z+140
650 LET yy=y/125*16*z+40
660 IF x<0 AND y<0 THEN GOTO 690
670 IF xx>255 OR xx<-255 OR yy>175 THEN LET z=z/2: CLS : PRINT AT 0,0;p$;AT 0,0;”Re-scale=”;z: GO TO 170
680 PLOT xx,yy
685 RETURN
690 FOR n=0 TO .5 STEP .02: BEEP n/4,n/5: NEXT n
700 LET hr=INT (t/.3)/100: LET dy=INT (t/.3/24)/100
710 PRINT PAPER 6;AT 0,0;”Half orbit plot-period=”;t*2;”mn”
720 PRINT AT 1,22;” “;AT 2,22;” ”
730 PRINT AT 1,22;”=”;hr;”hr”;AT 2,22;”=”;dy;”dy”
740 PRINT #0; INK 9; PAPER 4;”z=COPY:p=new Planet:o=new Orbit ”
750 PAUSE 0: IF INKEY$=”o” THEN PRINT AT 0,0;p$: GO TO 130
760 IF INKEY$=”z” THEN LPRINT : COPY : GO TO 750
770 RUN
1005 BORDER 0: PAPER 0: INK 9: CLS : RESTORE
1010 LET zz=1: DIM p$(32)
1015 DIM a$(12,7): DIM d(12): DIM m(12)
1020 DATA “Moon”,3476,.165
1030 DATA “Mercury”,4878,.377
1040 DATA “Venus”,12104,.90
1050 DATA “Earth”,12756,1
1060 DATA “Mars”,6794,.379
1070 DATA “Pallas”,532,.022
1080 DATA “Jupiter”,142800,2.69
1090 DATA “Saturn”,120000,1.19
1100 DATA “Uranus”,52000,.93
1110 DATA “Neptune”,48400,1.22
1120 DATA “Pluto”,3000,.2
1125 PRINT ” PAPER 6;” Satellite Modelling Program “”
1130 PRINT PAPER 5;”No Name Diam(km) Mass(Earth=1)”
1140 FOR n=1 TO 11: READ a$(n),d(n),m(n)
1150 PRINT (” ” AND n<10);n;” “;
1155 PRINT a$(n);TAB 12;d(n);TAB 23;m(n)
1160 NEXT n: PRINT PAPER 6;”12 ??? ??? ??? ”
1170 PRINT ‘”Enter Planet no”
1180 INPUT n: IF n12 THEN GO TO 1180
1200 RETURN