For reasons I’d rather not elaborate, I recently had to re-do my D5 exams. We’re talking all the courses, the whole shibang. If you think it sounds like fun to go back to school for a while so you can stun your peers with your grey beard and worldly wisdom, I can inform you that it wears off real soon after establishing that true virgins do indeed make terribly dull company, and the mind invariably drifts towards whiskey. In a bid to retain my sanity in the face of lethal boredom, I took it upon myself to solve the radar plot using trigonometry, and developed an algorithm that runs on my TI graph calculator.
Somewhat surprisingly, radar plotting was one of the “problem subjects” that saw a lot of my fellow students frustrated. If you’re also pulling your hair out over how difficult graphical vector addition can be, or if you (like me) are just annoyed at the inescapable measurement errors, you may find my little creation handy for double checking your work. Thus I present to you the BRPA, written in Texas Instruments Basic:
If you go to the program menu on your TI calculator, select new, and type in the above, you should end up with a functional program that does the following:
-Prompts for T, time between readings. In the study material that is basically always 6, but I decided not to hard code it in case you somehow have a different value
-Prompts for V, own ship speed over ground
-Prompts for K, own ship course over ground
-Prompts for B, target bearing
-Prompts for R, target range
-Returns nonsensical output, please ignore
-Prompts for B
-Prompts for R
-Returns CPA, TCPA, target SOG and COG, all rounded to two decimal places.
At this point the program is stuck in a loop, assuming you keep taking readings of the same target at the same time interval, and updates the output accordingly. I’ve tested it on all the example problems we were given, and it seemed to work correctly for all of those. As a funny side note, the answer key was sometimes significantly off on the CPA, sometimes in excess of 20%.
Now some important caveats:
Make sure your calculator is set to degrees (radians is default on most), and please don’t use this for anything without a sanity check. I don’t have the USB cable for my calculator, so the code has been manually transcribed; if it doesn’t run, I probably forgot a parenthesis or somesuch. I have not attempted to deal with targets moving away from own ship, since those didn’t show up in my data set (for some reason), but the way I built it I suspect that it’ll give you correct CPA and time since CPA as TCPA, but I haven’t tested it. Due to the pen and paper way I developed this, there is glaring potential for optimization. Due to the use of division in the intermediary steps, targets on a constant bearing result in a divide by zero, and due to the use of tangent, targets with relative course parallel or perpendicular to own ship result in out of domain error. The only way I can see to fix that is by testing for edge cases and outputting preset values, which sounds tedious, so I haven’t.
If there is any interest, I can sanitize the output, add some exception handling, maybe even a graphical interface, etc. If anyone wants to grab this and port it to whatever (Casio? iOS?), please go right ahead, no attribution required (but don’t blame me when the code blows up). The right arrow is the assignment symbol in TI basic, so substitute = and invert the statement for most common languages.
Anyway, hope someone gets use of this, and don’t hesitate to ask