Friday, October 23, 2015

Why Innovative Energy is a Bad Investment, or Why the Government Should Fund It, and Other Brilliant Observations About Energy

Bill Gates has said  a bunch of brilliant thing about innovations in Energy which have been reported in a article in The Atlantic.  I'll give you a summary which is much shorter than that article.

For energy, the incentive to invent is bad.  Patents give you a 20 year exclusive on your invention, and trade secrets don't really do much better than that.  But in energy, innovations are adopted over many decades.  In digital electronics, things are adopted almost instantly.  So while innovations in digital electronics are developed by the marketplace and paid for by patents, innovations in energy will be in the public domain before they have been broadly adopted!

A very high carbon tax could force energy to change faster than it is used to.  But perhaps better to just pay for the necessary innovations publicly, since they will wind up in the public domain benefiting society as a whole by the time they are broadly deployed.

But won't the government screw it up?  What Gates says is brilliant and insightful: “Yes, the government will be somewhat inept, but the private sector is in general inept. How many companies do venture capitalists invest in that go poorly? By far most of them.”

Responding to the concern that American politicians can't even agree on whether climate change is real, Gates said: “If you’re not bringing math skills to the problem, then representative democracy is a problem.”

“... the climate problem has to be solved in the rich countries. China and the U.S. and Europe have to solve CO2 emissions, and when they do, hopefully they’ll make it cheap enough for everyone else. But the big numbers are all in the developed economies, where China’s defined into that term.”

“When I first got into this I thought, How well does the Department of Energy spend its R&D budget? And I was worried: Gosh, if I’m going to be saying it should double its budget, if it turns out it’s not very well spent, how am I going to feel about that? But as I’ve really dug into it, the DARPA money is very well spent, and the basic-science money is very well spent. The government has these “Centers of Excellence.” They should have twice as many of those things, and those things should get about four times as much money as they do.”

There's plenty of good stuff in the article that I didn't include here.

Friday, July 10, 2015

Using the Audio Jack for power and digital interface to smartphones!

If you have seen credit car readers on smartphones, you will see they are a small block that plugs into the smartphone's audio jack, what you might think of as its headphone jack.

This is a remarkably clever solution to the problem: how do I build an add-on for both iPhone and Android without paying licensing fees to either?

Project HiJack at University of Michigan gets the credit for figuring this stuff out.

  • For power, your app can play a tone out the speaker jack on, say, the left speaker channel.  That tone can be rectified in your external device to provide up to about 7.4 mW.
  • If you need to, you can send data to your external device from your sensor.  You essentially generate an audio tone in software as you might generate a radio frequency in hardware on a radio communicator.  The data modulates the audio tone.  You build a demodulator on your external device and you are set.  
  • You can get data from your external device.  You generate an audio tone on your external device and play it into the microphone lead of the audio jack.  The app on the smartphone can record that audio, represent it in software as an array of numbers (voltage values from an analog-to-digital converter (ADC)).  The data you are sending can modulate the audio tone, which modulation can be detected mathematically by processing the recorded ADC values from receiving the audio.  
This stuff is cool!

Monday, February 09, 2015

Gasoline Engines: a simple mostly linear model

If you have ever googled, the efficiency of a gasoline engine, you have likely found something like this:

While this is very much a standard diagram to see, by the end of this post I am going to replace it with a different figure that has the same information on it, just rearranged.  The beauty of the replacement figure is that it will show that at any given engine speed, the engine output power increases linearly with the amount of gasoline flowing in to the engine.  It will show that this is true except at very high flow rates of gasoline into the engine, where the power output of the engine is seen to "saturate," the engine becomes less efficient at converting gasoline to output energy when the gasoline is flowing in to the engine very fast.  

The above diagram is called a BSFC map, a Brake Specific Fuel Consumption map.  This is created by measuring the engine output with a brake dynamometer.  A brake dynamometer effectively puts a friction brake on the output shaft of the engine, or rather to something connected to the output shaft of the engine.  The friction brake can be applied to slow the engine output down.  The dynamometer is instrumented so that it can measure the braking effort currently applied to the output shaft of the engine.  That braking effort is measured in units of torque, which in the metric system has units of Newton-meters.  

If the dynamometer measures the engine output shaft rotation speed at the same time as it measures the braking torque on the output shaft, we can easily calculate the power that the engine is dumping into heating up the brake.  Torque times rotation speed gives power.  To get power in the standard metric system unit of Watts, the engine speed needs to be expressed as an angular velocity in radians per second. To do this, the RPM measurement is divided by 60, to convert it to rotations per second, then multiplied by 2π to convert it into radians per second. 

The way you use a dynamometer to get the figure above is you set the engine accelerator to a fixed setting.  Then you adjust the braking force over a range of values.  At each braking force, you measure 1) the braking torque, 2) the engine rpm, and 3) the fuel consumption, typically in grams per second.  At each x,y point you have measured, you know how many Watts (W) are being produced in rotational motion of the engine shaft because at that point you can multiply the torque by the angular velocity corresponding to that point.  Since you have also measured the gasoline consumption in grams per second (g/s), with a little straightforward math you can calculate the number of grams of gasoline that would be required to produce a kWh of rotational output energy.  kWh is "kilowatt-hour," it is the amount of energy that a 1000 W power source produces in 1 hour.  1 kWh = 3,600,000 J.  

The contour lines on the BSFC map are lines of constant energy efficiency.  At any point on, for example, the 280 g/kWh contour, the engine produces 1 kWh of output energy for every 280 g of gasoline that it consumes.  One can see from the chart that the engine is most efficient at an engine speed of about 2700 rpm and an output torque of 95 Nm.  At this efficient point, by using the math above we calculate the engine is putting out about 26.9 kW.

One last little bit of mathematical conversion.  A gram of gasoline can be burned, and when it is burned it releases a certain amount of heat energy.  The amount of energy released is slightly variable because the mixture of hydrocarbons in gasoline is slightly variable depending on how it is formulated at the refinery.  The US EPA has settled on 33.7 kWh as a standard estimate of the energy content of one U.S. gallon of gasoline.  This translates to about 12.2 Wh/g energy content of gasoline.  So the contours of gasoline usage in units of "g/kWh" can actually be simplified to a pure energetic efficiency.

280 g of gasoline release 3.425 kWh of heat energy when burned.  but near the most efficient point of the engine shown in the BSFC fuel map above, we find we are able to get 1 kWh of rotational energy out of this engine for each 280 g of gasoline burned in the engine.  This means that the energy conversion efficiency of this engine operating on that 280 g/kWh contour is 1/3.425 = 29%.  That is to say that when this engine is operating at any point along the 280 g/kWh contour, is converting 29% of the thermal energy of the gasoline it is burning into rotational energy at the output shaft of the engine.

Finally, we combine all that we have said above and reformulate the BSFC fuel map into the following:

Here, the different colored dots come from digitizing points on the BSFC map above, and converting them so each one shows its output power, the rotational power of the output shaft of the engine, vs its input power, the heat energy of the gasoline flowing in to the engine to produce that output power.  We group data points by RPM.  At each RPM value, we find the best fit straight line through the points at that RPM.  What we find is generally: 1) at lower RPM, we convert gasoline heat energy into rotational energy more efficiently.  2) To get higher total output power, we need to go to higher RPM, but this costs us a little bit in efficiency.  3) at the high power end of each RPM value, there is some "saturation" visible: the output power falls below the best fit line.  The engine is a little less efficient when a lot of gasoline is flowing in to it then when less gasoline is flowing in to it.

We can rearrange the data in the Power out vs Power in plot by creating a y-axis showing values of Power_out / Power_in = Efficiency.  Here is that plot:
Plotting efficiency on the y-axis, we see that at each RPM, the efficiency of the engine rises as we drive it harder, as we pour more gasoline into it.  The efficiency drops to zero when we apply only enough gasoline to keep the engine idling: to keep the engine turning but with no extra energy available to be delivered through the engine's output shaft.

Note that each output line has an x-intercept, a value of gasoline flow into the engine which can keep the engine turning at this RPM value, but which produces no additional power at the output of the engine.  This is the fuel flow into the engine that is required to keep the idling engine turning at the specified RPM.  One could explore the points along the x-axis by putting the car in neutral gear, and revving the engine with the gas pedal.  If while doing this, you were able to measure the gasoline consumed at each RPM value, you would expect to measure directly the x-intercept values shown in this figure.

Here are plotted the x-intercept values, vs RPM.  Essentially this is a plot of the fuel flow rate required to keep the engine idling at a particular RPM value.

Saturday, January 10, 2015

Gasoline Usage at Idle with and without Air Conditioner Running

I logged gasoline usage with my car running at idle.  I varied the RPM to see how that affected it.  I turned the air conditioner on and off to see how that affected it.

The car is my 2005 Mercedes CLK320A.  This has a 3.2L V6 gasoline engine.  It is supposed to use "premium" fuel (91 Octane in the US), but I have been unable to determine any performance difference using what is sold as "regular" fuel (87 Octane in the US) in San Diego, where I live.  So I run it using regular fuel, and the results here are with regular fuel.

My set-up for testing this stuff is described in this post.

For the test, I used a warmed-up engine.  I ran the engine in my driveway and applied the accelerator pedal to achieve different RPM levels.  The RPM levels and fuel usage rates shown are those logged by the setup described in the other post throug the car's OBD2 connector.

For "air conditioner off" condition, everything in the car is turned off including the climate control.  The car does have running lights that stay on in the daytime, these were on.  No attempt was made to determine the state of the alternator, whether it was charging the battery or not during this test.

For "air conditioner on" condition, the climate control in the car cabin was turned on.  The thermostatic control was set to 60° F in order to keep the air conditioner on constantly.  The fan blowing air in the cabin was set to its highest setting.


Results are shown above.  Minimum mean square error line fit to the data are shown.  At lower RPM, results are pretty nice and linear.  

Idle Fuel Usage with Air Conditioner turned off

Without applying the accelerator, this engine idles at about 600 RPM.  The fuel usage at idle is about 0.25 gallons per hour, with the air conditioner turned off.  The idle fuel usage rises to about 1.0 gallons per hour at 2500 RPM.  The fitted line, with air conditioner turned off, nearly passes through 0 fuel usage at 0 RPM.  Thus for all intents and purposes, the idle fuel usage is:

(1 Gallon per Hour) * ( Engine RPM / 2500 )

What is the meaning of 0.25 gallons per hour of idling loss?  This is a car which gets about 22 miles per gallon averaged over my driving.  So an hour of idling uses the same amount of gasoline as driving about 5.5 miles.  At $4/gallon (as I write this prices in San Diego are as low as $2.40/gallon), idling costs $1/hour or 1.6 cents per minute.  My conclusion is that in regular use where idling more than a few minutes would be very unusual, idling is a very inexpensive process and not worth great efforts to avoid.  

Fuel Usage by Air Conditioner

The caption of the figure shows the linear fit equations for the fuel usage with air conditioner off and on.  The difference between these two linear fits is 0.16 gallons per hour.  This suggests that when the air conditioner is running, no matter what the RPM of the engine is, it is demanding fuel at a rate of 1 gallon every 6 hours.  

If the car gets 22 mpg with the air conditioner off, adding fuel flow of one additional gallon every 6 hours would correspond to moving the car at about 4 miles per hour.  Now this is with the air conditioner running constantly (it was set to 60° F for this test).  Since it cycles off and on in actual use, actual usage with air conditioner on will be less than this.  

At $4/gallon, air conditioner on constantly costs about 67 cents/hour.  Since in actual use air conditioner cycles on and off, a better rule of thumb might be 25 cents/hour.  

Gasoline Usage in your Car, the tools I use

You can learn a lot about gasoline usage in your car by, well, by logging gasoline usage in your car under a variety of conditions.  You can then analyze the logged results and figure out an astonishing amount of stuff!

In this post I just list the tools I use for getting results.  Following posts will show some of those results.

The Hardware

This is what I use.  It plugs into your OBD2 connector.  On my cars, this is located somewhere near where the hood release for the car is located, under the dashboard on the left side of the steering wheel.

The Software

Torque Pro is available for Apple and Android, I use the Android version.  Torque Pro has amazing real time gauges for displaying many things it can read from your car.  For this work, the real time displays are not so important.  What is important is the ability to log these data into spreadsheets, which spreadsheets can then be opened and analyzed later.  

After I have the spreadsheets of logged data from my driving runs, I write scripts in Matlab to do the analysis.  I have used Matlab for decades in my job.  It is a powerful and complicated tool.