Wednesday, April 01, 2020

March 2020: California Corona/COVID Cases doubled every 3.6 days without a break.

This post is written April 1 2020 but it is most decidedly and unfortunately NOT a joke.  I feature the data prominently because in an exponentially growing pandemic, these numbers will be difficult to interpret without being able to note "Oh yeah, that was like 4 days ago" or whatever.  

From the data on I tabulated cumulative cases and cumulative deaths from the cited article.  I calculated daily new cases and deaths by taking differences.  Plotted it all on logarithmic axes. 

By counting dots  on cumulative cases, determined it is taking 12 days to rise tenfold.  That is 21% rise per day.  That is doubling time of 3.6 days.  Counted over two decades of rise a.k.a. 6.6 doubling times.  

Here is same plot, with a straight line (on semilog plot) of the 12 day doubling time superimposed on each line.  

All four lines seem essentially consistent with a slightly noisy exponential.  

What does it mean?  California locked down in mid-March, the statewide stay-at-home order was 3/18/2020.  I plotted this data to look for what effect this might have had on the data.  Using my old eyes, I see nothing.  

What does this portend?  If this trend continues another week (through April 6), California will have nearly 27,000 cases and have accumulated nearly 5,000 deaths.  If it continues throughout April, at the end of April nearly 7% of Californians will have been infected and more than 1% of Californians will have died from Corona.  

Friday, September 02, 2016

How To Get a Working Browser after a Windows Vista Restore (or Reinstall)

I have an old Dell PC running Windows Vista Home Premium.  It had a number of "broken" things in its system, it couldn't see Windows Update anymore and I couldn't install Microsoft Security Essentials on it.  I decided to do a clean reinstall, or system reset on it.  This can be done without requiring any external back-up or restore or install media, it can be done entirely from the machine.  

This post does not tell you how to do the clean reinstall.  You can find that elsewhere.  

What this post tells you is how to finish the clean reinstall so that you have a working browser on the machine!  When I did the reinstall, Vista came up with Internet Explorer 7 installed.  IE 7 COULD NOT see Microsoft pages associated with updating IE 7!  It could not see google pages associated with downloading the Chrome browser!   

So how do you get Internet Explorer 9, the highest version that supports Windows Vista, on to a machine without a working browser?  

To do what I am describing will require you to have:
  1. The Vista machine with Vista clean installed (also known as "Reset") on it.  Find instructions on the web to get this done.  You should be able to do it completely from the Vista machine, no additional install media should be required.  
  2. Another working Windows machine connected to the Internet through a working Web Browser. 
  3. A flash drive ( or any portable USB connected drive) with at least 64 MB free space on it. 
FIRST: Let Windows Update install all the Vista updates it knows about. 

The first thing I did was let Windows Update update everything that it knew about.  This was over 100 updates when I did this in August 2016.  It took about 8 hours on my old slow Vista machine.  It required about 3 manual restarts, so check the machine once in a while while it is updating as it will hang until you approve the restarts.  I am not absolutely sure this is required before taking the next steps but it is what I did that worked so you decide whether you want to experiment or not.  

SECOND: Learn how many bits, what architecture and what Operating System your machine is.

The first thing to do is determine three things about your machine.  These three facts will be needed in choosing install packages.  These three things are:
  1. Is your machine 32-bit or 64-bit?
  2. Is your machine architecture x86 or x64?
  3. What exactly is your operating system?  Mine is Vista Home Premium.  
You can determine these by
  1. Pressing the windows button at lower left end of your screen
  2. typing "msinfo" and hitting return.  This will pop open a window.
  3. Clicking on "System Summary" in that window.  
  4. Your operating system is listed at the top under "OS Name."
  5. Your architecture is listed further down under "System Type."
  6. If your architecture is "x64" then you have a 64-bit machine.  If your architecture is "x86" then you have a 32-bit machine.
  7. Keep these three facts handy, write them on a piece of paper which you can refer to as you do the rest of this.  
THIRD: Get a Google Chrome version 49 installer from your other machine.

To get a working browser on your Vista machine, you will download an installer for Chrome version 49 onto a flash drive connected to another PC with a working browser and internet connection.  I took my copy from  You may find a copy elsewhere on the web, but I am told that some copies are infected with viruses.  I have had no problems with the copy I took, so you decide.  

From that page, right click on the version 49 download link for your machine and save it to your flash drive.  

Then attach your flash drive to your Vista machine and double click the installer on your flash drive.  Choose to install it to someplace on your C: drive on your vista machine.  You can then run Chrome browser by double-clicking on the Chrome app you installed.  You can put a shortcut to that on your desktop.  

FOURTH: Manually Install Vista Service Pack 1

You can find the installer for Windows Vista Service Pack 1 here:  It takes an hour or two to install.  

FIFTH: Manually Install 3 Other Required Updates.  

This page: tells us that there are three other updates that need to be installed manually before IE 9.  They are:
  1. Vista Service Pack 2
  2. the Windows Graphics, Imaging, and XPS Library (KB971512)
  3. Platform update supplement for Windows Vista and Windows Server 2008 (KB2117917)
They need to be installed in that order.  The page referenced has links to follow for the installers for each of these updates.  Service Pack 2 will take 1 to 2 hours to install, the others are faster than that.  

FIFTH: Install Internet Explorer 9

Windows Internet Explorer 9 installer for Vista is here:  

If you have installed all the updates above, you should find that this install will work.  


Microsoft stopped supporting Windows Vista in early 2016.  The instructions above worked on my Dell laptop in August of 2016.  Without official support, the information above took me many hours to sort out.  There is no guarantee that these instructions will continue to work as without support who knows what entropy will do to the web pages I used to get this done.  Good luck! 

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.