Sunday, 21 February 2010

Kicking a Dead Horse

My ISA calculator is done. I've left out the US Standard Atmosphere calculations from it, simply because if I were to add it now I'd take the cheap way out of simply converting the input to metric, then the original outputs back into US units. This would be a little bit inefficient and a bit inaccurate, as the different standards are bound to use different conversions than I would. If I ever want to add in that function, then I'll do it proper.

That said, I did change most of the other things I found to be lacking:


  • Now takes advantage of normalized units, which means the window can be resized (relatively) without problems. Resizing it will allow the table to be viewed without a horizontal scrollbar, and in many situations without a vertical one either.
  • No longer recalculates if the values entered at the time of giving it the calculation command are the same as the last values used.
  • Fixed a small bug in which if the user clicked the same plot button they were already on, they'd receive a dialog stating "Unknown Plot Type Error." Turns out, the error was simply that none of the plots were selected. If that situation comes up now, it simply returns out of the statement, leaving the last-selected plot in view.
  • Pressing enter in a text input box now calculates as necessary.
MATLAB itself has some shortfalls which prevented proper fixes for the recalculation bug and the axis tick mark problem. The first problem is that it's not easy (I'd like to say not possible but that almost always is proven wrong) to have more than one "axes" object in the same GUI. I wanted, originally, to have one set of axes for each plot, and simply hide/show the different axes as requested. Unfortunately, as MATLAB denies me this option, every time the user selects a different plot type, MATLAB has to go through and re-position all of the data points on the set of axes. While it doesn't need to calculate all of the values again, the plotting itself definitely appears to take longer than the calculations, as there's no noticeable decrease in time between inserting fresh values and just switching the displayed plot with the same values.

The second problem was axis tickmarks. The problem here is that the tickmarks have to be manually declared as exact values. While it's not incredibly hard to calculate a vector of values rounded to the nearest thousand or something, the requirements are so contextual to make it a mostly useless bit of extra programming. What happens when the user only wants to see the range of heights from 0 to 25m? From 1276 to 8452 meters? From 0 to 100 meters, in 520 increments? I think you see my point. MATLAB's automatic tickmark decisions are vaguely useful enough to allow them to be the only ones.

So, that said, my work is done.You can find, look over, criticize, and hopefully provide feedback on the source code at this link. I'd expect to hear things along the lines of "it's horribly inefficient," "I'm amazed this works at all," and "YOU SUCK!" so feel free to be brutal, as long as there's some sort of suggestion for improvement alongside it.

Expect to hear progress on my Java simulation tomorrow! Probably a working, if preliminary, version of my material decoder at the least.

No comments: