scott-vincent / instrument-panel

An instrument panel for Microsoft Flight Simulator 2020
171 stars 29 forks source link

Fix inaccurate RPM #27

Closed emxsys closed 3 years ago

emxsys commented 3 years ago

This pull request improves the accuracy of the indicated RPM on the standard RPM gauge and the Savage Cub (Rotax) RPM gauges, and it adds a new RPM Percent gauge for turbine and jet aircraft.

The standard RPM instrument tests the engine type and the engine's max rated RPM to determine whether to display the prop RPM in the standard gauge, the engine RPM in the Savage Cub gauge, or the turbine N1 percent in the RPM Percent gauge.

These changes have been tested with all the aircraft in MSFS, plus a community generated aircraft: the indicated RPM is the same as the value displayed in the aircraft's native instrument panel.

Closes #26

emxsys commented 3 years ago

Thanks for the review. Your concern is valid. I will investigate the non-piston aircraft.

emxsys commented 3 years ago

@scott-vincent, I plan to add some more engine related vars to perform conditional tests.

With these vars and one more RPM bitmap I think we can have an RPM gauge that works for all aircraft.

Below are the proposed changes to the data link. Does it look right?

--- a/instrument-data-link/simvarDefs.cpp
+++ b/instrument-data-link/simvarDefs.cpp
@@ -94,6 +94,9 @@ const char* SimVarDefs[][2] = {
     { "General Eng Oil Temperature:1", "fahrenheit" },
     { "General Eng Oil Pressure:1", "psi" },
     { "General Eng Exhaust Gas Temperature:1", "celsius" },
+    { "Engine Type", "enum" },
+    { "Eng Max RPM", "rpm" },
+    { "Eng Manifold Pressure:1", "inch of mercury" },
     { "Eng Fuel Flow GPH:1", "gallon per hour" },
     { "Suction Pressure", "inch of mercury" },
     { "Atc Id", "string64" },
diff --git a/instrument-data-link/simvarDefs.h b/instrument-data-link/simvarDefs.h
index dbab97c..b81eef8 100644
--- a/instrument-data-link/simvarDefs.h
+++ b/instrument-data-link/simvarDefs.h
@@ -96,6 +96,9 @@ struct SimVars
     double oilTemp = 75;
     double oilPressure = 50;
     double exhaustGasTemp = 0;
+    double engineType = 0;
+    double engineMaxRpm = 0;
+    double engineManifoldPressure = 0;
     double engineFuelFlow = 0;
     double suctionPressure = 1;
     char atcTailNumber[64] = "\0";
emxsys commented 3 years ago

Here's an example of the Percent RPM vs traditional tachometer:

image

scott-vincent commented 3 years ago

New Data Link vars look good to me. New gauge looks great.

emxsys commented 3 years ago

@scott-vincent, this is a work in progress, however, the new RPM Percent gauge can be tested with the Airbus and the current Data-Link (v1.4.2).

TODO:

emxsys commented 3 years ago

Thanks for the review. :- ) I'll make the requisite changes to instrument-panel.cpp and settings.

I still also think you need to change the rpm.cpp code so that it only uses the rpmEngine var for the Cessna and uses the original code with rpmPercent var for everything else.

I'm currently testing the new simVars->EngineType and instantiating rpmPercent for turbine and jet engines. Seems to work! Also, I just discovered that I can use Max Rated Engine RPM to instantiate the "High RPM" gauge (rpmSavageCub) if the engineType is piston and max RPM > 3500, otherwise use the standard RPM gauge for piston engines. So far, I've successfully tested with the Airbus, 747, Longitude, TBM, Caravan, Savage Cub, Bonanza, 172, and the community's GotGravel Carbon Cub STOL.

With the use of these new engine vars, it appears no longer necessary to make choices based on aircraft make/model.

One minor issue I've identified so far is the rpmPercent var is not in-sync with the RPM displayed in the Cessna Caravan's and TBM's G1000. I've tried other "RPM percent" vars without success. I don't know what value those aircraft are using for RPM .Good news is the 'rpmPercent` is working correctly for the Airbus, 747 and Cessna Longitude.

I'll be checking these changes in later today for your review, plus a pull request for the data link.

emxsys commented 3 years ago

I've completed all the changes for this pull request save for renaming/moving files. On that topic, there's possibly more to consider, such as possibly renaming/copying rpmSavageCub to something like rpmHighRev for the "generic" treatment. You can assign that to me if you wish or handle it later after more thought.

I've also update the PR's description.

In summary, we have a robust RPM instrument that should work correctly for all existing and future aircraft. I've tested it with all the MSFS Premium Deluxe aircraft plus a community developed plane.

Thanks for your help with the graphics!