wow Leiderman-Khlystov
This commit is contained in:
parent
8c10cf22c4
commit
07c08947ba
|
@ -18,6 +18,16 @@
|
||||||
end \
|
end \
|
||||||
"
|
"
|
||||||
|
|
||||||
|
#define LUA_POW " \
|
||||||
|
function pow(x, power) \
|
||||||
|
local result = x \
|
||||||
|
for i = 2, power, 1 \
|
||||||
|
do \
|
||||||
|
result = result * x \
|
||||||
|
end \
|
||||||
|
return result \
|
||||||
|
end \
|
||||||
|
"
|
||||||
|
|
||||||
#define PRINT_ARRAY "hexstr = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, \"A\", \"B\", \"C\", \"D\", \"E\", \"F\" } \
|
#define PRINT_ARRAY "hexstr = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, \"A\", \"B\", \"C\", \"D\", \"E\", \"F\" } \
|
||||||
\
|
\
|
||||||
|
|
|
@ -265,64 +265,16 @@ TEST(LuaVag, ChecksumMotor6) {
|
||||||
|
|
||||||
// Leiderman-Khlystov Coefficients for Estimating Engine Full Load Characteristics and Performance
|
// Leiderman-Khlystov Coefficients for Estimating Engine Full Load Characteristics and Performance
|
||||||
TEST(LuaVag, LeidermaKhlystov) {
|
TEST(LuaVag, LeidermaKhlystov) {
|
||||||
const char* magic = VAG_CHECKSUM realMotor6Packet R"(
|
const char* magic = LUA_POW VAG_CHECKSUM realMotor6Packet R"(
|
||||||
|
|
||||||
function pow(x, power)
|
|
||||||
local result = x
|
|
||||||
for i = 2, power, 1
|
|
||||||
do
|
|
||||||
result = result * x
|
|
||||||
end
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
Nemaxhp=188.7
|
|
||||||
Nn=3643
|
|
||||||
Memax=441.5
|
|
||||||
nM=2689
|
|
||||||
|
|
||||||
ne=2000
|
|
||||||
Nemax=Nemaxhp*0.7355
|
|
||||||
|
|
||||||
Mn=Nemax*9549/Nn
|
|
||||||
print('Mn ' ..Mn)
|
|
||||||
|
|
||||||
Kn=Nn/nM
|
|
||||||
print('Kn ' ..Kn)
|
|
||||||
|
|
||||||
Km=Memax/Mn
|
|
||||||
print('Km ' ..Km)
|
|
||||||
|
|
||||||
M3=(Km-1)*100;
|
|
||||||
zz=(100*(Kn-1)*(Kn-1));
|
|
||||||
print('m3 ' ..M3)
|
|
||||||
print('zz ' ..zz)
|
|
||||||
|
|
||||||
ax=1-((M3*Kn*(2-Kn))/zz);
|
|
||||||
bx=2*((M3*Kn)/zz);
|
|
||||||
cx=(M3*Kn*Kn)/zz;
|
|
||||||
|
|
||||||
print('ax ' ..ax)
|
|
||||||
print('bx ' ..bx)
|
|
||||||
print('cx ' ..cx)
|
|
||||||
|
|
||||||
xx=ax*((ne/Nn))+(bx*(pow(ne,2)/pow(Nn,2)))-(cx*(pow(ne,3)/pow(Nn,3)));
|
|
||||||
print ('xx ' ..xx)
|
|
||||||
|
|
||||||
|
|
||||||
Ne=Nemax*xx;
|
|
||||||
|
|
||||||
Me=(9550*Ne)/ne;
|
|
||||||
|
|
||||||
print('Me ' .. Me)
|
|
||||||
|
|
||||||
currentRpm = 2000
|
currentRpm = 2000
|
||||||
|
|
||||||
maxPowerHp =188.7
|
maxPowerHp = 148
|
||||||
maxPowerRpm = 3643
|
maxPowerRpm = 6000
|
||||||
maxTorqueNm = 441.5
|
maxTorqueNm = 147
|
||||||
maxTorqueRpm = 2689
|
maxTorqueRpm = 3500
|
||||||
|
|
||||||
|
|
||||||
maxPowerKw = maxPowerHp * 0.7355
|
maxPowerKw = maxPowerHp * 0.7355
|
||||||
|
|
||||||
|
@ -336,34 +288,34 @@ print('rpmCoef ' ..rpmCoef)
|
||||||
torqCoef = maxTorqueNm / torqAtMaxPower
|
torqCoef = maxTorqueNm / torqAtMaxPower
|
||||||
print('torqCoef ' ..torqCoef)
|
print('torqCoef ' ..torqCoef)
|
||||||
|
|
||||||
M3 =(torqCoef -1) * 100
|
torquePotential =(torqCoef -1) * 100
|
||||||
zz =(100 *(rpmCoef -1) *(rpmCoef -1))
|
zz =(100 *(rpmCoef -1) *(rpmCoef -1))
|
||||||
print('m3 ' ..M3)
|
print('torquePotential ' ..torquePotential)
|
||||||
print('zz ' ..zz)
|
print('zz ' ..zz)
|
||||||
|
|
||||||
ax = 1 -((M3 * rpmCoef *(2 - rpmCoef)) / zz)
|
ax = 1 -((torquePotential * rpmCoef *(2 - rpmCoef)) / zz)
|
||||||
bx = 2 *((M3 * rpmCoef) / zz)
|
bx = 2 *((torquePotential * rpmCoef) / zz)
|
||||||
cx =(M3 * rpmCoef * rpmCoef) / zz
|
cx =(torquePotential * rpmCoef * rpmCoef) / zz
|
||||||
|
|
||||||
print('ax ' ..ax)
|
print('ax ' ..ax .. ', bx ' ..bx .. ', cx ' ..cx)
|
||||||
print('bx ' ..bx)
|
|
||||||
print('cx ' ..cx)
|
|
||||||
|
|
||||||
xx = ax *((currentRpm / maxPowerRpm)) +(bx *(pow(currentRpm, 2) / pow(maxPowerRpm, 2))) -(cx *(pow(currentRpm, 3) / pow(maxPowerRpm, 3)))
|
rpmRatio = currentRpm / maxPowerRpm
|
||||||
print ('xx ' ..xx)
|
abcMult = ax * rpmRatio + bx * pow(rpmRatio, 2) - cx * pow(rpmRatio, 3)
|
||||||
|
print ('abcMult ' ..abcMult)
|
||||||
|
|
||||||
|
print('rpmRatio ' .. rpmRatio)
|
||||||
|
|
||||||
Ne = maxPowerKw * xx
|
LeidermanPower = maxPowerKw * abcMult
|
||||||
|
print('LeidermanPower ' .. LeidermanPower)
|
||||||
|
|
||||||
Me =(9550 * Ne) / currentRpm
|
LeidermanTorque = (9550 * LeidermanPower) / currentRpm
|
||||||
|
print('LeidermanTorque ' .. LeidermanTorque)
|
||||||
print('Me ' ..Me)
|
|
||||||
|
|
||||||
function testFunc()
|
function testFunc()
|
||||||
return Me
|
return LeidermanTorque
|
||||||
end
|
end
|
||||||
|
|
||||||
)";
|
)";
|
||||||
|
|
||||||
EXPECT_NEAR_M3(testLuaReturnsNumberOrNil(magic).value_or(0), 1846.3770);
|
EXPECT_NEAR_M3(testLuaReturnsNumberOrNil(magic).value_or(0), 156.463);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue