rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes
RedundantFordTps Class Referencefinal

#include <redundant_ford_tps.h>

Inheritance diagram for RedundantFordTps:
Inheritance graph
[legend]
Collaboration diagram for RedundantFordTps:
Collaboration graph
[legend]

Public Member Functions

 RedundantFordTps (SensorType outputType, SensorType firstSensor, SensorType secondSensor)
 
void configure (float maxDifference, float secondaryMaximum)
 
SensorResult get () const override
 
bool isRedundant () const override
 
void showInfo (const char *sensorName) const override
 
- Public Member Functions inherited from Sensor
bool Register ()
 
const chargetSensorName () const
 
virtual bool hasSensor () const
 
virtual float getRaw () const
 
void unregister ()
 
SensorType type () const
 

Private Attributes

const SensorType m_first
 
const SensorType m_second
 
float m_maxDifference = 0
 
float m_secondaryMaximum = 0
 

Additional Inherited Members

- Static Public Member Functions inherited from Sensor
static void showAllSensorInfo ()
 
static void showInfo (SensorType type)
 
static void resetRegistry ()
 
static const SensorgetSensorOfType (SensorType type)
 
static SensorResult get (SensorType type)
 
static float getOrZero (SensorType type)
 
static float getRaw (SensorType type)
 
static bool isRedundant (SensorType type)
 
static bool hasSensor (SensorType type)
 
static void setMockValue (SensorType type, float value, bool mockRedundant=false)
 
static void setInvalidMockValue (SensorType type)
 
static void resetMockValue (SensorType type)
 
static void resetAllMocks ()
 
static void inhibitTimeouts (bool inhibit)
 
static const chargetSensorName (SensorType type)
 
- Protected Member Functions inherited from Sensor
 Sensor (SensorType type)
 
- Static Protected Attributes inherited from Sensor
static bool s_inhibitSensorTimeouts = false
 

Detailed Description

Definition at line 5 of file redundant_ford_tps.h.

Constructor & Destructor Documentation

◆ RedundantFordTps()

RedundantFordTps::RedundantFordTps ( SensorType  outputType,
SensorType  firstSensor,
SensorType  secondSensor 
)

Definition at line 5 of file redundant_ford_tps.cpp.

6 : Sensor(outputType)
7 , m_first(first)
8 , m_second(second)
9{
10}
const SensorType m_first
const SensorType m_second

Member Function Documentation

◆ configure()

void RedundantFordTps::configure ( float  maxDifference,
float  secondaryMaximum 
)

Definition at line 12 of file redundant_ford_tps.cpp.

12 {
13 m_maxDifference = maxDifference;
14 m_secondaryMaximum = secondaryMaximum;
15}

◆ get()

SensorResult RedundantFordTps::get ( ) const
overridevirtual

Implements Sensor.

Definition at line 17 of file redundant_ford_tps.cpp.

17 {
18 // Sensor 1 is "plain linear" and has the full range
19 auto tps1 = Sensor::get(m_first);
20
21 // Sensor 2 is compressed in to 0 -> 50%
23
24 // If either result is invalid, return invalid.
25 if (!tps1 || !tps2) {
26 return UnexpectedCode::Inconsistent;
27 }
28
29 // The "actual" position resolved by the second throttle - this tops out at m_secondaryMaximum instead of 100%
30 float tps2Actual = tps2.Value * m_secondaryMaximum / 100;
31
32 // Switch modes slightly below the maximum of the secondary, to avoid misbehavior near 100%
33 float avgThreshold = m_secondaryMaximum * 0.9f;
34
35 // Case 1: both sensors show low position, average result
36 if (tps1.Value < avgThreshold && tps2Actual < avgThreshold) {
37 // Check that the resolved positions are close
38 float delta = absF(tps1.Value - tps2Actual);
39 if (delta > m_maxDifference) {
40 return UnexpectedCode::Inconsistent;
41 }
42
43 return (tps1.Value + tps2Actual) / 2;
44 }
45
46 // Case 2: both sensors show high position, return "full scale" sensor's position
47 if (tps1.Value > avgThreshold && tps2Actual > (avgThreshold - 3)) {
48 return tps1;
49 }
50
51 // Any other condition indicates an mismatch, and therefore an error
52 return UnexpectedCode::Inconsistent;
53}
virtual SensorResult get() const =0
static RedundantPair tps2(tps2p, tps2s, SensorType::Tps2)
Here is the call graph for this function:

◆ isRedundant()

bool RedundantFordTps::isRedundant ( ) const
inlineoverridevirtual

Reimplemented from Sensor.

Definition at line 18 of file redundant_ford_tps.h.

18 {
19 return true;
20 }

◆ showInfo()

void RedundantFordTps::showInfo ( const char sensorName) const
overridevirtual

Implements Sensor.

Definition at line 58 of file sensor_info_printing.cpp.

58 {
59 efiPrintf("Sensor \"%s\" is Ford-type redundant TPS combining \"%s\" and \"%s\"", sensorName, getSensorName(m_first), getSensorName(m_second));
60}
const char * getSensorName() const
Definition sensor.h:130
Here is the call graph for this function:

Field Documentation

◆ m_first

const SensorType RedundantFordTps::m_first
private

Definition at line 26 of file redundant_ford_tps.h.

Referenced by get(), and showInfo().

◆ m_maxDifference

float RedundantFordTps::m_maxDifference = 0
private

Definition at line 30 of file redundant_ford_tps.h.

Referenced by configure(), and get().

◆ m_second

const SensorType RedundantFordTps::m_second
private

Definition at line 27 of file redundant_ford_tps.h.

Referenced by get(), and showInfo().

◆ m_secondaryMaximum

float RedundantFordTps::m_secondaryMaximum = 0
private

Definition at line 33 of file redundant_ford_tps.h.

Referenced by configure(), and get().


The documentation for this class was generated from the following files: