This was a difficult one for me. I looked at the existing engine monitors that show percent power and realized they are only accurate when you are leaned for best power. They don't take mixture setting into account at all. I wanted something a bit more intelligent that this, but couldn't find a way to perform a full calculation with the information I had. (I would need the Air/Fuel ratio) which would mean I'd need a mass flow sensor.
I was looking through the Lycoming Operators Manual for my engine and found that they have two charts. One is a 'Power and Fuel Consumption' that is a power/RPM chart for full rich operations. The curve is really flat, so I modeled it as a linear function.
The equation is simply that of a line
I took two points off of the chart and found the slope:
(y-y0)/(x-x0) = m
Then I subbed in one of my points and solved for y. The software subs in x and calculates y. For O-235 L2C standard pistons, that comes out to:
HP=((0.055 * RPM) - 36)
This gives me the HP the engine is making based on RPM and assuming a full rich mixture. It is accurate at 2200 RPM, and 2800 RPM, but off by 3-5% in the middle since I simplified the chart to a linear function.
I wanted to also see the power when fully leaned. There is no chart for this in the Lycoming manuals, so I use a fuel flow based formula that I got from one of John Deakins engine articles:
HP = FuelFlow * 14.9
I don't know how accurate it is, but also don't know of a better way.
The Lycoming charts also show a 'best power mixture' chart. There are several linear functions to integrate and pressure altitude is required for the calculation. I don't have pressure altitude data available yet so I haven't done the math to integrate the chart into a usable function.
So to sum it up, I've got two calculations. The % Power Full Rich shows up on my engine startup/climb page and the % Power Full lean shows up on the cruise page of my engine analyzer software.