June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -0,0 +1,49 @@
MODULE SunDial;
FROM STextIO IMPORT
WriteString, WriteLn, SkipLine;
FROM SRealIO IMPORT
ReadReal, WriteFixed, WriteFloat;
FROM SWholeIO IMPORT
WriteInt;
FROM RealMath IMPORT
sin, pi, arctan, tan;
VAR
Lat, Slat, Lng, Ref: REAL;
Hour: INTEGER;
HourAngle, HourLineAngle: REAL;
BEGIN
WriteString("Enter latitude => ");
ReadReal(Lat);
SkipLine;
WriteString("Enter longitude => ");
ReadReal(Lng);
SkipLine;
WriteString("Enter legal meridian => ");
ReadReal(Ref);
SkipLine;
WriteLn;
Slat := sin(Lat * pi / 180.0);
WriteString(" sine of latitude: ");
WriteFloat(Slat, 2, 8);
WriteLn;
WriteString(" diff longitude: ");
WriteFixed(Lng - Ref, 3, 1);
WriteLn;
WriteLn;
WriteString("Hour, sun hour angle, dial hour line angle from 6am to 6pm");
WriteLn;
FOR Hour := -6 TO 6 DO
HourAngle := FLOAT(15 * Hour);
HourAngle := HourAngle - (Lng - Ref); (* correct for longitude difference *)
HourLineAngle := arctan(Slat * tan(HourAngle * pi / 180.0)) * 180.0 / pi;
WriteString("HR=");
WriteInt(Hour, 3);
WriteString("; HRA=");
WriteFixed(HourAngle, 3, 8);
WriteString("; HLA=");
WriteFixed(HourLineAngle, 3, 8);
WriteLn;
END;
END SunDial.