Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/libraries/AP_EFI/AP_EFI_State.h
Views: 1798
/*1This program is free software: you can redistribute it and/or modify2it under the terms of the GNU General Public License as published by3the Free Software Foundation, either version 3 of the License, or4(at your option) any later version.56This program is distributed in the hope that it will be useful,7but WITHOUT ANY WARRANTY; without even the implied warranty of8MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9GNU General Public License for more details.1011You should have received a copy of the GNU General Public License12along with this program. If not, see <http://www.gnu.org/licenses/>.13*/1415#pragma once1617#include <AP_EFI/AP_EFI_config.h>1819#if HAL_EFI_ENABLED2021#include <AP_Common/AP_Common.h>22#include <AP_HAL/AP_HAL.h>2324// Time in milliseconds before we declare the EFI to be "unhealthy"25#define HEALTHY_LAST_RECEIVED_MS 30002627/***************28*29* Status enums30*31***************/3233enum class Engine_State : uint8_t {34STOPPED = 0,35STARTING = 1,36RUNNING = 2,37FAULT = 338};3940enum class Crankshaft_Sensor_Status : uint8_t {41NOT_SUPPORTED = 0,42OK = 1,43ERROR = 244};4546enum class Temperature_Status : uint8_t {47NOT_SUPPORTED = 0,48OK = 1,49BELOW_NOMINAL = 2,50ABOVE_NOMINAL = 3,51OVERHEATING = 4,52EGT_ABOVE_NOMINAL = 553};5455enum class Fuel_Pressure_Status : uint8_t {56NOT_SUPPORTED = 0,57OK = 1,58BELOW_NOMINAL = 2,59ABOVE_NOMINAL = 360};6162enum class Oil_Pressure_Status : uint8_t {63NOT_SUPPORTED = 0,64OK = 1,65BELOW_NOMINAL = 2,66ABOVE_NOMINAL = 367};6869enum class Detonation_Status : uint8_t {70NOT_SUPPORTED = 0,71NOT_OBSERVED = 1,72OBSERVED = 273};7475enum class Misfire_Status : uint8_t {76NOT_SUPPORTED = 0,77NOT_OBSERVED = 1,78OBSERVED = 279};8081enum class Debris_Status : uint8_t {82NOT_SUPPORTED = 0,83NOT_DETECTED = 1,84DETECTED = 285};8687enum class Spark_Plug_Usage : uint8_t {88SINGLE = 0,89FIRST_ACTIVE = 1,90SECOND_ACTIVE = 2,91BOTH_ACTIVE = 392};939495/***************96* Status structs.97* EFIs may not provide all data in the message, therefore, the following guidelines should be followed.98* All integer fields are required unless stated otherwise.99* All floating point fields are optional unless stated otherwise; unknown/unapplicable fields will be NaN.100***************/101102103// Per-cylinder status struct104struct Cylinder_Status {105// Cylinder ignition timing (angular degrees of the crankshaft)106float ignition_timing_deg;107108// Fuel injection time (millisecond)109float injection_time_ms;110111// Cylinder head temperature (CHT) (kelvin)112float cylinder_head_temperature;113114// 2nd Cylinder head temperature (CHT) (kelvin), 0 if not applicable115float cylinder_head_temperature2;116117// Exhaust gas temperature (EGT) (kelvin)118// If this cylinder is not equipped with an EGT sensor - will be NaN119// If there is a single shared EGT sensor, will be the same value for all cylinders120float exhaust_gas_temperature;121122// 2nd cylinder exhaust gas temperature, 0 if not applicable123float exhaust_gas_temperature2;124125// Estimated lambda coefficient (dimensionless ratio)126// Useful for monitoring and tuning purposes.127float lambda_coefficient;128};129130// Stores the current state read by the EFI system131// All backends are required to fill in this state structure132struct EFI_State {133// When this structure was last updated (milliseconds)134uint32_t last_updated_ms;135136// Current overall engine state137Engine_State engine_state;138139// If there is an error that does not fit other error types140bool general_error;141142// Error/status fields143Crankshaft_Sensor_Status crankshaft_sensor_status;144Temperature_Status temperature_status;145Fuel_Pressure_Status fuel_pressure_status;146Oil_Pressure_Status oil_pressure_status;147Detonation_Status detonation_status;148Misfire_Status misfire_status;149Debris_Status debris_status;150151// Engine load (percent)152uint8_t engine_load_percent;153154// Engine speed (revolutions per minute)155uint32_t engine_speed_rpm;156157// Spark dwell time (milliseconds)158float spark_dwell_time_ms;159160// Atmospheric (barometric) pressure (kilopascal)161float atmospheric_pressure_kpa;162163// Engine intake manifold pressure (kilopascal)164float intake_manifold_pressure_kpa;165166// Engine intake manifold temperature (kelvin)167float intake_manifold_temperature;168169// Engine coolant temperature (kelvin)170float coolant_temperature;171172// Oil pressure (kilopascal)173float oil_pressure;174175// Oil temperature (kelvin)176float oil_temperature;177178// Fuel pressure (kilopascal)179float fuel_pressure;180181// Instant fuel consumption estimate, which182// should be low-pass filtered in order to prevent aliasing effects.183// (centimeter^3)/minute.184float fuel_consumption_rate_cm3pm;185186// Estimate of the consumed fuel since the start of the engine (centimeter^3)187// This variable is reset when the engine is stopped.188float estimated_consumed_fuel_volume_cm3;189190// Throttle position (percent)191uint8_t throttle_position_percent;192193// The index of the publishing ECU.194uint8_t ecu_index;195196// Spark plug activity report.197// Can be used during pre-flight tests of the spark subsystem.198// Use case is that usually on double spark plug engines, the199// engine switch has the positions OFF-LEFT-RIGHT-BOTH-START.200// Gives pilots the possibility to test both spark plugs on201// ground before takeoff.202Spark_Plug_Usage spark_plug_usage;203204// Status for each cylinder in the engine205Cylinder_Status cylinder_status;206207// ignition voltage in Volts208float ignition_voltage = -1; // -1 is "unknown";209210// throttle output percentage211float throttle_out;212213// PT compensation214float pt_compensation;215};216217#endif // HAL_EFI_ENABLED218219220