| 1 | """Metric definitions: units, scale, axis ranges per metric type. |
| 2 | |
| 3 | Axis ranges chosen to span the typical operating envelope of piston/turbine GA |
| 4 | engines plus headroom. They are *recommended* defaults; callers can override. |
| 5 | """ |
| 6 | from dataclassesscip-python python python-stdlib 3.11 dataclasses/__init__: import dataclassscip-python python python-stdlib 3.11 dataclasses/dataclass()., fieldscip-python python python-stdlib 3.11 dataclasses/field(). |
| 7 | from typingscip-python python python-stdlib 3.11 typing/__init__: import Dictscip-python python python-stdlib 3.11 typing/Dict., Optionalscip-python python python-stdlib 3.11 typing/Optional., Tuplescip-python python python-stdlib 3.11 typing/Tuple. |
| 8 | |
| 9 | |
| 10 | @dataclassscip-python python python-stdlib 3.11 dataclasses/dataclass().(frozenscip-python python python-stdlib 3.11 dataclasses/dataclass().(frozen)=True) |
| 11 | class MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#: |
| 12 | namescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#name.: strscip-python python python-stdlib 3.11 builtins/str# |
| 13 | unitscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#unit.: strscip-python python python-stdlib 3.11 builtins/str# |
| 14 | axis_minscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#axis_min.: floatscip-python python python-stdlib 3.11 builtins/float# |
| 15 | axis_maxscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#axis_max.: floatscip-python python python-stdlib 3.11 builtins/float# |
| 16 | descriptionscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#description.: strscip-python python python-stdlib 3.11 builtins/str# = "" |
| 17 | |
| 18 | |
| 19 | # Keyed by metric short code prefix. EGT covers E1..E9, LE1..LE9, RE1..RE9 etc. |
| 20 | # CHT covers C1..C9, etc. |
| 21 | CATEGORIESscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/CATEGORIES.CATEGORIES.: Dictscip-python python python-stdlib 3.11 typing/Dict.[strscip-python python python-stdlib 3.11 builtins/str#, MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#] = { |
| 22 | "EGT": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("EGT", "°F", 0, 2000, "Exhaust Gas Temperature"), |
| 23 | "CHT": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("CHT", "°F", 0, 500, "Cylinder Head Temperature"), |
| 24 | "TIT": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("TIT", "°F", 0, 2000, "Turbine Inlet Temperature"), |
| 25 | "ITT": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("ITT", "°F", 0, 2000, "Inter-Turbine Temperature"), |
| 26 | "OAT": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("OAT", "°F", -60, 130, "Outside Air Temperature"), |
| 27 | "OILT": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("OILT", "°F", 0, 300, "Oil Temperature"), |
| 28 | "OILP": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("OILP", "PSI", 0, 100, "Oil Pressure"), |
| 29 | "CDT": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("CDT", "°F", 0, 400, "Compressor Discharge Temp"), |
| 30 | "IAT": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("IAT", "°F", 0, 200, "Induction Air Temperature"), |
| 31 | "CLD": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("CLD", "°F/min", -100, 100, "Cylinder Cooling Rate"), |
| 32 | "DIF": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("DIF", "°F", 0, 300, "EGT Spread (max-min)"), |
| 33 | "MAP": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("MAP", "in.Hg", 0, 35, "Manifold Pressure"), |
| 34 | "RPM": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("RPM", "rpm", 0, 3500, "Engine RPM"), |
| 35 | "FF": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("FF", "GPH", 0, 30, "Fuel Flow"), |
| 36 | "FF2": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("FF2", "GPH", 0, 30, "Fuel Flow #2"), |
| 37 | "USD": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("USD", "gal", 0, 200, "Fuel Used"), |
| 38 | "USD2": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("USD2", "gal", 0, 200, "Fuel Used #2"), |
| 39 | "FL": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("FL", "gal", 0, 100, "Fuel Level"), |
| 40 | "FP": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("FP", "PSI", 0, 60, "Fuel Pressure"), |
| 41 | "BAT": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("BAT", "V", 0, 16, "Battery Voltage"), |
| 42 | "BAT2": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("BAT2", "V", 0, 16, "Battery #2 Voltage"), |
| 43 | "AMP": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("AMP", "A", -100, 100, "Amperage"), |
| 44 | "AMP2": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("AMP2", "A", -100, 100, "Amperage #2"), |
| 45 | "HP": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("HP", "%", 0, 110, "Percent Power / Horsepower"), |
| 46 | "HRS": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("HRS", "h", 0, 10000, "Hobbs Hours"), |
| 47 | "MARK": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("MARK", "", 0, 8, "Pilot Mark / Lean-Find State"), |
| 48 | "SPD": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("SPD", "kt", 0, 300, "Ground Speed"), |
| 49 | "ALT": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("ALT", "ft", -1000, 30000, "Pressure Altitude"), |
| 50 | "LAT": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("LAT", "deg", -90, 90, "Latitude"), |
| 51 | "LNG": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("LNG", "deg", -180, 180, "Longitude"), |
| 52 | "NG": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("NG", "%", 0, 110, "Gas Generator Speed"), |
| 53 | "NP": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("NP", "rpm", 0, 3000, "Propeller Speed"), |
| 54 | "TRQ": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("TRQ", "%", 0, 110, "Torque"), |
| 55 | "HYD": MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#("HYD", "PSI", 0, 5000, "Hydraulic Pressure"), |
| 56 | } |
| 57 | |
| 58 | |
| 59 | def _category_for_codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_category_for_code().(codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_category_for_code().(code): strscip-python python python-stdlib 3.11 builtins/str#) -> Optionalscip-python python python-stdlib 3.11 typing/Optional.[MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#]: |
| 60 | """Strip L/R prefix and trailing digit to find category.""" |
| 61 | base = codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_category_for_code().(code) |
| 62 | if base.startswithscip-python python python-stdlib 3.11 builtins/str#startswith().(("L", "R")) and base[1:] in CATEGORIESscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/CATEGORIES.CATEGORIES.: |
| 63 | return CATEGORIESscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/CATEGORIES.CATEGORIES.[base[1:]] |
| 64 | # Strip trailing digit(s): "E1" -> "E", "RC1" -> "RC" |
| 65 | stripped = base.rstripscip-python python python-stdlib 3.11 builtins/str#rstrip().("0123456789") |
| 66 | # Single-letter codes for cylinders: E (EGT), C (CHT), T (TIT) |
| 67 | letter_map = {"E": "EGT", "C": "CHT", "T": "TIT", "LE": "EGT", |
| 68 | "RE": "EGT", "LC": "CHT", "RC": "CHT", "LT": "TIT", |
| 69 | "RT": "TIT"} |
| 70 | if stripped in letter_map: |
| 71 | return CATEGORIESscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/CATEGORIES.CATEGORIES.[letter_map[stripped]] |
| 72 | if stripped in CATEGORIESscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/CATEGORIES.CATEGORIES.: |
| 73 | return CATEGORIESscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/CATEGORIES.CATEGORIES.[stripped] |
| 74 | # Strip an L/R prefix and try again: "LMAP" -> "MAP" |
| 75 | if stripped.startswithscip-python python python-stdlib 3.11 builtins/str#startswith().(("L", "R")) and stripped[1:] in CATEGORIESscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/CATEGORIES.CATEGORIES.: |
| 76 | return CATEGORIESscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/CATEGORIES.CATEGORIES.[stripped[1:]] |
| 77 | return None |
| 78 | |
| 79 | |
| 80 | @dataclassscip-python python python-stdlib 3.11 dataclasses/dataclass().(frozenscip-python python python-stdlib 3.11 dataclasses/dataclass().(frozen)=True) |
| 81 | class MetricDefscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#: |
| 82 | """Definition of one decodable metric in a flight record.""" |
| 83 | sensor_namescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#sensor_name.: strscip-python python python-stdlib 3.11 builtins/str# # "Left EGT 1" |
| 84 | codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#code.: strscip-python python python-stdlib 3.11 builtins/str# # "E1", "MAP", "RPM" |
| 85 | cfg_byt_idxscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#cfg_byt_idx.: intscip-python python python-stdlib 3.11 builtins/int# # which Cfg_Word to test |
| 86 | cfg_bit_idxscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#cfg_bit_idx.: intscip-python python python-stdlib 3.11 builtins/int# # which bit |
| 87 | scale_valscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#scale_val.: floatscip-python python python-stdlib 3.11 builtins/float# # divisor for engineering units |
| 88 | m_lo_byt_idxscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#m_lo_byt_idx.: intscip-python python python-stdlib 3.11 builtins/int# = -1 # byte index in data stream (low delta) |
| 89 | m_lo_bit_idxscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#m_lo_bit_idx.: intscip-python python python-stdlib 3.11 builtins/int# = -1 |
| 90 | m_hi_byt_idxscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#m_hi_byt_idx.: intscip-python python python-stdlib 3.11 builtins/int# = -1 # byte index in data stream (high delta) |
| 91 | m_hi_bit_idxscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#m_hi_bit_idx.: intscip-python python python-stdlib 3.11 builtins/int# = -1 |
| 92 | |
| 93 | @propertyscip-python python python-stdlib 3.11 builtins/property# |
| 94 | def categoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#category().(selfscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#category().(self)) -> Optionalscip-python python python-stdlib 3.11 typing/Optional.[MetricCategoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#]: |
| 95 | return _category_for_codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_category_for_code().(selfscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#category().(self).codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#code.) |
| 96 | |
| 97 | @propertyscip-python python python-stdlib 3.11 builtins/property# |
| 98 | def unitscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#unit().(selfscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#unit().(self)) -> strscip-python python python-stdlib 3.11 builtins/str#: |
| 99 | cat = selfscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#unit().(self).categoryscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#category(). |
| 100 | return cat.unitscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#unit. if cat else "" |
| 101 | |
| 102 | |
| 103 | def axis_range_forscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/axis_range_for().(codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/axis_range_for().(code): strscip-python python python-stdlib 3.11 builtins/str#) -> Tuplescip-python python python-stdlib 3.11 typing/Tuple.[floatscip-python python python-stdlib 3.11 builtins/float#, floatscip-python python python-stdlib 3.11 builtins/float#]: |
| 104 | """Recommended (min, max) Y-axis range for a metric short code.""" |
| 105 | cat = _category_for_codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_category_for_code().(codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/axis_range_for().(code)) |
| 106 | if cat is None: |
| 107 | return (0.0, 100.0) |
| 108 | return (cat.axis_minscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#axis_min., cat.axis_maxscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#axis_max.) |
| 109 | |
| 110 | |
| 111 | def unit_forscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/unit_for().(codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/unit_for().(code): strscip-python python python-stdlib 3.11 builtins/str#) -> strscip-python python python-stdlib 3.11 builtins/str#: |
| 112 | cat = _category_for_codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_category_for_code().(codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/unit_for().(code)) |
| 113 | return cat.unitscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#unit. if cat else "" |
| 114 | |
| 115 | |
| 116 | def description_forscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/description_for().(codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/description_for().(code): strscip-python python python-stdlib 3.11 builtins/str#) -> strscip-python python python-stdlib 3.11 builtins/str#: |
| 117 | cat = _category_for_codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_category_for_code().(codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/description_for().(code)) |
| 118 | return cat.descriptionscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricCategory#description. if cat else codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/description_for().(code) |
| 119 | |
| 120 | |
| 121 | def _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().(namescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().(name), cfg_bscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().(cfg_b), cfg_bitscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().(cfg_bit), codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().(code), scalescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().(scale)=1.0, lo_bscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().(lo_b)=-1, lo_bitscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().(lo_bit)=-1, hi_bscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().(hi_b)=-1, hi_bitscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().(hi_bit)=-1): |
| 122 | return MetricDefscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#(namescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().(name), codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().(code), cfg_bscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().(cfg_b), cfg_bitscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().(cfg_bit), scalescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().(scale), lo_bscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().(lo_b), lo_bitscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().(lo_bit), hi_bscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().(hi_b), hi_bitscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().(hi_bit)) |
| 123 | |
| 124 | |
| 125 | # ---- Header tables, transcribed from EzTrends2 Decomp.cs ---- |
| 126 | # init_strings_for_107 — used for EDM830/831 (and other models) running protocol 2. |
| 127 | # Includes byte indices up to 10 (HRS, AMP, FL, ALT, SPD, LAT, LNG). |
| 128 | HEADERS_107scip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/HEADERS_107. = [ |
| 129 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left EGT 1", 0, 2, "E1", 1, 0, 0, 6, 0), |
| 130 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left EGT 2", 0, 3, "E2", 1, 0, 1, 6, 1), |
| 131 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left EGT 3", 0, 4, "E3", 1, 0, 2, 6, 2), |
| 132 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left EGT 4", 0, 5, "E4", 1, 0, 3, 6, 3), |
| 133 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left EGT 5", 0, 6, "E5", 1, 0, 4, 6, 4), |
| 134 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left EGT 6", 0, 7, "E6", 1, 0, 5, 6, 5), |
| 135 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left EGT 7", 0, 8, "E7", 1, 3, 0, 7, 0), |
| 136 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left EGT 8", 0, 9, "E8", 1, 3, 1, 7, 1), |
| 137 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left EGT 9", 0, 10, "E9", 1, 3, 2, 7, 2), |
| 138 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left CHT 1", 0, 11, "C1", 1, 1, 0), |
| 139 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left CHT 2", 0, 12, "C2", 1, 1, 1), |
| 140 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left CHT 3", 0, 13, "C3", 1, 1, 2), |
| 141 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left CHT 4", 0, 14, "C4", 1, 1, 3), |
| 142 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left CHT 5", 0, 15, "C5", 1, 1, 4), |
| 143 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left CHT 6", 1, 0, "C6", 1, 1, 5), |
| 144 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left CHT 7", 1, 1, "C7", 1, 3, 3), |
| 145 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left CHT 8", 1, 2, "C8", 1, 3, 4), |
| 146 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left CHT 9", 1, 3, "C9", 1, 3, 5), |
| 147 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left TIT 1", 1, 5, "T1", 1, 0, 6, 6, 6), |
| 148 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left TIT 2", 1, 6, "T2", 1, 0, 7, 6, 7), |
| 149 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left ITT", 3, 12, "ITT", 1, 9, 3), |
| 150 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("OAT", 1, 9, "OAT", 1, 2, 5), |
| 151 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left DIF", 0, 0, "DIF"), |
| 152 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left CLD", 0, 0, "CLD", 1, 1, 6), |
| 153 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left CDT", 1, 7, "CDT", 1, 2, 2), |
| 154 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left IAT", 1, 8, "IAT", 1, 2, 3), |
| 155 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left MAP", 1, 14, "MAP", 10.0, 5, 0), |
| 156 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left RPM", 1, 10, "RPM", 1, 5, 1, 5, 2), |
| 157 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left HP", 1, 10, "HP", 1, 3, 6), |
| 158 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left FF (gph)", 1, 11, "FF", 10.0, 2, 7), |
| 159 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left FF (lph)", 1, 11, "FF_L", 1, 2, 7), |
| 160 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left FF2 (gph)", 3, 5, "FF2", 10.0, 5, 6), |
| 161 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left FF2 (lph)", 3, 5, "FF2_L", 1, 5, 6), |
| 162 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left FP", 1, 15, "FP", 10.0, 8, 5), |
| 163 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left TRQ", 3, 8, "TRQ", 1, 9, 2), |
| 164 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left OILP", 1, 13, "OILP", 1, 2, 1), |
| 165 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left OILT", 1, 4, "OILT", 1, 1, 7), |
| 166 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("BAT", 0, 0, "BAT", 10.0, 2, 4), |
| 167 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("BAT2", 2, 6, "BAT2", 10.0, 8, 1), |
| 168 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("AMP", 0, 1, "AMP", 1, 8, 0), |
| 169 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("AMP2", 2, 5, "AMP2", 1, 8, 2), |
| 170 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left USD (gal)", 1, 11, "USD", 10.0, 2, 6), |
| 171 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left USD (l)", 1, 11, "USD_L", 1, 2, 6), |
| 172 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left FL (gal)", 2, 3, "RFL", 10.0, 8, 3), |
| 173 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left FL (l)", 2, 3, "RFL_L", 1, 8, 3), |
| 174 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left FL2 (gal)", 2, 4, "LFL", 10.0, 8, 4), |
| 175 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left FL2 (l)", 2, 4, "LFL_L", 1, 8, 4), |
| 176 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left HRS", 0, 0, "HRS", 10.0, 9, 6, 9, 7), |
| 177 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left USD2 (gal)", 3, 5, "USD2", 10.0, 5, 7), |
| 178 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left USD2 (l)", 3, 5, "USD2_L", 1, 5, 7), |
| 179 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left HYD", 3, 15, "HYD", 1, 5, 5), |
| 180 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left HYD2", 4, 2, "HYD2", 1, 5, 4), |
| 181 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("SPD", 4, 5, "SPD", 1, 10, 5), |
| 182 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("ALT", 4, 6, "ALT", 1, 10, 3), |
| 183 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("LAT", 4, 3, "LAT", 1, 10, 7, 10, 2), |
| 184 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("LNG", 4, 4, "LNG", 1, 10, 6, 10, 1), |
| 185 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("MARK", 0, 0, "MARK", 1, 2, 0), |
| 186 | ] |
| 187 | |
| 188 | # init_strings_for_single — used for non-Edm_Typ_actual installations. |
| 189 | SINGLE_HEADERSscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/SINGLE_HEADERS. = [ |
| 190 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left EGT 1", 0, 2, "E1", 1, 0, 0, 6, 0), |
| 191 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left EGT 2", 0, 3, "E2", 1, 0, 1, 6, 1), |
| 192 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left EGT 3", 0, 4, "E3", 1, 0, 2, 6, 2), |
| 193 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left EGT 4", 0, 5, "E4", 1, 0, 3, 6, 3), |
| 194 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left EGT 5", 0, 6, "E5", 1, 0, 4, 6, 4), |
| 195 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left EGT 6", 0, 7, "E6", 1, 0, 5, 6, 5), |
| 196 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left EGT 7", 0, 8, "E7", 1, 3, 0, 7, 0), |
| 197 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left EGT 8", 0, 9, "E8", 1, 3, 1, 7, 1), |
| 198 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left EGT 9", 0, 10, "E9", 1, 3, 2, 7, 2), |
| 199 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left CHT 1", 0, 11, "C1", 1, 1, 0), |
| 200 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left CHT 2", 0, 12, "C2", 1, 1, 1), |
| 201 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left CHT 3", 0, 13, "C3", 1, 1, 2), |
| 202 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left CHT 4", 0, 14, "C4", 1, 1, 3), |
| 203 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left CHT 5", 0, 15, "C5", 1, 1, 4), |
| 204 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left CHT 6", 1, 0, "C6", 1, 1, 5), |
| 205 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left CHT 7", 1, 1, "C7", 1, 3, 3), |
| 206 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left CHT 8", 1, 2, "C8", 1, 3, 4), |
| 207 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left CHT 9", 1, 3, "C9", 1, 3, 5), |
| 208 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left TIT 1", 1, 5, "T1", 1, 0, 6, 6, 6), |
| 209 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left TIT 2", 1, 6, "T2", 1, 0, 7, 6, 7), |
| 210 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("OAT", 1, 9, "OAT", 1, 2, 5), |
| 211 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left DIF", 0, 0, "DIF"), |
| 212 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left CLD", 0, 0, "CLD", 1, 1, 6), |
| 213 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left CDT", 1, 7, "CDT", 1, 2, 2), |
| 214 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left IAT", 1, 8, "IAT", 1, 2, 3), |
| 215 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left MAP", 1, 14, "MAP", 10.0, 5, 0), |
| 216 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left RPM", 1, 10, "RPM", 1, 5, 1, 5, 2), |
| 217 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left HP", 1, 10, "HP", 1, 3, 6), |
| 218 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left FF (gph)", 1, 11, "FF", 10.0, 2, 7), # fUnit==0 default |
| 219 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left FF (lph)", 1, 11, "FF_L", 1, 2, 7), # fUnit==1 |
| 220 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left OILP", 1, 13, "OILP", 1, 2, 1), |
| 221 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left OILT", 1, 4, "OILT", 1, 1, 7), |
| 222 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("BAT", 0, 0, "BAT", 10.0, 2, 4), |
| 223 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left USD (gal)", 1, 11, "USD", 10.0, 2, 6), |
| 224 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("Left USD (l)", 1, 11, "USD_L", 1, 2, 6), |
| 225 | _hscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_h().("MARK", 0, 0, "MARK", 1, 2, 0), |
| 226 | ] |
| 227 | |
| 228 | |
| 229 | # Codes that come in (gallons, liters) pairs. The "_L" variant uses scale 1.0, |
| 230 | # the bare variant uses scale 10.0. We pick one based on fUnit and rename to |
| 231 | # the bare code so downstream consumers see "FF" regardless of unit. |
| 232 | _FUEL_UNIT_PAIRSscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_FUEL_UNIT_PAIRS. = {"FF", "FF2", "USD", "USD2", "RFL", "LFL"} |
| 233 | |
| 234 | |
| 235 | def headers_for_modelscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/headers_for_model().(modelscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/headers_for_model().(model): strscip-python python python-stdlib 3.11 builtins/str#, fuel_unitscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/headers_for_model().(fuel_unit): intscip-python python python-stdlib 3.11 builtins/int#, twinscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/headers_for_model().(twin): boolscip-python python python-stdlib 3.11 builtins/bool#, edm_typ_actualscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/headers_for_model().(edm_typ_actual): boolscip-python python python-stdlib 3.11 builtins/bool#): |
| 236 | """Return the list of MetricDef relevant for the model, with fUnit-conditional |
| 237 | entries pruned. EDM830/831 with protocol-2 → HEADERS_107; otherwise SINGLE. |
| 238 | """ |
| 239 | table = HEADERS_107scip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/HEADERS_107. if edm_typ_actualscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/headers_for_model().(edm_typ_actual) else SINGLE_HEADERSscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/SINGLE_HEADERS. |
| 240 | out = [] |
| 241 | for hdr in table: |
| 242 | bare = hdr.codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#code.[:-2] if hdr.codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#code..endswithscip-python python python-stdlib 3.11 builtins/str#endswith().("_L") else hdr.codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#code. |
| 243 | if bare in _FUEL_UNIT_PAIRSscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_FUEL_UNIT_PAIRS. and bare != hdr.codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#code.: |
| 244 | # liters variant — keep only when fuel_unit != 0 |
| 245 | if fuel_unitscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/headers_for_model().(fuel_unit) == 0: |
| 246 | continue |
| 247 | elif bare in _FUEL_UNIT_PAIRSscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/_FUEL_UNIT_PAIRS. and bare == hdr.codescip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#code.: |
| 248 | # gallons variant — keep only when fuel_unit == 0 |
| 249 | if fuel_unitscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/headers_for_model().(fuel_unit) != 0: |
| 250 | continue |
| 251 | out.appendscip-python python python-stdlib 3.11 builtins/list#append().(hdr) |
| 252 | # Rename "_L" codes to their bare form |
| 253 | normalized = [] |
| 254 | for h in out: |
| 255 | if h.code.endswith("_L"): |
| 256 | normalized.appendscip-python python python-stdlib 3.11 builtins/list#append().(MetricDefscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/MetricDef#(h.sensor_name, h.code[:-2], h.cfg_byt_idx, |
| 257 | h.cfg_bit_idx, h.scale_val, |
| 258 | h.m_lo_byt_idx, h.m_lo_bit_idx, |
| 259 | h.m_hi_byt_idx, h.m_hi_bit_idx)) |
| 260 | else: |
| 261 | normalized.appendscip-python python python-stdlib 3.11 builtins/list#append().(h) |
| 262 | return normalized |
| 263 | |
| 264 | |
| 265 | METRIC_LIBRARYscip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/METRIC_LIBRARY. = HEADERS_107scip-python python jpi-analyzer 0.2.0 `jpi_analyzer.metrics`/HEADERS_107. |