Category : Science and Education
Archive   : PLANETS.ZIP
Filename : PLANETS.3TP

 
Output of file : PLANETS.3TP contained in archive : PLANETS.ZIP
PROGRAM PLANETS;
{$C-}
{ Version 3.4 May 10, 1987

This Program computes information relating to the position,
distance, magnitude, orbit view, skyview, etc for the major
planets, four minor planets or halley's comet on a specified date
and time. Also, orbital data for any desired planet or comet can
be entered and saved in a disk file. Skyview, Starview, and
Orbital Views can show forward or backward motion. Most of the
equations used are taken from PRACTICAL ASTRONOMY WITH YOUR
CALCULATOR by Peter Duffett-Smith, Cambridge University Press.

This program is placed in the public domain and may be freely
copied and distributed for a nominal distribution charge. The
Turbo Pascal source code and the latest version of the program
can be obtained from the author for $10.00.

Larry Puhl 6 Plum Ct. Sleepy Hollow, Ill. 60118


}
{.D+}
{$I GRAPH.P}
{.D-} {Disables Turbo Power Checking}
{$I Planets1.PAS}
{ Compare Size of Planets/Moons }
PROCEDURE Xcompare;
VAR
Xloc,Yloc : integer;
Size1, Size2 : real;
smallsize : integer;
Name1, Name2 : string[10];
FUNCTION MakeInteger(C : char) : integer;
BEGIN
IF (Ord(C) > 96) THEN
MakeInteger := Ord(C) - Ord('a') + 10;
IF (Ord(C) < 96) AND (Ord(C) > 65) THEN
MakeInteger := Ord(C) - Ord('A') + 10;
IF (Ord(C) < 58) THEN
MakeInteger := Ord(C) - Ord('0');
END;
BEGIN
ClrScr;
Xloc := 0; Yloc := 0;
FOR n := 1 TO 13 DO
BEGIN
GoToXY(Xloc,Yloc);
IF n <= 9
THEN
WriteLn(n,' ',Planets[n].name)
ELSE
WriteLn(chr(n + 87),' ',Planets[n].name);
Yloc := Yloc + 1;
i := 1;
WHILE planets[n].NumberOfMoons >= i DO
BEGIN
IF WhereY > 14 THEN
BEGIN
Xloc := Xloc + 20;
Yloc := 1;
END;
GoToXY(Xloc,Yloc);
IF i <= 9
THEN
WriteLn('F',n,' ',i,' ',Moons[n,i].name)
ELSE
WriteLn('F',n,' ',chr(i + 87),' ',Moons[n,i].name);
Yloc := Yloc + 1;
i := i + 1;
END;
END;
GoToXY(10,18);
Write('Select first planet/moon to show : ');
Read(Kbd,Ch);
IF (Ch = #27)
THEN
BEGIN
Read(Kbd,Ch1);
Read(Kbd,Ch);
Size1 := moons[(Ord(Ch1) - Ord(58)),MakeInteger(Ch)].radius;
Name1 := moons[(Ord(Ch1) - Ord(58)),MakeInteger(Ch)].name;
END
ELSE
BEGIN
Size1 := planets[MakeInteger(Ch)].radius;
Name1 := planets[MakeInteger(Ch)].name;
END;
Write(Name1);
GoToXY(10,19);
Write('Select second planet/moon to show : ');
Read(Kbd,Ch);
IF (Ch = #27)
THEN
BEGIN
Read(Kbd,Ch1);
Read(Kbd,Ch);
Size2 := moons[(Ord(Ch1) - Ord(58)),MakeInteger(Ch)].radius;
Name2 := moons[(Ord(Ch1) - Ord(58)),MakeInteger(Ch)].name;
END
ELSE
BEGIN
Size2 := planets[MakeInteger(Ch)].radius;
Name2 := planets[MakeInteger(Ch)].name;
END;
GraphMode;
GraphBackground(0);
Palette(0);
IF Size1 > Size2
THEN
BEGIN
smallsize := round(50 * Size2 / Size1);
Circle(213,100,50,3);
FillShape(213,100,3,3);
Circle((100 - smallsize),100,smallsize,3);
FillShape((100 - smallsize),100,3,3);
GoToXY(25,22);
Write(name1);
GoToXY(8,22);
Write(name2);
END
ELSE
BEGIN
smallsize := round(50.0 * Size1 / Size2);
Circle(213,100,50,3);
FillShape(213,100,3,3);
Circle((100 - smallsize),100,smallsize,3);
FillShape((100 - smallsize),100,3,3);
GoToXY(25,22);
Write(name2);
GoToXY(8,22);
Write(name1);
END;
Read(Kbd,Ch);
TextMode;
END;

{ Plot Moon Orbits }
PROCEDURE Plot_Planet_and_Moon(PlanetNum, start_moon, last_moon:integer);
VAR
Scale : real;
Largest : real;
X,Y,i : integer;
PROCEDURE plot_planet(pn : integer; scale : real);
VAR
radius : real;
BEGIN
radius := planets[pn].radius / 1000;
FOR i := 0 TO 18 DO
BEGIN
X := Round(radius * scale * Screen_Aspect * COSD(i * 5));
Y := Round(radius * scale * SIND(i * 5));
draw(CenterX - X, CenterY - Y, CenterX + X, CenterY - Y,1);
draw(CenterX - X, CenterY + Y, CenterX + X, CenterY + Y,1);
END;
END; {plot_planet}
FUNCTION compute_moon_radius_vector(n,m : Integer; angle : real) : Real;
BEGIN
compute_moon_radius_vector := moons[n,m].axis *
(1 - moons[n,m].ecc * moons[n,m].ecc)
/ (1 + moons[n,m].ecc * COSD(angle - moons[n,m].long_of_per));
END; {compute_moon_radius_vector}

PROCEDURE plot_moon(n,m : Integer; scale : real);
VAR
XOld, YOld, XNew, YNew,A : Integer;
PROCEDURE Draw_orbit(deg : Integer);
BEGIN
Xold := Xnew;
Yold := Ynew;
IF moons[n,m].Inc > 90
THEN
BEGIN
Xnew := Round(compute_moon_radius_vector(n,m, A * deg) * scale *
Screen_Aspect * COSD(A * deg)) + CenterX;
Ynew := Round(compute_moon_radius_vector(n,m, A * deg) * scale *
SIND(A * deg)) + CenterY;
END
ELSE
BEGIN
Xnew := Round(compute_moon_radius_vector(n,m, A * deg) * scale *
Screen_Aspect * COSD(A * deg)) + CenterX;
Ynew := Round(compute_moon_radius_vector(n,m, A * deg) * scale *
SIND(A * deg)) + CenterY;
END;
IF A > 0 THEN
Draw(Xold, Yold, Xnew, Ynew, PlanetColor );
END; {Draw_orbit}
BEGIN
IF NOT TravelMode THEN
BEGIN
IF moons[n,m].ecc > 0.3
THEN
FOR A := 0 TO 120 DO
draw_orbit(3)
ELSE
FOR A := 0 TO 30 DO
draw_orbit(12);
END;
END; {plot_moon}
PROCEDURE Locate_Position_of_Moon(n,m : integer);
BEGIN
moon_mean_anomaly := Earth_Day / moons[n,m].period * 360;
Make_degrees_in_Range(moon_mean_anomaly);
moon_true_anomaly := DEGREE(ANOMALY(RADIAN(moon_mean_anomaly),
moons[n,m].Ecc)) + moons[n,m].long_of_per;
Make_degrees_in_Range(moon_true_anomaly);
moon_radius_vector :=
compute_moon_radius_vector(n,m,moon_true_anomaly);
END; {locate_position_of_moon}
BEGIN
GoToHiRes;
GoToXY(1,1);
PlanetSelected := PlanetNum;
start_moon_selected := start_moon;
last_moon_selected := last_moon;
LastCommand := '@';
WriteLn(planets[PlanetNum].name);
WriteLn;
n := start_moon;
Largest := 1;
WHILE n <= last_moon
BEGIN
IF moons[PlanetNum,n].axis > Largest THEN
Largest := moons[PlanetNum,n].axis;
WriteLn(moons[PlanetNum,n].name);
n := n + 1;
END;
Scale := 70 / Largest;
IF NOT TravelMode THEN
plot_planet(PlanetNum, scale);
n := start_moon;
WHILE n <= last_moon { Draw all the moons }
BEGIN
plot_moon(PlanetNum,n,Scale);
locate_position_of_moon(PlanetNum,n);
X := CenterX + Round(moon_radius_vector * scale
* Screen_Aspect * COSD(moon_true_anomaly));
Y := CenterY + Round(moon_radius_vector * scale *
SIND(moon_true_anomaly));
overwriting := false;
FOR i := 1 TO Num_Of_Planets DO
IF (ABS(OldXpos[i] - X) < 9) AND (ABS(OldYpos[i] - Y) < 9) AND
(i <> n) THEN
overwriting := true;
Make_Planet_Symbol(X,Y,n,overwriting);
n := n + 1;
END;
END;

{ Kepler Demo }
PROCEDURE Kepler;
VAR
period_squared : real;
axis_cubed : real;
BEGIN
Write(Ch);
Read(Kbd, Ch1);
IF Ch1 = '1' THEN
BEGIN { Kepler's First Law }
plot_planet_and_moon(8,2,2);
frame(48,10,75,15);
Window(50,11,74,14);
GoToXY(1,1);
WriteLn('Each planetary orbit is');
WriteLn('an ellipse with the sun');
WriteLn('at one focus.');
Window(1,1,80,25);
GoToXY(50,16);
write('Demo shows orbit of moon');
GoToXY(50,17);
write('around Neptune');
GoToXY(35,13);
Write('Neptune');
END;
IF Ch1 = '2' THEN
BEGIN { Kepler's Second Law }
plot_planet_and_moon(8,2,2);
frame(48,10,75,15);
Window(50,11,74,14);
GoToXY(1,1);
WriteLn('The line joining any one');
WriteLn('planet to the Sun sweeps');
WriteLn('equal area in equal time');
Window(1,1,80,25);
GoToXY(50,16);
write('Demo shows orbit of moon');
GoToXY(50,17);
write('around Neptune');
TravelMode := True;
REPEAT
draw(CenterX,CenterY,OldXpos[2],OldYpos[2],1);
FOR n := 1 TO 10 DO
BEGIN
earth_day := earth_day + 359.881 / 200;
plot_Planet_and_Moon(8,2,2);
END;
UNTIL KeyPressed;
END;
IF Ch1 = '3' THEN
BEGIN
frame(13,18,48,24);
Window(15,19,47,23);
GoToXY(1,1);
WriteLn('For any pair of planets, the');
WriteLn('squares of the periods are');
WriteLn('proportional to the cubes of the');
WriteLn('semi-major axis of their orbits.');
Window(1,1,80,25);
GoToXY(1,1);
write(' 2 3');
GoToXY(1,2);
write('planet period axis ');
write(' period axis ratio');
FOR n := 1 TO 13 DO
BEGIN
GoToXY(1,3 + n);
period_squared := planets[n].period * planets[n].period;
axis_cubed := planets[n].axis * planets[n].axis * planets[n].axis;
Write(planets[n].name);
GoToXY(10,3 + n);
Write(planets[n].period:8:2);
GoToXY(20,3 + n);
Write(planets[n].axis:8:2);
GoToXY(30,3 + n);
Write(period_squared:8:2);
GoToXY(40,3 + n);
Write(axis_cubed:8:2);
GoToXY(50,3 + n);
Write((period_squared / axis_cubed):8:2);
END;
END;
END;



PROCEDURE Locate_Position_of_Sun_and_Moon;
VAR
Moon_evection : Real;
Moon_annual_equation : Real;
Moon_third_correction : Real;
Moon_fourth_correction : Real;
Moon_corrected_longitude : Real;
Moon_longitude_variation : Real;
Moon_corrected_longitude_of_node : Real;
D : Real;
BEGIN
D := Julianday(month, Day, year) - Julianday(1, 0, Sun_Epoch) +
(LCT + Zone_correction)/24;
IF (year > 1900) AND (year < 2000) THEN
D := D + (year - 1900) * 0.00000738;
Sun_mean_anomaly := (360/365.2422) * D +
Sun_ecliptic_longitude_at_epoch -
Sun_ecliptic_longitude_of_perigee;
Make_Degrees_in_Range(Sun_mean_anomaly);
Sun_true_anomaly := DEGREE(ANOMALY(RADIAN(Sun_mean_anomaly),
Sun_Ecc));
Make_Degrees_in_range(Sun_mean_anomaly);
Sun_longitude := Sun_true_anomaly +
Sun_ecliptic_longitude_of_perigee;
Sun_RA := ECL_TO_RA(Sun_longitude, 0);
Sun_DEC := ECL_TO_DEC(Sun_longitude, 0);
Sun_Hour_Angle := Lst - Sun_RA/15;
IF Sun_Hour_Angle < 0 THEN
Sun_Hour_Angle := Sun_Hour_Angle + 24;
Sun_Altitude := ARCSIND(SIND(Sun_DEC) * SIND(Latitude) +
COSD(Sun_Dec) * COSD(Latitude) * COSD(Sun_Hour_Angle * 15));
Sun_Azimuth := ARCCOSD((SIND(Sun_Dec) - SIND(Latitude) *
SIND(SUN_Altitude))/(COSD(Latitude) *
COSD(Sun_Altitude)));
IF SIND(Sun_Hour_Angle * 15) > 0 THEN
Sun_Azimuth := 360 - Sun_Azimuth;
Moon_mean_longitude := 13.1763966 * D + Moon_mean_longitude_at_epoch;
Make_Degrees_in_range(Moon_mean_longitude);
Moon_mean_anomaly := Moon_mean_longitude - 0.1114041 * D -
Moon_longitude_of_perigee_at_epoch;
Make_Degrees_in_range(Moon_mean_anomaly);
Moon_ascending_node_mean_longitude :=
Moon_longitude_of_node_at_epoch -
0.0529539 * D;
Make_Degrees_in_range(Moon_ascending_node_mean_longitude);
Moon_evection := 1.2739 * SIND(2 * (Moon_mean_longitude - Sun_longitude
) -
Moon_mean_anomaly);
Moon_annual_equation := 0.1858 * SIND(Sun_mean_anomaly);
Moon_third_correction := 0.37 * SIND(Sun_mean_anomaly);
Moon_corrected_anomaly := Moon_mean_anomaly + Moon_evection -
Moon_annual_equation - Moon_third_correction;
Moon_correction_for_equation_of_centre := 6.2886 *
SIND(Moon_corrected_anomaly);
Moon_fourth_correction := 0.214 *
SIND(2 * Moon_correction_for_equation_of_centre);
Moon_corrected_longitude := Moon_mean_longitude +
Moon_evection +
Moon_correction_for_equation_of_centre -
Moon_annual_equation +
Moon_fourth_correction;
Moon_longitude_variation := 0.6583 * SIND(2 * (
Moon_corrected_longitude -
Sun_longitude));
Moon_true_longitude := Moon_corrected_longitude +
Moon_longitude_variation;
Moon_corrected_longitude_of_node :=
Moon_ascending_node_mean_longitude -
0.16 * SIND(Sun_mean_anomaly);
Moon_ecliptic_longitude := ARCTANYX((SIND(Moon_true_longitude -
Moon_corrected_longitude_of_node) *
COSD(Moon_Inc)),
COSD(Moon_true_longitude -
Moon_corrected_longitude_of_node)) +
Moon_corrected_longitude_of_node;
Moon_ecliptic_latitude := ARCSIND(SIND(Moon_true_longitude -
Moon_corrected_longitude_of_node) *
SIND(Moon_Inc));
Moon_RA := ECL_TO_RA(Moon_ecliptic_longitude,
Moon_ecliptic_latitude);
Moon_DEC := ECL_TO_DEC(Moon_ecliptic_longitude,
Moon_ecliptic_latitude);
Moon_Hour_Angle := Lst - Moon_RA/15;
IF Moon_Hour_Angle < 0 THEN
Moon_Hour_Angle := Moon_Hour_Angle + 24;
Moon_Altitude := ARCSIND(SIND(Moon_DEC) * SIND(Latitude) +
COSD(Moon_Dec) * COSD(Latitude) * COSD(Moon_Hour_Angle * 15));
Moon_Azimuth := ARCCOSD((SIND(Moon_Dec) - SIND(Latitude) *
SIND(Moon_Altitude))/(COSD(Latitude) *
COSD(Moon_Altitude)));
IF SIND(Moon_Hour_Angle * 15) > 0 THEN
Moon_Azimuth := 360 - Moon_Azimuth;
END;

PROCEDURE Show_Menu;
BEGIN
Window(1, 1, 80, 25);
ClrScr;
Time_Window;
Window(1, 1, 80, 25);
GoToXY(1, 1);
IF MenuNumber = 1 THEN
BEGIN
IF ColorMonitor
THEN
TextColor(LightCyan)
ELSE
TextColor(White);
FOR num := 1 TO Num_of_major_planets DO
WITH planets[num] DO
WriteLn(num, ' ', name);
WriteLn;
WriteLn('H Help');
WriteLn('I Plot Inner Planets');
WriteLn('L Change Long/Lat');
WriteLn('M Switch to next Menu');
WriteLn('O Plot Outer Planets');
WriteLn('Q Quit');
WriteLn('S Set_up');
WriteLn('R Read Orbital Data');
WriteLn('T Change Time/Date');
WriteLn('U skyView Sun and Moon');
WriteLn('V skyView planets');
WriteLn('W Write Orbital Data');
WriteLn('Y starView Sun and Moon');
WriteLn('Z starView planets');
Window(27, 1, 64, 25);
GoToXY(1, 1);
FOR num := (Num_of_major_planets + 1) TO Num_of_planets DO
WITH planets[num] DO
WriteLn('*', (num - num_of_major_planets):1, ' ', name);
WriteLn;
WriteLn;
WriteLn('* A : detailed data');
WriteLn(' B : Sky View');
WriteLn(' C : Orbital View (Inner)');
WriteLn(' D : Orbital View (Middle)');
WriteLn(' E : Orbital View (Outer)');
WriteLn(' F : SideView (C,D,E select Scale)');
END;
IF MenuNumber = 2 THEN
BEGIN
IF ColorMonitor THEN
TextColor(LightGreen);
WriteLn('3 Earth,Sun,Moon info');
WriteLn('H Help');
WriteLn('K1 Demo of Keplers 1st law');
WriteLn('K2 Demo of Keplers 2st law');
WriteLn('K3 Demo of Keplers 3st law');
WriteLn('M Switch to next Menu');
WriteLn('Q Quit');
WriteLn('X Show relative sizes of planets');
WriteLn;
WriteLn;
WriteLn('For Orbital, Sky, and Star Views:');
WriteLn(' + key moves time forward *');
WriteLn(' - key moves time backward *');
WriteLn(' space key stops time');
WriteLn(' any other key exit time travel mode');
WriteLn;
WriteLn('* use several depressions to increase speed');
END;
IF MenuNumber = 3 THEN
BEGIN
IF ColorMonitor THEN
TextColor(LightMagenta);
WriteLn(' F3 Earth and its Moon');
WriteLn(' F4 Mars and its Moons');
WriteLn(' F5 Jupitor and its Moons 1 to 5');
WriteLn('^F5 Jupitor and its Moons 6 to 9');
WriteLn('@F5 Jupitor and its Moons 10 to 13');
WriteLn(' F6 Saturn and its inner Moons');
WriteLn('^F6 Saturn and its outer Moons');
WriteLn('@F6 Saturn and Janus');
WriteLn(' F7 Uranus and its inner Moons');
WriteLn('^F7 Uranus and its outer Moons');
WriteLn(' F8 Neptune and its inner Moon');
WriteLn('^F8 Neptune and its outer Moon');
WriteLn(' H Help');
WriteLn(' M Switch to next Menu');
WriteLn(' Q Quit');

WriteLn;
WriteLn('^ indicates shifted function key');
WriteLn('@ indicates alternate function key');
END;
Window(1, 1, 80, 25);
TextColor(White);
IF ColorMonitor
THEN
TextColor(Green);
GoToXY(21, 25);
Write('PLANETS V3.4 is a Public Domain Program');
TextColor(White);
IF ColorMonitor
THEN
TextBackground(Brown);
GoToXY(40, 23);
Write('Enter command or M for next Menu: ');
TextBackground(Black);
END; {Show_menu}

PROCEDURE Read_Set_Up_File;
VAR
Ch : Char;
BEGIN
Assign(SaveSetUpFile, 'planetsa.sav');
{$I-} Reset(SaveSetUpFile) {$I+} ;
IF (IOResult = 0)
THEN
BEGIN
ReadLn(SaveSetUpFile, Ch);
ColorMonitor := (Ch = 'T');
ReadLn(SaveSetUpFile, Ch);
Display_Degrees_in_Decimal := (Ch = 'T');
ReadLn(SaveSetUpFIle, Ch);
Daylight_Savings_Correction_Enabled := (Ch = 'T');
ReadLn(SaveSetUpFile, Ch);
Display_Hour_Angle_in_Degrees := (Ch = 'T');
ReadLn(SaveSetUpFile, Ch);
Display_RA_in_Degrees := (Ch = 'T');
ReadLn(SaveSetUpFile, Ch);
Display_Names_on_Plots := (Ch = 'T');
ReadLn(SaveSetUpFile, Screen_Aspect);
ReadLn(SaveSetUpFile, Zone_correction);
ReadLn(SaveSetUpFile, Longitude);
ReadLn(SaveSetUpFile, Latitude);
Close(SaveSetUpFile);
END;
END;

PROCEDURE Help;
VAR
Document : Text;
n : Integer;
Line : STRING[80];
BEGIN
GoToXY(1, 25);
IF ColorMonitor THEN
TextColor(Yellow);
Write('Use Space Bar to Advance, any other key to return to menu'
);
TextColor(White);
Window(1, 1, 80, 23);
Assign(Document, 'Planets.DOC');
{$I-} Reset(Document) {$I+} ;
IF (IOResult = 0)
THEN
BEGIN
GoToXY(1, 1);
REPEAT
FOR n := 1 TO 20 DO
BEGIN
ReadLn(Document, Line);
WriteLn(Line);
END;
Read(Kbd, Ch);
UNTIL (Ch <> ' ') OR EoF(Document);
ClrScr;
Close(SaveSetUpFile);
END
ELSE
WriteLn('can not find file planets.doc');
END;


PROCEDURE Set_Up;
VAR
Heigth, Width : Real;
PROCEDURE Test_True_False(VAR Test : Boolean);
BEGIN
Read(Kbd, Ch);
IF (Ch = 'Y') OR (Ch = 'y')
THEN Test := True;
IF (Ch = 'N') OR (Ch = 'n')
THEN Test := False;
END;
BEGIN
WriteLn('Do you have a color monitor (Y/N)?');
Test_True_False(ColorMonitor);
WriteLn('Display Degrees in Decimal Degrees ( Y/N )? ');
Test_True_False(Display_Degrees_in_Decimal);
WriteLn('Correct for daylight savings ( Y/N )?');
Test_True_False(Daylight_Savings_Correction_Enabled);
WriteLn('Display Hour Angle in Degrees ( Y/N )?');
Test_True_False(Display_Hour_Angle_in_Degrees);
WriteLn('Display RA in Degrees ( Y/N )?');
Test_True_False(Display_RA_in_Degrees);
WriteLn('Print names of planets on plots (Y/N)?');
Test_True_False(Display_Names_on_Plots);
WriteLn('Enter new Aspect Ratio (Y/N)?');
Read(Kbd, Ch);
IF (Ch = 'Y') OR (Ch = 'y')
THEN
BEGIN
GoToHiRes;
Draw(100, 50, 400, 50, 1);
Draw(400, 50, 400, 150, 1);
Draw(400, 150, 100, 150, 1);
Draw(100, 150, 100, 50, 1);
GoToXY(1, 1);
WriteLn('Enter Heigth of Box');
{$I-}
REPEAT
ReadLn(Heigth);
ok := (IOResult = 0);
IF NOT ok THEN Write('input must be numeric :');
UNTIL ok;
WriteLn('Enter Width of Box');
REPEAT
ReadLn(Width);
ok := (IOResult = 0);
IF NOT ok THEN Write('input must be numeric :');
UNTIL ok;
{$I+}
Screen_Aspect := Heigth * 3/Width;
WriteLn('Aspect Ratio has been set to : ', Screen_Aspect);
END;
WriteLn('Do you want to save Set-Up (Y/N) ?');

Read(Kbd, Ch);
IF (Ch = 'Y') OR (Ch = 'y')
THEN
BEGIN
Assign(SaveSetUpFile, 'planetsa.sav');
Rewrite(SaveSetUpFile);
WriteLn(SaveSetUpFile, ColorMonitor);
WriteLn(SaveSetUpFile, Display_Degrees_in_Decimal);
WriteLn(SaveSetUpFIle, Daylight_Savings_Correction_Enabled);
WriteLn(SaveSetUpFile, Display_Hour_Angle_in_Degrees);
WriteLn(SaveSetUpFile, Display_RA_in_Degrees);
WriteLn(SaveSetUpFile, Display_Names_on_Plots);
WriteLn(SaveSetUpFile, Screen_Aspect);
WriteLn(SaveSetUpFile, Zone_correction);
WriteLn(SaveSetUpFile, Longitude);
WriteLn(SaveSetUpFile, Latitude);
Close(SaveSetUpFile);
WriteLn(
'Set Up information has been saved in file "planetsa.sav"');
END;
END;


PROCEDURE Plot_Inner_Planets;
BEGIN
GoToHiRes;
Plot(CenterX, CenterY, 1);
FOR num := 1 TO 4 DO
plot_planet(num, scale_for_inner_planets);
END;

PROCEDURE Read_Orbital_Lines;
BEGIN
{$I-} Reset(OrbitFile) {$I+} ;
IF (IOResult = 0)
THEN
BEGIN
WITH Planets[num_of_planets] DO
BEGIN
ReadLn(OrbitFile, name);
ReadLn(OrbitFile, Epoch);
ReadLn(OrbitFile, Perihelion_Epoch);
ReadLn(OrbitFile, Period);
ReadLn(OrbitFile, Long_at_Epoch);
ReadLn(OrbitFile, Long_of_Per);
ReadLn(OrbitFile, Ecc);
ReadLn(OrbitFile, Axis);
ReadLn(OrbitFile, Inc);
ReadLn(OrbitFile, Long_of_ascend_Node);
END;
Close(OrbitFile);
WriteLn('Orbital data read from disk');
WriteLn('Use A', num_of_minor_planets, ' to compute orbit');
END
ELSE
WriteLn('Can not find File');
END;


PROCEDURE Read_Orbital_Data;
VAR
DiskFileName : ARRAY[1..10] OF Char;
BEGIN
WriteLn('Enter name of file');
ReadLn(DiskFileName);
Assign(OrbitFile, DiskFileName);
Read_Orbital_Lines;
END;

PROCEDURE Write_Orbital_Data;
FUNCTION GetNumber : Real;
VAR
inputnumber : Real;
BEGIN
{$I-}
REPEAT
ReadLn(inputnumber);
ok := (IOResult = 0);
IF NOT ok THEN Write('input must be numeric :');
UNTIL ok;
{$I+}
GetNumber := inputnumber;
END;
VAR
DiskFileName : ARRAY[1..10] OF Char;
Line : STRING[40];
EpochMonth, EpochDay, EpochYear : Integer;
number : Real;
BEGIN
WriteLn('Enter name of file');
ReadLn(DiskFileName);
Assign(OrbitFile, DiskFileName);
Rewrite(OrbitFile);
Write('Enter name of planet (Max 10 letters) : ');
ReadLn(Line);
WriteLn(OrbitFile, Line);
Write(
'Enter month day year of Epoch (0 0 0 if Perihelion at Epoch): '
);
{$I-}
REPEAT
ReadLn(Epochmonth, Epochday, Epochyear);
ok := (IOResult = 0);
IF NOT ok THEN Write('use spaces to seperate inputs');
UNTIL ok;
{$I+}
IF Epochyear = 0
THEN
BEGIN
WriteLn(OrbitFile, '0');
Write('Enter Perihelion Epoch : ');
number := GetNumber;
WriteLn(OrbitFile, number);
END
ELSE
BEGIN
number := Epochyear +
(Julianday(Epochmonth, Epochday, Epochyear) -
Julianday(1, 0, Epochyear))/365.2422;
WriteLn(OrbitFile, number);
WriteLn(OrbitFile, '0');
END;
Write('Enter period : ');
number := GetNumber;
WriteLn(OrbitFile, number);
IF Epochyear <> 0
THEN
BEGIN
Write('Enter Longitude at Epoch : ');
number := GetNumber;
WriteLn(OrbitFile, number);
END
ELSE
WriteLn(OrbitFile, '0');
Write('Enter Longitude of Perihelion : ');
number := GetNumber;
WriteLn(OrbitFile, number);
Write('Enter Eccentricity : ');
number := GetNumber;
WriteLn(OrbitFile, number);
Write('Enter Semi - major Axis : ');
number := GetNumber;
WriteLn(OrbitFile, number);
Write('Enter Inclination of Orbit : ');
number := GetNumber;
WriteLn(OrbitFile, number);
Write('Enter Longitude of ascending node : ');
number := GetNumber;
WriteLn(OrbitFile, number);
Close(OrbitFile);
Read_Orbital_Lines;

END;

PROCEDURE Plot_Outer_Planets;
BEGIN
GoToHiRes;
Plot(CenterX, CenterY, 1);
plot_planet(3, scale_for_outer_planets);
FOR num := 5 TO 9 DO
plot_planet(num, scale_for_outer_planets);
END;

PROCEDURE Orbital_View_of_Minor_Planet_and_Inner_Planets;
BEGIN
GoToHiRes;
GoToXY(1, 1);
Write(planets[num].name);
last_scale_selected := scale_for_inner_planets;
Plot(CenterX, CenterY, 1);
plot_planet(num, scale_for_inner_planets);
FOR num := 1 TO 4 DO
plot_planet(num, scale_for_inner_planets);
END;

PROCEDURE Orbital_View_of_Minor_Planet_and_Middle_Planets;
BEGIN
GoToHiRes;
GoToXY(1, 1);
Write(planets[num].name);
last_scale_selected := scale_for_middle_planets;
Plot(CenterX, CenterY, 1);
plot_planet(num, scale_for_middle_planets);
FOR num := 1 TO 5 DO
plot_planet(num, scale_for_middle_planets);
END;

PROCEDURE Orbital_View_of_Minor_Planet_and_Outer_Planets;
BEGIN
GoToHiRes;
GoToXY(1, 1);
Write(planets[num].name);
last_scale_selected := scale_for_outer_planets;
plot_planet(num, scale_for_outer_planets);
num := 3;
plot_planet(num, scale_for_outer_planets);
FOR num := 5 TO 9 DO
plot_planet(num, scale_for_outer_planets);
END;


PROCEDURE Sky_View_of_Minor_Planet;
VAR
num_save : Integer;
BEGIN
Draw_Sky_Window;
Locate_Position_of_Earth;
num_save := num;
FOR num := 1 TO 9 DO
IF num <> 3 THEN
Compute_and_Plot_Planet_in_Sky_Window;
num := num_save;
Compute_and_Plot_Planet_in_Sky_Window;
END;

PROCEDURE View;
BEGIN
Draw_Sky_Window;
Locate_Position_of_Earth;
FOR num := 1 TO 9 DO
BEGIN
IF num <> 3
THEN
Compute_and_Plot_Planet_in_Sky_Window;
END;
END;

PROCEDURE SunView;
VAR
X, Y : Integer;
BEGIN
Draw_Sky_Window;
Locate_position_of_Sun_and_Moon;
IF Sun_Altitude > 0
THEN
BEGIN
X := Round(Sun_Azimuth * 1.5 + 50);
Y := Round(170 - Sun_Altitude * 1.5);
Make_Planet_Symbol(X, Y, 10,true);
END
ELSE
Make_Planet_Symbol(0, 0, 10,true);
IF Moon_Altitude > 0
THEN
BEGIN
X := Round(Moon_Azimuth * 1.5 + 50);
Y := Round(170 - Moon_Altitude * 1.5);
Make_Planet_Symbol(X, Y, 11,true);
END
ELSE
Make_Planet_Symbol(0, 0, 11,true);
END;
PROCEDURE DrawStarViewWindow;
VAR
x : Integer;
BEGIN
GotoHiRes;
IF NOT TravelMode THEN
BEGIN
FOR x := 1 TO 11 DO
Draw(54, 40 + x * 10, 594, 40 + x * 10, 1);
FOR x := 0 TO 12 DO
Draw(54 + x * 45, 50, 54 + x * 45, 150, 1);
GoToXY(3, 7);
Write(' + 50');
GoToXY(3, 13);
Write(' 0');
GoToXY(3, 19);
Write('-50');
GoToXY(7, 20);
Write('0h 4h 8h 12h 16h');
Write(' 20h 24h');
GoToXY(32, 22);
Write('Right Ascension');
GoToXY(1, 12);
Write('D');
GoToXY(1, 13);
Write('E');
GoToXY(1, 14);
Write('C');
END;
END;

PROCEDURE StarView;
BEGIN
DrawStarViewWindow;
Locate_Position_of_Earth;
FOR num := 1 TO 9 DO
IF num <> 3 THEN
BEGIN
Locate_Position_of_Planet_in_its_Own_Orbital_Plane(num);
Project_Position_of_Planet_onto_Plane_of_ecliptic;
Calculate_Ecliptical_Coordinates;
RA := ECL_TO_RA(Geocentric_Ecliptic_Long,
Geocentric_Latitude);
DEC := ECL_TO_DEC(Geocentric_Ecliptic_Long,
Geocentric_Latitude);
Make_Planet_Symbol(Round(54 + (RA * 1.5)), Round(100 - DEC), Num,true)
;
END;
END;
PROCEDURE SunStarView;
BEGIN
DrawStarViewWindow;
Locate_position_of_Sun_and_Moon;
Make_Planet_Symbol(Round(54 + (SUN_RA * 1.5)),
Round(100 - SUN_DEC), 10,true);
Make_Planet_Symbol(Round(54 + (MOON_RA * 1.5)),
Round(100 - MOON_DEC), 11,true);
END;

PROCEDURE Change_Date_Time;
BEGIN
{$I-}
time_window;
Window(1, 1, 80, 25);
WriteLn;
WriteLn('Enter month day year');
REPEAT
ReadLn(month, day, year);
ok := (IOResult = 0);
IF NOT ok THEN Write(
'input must be numeric with spaces between : ');
UNTIL ok;
WriteLn('Enter hour minute');
REPEAT
ReadLn(hour, minute);
ok := (IOResult = 0);
IF NOT ok THEN Write(
'input must be numeric with spaces between : ');
UNTIL ok;
day_of_year := Trunc(Julianday(month, day, year) - Julianday(1, 0,
year));
time_window;
{$I+}
END;



PROCEDURE Change_Long_Lat;
BEGIN
{$I-}
time_window;
Window(1, 1, 80, 25);
WriteLn;
WriteLn('Enter Longitude Latitude');
REPEAT
ReadLn(longitude, Latitude);
ok := (IOResult = 0);
IF NOT ok THEN Write(
'input must be numeric with spaces between : ');
UNTIL ok;
Zone_correction := Trunc(longitude/15) + 1;
WriteLn('Enter time zone correction (Default = ', zone_correction
, ' ):');
REPEAT
ReadLn(zone_correction);
ok := (IOResult = 0);
IF NOT ok THEN Write(
'input must numeric with spaces between : ');
UNTIL ok;
time_window;
{$I+}
END;

PROCEDURE Change_Speed(UpDown : Char);
BEGIN
IF UpDown = '=' THEN
TimeSpeed := StopTime;
IF UpDown = '+' THEN
TimeSpeed := TimeSpeed + 1;
IF UpDown = '-' THEN
TimeSpeed := TimeSpeed-1;
IF TimeSpeed > FastestTime THEN
TimeSpeed := Fastesttime;
IF TimeSpeed < SlowestTime THEN
TimeSpeed := SlowestTime;
END;

PROCEDURE Time_Travel;
BEGIN
IF (TimeSpeed <> StopTime) THEN
REPEAT
IF Lastcommand = '@'
THEN
BEGIN
IF TimeSpeed > 8
THEN
Earth_Day := Earth_Day + (TimeSpeed - 8) * (TimeSpeed - 8) * 0.1
ELSE
Earth_Day := Earth_Day - (TimeSpeed - 8) * (TimeSpeed - 8) * 0.1;
END
ELSE
BEGIN
IF (TimeSpeed = StopTime + 1) THEN
hour := hour + 1;
IF (TimeSpeed = StopTime + 2) THEN
day := day + 1;
IF (TimeSpeed = StopTime + 3) THEN
day := day + 7;
IF (TimeSpeed = StopTime + 4) THEN
month := month + 1;
IF (TimeSpeed >= StopTime + 5) THEN
year := year + 1;
IF (TimeSpeed = StopTime - 1) THEN
hour := hour - 1;
IF (TimeSpeed = StopTime - 2) THEN
day := day - 1;
IF (TimeSpeed = StopTime - 3) THEN
day := day - 7;
IF (TimeSpeed = StopTime - 4) THEN
month := month - 1;
IF (TimeSpeed <= StopTime - 5) THEN
year := year - 1;
IF hour > 24 THEN
BEGIN
hour := 1;
day := day + 1;
END;
IF hour < 0 THEN
BEGIN
hour := 23;
day := day - 1;
END;
IF (Month = 2) AND (day > 29) AND (year MOD 4 = 0) THEN
BEGIN
day := day MOD 29;
Month := Month + 1;
END;
IF (Month = 2) AND (day > 28) AND (year MOD 4 > 0) THEN
BEGIN
day := day MOD 28;
Month := Month + 1;
END;
IF ((Month = 4) OR (Month = 6) OR (Month = 9) OR (Month = 11))
AND (day > 30) THEN
BEGIN
day := day MOD 30;
Month := Month + 1;
END;
IF day > 31 THEN
BEGIN
day := day MOD 31;
Month := Month + 1;
END;
IF day < 1 THEN
BEGIN
IF ((Month = 5) OR (Month = 7) OR (Month = 10) OR (Month
= 12))
THEN
day := 30
ELSE
day := 31;
IF Month = 3
THEN
IF Year MOD 4 = 0
THEN
day := 29
ELSE
day := 28;
Month := Month - 1;
END;
IF Month > 12 THEN
BEGIN
Month := Month MOD 12;
Year := year + 1;
END;
IF Month < 1 THEN
BEGIN
Month := 12;
Year := Year - 1;
END;
time_window;
day_of_year := Trunc(Julianday(month, day, year) - Julianday(1
, 0, year));
num := MinorPlanetSelected;
END;
CASE LastCommand OF
'B' : Sky_View_of_Minor_Planet;
'C' : Orbital_View_of_Minor_Planet_and_Inner_Planets;
'D' : Orbital_View_of_Minor_Planet_and_Middle_Planets;
'E' : Orbital_View_of_Minor_Planet_and_Outer_Planets;
'I' : Plot_Inner_Planets;
'O' : Plot_Outer_Planets;
'U' : SunView;
'V' : View;
'Y' : SunStarView;
'Z' : StarView;
'@' : Plot_planet_and_moon(PlanetSelected,
start_moon_selected,
last_moon_selected);
END; {CASE}
TravelMode := True;
IF KeyPressed
THEN
BEGIN
Read(Kbd, Ch);
IF (Ch = '+') OR (Ch = '-')
THEN
BEGIN
Change_Speed(Ch);
ExitLoop := False;
END
ELSE
ExitLoop := True;
IF Ch = ' '
THEN
BEGIN
TimeSpeed := StopTime;
ExitLoop := False;
END;
END
ELSE
ExitLoop := False;
GoToHiRes;
UNTIL ExitLoop;
END;

PROCEDURE Locate_Planet;
LABEL
End_of_Locate_Planet;
BEGIN
Time_window;
Window(1, 1, 80, 25);
frame(1, 1, 54, 9);
Window(3, 2, 53, 10);
IF (num = 3) AND ColorMonitor
THEN
TextColor(LightBlue)
ELSE
TextColor(White);
GoToXY(1, 1);
Locate_Position_of_Planet_in_Its_Own_Orbital_Plane(num);
WriteLn(' ', planets[num].name);
Write('long of ascend node = ');
deg_min_sec(planet_long_of_ascend_node);
WriteLn;
Write('mean anomaly = ');
deg_min_sec(planet_mean_anomaly);
WriteLn;
Write('true anomaly = ');
deg_min_sec(planet_true_anomaly);
WriteLn;
Write('heliocentric long = ');
deg_min_sec(planet_heliocentric_long);
WriteLn;
WriteLn('radius vector = ', planet_radius_vector:8:3,
' AU');
Write('helio ecliptic lat. =');
deg_min_sec(planet_helio_ecliptic_lat);
WriteLn;

{ Locate Position of Earth in Its Own Orbital Plane }

IF ColorMonitor
THEN
TextColor(LightBlue)
ELSE
TextColor(White);
IF num = 3 THEN
BEGIN
Locate_Position_of_Sun_and_Moon;
Window(1, 1, 80, 25);
frame(1, 10, 26, 16);
Window(2, 11, 26, 15);
GoToXY(1, 1);
Write('SUN RA = ');
IF Display_RA_in_Degrees
THEN
deg_min_sec(Sun_RA)
ELSE
hours_min_sec(Sun_RA);
WriteLn;
Write('SUN DEC = ');
deg_min_sec(Sun_DEC);
WriteLn;
Write('SUN Alt = ');
deg_min_sec(Sun_Altitude);
WriteLn;
Write('SUN Azi = ');
deg_min_sec(Sun_Azimuth);
WriteLn;
Sun_Size := Sun_Angular_Diameter *
(1 + Sun_Ecc * COSD(Sun_true_anomaly))/
(1 - Sun_Ecc * Sun_Ecc);
Write('SUN Size= ');
deg_min_sec(Sun_Size);
Window(1, 1, 80, 25);
frame(29, 10, 54, 16);
Window(30, 11, 54, 15);
GoToXY(1, 1);
Write('MOON RA = ');
IF Display_RA_in_Degrees
THEN
deg_min_sec(Moon_RA)
ELSE
hours_min_sec(Moon_RA);
WriteLn;
Write('MOON DEC = ');
deg_min_sec(Moon_DEC);
WriteLn;
Write('MOON Alt = ');
deg_min_sec(Moon_Altitude);
WriteLn;
Write('MOON Azi = ');
deg_min_sec(Moon_Azimuth);
WriteLn;
Moon_Distance := Moon_Axis *
(1 - Moon_Ecc * Moon_Ecc)/
(1 + Moon_Ecc * COSD(Moon_corrected_anomaly +
Moon_correction_for_equation_of_centre));
Moon_Size := Moon_Angular_Diameter * Moon_Axis/Moon_Distance;
Write('MOON Size= ');
deg_min_sec(Moon_Size);
Window(1, 1, 80, 25);
frame(1, 18, 54, 22);
Window(4, 19, 53, 25);
GoToXY(1, 1);
Write('Distance to Moon = ', Moon_Distance:6:0, ' Km = ');
WriteLn((Moon_Distance/Moon_Axis):1:3, ' Ratio');
Moon_Age := Moon_True_Longitude - Sun_Longitude;
Make_Degrees_in_Range(Moon_Age);
Write('Age of Moon = ');
Write((Moon_Age/12.8):2:1, ' Days = ');
deg_min_sec(Moon_Age);
WriteLn;
Moon_Position_Angle := ARCTANYX(
COSD(SUN_DEC * SIND(SUN_RA - MOON_RA)),
COSD(MOON_DEC) * SIND(SUN_DEC) -
SIND(MOON_DEC) * SIND(SUN_DEC) *
COSD(SUN_DEC) * COSD(SUN_RA - MOON_RA));
WriteLn('Position Angle of Moon = ', Moon_Position_Angle:3:2
, 'ø');

{ Calculate Time and Position of Rise and Set for Sun }

Window(1, 1, 80, 25);
frame(56,11,80,24);
Window(58,12,79,22);
GoToXY(1, 1);
Sun_Azimuth_Rise := SIND(Sun_DEC)/COSD(Latitude);
Sun_Azimuth_Rise := ARCCOSD(Sun_Azimuth_Rise);
Sun_Azimuth_Set := 360 - Sun_Azimuth_Rise;
Sun_LST_Rise := 24 + Sun_RA/15 - (ARCCOSD( - TAND(Latitude) * TAND(Sun_DEC)))/15;
IF Sun_LST_Rise > 24 THEN Sun_LST_Rise := Sun_LST_Rise - 24;
Sun_LST_SET := Sun_RA/15 + (ARCCOSD( - TAND(Latitude) * TAND(Sun_DEC)))/15;
IF Sun_LST_SET > 24 THEN Sun_LST_SET := Sun_LST_SET - 24;
Sun_LCT_SET := LST_TO_LCT(Sun_LST_SET, Longitude, Year, Day_of_Year,
Zone_Correction);
IF Daylight_Savings THEN
Sun_LCT_SET := Sun_LCT_SET + 1;
IF Sun_LCT_SET < 0 THEN Sun_LCT_SET := Sun_LCT_SET + 24;
Sun_LCT_RISE := LST_TO_LCT(Sun_LST_RISE, Longitude, Year,
Day_of_Year,
Zone_Correction);
IF Daylight_Savings THEN
Sun_LCT_RISE := Sun_LCT_RISE + 1;
IF Sun_LCT_RISE < 0 THEN Sun_LCT_RISE := Sun_LCT_RISE + 24;
WriteLn(' SUN');
WriteLn('Rises at ', Trunc(Sun_LCT_Rise):2, ':', minutes(Sun_LCT_Rise):
2, ' LCT');
Write('Azimuth');
deg_min_sec(Sun_Azimuth_Rise);
WriteLn;
WriteLn('Sets at ', Trunc(Sun_LCT_Set):2, ':', minutes(Sun_LCT_Set):2
, ' LCT');
Write('Azimuth');
deg_min_sec(Sun_Azimuth_Set);

{ Calculate Time and Position of Rise and Set for Moon }

Moon_Azimuth_Rise := SIND(Moon_DEC)/COSD(Latitude);
Moon_Azimuth_Rise := ARCCOSD(Moon_Azimuth_Rise);
Moon_Azimuth_Set := 360 - Moon_Azimuth_Rise;
Moon_LST_Rise := 24 + Moon_RA/15 - (ARCCOSD( - TAND(Latitude) * TAND(Moon_DEC)))/15;
IF Moon_LST_Rise > 24 THEN Moon_LST_Rise := Moon_LST_Rise - 24;
Moon_LST_SET := Moon_RA/15 + (ARCCOSD( - TAND(Latitude) * TAND(Moon_DEC)))/15;
IF Moon_LST_SET > 24 THEN Moon_LST_SET := Moon_LST_SET - 24;
Moon_LCT_SET := LST_TO_LCT(Moon_LST_SET, Longitude, Year, Day_of_Year,
Zone_Correction);
IF Daylight_Savings THEN
Moon_LCT_SET := Moon_LCT_SET + 1;
IF Moon_LCT_SET < 0 THEN Moon_LCT_SET := Moon_LCT_SET + 24;
Moon_LCT_RISE := LST_TO_LCT(Moon_LST_RISE, Longitude, Year,
Day_of_Year,
Zone_Correction);
IF Daylight_Savings THEN
Moon_LCT_RISE := Moon_LCT_RISE + 1;
IF Moon_LCT_RISE < 0 THEN Moon_LCT_RISE := Moon_LCT_RISE + 24;
WriteLn;
WriteLn(' Moon');
WriteLn('Rises at ', Trunc(Moon_LCT_Rise):2, ':', minutes(Moon_LCT_Rise):
2, ' LCT');
Write('Azimuth');
deg_min_sec(Moon_Azimuth_Rise);
WriteLn;
WriteLn('Sets at ', Trunc(Moon_LCT_Set):2, ':', minutes(Moon_LCT_Set):2
, ' LCT');
Write('Azimuth');
deg_min_sec(Moon_Azimuth_Set);



END;
IF num = 3 THEN GOTO End_of_Locate_Planet;

Window(40, 2, 53, 10);
GoToXY(1, 1);
WriteLn(' Earth');
Locate_Position_of_Earth;
deg_min_sec(earth_long_of_ascend_node);
WriteLn;
deg_min_sec(earth_mean_anomaly);
WriteLn;
deg_min_sec(earth_true_anomaly);
WriteLn;
deg_min_sec(earth_heliocentric_long);
WriteLn;
WriteLn(earth_radius_vector:8:3, ' AU');
deg_min_sec(zero);

Window(1, 1, 80, 25);
frame(1, 10, 54, 13);
Window(12, 11, 79, 23);
TextColor(White);
GoToXY(1, 1);
Project_Position_of_Planet_onto_Plane_of_ecliptic;
Write('Projected Longitude = ');
deg_min_sec(projected_heliocentric_long);
WriteLn;
WriteLn('Projected Radius = ', Projected_Radius_Vector:8:3,
' AU');

{ Calculate Ecliptical Coordinates }


Window(1, 1, 80, 25);
frame(1, 18, 25, 24);
Window(3, 19, 24, 23);
GoToXY(1, 1);
Calculate_Ecliptical_Coordinates;
WriteLn(' ECLIPTIC');
WriteLn;
Write(' Long = ');
deg_min_sec(Geocentric_Ecliptic_Long);
WriteLn;
Write(' Lat = ');
deg_min_sec(Geocentric_latitude);
WriteLn;


{ Calculate Equatorial Coordinates }

Window(1, 1, 80, 25);
frame(27, 18, 52, 24);
Window(29, 19, 51, 24);
GoToXY(1, 1);
WriteLn(' EQUATORIAL');
WriteLn;
RA := ECL_TO_RA(Geocentric_Ecliptic_Long, Geocentric_Latitude);
Write(' RA = ');
IF Display_RA_in_Degrees
THEN
deg_min_sec(RA)
ELSE
hours_min_sec(RA);
WriteLn;
DEC := ECL_TO_DEC(Geocentric_Ecliptic_Long, Geocentric_Latitude);
Write(' DEC = ');
deg_min_sec(DEC);
WriteLn;
Hour_Angle := Lst - RA/15;
IF Hour_Angle < 0 THEN Hour_Angle := Hour_Angle + 24;
Hour_Angle_in_Degrees := Hour_Angle * 15;
Write(' HA = ');
IF Display_Hour_Angle_in_Degrees
THEN
deg_min_sec(Hour_Angle_in_Degrees)
ELSE
hours_min_sec(Hour_Angle_in_Degrees);

{ Calculate Horizontal Coordinates }

Window(1, 1, 80, 25);
frame(54, 18, 80, 24);
Window(56, 19, 78, 23);
GoToXY(1, 1);
WriteLn(' HORIZONTAL');
WriteLn;
Altitude := ArcSinD(SIND(Dec) * SIND(Latitude) +
COSD(Dec) * COSD(Latitude) * COSD(Hour_Angle * 15));
Write(' Alt = ');
deg_min_sec(Altitude);
WriteLn;

Azimuth := ArcCosD((SIND(Dec) - SIND(Latitude) * SIND(Altitude))/
(COSD(Latitude) * COSD(Altitude)));
IF SIND(Hour_Angle * 15) > 0 THEN
Azimuth := 360 - Azimuth;
Write(' Azim = ');
deg_min_sec(Azimuth);


{ Calculate Time and Position of Rise and Set }


Window(1, 1, 80, 25);
frame(1, 14, 54, 17);
Window(4, 15, 52, 17);
GoToXY(1, 1);
Azimuth_Rise := SIND(DEC)/COSD(Latitude);
IF (Azimuth_Rise < -1) OR (Azimuth_Rise > 1) THEN
IF Altitude < 0
THEN
WriteLn('never rises above horizon')
ELSE
WriteLn('never sets below horizon')
ELSE
BEGIN
Azimuth_Rise := ARCCOSD(Azimuth_Rise);
Azimuth_Set := 360 - Azimuth_Rise;
LST_Rise := 24 + RA/15 - (ARCCOSD( - TAND(Latitude) * TAND(DEC)))/15;
IF LST_Rise > 24 THEN LST_Rise := LST_Rise - 24;
LST_SET := RA/15 + (ARCCOSD( - TAND(Latitude) * TAND(DEC)))/15;
IF LST_SET > 24 THEN LST_SET := LST_SET - 24;

LCT_SET := LST_TO_LCT(LST_SET, Longitude, Year, Day_of_Year,
Zone_Correction);
IF Daylight_Savings THEN
LCT_SET := LCT_SET + 1;
IF LCT_SET < 0 THEN LCT_SET := LCT_SET + 24;

LCT_RISE := LST_TO_LCT(LST_RISE, Longitude, Year, Day_of_Year
,
Zone_Correction);
IF Daylight_Savings THEN
LCT_RISE := LCT_RISE + 1;
IF LCT_RISE < 0 THEN LCT_RISE := LCT_RISE + 24;

Write('Rises at ', Trunc(LCT_Rise):2, ':', minutes(LCT_Rise):
2, ' LCT');
Write(' Azimuth ');
deg_min_sec(Azimuth_Rise);
WriteLn;
Write('Sets at ', Trunc(LCT_Set):2, ':', minutes(LCT_Set):2
, ' LCT');
Write(' Azimuth ');
deg_min_sec(Azimuth_Set);
END;


{ Calculate Phase,Distance, Diameter, Magnitude }


Window(1, 1, 80, 25);
frame(56, 11, 80, 17);
Window(57, 12, 79, 16);
GoToXY(1, 1);
Distance_from_Earth1 := Sqrt(Earth_Radius_Vector *
Earth_Radius_Vector
+ projected_radius_vector * projected_radius_vector
- 2 * Earth_Radius_Vector * projected_radius_vector *
COSD(projected_heliocentric_long -
earth_heliocentric_long));
Distance_from_Earth2 := SIND(planet_helio_ecliptic_lat) *
projected_radius_Vector;
Distance_from_Earth := Sqrt(Distance_from_Earth1 *
Distance_from_Earth1 +
Distance_from_Earth2 * Distance_from_Earth2);
WriteLn('Distance = ', Distance_from_Earth:6:2, ' AU');

WITH Planets[num] DO
BEGIN
IF Size > 0 THEN
BEGIN
Diameter := size/Distance_from_Earth;
WriteLn('Diameter = ', Diameter:6:2, '"');
Phase := (1 + COSD(Geocentric_ecliptic_long -
planet_heliocentric_long))/2;
WriteLn('Phase = ', 100 * Phase:6:2, '%');
END;
IF Brightness <> 0 THEN
BEGIN
Magnitude := 2.17147 * Ln(Distance_from_Earth *
Planet_Radius_Vector/
Brightness * Sqrt(Phase)) - 26.7;
WriteLn('Magnitude = ', Magnitude:6:2);
END;
END;
End_of_Locate_Planet:
END; {Locate_Planet}

PROCEDURE SideView;
VAR
A, X, Y, OldX, OldY : Integer;
longitude, latitude, Radius : Real;

BEGIN
GoToHiRes;
Plot(centerX, centerY, 1);
GoToXY(1, 1);
WITH planets[num] DO
BEGIN
WriteLn(' ', name);
WriteLn('Period = ', period:3:1, ' years');
WriteLn('Ecc = ', Ecc:1:3, ' deg');
WriteLn('Inc = ', Inc:3:1, ' deg');
WriteLn('Axis = ', Axis:3:1, 'AU');
END;
X := 0; Y := 0;
FOR A := 0 TO 120 DO
WITH planets[num] DO
BEGIN
OldX := X;
OldY := Y;
longitude := A * 3 + long_of_per;
Radius := axis * (1 - Ecc * Ecc)/(1 + Ecc *
COSD(A * 3 - long_of_per));
Latitude := ARCSIND(SIND(longitude -
long_of_ascend_node) * SIND(Inc));
IF Inc > 90
THEN
X := Round(Radius * Screen_Aspect * last_scale_selected *
COSD(A * 3) * COSD(Latitude)) + CenterX
ELSE
X := Round(Radius * Screen_Aspect * last_scale_selected *
SIND(A * 3) * COSD(Latitude)) + CenterX;
Y := Round(Radius * SIND(Latitude) * last_scale_selected) +
CenterY;
IF A > 0 THEN
Draw(OldX, OldY, X, Y, 1);
END;
END; {SideView}

PROCEDURE error;
BEGIN
Write('illegal input');
END;


BEGIN {Planets}

{ Initalize Default Parameters }

get_hardware(Hardware,EGA_present); {read ROM BIOS to get machine specs}
TextMode(C80);
ClrScr;
MSDOS_time.AX := $2C00; {time call to MSDOS}
MsDos(MSDOS_time);
Hour := Hi(MSDOS_time.CX);
Minute := Lo(MSDOS_time.CX);
MSDOS_time.AX := $2A00; {Date call to MSDOS}
MsDos(MSDOS_time);
Year := MSDOS_time.CX;
Month := Hi(MSDOS_time.DX);
Day := Lo(MSDOS_time.DX);
Earth_Day := 0;
Orbital_Data;
day_of_year := Trunc(Julianday(month, day, year) - Julianday(1, 0,
year));
ColorTable(3, 2, 1, 0);
FOR n := 1 TO Num_Of_Planets DO
BEGIN
OldXpos[n] := 0;
OldYpos[n] := 0;
END;
Read_Set_Up_File;


{ Main Program }


Show_Menu;
REPEAT
Time_Travel;
Read(Kbd, Ch);
IF (Ch >= 'a') AND (Ch <= 'z') THEN
Ch := Chr(Ord(Ch) - Ord('a') + Ord('A'));
IF NOT((Ch = '-') OR (Ch = '+')) THEN
BEGIN
TimeSpeed := StopTime;
TravelMode := False;
END
ELSE TravelMode := True;
IF (Ch >= 'A') AND (Ch <= 'F')
THEN
BEGIN
Write(Ch);
Read(Kbd, Ch1);
num := Num_of_major_planets + Ord(ch1) - Ord('0');
IF (num > (num_of_planets)) OR
(Planets[num].period = 0)
THEN
Ch := '?'; { ? prints error message}
MinorPlanetSelected := num;
END
ELSE
num := Ord(Ch) - Ord('0');
IF (Ch = #27)
THEN
BEGIN
FOR n := 1 TO Num_Of_Planets DO
BEGIN
OldXpos[n] := 0;
OldYpos[n] := 0;
END;
Read(Kbd, Ch);
CASE Ch OF
#73 : TimeSpeed := StopTime + 1;
#81 : TimeSpeed := StopTime - 1;
#61 : Plot_planet_and_Moon(3,1,planets[3].NumberOfMoons);
#62 : Plot_planet_and_Moon(4,1,planets[4].NumberOfMoons);
#63 : Plot_planet_and_Moon(5,1,5);
#88 : Plot_planet_and_Moon(5,6,9);
#108 : Plot_planet_and_Moon(5,10,planets[5].NumberOfMoons);
#64 : Plot_planet_and_Moon(6,1,5);
#89 : Plot_planet_and_Moon(6,6,9);
#109 : Plot_planet_and_Moon(6,10,10);
#65 : Plot_planet_and_Moon(7,1,3);
#90 : Plot_planet_and_Moon(7,4,planets[7].NumberOfMoons);
#66 : Plot_planet_and_Moon(8,1,1);
#91 : Plot_planet_and_Moon(8,2,planets[8].NumberOfMoons);
#67 : Plot_planet_and_Moon(9,1,planets[9].NumberOfMoons);
END; {CASE}
END
ELSE
BEGIN
IF NOT TravelMode THEN
BEGIN
FOR n := 1 TO Num_Of_Planets DO
BEGIN
OldXpos[n] := 0;
OldYpos[n] := 0;
END;
TextMode(C80);
ClrScr;
END;
IF (Ch <> 'M') THEN
MenuOnScreen := False;
IF (Ch >= 'A') AND (Ch <= 'Z') THEN
LastCommand := Ch;
CASE Ch OF
'B' : Sky_View_of_Minor_Planet;
'C' : Orbital_View_of_Minor_Planet_and_Inner_Planets;
'D' : Orbital_View_of_Minor_Planet_and_Middle_Planets;
'E' : Orbital_View_of_Minor_Planet_and_Outer_Planets;
'F' : SideView;
'I' : Plot_Inner_Planets;
'H' : Help;
'K' : Kepler;
'L' : Change_Long_Lat;
'M' : BEGIN
IF MenuOnScreen THEN
BEGIN
MenuNumber := MenuNumber + 1;
IF MenuNumber > NumberOfMenus THEN
MenuNumber := 1;
END;
MenuOnScreen := True;
Show_Menu;
END;
'O' : Plot_Outer_Planets;
'R' : Read_Orbital_Data;
'S' : Set_Up;
'T' : Change_Date_Time;
'U' : SunView;
'V' : View;
'W' : Write_Orbital_Data;
'X' : Xcompare;
'Y' : SunStarView;
'Z' : StarView;
'+' : Change_Speed(Ch);
'-' : Change_Speed(Ch);
'1', '2', '3', '4', '5', '6', '7', '8', '9', 'A' :
Locate_Planet;
'?' : Error;
END; {case}
END; {ELSE}
Window(1, 1, 80, 25);
GoToXY(1, 25);
IF NOT MenuOnScreen THEN
Write(
'(Q)uit (M)enu (I)nner (O)uter (T)ime (L)ong (1 - 9) Planet : '
);
UNTIL (Ch = 'Q') OR (Ch = 'q');
TextMode(BW80);
ClrScr;
END.


  3 Responses to “Category : Science and Education
Archive   : PLANETS.ZIP
Filename : PLANETS.3TP

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/