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

#include <hellen_board_id.h>

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

Public Member Functions

float fx (float x) override
 
float dfx (float x) override
 
float solve (float Tc1, float Tc2, float x0, float y, float deltaX)
 

Private Attributes

float k1
 
float k2
 
float k3
 

Detailed Description

Definition at line 30 of file hellen_board_id.h.

Member Function Documentation

◆ dfx()

float HellenBoardIdSolver::dfx ( float  x)
inlineoverride

Definition at line 38 of file hellen_board_id.h.

38 {
39 return (-1.0f / (x * x)) * (k1 * exp(k1 / x) - k2 * exp(k2 / x) + k3 * exp(k3 / x));
40 }

◆ fx()

float HellenBoardIdSolver::fx ( float  x)
inlineoverride

Definition at line 33 of file hellen_board_id.h.

33 {
34 return exp(k1 / x) - exp(k2 / x) + exp(k3 / x) - 1.0;
35 }

◆ solve()

float HellenBoardIdSolver::solve ( float  Tc1,
float  Tc2,
float  x0,
float  y,
float  deltaX 
)

Definition at line 83 of file hellen_board_id.cpp.

83 {
84 // the discharge time equals to the charge time
85 float Td = Tc1;
86
87 float iC = -1.0f / y;
88 k1 = iC * Td;
89 k2 = iC * (Tc1 + Td);
90 k3 = iC * (Tc1 - Tc2);
91
92 // the same method works for R (if C is known) or C (if R is known)
93 auto result = NewtonsMethodSolver::solve(x0, deltaX, 20);
94
95 // since we had https://github.com/rusefi/rusefi/issues/4084 let's add paranoia check
96 // All real cases seem to converge in <= 5 iterations, so we don't need to try more than 20.
97 if (!result) {
98 criticalError("hellen boardID is broken");
99 return 0;
100 }
101
102 return result.Value;
103}

Referenced by HellenBoardIdFinderBase::calc().

Here is the caller graph for this function:

Field Documentation

◆ k1

float HellenBoardIdSolver::k1
private

Definition at line 47 of file hellen_board_id.h.

Referenced by dfx(), fx(), and solve().

◆ k2

float HellenBoardIdSolver::k2
private

Definition at line 47 of file hellen_board_id.h.

Referenced by dfx(), fx(), and solve().

◆ k3

float HellenBoardIdSolver::k3
private

Definition at line 47 of file hellen_board_id.h.

Referenced by dfx(), fx(), and solve().


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