uwMike.com

I'm in Waterloo at the moment, and next available to work in September 2008.

Engines and Fireflies

January 8th, 2007

I had another opportunity recently to make a visualization out of JavaScript; I thought I’d share two examples of using the language for this purpose.

The 6-Stroke Wankel

Last winter, there was brief flurry of activity over some guy building a six-stroke engine. The principle was ingenious—rather than waste excess heat through a cooling system, why not harvest it as an extra power stroke, by injecting distilled water into your cylinder? The rapid expansion of the liquid into gas would provide a small boost, plus drastically reduce the amount of cooling infrastructure necessary on the engine block.

6-Stroke Wankel

My immediate thought was, well, what about doing that with a Wankel? A Wankel rotary engine is a lightweight, high-torque system. Mazda uses standard 4-cycle Wankels with their RX7 and RX8 cars, but what about a 6-cycle one, that implemented this water-injection cycle?

Jeff helped me out with some of the formulas, and we ended up figuring out what the thing should look like. Now, it could certainly be modeled in a tool like SolidWorks, or AutoCAD, or maybe even MATLAB, but what’s the fun of that, when only people who have the software can look at it?

Instead, I tried going the SVG route. SVG is an open standard vector language that’s positioned to compete with Flash. Through various problems, it’s not as widespread as it could be, but all of Firefox, Opera, and Safari provide reasonable support for static SVG, and Firefox provides excellent support for SVG animation. So you’ll need to be using Firefox to view this, but here’s the animated demo of the six-stroke Wankel.

The real-world feasibility of the thing is a topic for another day, but I was very pleased with myself to be able to come up with an attractive demo like that within a few hours of a concept. Although I didn’t know SVG at all, all my knowledge of JavaScript DOM operations was completely transferable, and thus the coding of it was a snap.

Crickets and Fireflies

Synchronized Oscillators

The second demo was from a few days ago. The guy I’m living with this term was explaining to me about synchronized oscillators, the principle that explains how a group of crickets—all apparently acting on their own—can all chirp in unison. He’d been looking for a visual aid to use with his students, and I mused about the feasibility of implementing such a simple thing in straight JavaScript.

The final demo is here, this time without any SVG at all, just straight HTML, JavaScript, and CSS. It only took about two hours, but there it is, you can play with the knobs and switches, and see the math at work.

I guess the funniest thing in all of this is that the JavaScript involved in both of these demos is frightfully simple stuff. Just a few functions, a timer, some event handlers, and a bit DOM tree manipulation. Compared to what goes on at work, it’s nothing. But it’s just neat to see how much can be accomplished with so little.

Mike

Discussion

  1. I take it there’s already a patent on the six stroke rotary engine, then? (Otherwise, I think this counts as public disclosure)

    Posted at 8:27 pm on January 9th by Ryan Gariepy.

  2. I’m not aware that anyone has patented this exact design; Google doesn’t seem to turn up anything quite like it. On the other hand, I have some serious doubts about how you could seal it; plus, you’d need to build casing out of some metal that absorbs very little heat, and the rotor out of one that absorbed as much as possible, yet still have neither deform by any significant amount.

    Between the impossibility of trying to engineer it, and the fact that gasoline engines are passé anyways, if Mazda somehow makes a million dollars off this, I’ll chalk it up to experience. :)

    Either way, I think it’s a nifty idea worth sharing.

    Posted at 9:14 pm on January 9th by Mike Purvis.

  3. That rotary engine is awesome! I’m thoroughly impressed, and have revisited this article a few times now.

    Widespread SVG adoption is high on my wish list. One day it will be, and I can’t wait. So many things would be possible, it hurts my head just thinking about it all.

    Posted at 10:57 pm on February 10th by Terrill Dent.

  4. so the steam cycle generates enough power to take care of it’s own pumping losses?

    Posted at 12:25 pm on May 20th by bob robbuts.

Leave a Reply

You can use Markdown for style. I love hearing from readers, but please don’t hijack the discussion, use offensive language, or try to sell anything.

© 2004-2008, Mike Purvis, some rights reserved. I'm running Wordpress, and I have an RSS feed.