Determining the Altitude of a Model Rocket

Before we try and simulate a “real” spacecraft in flight, it might help to consider the problem of tracking a model rocket, or similar “simplified” ballistic problem. Using a single tracking station, with a known distance from the launch point, we can estimate the altitude using a single measured angle and some simple trigonometry:

diagram1

 

When we code this particular exercise in Applesoft BASIC, we need to remember to convert our angles (typically measured using degrees) to radians by multiplying by PI/180.

 1000 REM SINGLE STATION TRACKING OF A MODEL ROCKET
 1010 REM DETERMINES ALTITUDE BY MEASURING ANGLE AT
 1020 REM APOGEE GIVEN A KNOWN BASELINE.
 1030 TEXT : HOME : SPEED= 255
 1040 PRINT "MODEL ROCKET - SINGLE STATION TRACKING"
 1050 PRINT 
 1060 PRINT "DETERMINES ALTITUDE AT APOGEE GIVEN A KNOWN BASELINE AND SIGHT"
 1070 PRINT "ANGLE AT APOGEE."
 1080 PRINT 
 1090 INPUT "ENTER BASELINE (DISTANCE FROM LAUNCH PAD TO TRACKING STATION: ";B
 1100 PRINT 
 1110 INPUT "ENTER SIGHT ANGLE (REF GROUND) AT APOGEE: ";A
 1120 PRINT 
 1130 PRINT "THANK YOU."
 1140 PRINT 
 1150 REM CONVERT DEGREES TO RADIANS
 1160 LET PI = 22 / 7
 1170 LET A = A * (PI / 180)
 1180 REM NOW CALCULATE THE HEIGHT
 1190 LET H = B * TAN (A)
 1200 PRINT "THE ESTIMATED HEIGHT AT APOGEE WAS ";H
 1210 PRINT 
 1220 PRINT "END PROGRAM."
 1230 END

The program works pretty much as expected – given a known baseline and several “convenient” angles, we get results that are both intuitive and mathematically correct.  As long as the rocket’s flight path is perfectly vertical, we obtain a good approximation of the altitude at apogee.

screenshot_alt1

Since it’s unlikely that an Apple II computer will be portable enough to drag along on a rocketry field exercise, a better approach to this particular problem might be to create a table of baselines and sight angles that can be printed and carried afield when launching rockets.

 1000 TEXT : HOME : SPEED= 255
 1010 PRINT "TABLE OF ALTITUDES FOR MODEL ROCKETRY:"
 1020 PRINT 
 1025 PRINT TAB( 17);"BASELINE"
 1030 PRINT "DEG","100","200","300","400"
 1040 FOR I = 0 TO 79: PRINT "=";: NEXT I
 1050 FOR A = 5 TO 85 STEP 5
 1055 PRINT A,
 1060 FOR B = 100 TO 400 STEP 100
 1070 LET A1 = A * ((22 / 7) / 180)
 1080 LET H = B * TAN (A1)
 1090 REM TRUNCATE THE ANSWER
 1100 LET H = INT (H)
 1110 PRINT H,
 1120 NEXT B
 1130 NEXT A
 1140 END

A screenshot of the table-formatted output is shown below.  This can be easily printed on a half-sheet of paper and carried into the field.

screenshot_alt2

Warming Up for the Retrochallenge

telescope_41073Simulating a spacecraft — or more accurately simulating spaceflight — will involve any number of astronomical calculations.  At the minimum, for a simple simulation of a ballistic or orbital spaceflight, one must solve the “two body problem” when finding the spacecraft’s trajectory.  Long before Galileo, Newton, Copernicus, or Kepler dared to challenge conventional wisdom or the church itself, the clergy found themselves with a similar problem:  What is the date of Easter?

Easter is normally defined as the first sunday after the fourteenth day after the first new moon following the Vernal Equinox… Since the date of Easter is determined by the date of Passover and we’re mixing both a solar and lunar calendar (courtesy of the ancient Hebrews) with the modifications to the solar calendar courtesy of both Julius Caesar and Pope Gregory, the problem becomes one not only of Sun, Moon, and Earth but one of Political whim and Ecclesiastical dogma… Are we sure they didn’t have computers back in the middle ages?  Oh, yes!  They were called “Monks!”

Anyway, the best definition for Easter (and the means by which one can calculate the date) can be found in ‘The Explanatory Supplement to the Astronomical Ephemeris and American Ephemeris and Nautical Almanac.”  Otherwise, there are some nice tables in the ‘Book of Common Prayer (1662)’, and an algorithm found in ‘Butcher’s Ecclesiastical Calendar’ published in 1876.  A variant of this algorithm, prepared for use with a handheld calculator, was printed in ‘Practical Astronomy with Your Calculator’ by Peter Duffett-Smith in 1979.

Applesoft Source Code Follows:

]LIST

 1000 REM FIND THE DATE OF EASTER
 1010 REM WORDS FOR ANY YEAR IN THE GREGORIAN CALENDAR FROM
 1020 REM 1583 ONWARDS
 1030 REM 
 1040 REM ALGORITHM IS TAKEN FROM THE BOOK 'PRACTICAL ASTRONOMY
 1050 REM WITH YOUR CALCULATOR' BY PETER DUFFETT-SMITH, COPYRIGHT
 1060 REM 1979 BY CAMBRIDGE UNIVERSITY PRESS.
 1070 REM 
 1080 TEXT : HOME : SPEED= 255
 1090 PRINT "CALCULATE THE DATE OF EASTER:"
 1100 PRINT 
 1110 INPUT "PLEASE ENTER THE YEAR (POST 1583 AD): ";Y
 1120 PRINT 
 1130 IF Y > = 1583 THEN 1170
 1140 PRINT "SORRY, YEAR MUST BE GREATER THAN 1583."
 1150 PRINT 
 1160 GOTO 1110
 1170 LET A = Y - ( INT (Y / 19) * 19)
 1180 LET B = INT (Y / 100)
 1190 LET C = Y - (B * 100)
 1200 LET D = INT (B / 4)
 1210 LET E = B - (D * 4)
 1220 LET F = INT ((B + 8) / 25)
 1230 LET G = INT ((B - F + 1) / 3)
 1240 LET H1 = 19 * A + B - D - G + 15
 1250 LET H = H1 - ( INT (H1 / 30) * 30)
 1260 LET I = INT (C / 4)
 1270 LET K = C - (I * 4)
 1280 LET L1 = 32 + 2 * E + 2 * I - H - K
 1290 LET L2 = INT (L1 / 7)
 1300 LET L = L1 - (L2 * 7)
 1310 LET M = INT ((A + 11 * H + 22 * L) / 451)
 1320 LET N1 = (H + L - 7 * M + 114)
 1330 LET N = INT (N1 / 31)
 1430 LET P = N1 - (N * 31) + 1
 1440 PRINT "MONTH: ";N
 1450 PRINT "DAY: ";P
 1460 PRINT 
 1470 PRINT "END PROGRAM."
 1480 END

]

easter_2017

The Apple II Plus

Apple_II_Plus

What can you say about the Apple II Plus that hasn’t already been said?  6502 Microprocessor, 48k RAM (Plus 16k RAM bank switched into the ROM address space for the “language card), AppleSoft in ROM, DOS 3.3, UPPER CASE ONLY, 80-column text optional.  In short, I love the damned thing.

Unfortunately, mine has a flakey keyboard encoder, so reliability has become an issue with this favorite artifact of the 1970’s.   I’ve also noticed some problems with cassette I/O — but that could easily be the computer, the tape deck, or the tape itself… Cassette I/O was never known for either speed or reliability. 🙂

I’m told that some versions of PRODOS might actually be made to work on the II Plus.  This might be a fun, if pointless, endeavor for the long cool evenings this fall.

What I would really like to accomplish is to recover some FORTRAN programs I wrote on this machine back in 1981 and move them to a newer platform.  Since FORTRAN on the Apple II actually ran under the UCSD Pascal operating system (the compiler generated the same pseudocode as the PASCAL compiler), it’s always been a bitch to interchange data with either DOS or PRODOS.  I might have to try and get the p-System running on an emulator in order to exchange data in the form of disk images.  We’ll see!

The Commodore VIC-20: 36 Years Later

Commodore-VIC-20-FL

Like many kids that grew up in the 1970s and 1980s, the VIC-20 was the first computer I actually owned, if not the first one I regularly used or programmed.  Mine came from Montgomery-Ward (a now-defunct department store and mail-order company that was the chief competitor to Sears and Roebuck for a century or so) and had been marked down to $329 from it’s original price of $499. Naturally, right after I got it, the MSRP was dropped down to $299 and sold “on the street” for under $200!  With no means of data-storage, there was an immediate need for some peripherals so I soon acquired the C2N Cassette Drive, the VIC-1525 Graphics Printer, and eventually a 1541 Disk Drive.  All told I had the full-on Commodore Experience as my main machine until 1985 when I received one of the original 128k Macintosh Systems.

I’ve had it out of the box a few times since then.  I had to show my kids what the term “gaming system” meant to me — they played the retro games for a few months and it went back into storage.  I dug it out for the Retrochallenge a few years ago.  Heck, I even pulled it out of storage so I could use the 20 ma Current Loop interface to read some punched paper tapes off the teletype!

Even as limited as the VIC-20 was, with its 22 column display and 5k (3,583 bytes free!) memory, it was still a REAL COMPUTER that was capable of serving as a word processor, programmable calculator, data terminal, and BASIC programmer’s workstation.  With a “shell account,” it is even possible to surf the net and do rudimentary email and such (but only if you’re a real masochist!)

In all honestly, the biggest limitation really is the 22 column display — I have RAM expansion packs that fill out the address space to a full 48k of RAM, just like the Apple II.  The printer produces reasonable dot-matrix output on standard 8.5 x 11 inch paper. The BASIC programming language is more than capable of handling any mathematical problem I might feed it.  Even communications on the VIC-20 are fairly painless, even though the emulated UART maxes out at 9600 baud on the “user port.”  It’s a handy little system that still gets me excited when I boot it up.

8-bits forever!

 

More Trojans, Viruses, and Malware

Well, isn’t this just special!  I clicked through a facebook link to read whatever salacious bit of trivia the advertisers were posting and I get one of the (always charming) fake virus warnings.

Fake_Virus_1

Yep, complete with a convenient telephone number, Microsoft Logo, and all the particulars needed to either bilk me out of some hard-earned cash or allow some scumbag to access my computer and install some actual bullshit malware.  A closeup of the message box gives us the details…

Fake_Virus_2

This one is particularly cute, since it tries to give you a drive-by download (courtesy of Javascript) and won’t go away when you click the stupid x in the upper right corner. Instead, it just reloads the page and displays another identical dialog box. Any reasonable anti-virus software will stop it, even the freebie Microsoft Security Essentials, but it’s still a pain in the ass to get away from.

Needless to say, I didn’t call the number.  The 844 area code is a dead giveaway — that area code is reserved for toll-free numbers but is supposedly not currently assigned in the continental United States.  A quick look at the WHOIS data for hailwater.com also points us to mainland China instead of the good folks in Redmond, Washington:

Domain Name: hailwater.com
Registry Domain ID: D400730592
Registrar WHOIS Server: Whois.domainerschoice.com
Updated date: 2016-07-05T20:30:05Z
Creation date: 2016-07-05T20:30:05Z
Registrar Registration Expiration date: 2017-07-05T20:30:05Z
Registrar: Nanjing Imperiosus Technology Co. Ltd
Registrar IANA ID: 953
Registrar Abuse Contact Email: abuse@domainerschoice.com
Registrar Abuse Contact Phone: +86.2584752360
Registrar Abuse Website: http://www.domainerschoice.com/report_abuse
Domain Status: ok
Registry Registrant ID: 
Registrant Name: Domain Admin
Registrant Organization: WhoisGuardService.com
Registrant Street: Tian Hong Shan Zhuang, BLd. 7, Office 104 
Registrant City: Nanjing
Registrant State/Province : Jiangsu
Registrant Postal Code: 210049
Registrant Country: CN
Registrant Phone: 86.2584752362
Registrant Phone Ext: 
Registrant Fax: 86.2584752362
Registrant Fax Ext: 
Registrant Email: abuse@domainerschoice.com
Registry Admin ID: 
Admin Name: Stefan Hansmann
Admin Organization: Nanjing Imperiosus Technology Co. Ltd
Admin Street: 
Admin City: Nanjing
Admin State/Province : 
Admin Postal Code : 210004
Admin Country: CN
Admin Phone: 8.6.13951615475
Admin Phone Ext: 
Admin Fax: .
Admin Fax Ext: 
Admin Email: stefan@domainerschoice.com
Registry Tech ID: 
Tech Name: Domain Admin
Tech Organization: WhoisGuardService.com
Tech Street: Tian Hong Shan Zhuang, BLd. 7, Office 104 
Tech City: Nanjing
Tech State/Province: Jiangsu
Tech Postal Code: 210049
Tech Country: CN
Tech Phone: 86.2584752362
Tech Phone Ext: 
Tech Fax: 86.2584752362
Tech Fax Ext: 
Tech Email: abuse@domainerschoice.com
Name Server: NS1.DNSSUPPORTPC.COM
Name Server: NS2.DNSSUPPORTPC.COM
DNSSEC: UnSigned
URL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/

I suppose I could try and contact these folks and let them know about the scam, but it’s a fair bet that already know. Heck, it’s a fair bet that these particular folks are getting paid by their government to spread the joy…

Anyway, on a Windows machine the best way to get out of this little trap is to give your computer the three-finger salute (CTRL-ALT-DELETE) and use the task manager to kill the browser.  If you don’t feel comfortable with the task manager, shutting down the computer may get you out of their clutches.  If you’re on a Macintosh or Linux machine, just laugh at the poor stupidity of the folks who bought a Windows machine and go about your business…

In any case, don’t call the number.  If you already screwed up and called the number, don’t pay the bastards anything.  If you let the nasty little hackers get into your computer, make sure you do some serious housecleaning before using the computer for any banking or personal business.  If you have any doubts about your ability to eliminate Malware, it might be time to consult a professional to wipe the machine and start over.

Incidentally, neither the local, state, or federal law enforcement types will be of much help… They might offer you a certain amount of “tea and sympathy” but until we’re actually in a position to permanently eliminate China, India, Pakistan, Nigeria, and all the other places that host these scammers, there won’t be any concrete progress in catching or punishing the bad guys.  It’s Piracy, plain and simple, but there’s nobody to enforce the laws on the high seas of cyberspace just yet.

In the mean-time, I have a simple message for the person at domainerschoice.com calling himself Stefan Hansmann  — Fuck off and die, asshole!

Micheal H. McCabe

 

The Beginnings of Our Interstellar Exploration

Despite an apparent lack of interest in space exploration by our government here in the United States, the notion of interstellar travel is an important idea in the public consciousness.  Many of us are anxiously awaiting the new Star Trek film — we need our “fix” of a speculative future where humanity lives not on a single world, but on a multitude of different planets and can travel at will between them.  Space Travel is part of our culture, and we can’t get enough.

Even as we wait for NASA to regain a nominal ability for manned space exploration with the new (and not particularly creatively named) Space Launch System and Crew Exploration Vehicles, we can find some interest in the fate of our (somewhat dated) unmanned spacecraft that have left, or are about to leave, the confines of our local solar system and have made it into interstellar space.  These are the emissaries of our species, and it’s interesting to think about where they are going and what they will encounter.

There are currently five such spacecraft that have reached escape velocity and are on a heading for the unknown regions of deep space beyond the influence of our home star.  Two are presumably “dead” and lack the ability to report any information back to us.  Three are still functional at some level and can communicate basic telemetry back to Earth, if only we continue to listen.  Both Voyager spacecraft are transmitting as is the New Horizons probe that recently left Pluto and headed towards the edges of the known solar system.  Listening to their reports is often tedious and can become expensive, but every bit of data that they transmit is new information about a region of space that is almost completely unknown.  I hope that our technology continues to improve and allows us to listen to these data streams for as long as possible.  Ignoring them would be a crime — a crime that the right-wing partisans in Washington are all-to-ready to commit.

Extrasolar Spacecraft

 

Circles, High Resolution Graphics, and Remedial Math

It was a simple question, really: “How do you draw a circle on the screen?”

Some programming languages have a nice set of graphic primitives that let you specify the coordinates and radius and draw a circle with a single statement… Heck, even the Commodore Plus 4 supported this.  Microsoft BASIC on the Macintosh did.  I even vaguely remember something in the current version of Visual Studio that lets you do this without too much trouble.

Sadly, Applesoft does not and the young programmer in question was working on an ancient Apple IIe that was already considered “Vintage” when he was born.

I’m told there are ways of generating the Cartesian Coordinates of points on a circle without using the Sine or Cosine function… Some other genius can show you this on their own time, but I got wrapped up in essentially converting polar coordinates to Cartesian and Applesoft conveniently DOES have the Sine and Cosine functions readily accessible, even if they are somewhat slow.  The meat of the program are these two functions:

x = r * cos (theta)

y = r * sin (theta)

Where x and y are the Cartesian coordinates of points on the circle, arc, or curve; r is the radius from the central point; and theta is the angle from the horizontal.

Complicating this somewhat, for someone who was taught to think about angular measure in degrees is the fact that Applesoft BASIC uses radians.  We convert degrees to radians by multiplying the angle in degrees by the value of pi divided by 180:

radians = degrees * (PI / 180)

We also need to consider that the screen coordinates place the origin in the upper left-hand corner of the screen and are all positive integers.  Since our functions for X and Y are going to give us negative values, we have to redefine the origin as the middle of the screen:

Cx = INT (280 / 2)

Cy = INT (192 / 2)

Where Cx is the center of the screen along the X axis (Horizontal) and Cy is the center of the screen along the Y axis (Vertical.) By adding the X and Y coordinates generated by our earlier function t0 Cx and Cy, we can plot even those points where the functions give us negative numbers.

So, thus far we can convert Radians to Degrees, convert Polar coordinates to Cartesian, and map those “absolute” coordinates to our actual screen.  The next part of the procedure is simply to step through all “360 Degrees” of the circle and plot those points that lie on the circle. The sample code looks like this:

 1000 TEXT : HOME : SPEED= 255
 1010 HGR2 : HCOLOR= 3
 1020 LET PI = 22 / 7
 1021 LET CX = INT (280 / 2)
 1022 LET CY = INT (192 / 2)
 1030 DEF FNR(D) = D * (PI / 180)
 1050 DEF FNX(D) = R * COS(FNR(D)) + CX
 1060 DEF FNY(D) = R * SIN(FNR(D)) + CY
 1070 LET R = 90
 1080 FOR T = 0 TO 360
 1090 HPLOT FNX(T), FNY(T)
 1100 NEXT T
 1110 END 

And generates the following display on the Apple Iie emulator:

A2E_Circle_Plot

A line-by-line examination of the program follows:

1000 – Sets text mode, clears the screen, and sets the output speed to maximum. Since we don’t know any of these states when we begin execution, this is just precautionary.

1010 – Sets the full-screen high resolution graphics mode and sets the output color to white.

1020 – This defines our constant pi using the rough approximation I learned back in Junior High.

1021 – This defines constant Cx as the center of the screen along the X-Axis.

1022 – This defines constant Cy as the center of the screen along the Y-Axis.

1030 – This user-defined function converts an angle measured in degrees (D) to an angle measured in Radians (R)

1050 – This user-defined function finds the X-coordinate of each point given the angle and radius.

1060 – This user-defined function finds the Y-coordinate of each point given the angle and radius.

1070 – This defines our radius (R) as 90 pixels.

1080 – This marks the beginning of a FOR loop that will step through all 360 degrees of angle T (Theta) that define the circle.  If we wanted to draw an arc instead of a circle, we could limit the range of T to the beginning and end of the arc.

1090 – This plots each point that lies on the circle, as computed by the user-defined functions above.

1100 – This line completes the FOR/NEXT control structure.

1110 – This line marks the end of the program and terminates execution.

Yes, the program works but it’s rather slow and it turns out that we can speed-up execution a bit by treating our circle as a polygon with n equal sides. We accomplish this by adding a STEP value to our FOR/NEXT loop and “remembering” the previous point so that we can draw a straight line between them.

Edit the program as follows:

 1075 LET OX = FNX(O):OY = FNY(0)
 1080 FOR T = 15 TO 360 STEP 15
 1090 HPLOT OX,OY TO FNX(T), FNY(T)
 1096 LET OX = FN X(T):OY = FNY(T)

Line 1075 finds the first X and Y values at T=0 and stores those values in variables Ox and Oy.

Line 1080 is edited to reflect that we’re now starting at T=15 and working towards 360 in 15 degree steps.

Line 1090 is edited to now draw a line from the “old” coordinates specified by OX,OY and the “current” coordinates found by FNX(T) and FNY(T).

Line 1096 is added to update the values of OX and OY to the “current” values and storing them for the next iteration of the loop.

Drawing the circle in 15 degree steps makes the outline of the circle a little rougher, but the program only loops 23 times versus 360 times in the previous version.  Here’s a sample of the output generated by the revised program:

A2E_Circle_Plot2

Although the circle shown here is a little “rough”, this is actually a worst-case scenario since this is probably the largest circle you can practically draw on the Apple II screen — smaller circles will show less irregularity due to the jagged plot lines.

Good Night, All!

 

Future Past

thm_bytedec1977cover-Starrek

The December 1977 issue of Byte magazine featured an illustration of the Enterprise (ST: TOS) crew visiting a museum and looking at an exhibit of a 20th century computer enthusiast seated at the DecWriter console of his S-100 computer system, evidently trying to key-in or debug a program from a bound book.  The book bears a striking resemblance to a later reprint of the classic 1973 “BASIC Computer Games” by David Ahl.  A somewhat self-referential paradox is that one of the longer and more complex games published in the book is titled “Super Star Trek.”

basic_computer_games

Access to the Old Content

Paleoferrosaurus

[HOME] [DOCUMENTS] [FLICKR] [YOUTUBE] [Gallery2][WEATHER]

 

Quick Links to Editorial Content:

The UNIVAC 90/60 Fan Page

Wang 5506-2 Terminal / Workstation

Erie County Dept. of Public Safety (WebCad)

EMS Charts for Patient Care Reports and Human Resources

West County Fire Control — Legacy Webpage

The Original “Computer Collection” Document

The Gudgeonville Covered Bridge

Fun and Games with the Commodore 64

Moving the Valley School

Local Railroad History

The Grand Trunk Western 4070 that pulled excursion trains at Conneaut Lake Park

Fairview Engine #45

The DecMate VT-278

Where to get Classic Macintosh Software

Macintosh Software Collection

What to do “After the Fire”

Childhood Homes Revisited

A Timeline of the MacArthur Ancestors

Children of Arthur (By Michael A. McCabe)

This page last revised on April 13, 2016 by Micheal H. McCabe

Changes at Paleoferrosaurus

Hand-coded HTML was getting fairly tedious to write and maintain, so in the spirit of 1995, I’ve switched to the WordPress content management system for this website.  Right now, it’s purely an experiment — I might switch back to a traditional home-page someday.  Most of the existing content will be preserved, but it might take me some time to migrate everything over to the new system.  In the meantime, wish me luck in keeping this old-school personal web-page alive!

Thanks!

–Paleoferrosaurus (Micheal H. McCabe)