Monday, October 19, 2020

Aviation Oil

I’m no expert, but I’ve found a few pieces of information useful along the way. Collected here. (Anyone who knows me knows I’m a huge fan of Mike Busch when it comes to the care and feeding of aviation engines.)

Consumption and When to Change

Mike Busch’s Checking the Dipstick (November 15, 2016) provides two excellent visual aids:

  • A chart showing the acceleration of oil consumption over time in service (“the viscosity of the oil decreases as the oil deteriorates”).
  • What “good” vs. “due to be changed” oil looks like.
I know folks who change their oil religiously at 25 hours, and when I’ve submitted samples to Blackstone for analysis, they state their “universal averages are taken after ~30 hours of oil use.” But as Mike Busch notes:
If your oil remains relatively light-colored and translucent after 25 hours in service, you can be reasonably confident that your cylinders and rings are in fine condition and that your oil can prudently remain in service for 40 or 50 hours. On the other hand, if your oil gets dark and opaque after 10 or 15 hours, you’d be wise to change your oil more often— perhaps at 25 hours—and you may want to investigate the possibility that one or more cylinders are excessively worn.

Which Oil, What Additives

I have been using AeroShell W100 and adding CamGuard. (In fact, I carry a 1.5 oz. plastic shot glass, to add an appropriate amount of CamGuard whenever I add a quart.) Per Ed Kollin, the developer of CamGuard, ...

Mr. Kollin states he uses Phillips 20W-50 year ’round (and I’m thinking that’s the way forward, once the engine is back in the Mooney):

Mike Busch echoes this, in All About Oil (January 2011):

For most of the airplanes we manage, we recommend AeroShell W100 with a pint of CamGuard added at each oil change. That’s what I use in my airplane, and my two engines are at nearly 200 percent of time between overhauls (TBO) and still going strong. For wintertime operations in cold climates, I recommend Phillips X/C 20W-50 multigrade with a pint of CamGuard.

Oil Analysis

 The Mooney came with about a decade’s worth of Aviation Oil Analysis by ALS Laboratory Group's Tribology Division reports. I switched to what everyone I know uses and my mechanic recommended, Blackstone Labs. They’re useful but they’re not comprehensive; case in point, the Mooney had serious spalling on the intake lobes on the camshaft, that was not detected in the Blackstone analyses. Per Mike Busch, asked if oil analysis would uncover an issue with spalled camshaft and lifters:

Probably not ... Generally speaking, when cam and lifter stuff comes apart, we don’t see it in oil analysis. The reason is, when cams and lifters come apart they come apart pretty rapidly, and they throw off pretty good sized pieces of metal ... That metal is gonna be caught in the suction screen or caught in the oil filter and it’s never going to wind up in the sample jar. So that’s why we very rarely will see evidence of cam and lifter spalling in oil analysis. Oil analysis only sees microscopic wear metal particles that generally are thrown off by very slow wear events. So if we have for example accelerated wear of an exhaust valve guide, that’s going to show up in oil analysis as high nickel. The exhaust valve guide is made of very hard material, the exhaust valve stem is chrome, and is very hard, so the wear rate is very slow and the wear particles that are thrown off are very very tiny. And they are tiny enough that they would pass through the oil filter and be suspended in the oil, and be analyzed when the sample goes to the lab. But anything that throws off pretty good sized pieces of metal, say 100 microns or bigger, those are always going to be caught in the oil filter and they’re never going to end up in sample jar. So you wouldn’t expect oil analysis to show those things.

Fresh Annual EAA presentation, September 2020.


Wednesday, September 23, 2020

Understanding UNIX `time` command output

Bizarrely, I couldn’t find any documentation as to the output from the UNIX (BASH shell version 3.2.57(1)-release, here) `time` command. I thought I had it, but I wanted to be sure, so I wrote a quick shell script to verify my understanding. A script that takes 1 minute, 5 seconds to run will have output that looks something like this:

iMac:~ me$ cat time_test.sh 

#!/bin/bash

sleep 65

echo "Done."


iMac:~ me$ time ./time_test.sh 

Done.


real 1m5.016s

user 0m0.003s

sys 0m0.006s


An hour, 2 minutes, and 8 seconds (sleep 3728):

real 62m8.083s

user 0m0.003s

sys 0m0.007s


A script that completes in approximately 2 seconds (sleep 2):

real 0m2.014s

user 0m0.003s

sys 0m0.006s


Mystery solved.

Monday, September 21, 2020

Parsing and modifying Microsoft Word docx XML in PHP

I’m implementing Microsoft Word templates in PHP. That is, taking an existing Word document, modifying some particulars on the fly, and spitting out the finished product (think: automatically generating legal forms, pre-populated with case names and docket numbers, assigned judges, that sort of thing.)

The easiest way I’ve found to do that is to make liberal use of custom properties:

Those custom properties can then be inserted into the document using the DOCPROPERTY field:


 

Modifying these on the fly should, in theory, be easy. Microsoft’s “docx” file format, in use since Office 2007 (Windows) and 2008 (Mac), is a ZIP archive containing multiple XML files. Easily enough processed with PHP’s ZipArchive functionality:

// Store the supplied ZIP file data in a temporary file:
$fp = tmpfile();
fwrite( $fp, $data );
$stream = stream_get_meta_data($fp);
$filename = $stream['uri'];
$za
= new ZipArchive();
$za->open($filename);

$nza = new ZipArchive();
$new_filename = __DIR__ . DIRECTORY_SEPARATOR . uniqid() . $database["extension"];
$nza->open($new_filename,ZipArchive::CREATE );
for( $i = 0; $i < $za->numFiles; $i++ ){
$stat = $za->statIndex( $i );
//print_r($stat);
print $stat['name'];
if( key_exists( $stat['name'], $fields_data['container']['files'])) {
// Use Template to alter contents of ZIP entry and add modified contents to new ZIP archive
// ...
} else {
// Straight copy file into new ZIP archive
$nza->addFromString( $stat['name'], $za->getFromIndex( $i ));
}
}
$za->close();
$nza->close();

The custom properties are stored in the file docProps/custom.xml within the docx ZIP archive.

The PHP documentation for XML handling only contemplates pretty straightforward examples, though, and Microsoft’s is ... Not that. Here’s the XML Microsoft uses to specify two custom properties (whitespace added):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
xmlns:
vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
<property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="2" name="Matter">
<
vt:lpwstr>30738</vt:lpwstr>
</property>
<property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="3" name="Document number">
<
vt:lpwstr>999999</vt:lpwstr>
</property>
</Properties>

The PHP code to examine, and modify, those values, isn’t as straightforward as I’d like, but here’s what I’ve come up with so far, with some considerable help from redditor crazedizzled:

$custom = simplexml_load_string($xml);
$namespaces = $custom->getNamespaces(true);
$custom->registerXPathNamespace('vt', $namespaces['vt']);
$nodes = $custom->xpath('//vt:*');
$count = $custom->property->count();
for($i = 0; $i < $count; $i++) {
print $custom->property[$i]->attributes()->name . ": " . $nodes[$i][0] . "\n";
$nodes[$i][0] .= ".foo";
}
print $custom->asXML() . "\n\n";

Here’s the complete code (more or less; this is a working scratchpad example):

$xml = <<<ENDXML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"><property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="2" name="Matter"><vt:lpwstr>30738</vt:lpwstr></property><property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="3" name="Document number"><vt:lpwstr>999999</vt:lpwstr></property></Properties>
ENDXML;

try
{
print "Processed XML for matter no. 1542: " .
populateDocPropsCustomXML($xml, [
'Matter' => 1542,
'Document number' => 2020.14723
] ) . "\n\n";
} catch(Exception $exception) {
print $exception;
}


/**
* @param $xml The XML data to parse and, if necessary, modify (from docProps/custom.xml)
* @param $keyValuePairs The substitution data, keyed with "name" attributes from property elements. E.g., 'MatterNo' => '1701'
* @return mixed The XML data, as modified
* @throws ErrorException
*/
function populateDocPropsCustomXML( $xml, $keyValuePairs ) {
libxml_use_internal_errors(true);
$custom = simplexml_load_string($xml);
if($custom === false) {
$errormesg = "Unable to parse XML:\n";
$errors = libxml_get_errors();
foreach ($errors as $e) {
$errormesg .= trim($e->message) . "\n"
. "\tLine/Column: " . $e->line . "/" . $e->column . "\n";
}
libxml_clear_errors();

throw new ErrorException( $errormesg );
}

$namespaces = $custom->getNamespaces(true);
$custom->registerXPathNamespace('vt', $namespaces['vt']);
$nodes = $custom->xpath('//vt:*');
$count = $custom->property->count();

for($i = 0; $i < $count; $i++) {
// print $custom->property[$i]->attributes()->name . ": " . $nodes[$i][0] . "\n";
$key = (string)$custom->property[$i]->attributes()->name;
if(key_exists( $key, $keyValuePairs )) {
$nodes[$i][0] = $keyValuePairs["$key"];
}
}
return $custom->asXML();
}

Thursday, September 10, 2020

On the dangers of flight

Found these quotes recently:

In the catalog of human endeavors, few activities are as fragile as flight. The air offers no mercy for mistakes and no second chances. Flight is, as Winston Churchill observed, “an extremely dangerous, jealous and exacting mistress, ” demanding unfettered attention and respect. WINSTON S. CHURCHILL, THOUGHTS AND ADVENTURES 128 (Leo Cooper pub., 1990).

“Flying is not inherently dangerous but very intolerant of errors.” (Which appears to be a twist on: “Aviation in itself is not inherently dangerous. But to an even greater degree than the sea, it is terribly unforgiving of any carelessness, incapacity or neglect.” Captain A. G. Lamplugh, British Aviation Insurance Group, London.)


Monday, September 7, 2020

Mooney back from the dead. Again.

 https://www.aopa.org/news-and-media/all-news/2020/september/03/pilots-aircraft-owners-buy-mooney-international. I’m not going to try and count how many times this makes it, that Mooney’s been “dead” and then revived. Hope springs eternal. They really are bitchin’ machines.

Freshly?

 After looking at my DoorDash/Grubhub/etc. spends, I’m going to try Freshly for a minute. Reviews seem promising:

Fingers crossed.

Meal 1: Steak Peppercorn with Sautéed Carrots & French Green Beans

September 21, 2020. Meals were delivered yesterday. Popped this in my ~1100 watt microwave for 3:30 and sat down with what was left of a bottle of Babcock’s Backroads Red Blend. Verdict: Not bad. Compared to Lean Cuisine? Blows it away. Compared to a homecooked meal from scratch? On par with what I’d whip up with budget ingredients. Nowhere near what I’d produce if I spent for even “high quality for the local supermarket” beef and veggies. But, it’s not meant to substitute for meals I actually make. It’s Bachelor Chow®: Now with flavor!™ Would eat again. Only 490 calories, too, well within where I want to be (I aim for about 600 calories per meal, give or take).

October 3, 2020: Hitting Pause.

So, despite signing up on or about the 7th of September, my first meals weren’t delivered until Sunday the 20th. My shipment for the next week had to be edited by 3 pm on Monday the 21st, giving me basically zero time to decide which meals I liked, which I didn’t, etc. So the menu repeated for week 2. I edited it a bit for week 3, which will be delivered tomorrow. But based on my experience over the last two weeks, I’m hitting pause for now (for at least the next two months), and am on the fence as to whether or not I’ll cancel. Issues;
  • Delivery hassle. The whole point of subscribing to a service like this is to minimize inconvenience. But when they can only give you a 12 hour window, that destroys your Sunday, if you wanted to make plans to do anything (like, watch the Rams play at a bar (“and grill,” COVID Karens)).
    • My first delivery (both so far have been delivered by “AxelHire”) was around 12:45 p.m., though the driver managed to find their way around the building, and up a flight of stairs, to leave the box underneath a sign that says “leave no packages here.” SMH. (But, once I found it, I at least had the rest of the afternoon.)
    • The delivery on the 27th arrived at the door to my apartment at 5:19 p.m., after we’d sat around all day waiting for it (and watching football on TV and munching on leftover pizza and wings).
  • Price and Quality. The first two orders had $20 promotional discounts applied, and so were about $50 for 6 meals. After that, it popped up to about $70 for 6, making the price per meal almost $12. The Lean Cuisines against which they’re directly competing are about $3/meal. The Freshly stuff is, well, fresher, and not loaded with sodium. Better. But 4x better? Eh, not so much.
  • Lack of Variety.  I was really hoping for more green veggies; the steak has green beans, as does the chicken mac & cheese. The chicken Parmesan has broccoli, that’s kind of over-steamed and mushy. At the end of the day, the meals quickly (over just 2 weeks!) got monotonous - especially the chicken dishes aren’t really strongly differentiated, and the overall effect just seemed to be, again, not that different than nuking a Lean Cuisine or similar entree.

 I had high hopes, but, this was not that. I might try one of those meal prep kit delivery services, but probably not, just because I know I’ll end up throwing away half of each delivery unused. :/ Pondering next steps.

Wednesday, August 26, 2020

Marceline, Missouri


Okay, as a fan of Disneyland, I feel like I kinda have to visit Marceline, Missouri, Walt Disney's home town and the inspiration for Main Street:

Marceline used to have an airport, but apparently no more. (How can the town that hosts the Walt Disney Hometown Museum, not have an airport?!) Looks like the nearest is the North Central Missouri Regional Airport in Brookfield (5000x75' runway, with instrument approaches; ~130 nm from Spirit of St. Louis Airport, less than an hour’s flight). It’s about 7 miles by road to the museum. Might be a good application for folding bicycles? Also, I still need the Rohde ears (I tried to get them when they went on sale, but they sold out before I could complete the purchase!).