[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 258: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 320: mysqli_free_result(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4433: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3315)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4433: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3315)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4433: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3315)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4433: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3315)
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 258: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 320: mysqli_free_result(): Couldn't fetch mysqli_result
rusefi.com • Calculate VSS with RPM vs GEAR position
Page 1 of 1

Calculate VSS with RPM vs GEAR position

Posted: Mon Jun 20, 2022 9:18 pm
by nmstec
In the rare case you have a car that has no actual VSS, but need an idea of speed, this would be the future LUA script to do so.



****
SCRIPT GOES HERE
****

Info go here:
FIRST GEAR
22kph @1890 - 85.90
25kph @2189 - 87.56
31kph @2768 - 89.29
39kph @3497 - 89.66
49kph @4361 - 89.00
51kph @4595 - 90.09

OVERALL AVERAGE RPM/88.583

SECOND GEAR
27kph @1654 - 61.25
29kph @1777 - 61.27
33kph @2013 - 61
35kph @2172 - 62.05
40kph @2491 - 62.27
59kph @3760 - 63.72
68kph @4244 - 62.41
73kph @4597 - 62.97

OVERALL AVERAGE RPM/62.117

THIRD GEAR
31kph @1552 - 50.06
35kph @1763 - 50.37
39kph @1937 - 49.66
46kph @2325 - 50.54
53kph @2695 - 50.84
72kph @3778 - 52.47
85kph @4414 - 51.92
91kph @4672 - 51.34

OVERALL AVERAGE RPM/50.9

FOURTH GEAR
42kph @1787 - 42.54
47kph @1937 - 41.21
49kph @2052 - 41.87
53kph @2191 - 41.33
79kph @3433 - 43.45
91kph @3853 - 42.34
99kph @4233 - 42.75

OVERALL AVERAGE RPM/42.21

FIFTH GEAR
56kph @1969 - 35.16
59kph @2086 - 35.35
63kph @2239 - 35.53
76kph @2731 - 35.93
94kph @3419 - 36.37
101kph @3659 - 36.22

OVERALL AVERAGE RPM/35.76

SIXTH GEAR
70kph @1971 - 28.15
74kph @2118 - 28.62
80kph @2283 - 28.53
86kph @2464 - 28.65
105kph @3062 - 29.16
122kph @3345 - 27.41

OVERALL AVERAGE RPM/28.42

Re: Calculate VSS with RPM vs GEAR position

Posted: Mon Jun 20, 2022 9:19 pm
by mck1117
nmstec wrote:
Mon Jun 20, 2022 9:18 pm
In the rare case you have a car that has no actual VSS, but need an idea of speed, this would be the future LUA script to do so.
In the rare case you have no VSS, want one, and ALSO HAVE GEAR POSITION SENSING!

Re: Calculate VSS with RPM vs GEAR position

Posted: Mon Jun 20, 2022 10:01 pm
by nmstec
mck1117 wrote:
Mon Jun 20, 2022 9:19 pm
nmstec wrote:
Mon Jun 20, 2022 9:18 pm
In the rare case you have a car that has no actual VSS, but need an idea of speed, this would be the future LUA script to do so.
In the rare case you have no VSS, want one, and ALSO HAVE GEAR POSITION SENSING!
Very true. But hey, Andrey says he wants this info saved, so I figure fuck it. Gear sensing AND A 30K sequential tranny lol

Re: Calculate VSS with RPM vs GEAR position

Posted: Tue Jun 21, 2022 1:37 am
by AndreyB
Show me your Lua :) Do you already print speed into console? Did you try Lua PWM frequency?

Re: Calculate VSS with RPM vs GEAR position

Posted: Tue Jun 21, 2022 3:53 am
by nmstec
Haven't gotten to it yet, working slowly now. Was finishing up with the LSX.

Re: Calculate VSS with RPM vs GEAR position

Posted: Tue Jun 21, 2022 4:14 am
by nmstec
Basic write up at home, with 0 tests done, and voltage values pulled out of my very fine magical ass.

Code: Select all

local gear = 0 --added for later usage and data logging
local vss = 0
local ratio = 0
function onTick()
    
    
    
    rpm = getSensor("RPM")
    gPos = getAuxAnalog(0)
    if gPos < 0.7 then --Reverse
        gear = 0--no fucks given
    elseif gPos > 0.7 and gPos < 1.1 then --neutral
        gear = 9--noone cares
    elseif gPos > 1.1 and gPos < 1.6 then --1
        ratio = 88.583
    elseif gPos > 0.7 and gPos < 1.1 then --2
        ratio = 62.117
    elseif gPos > 1.1 and gPos < 1.7 then --3
        ratio = 50.9
    elseif gPos > 1.7 and gPos < 2.4 then --4
        ratio = 42.21
    elseif gPos > 2.4 and gPos < 3.0 then --5
        ratio = 35.76
    elseif gPos > 3.0 and gPos < 4.0 then --6
        ratio = 28.42
    end
    if ratio > 0 then --hack to make sure never divide by 0. set to R
        vss = rpm/ratio 
    else
        vss = 0
    end
    
    print(vss)

 end