Calculate VSS with RPM vs GEAR position

It's all about the code!
Post Reply
nmstec
contributor
contributor
Posts: 124
Joined: Tue Oct 05, 2021 9:02 pm
Location: Vancouver

Calculate VSS with RPM vs GEAR position

Post 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
"Dave B. 5:03 PM
Mark is an ass but by far the most potent combination of knowledgeable ass, smart ass, get it done ass and determined ass. and his ass consistently puts in time."

-Dave B, Hero, Tuner, and probably has a car.
mck1117
running engine in first post
running engine in first post
Posts: 1493
Joined: Mon Jan 30, 2017 2:05 am
Location: Seattle-ish

Re: Calculate VSS with RPM vs GEAR position

Post 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!
nmstec
contributor
contributor
Posts: 124
Joined: Tue Oct 05, 2021 9:02 pm
Location: Vancouver

Re: Calculate VSS with RPM vs GEAR position

Post 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
"Dave B. 5:03 PM
Mark is an ass but by far the most potent combination of knowledgeable ass, smart ass, get it done ass and determined ass. and his ass consistently puts in time."

-Dave B, Hero, Tuner, and probably has a car.
User avatar
AndreyB
Site Admin
Posts: 14292
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Calculate VSS with RPM vs GEAR position

Post by AndreyB »

Show me your Lua :) Do you already print speed into console? Did you try Lua PWM frequency?
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
nmstec
contributor
contributor
Posts: 124
Joined: Tue Oct 05, 2021 9:02 pm
Location: Vancouver

Re: Calculate VSS with RPM vs GEAR position

Post by nmstec »

Haven't gotten to it yet, working slowly now. Was finishing up with the LSX.
"Dave B. 5:03 PM
Mark is an ass but by far the most potent combination of knowledgeable ass, smart ass, get it done ass and determined ass. and his ass consistently puts in time."

-Dave B, Hero, Tuner, and probably has a car.
nmstec
contributor
contributor
Posts: 124
Joined: Tue Oct 05, 2021 9:02 pm
Location: Vancouver

Re: Calculate VSS with RPM vs GEAR position

Post 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
"Dave B. 5:03 PM
Mark is an ass but by far the most potent combination of knowledgeable ass, smart ass, get it done ass and determined ass. and his ass consistently puts in time."

-Dave B, Hero, Tuner, and probably has a car.
Post Reply