RegisterSearchFAQMemberlistUsergroupsLog in
Reply to topic Page 1 of 1
Some E36 scripts
Author Message
Reply with quote
Post Some E36 scripts 
Here are a couple scripts I wrote for my E36 M3. Having the speed sensor in the rear diff is handy. Change the constants to suit your diff ratio and tire size of course. Feel free to suggest how to improve them.

Code:
setTickRate(10) --10Hz

--virtual channels
--addChannel("name",SR,prec,min,max,"unit")
speeddiff_id = addChannel("Speed_",10,0,0,160,"MPH")
gear_id = addChannel("Gear_",5,0,0,5,"gear")


--global constants
first = 4.20
second = 2.49
third = 1.66
fourth = 1.24
fifth = 1.00
final = 3.46
tirediameter = 24.7

--global variables
rpm = 0
rpm_diff = 0
speed = 0

function updateSpeedDiff()
   rpm_diff = getTimerRpm(1)
   speed = rpm_diff*tirediameter*0.002975
   speed = speed + 0.5 -- round because 0 prec. truncates
   setChannel(speeddiff_id, speed)
end

function updateGear()
   rpm = getTimerRpm(0)
   local gearErr = 0.15
   local gear = 0
   
   if speed > 2 then
      ratio = rpm/(rpm_diff*final)
      if ((first  - ratio)^2) < (gearErr^2) then gear = 1 end
      if ((second - ratio)^2) < (gearErr^2) then gear = 2 end
      if ((third  - ratio)^2) < (gearErr^2) then gear = 3 end
      if ((fourth - ratio)^2) < (gearErr^2) then gear = 4 end
      if ((fifth  - ratio)^2) < (gearErr^2) then gear = 5 end
   end
     setChannel(gear_id, gear)
end

function onTick()
  updateSpeedDiff()
  updateGear()
end


View user's profile Send private message
Reply with quote
Post  
Awesome, I'll add this to the Wiki under the E36 section. Thank you!


_________________
Brent Picasso
Founder, Autosport Labs
Facebook | Twitter
View user's profile Send private message Send e-mail
Reply with quote
Post  
Here: https://wiki.autosportlabs.com/BMW_E36_Guide#Road_speed_.28differential_speed_sensor_based.29


_________________
Brent Picasso
Founder, Autosport Labs
Facebook | Twitter
View user's profile Send private message Send e-mail
Reply with quote
Post  
cool!

The diff speed signal is on a black w/ white stripe wire and can be found:
Pin 2 on connector X17 to the back of the gauge cluster
Pin 10 on connector X22 on the cruise control module behind the glove box
Pin 10 on radio connector

View user's profile Send private message
Reply with quote
Post  
Updated here! https://wiki.autosportlabs.com/BMW_E36_Guide#Road_speed_.28differential_speed_sensor_based.29


_________________
Brent Picasso
Founder, Autosport Labs
Facebook | Twitter
View user's profile Send private message Send e-mail
Reply with quote
Post  
It should be mentioned in the wiki that it is assumed the differential input attached to the second RPM input.

-bj

View user's profile Send private message
Reply with quote
Post  
Got it.


_________________
Brent Picasso
Founder, Autosport Labs
Facebook | Twitter
View user's profile Send private message Send e-mail
Reply with quote
Post  
Hey Brent,

Since the latest software only supports alphanumerica characters for channel names, we should update this script to remove the underscores.

View user's profile Send private message
Reply with quote
Post  
Actually, the latest 1.10.1 beta software supports underscores as well as spaces. That was a change I just made.


_________________
Brent Picasso
Founder, Autosport Labs
Facebook | Twitter
View user's profile Send private message Send e-mail
Reply with quote
Post  
Ah that's good. I'm still confused as to whether i can overwrite existing channels or not so i like to put an underscore after all the ones that i make to keep things clear.

View user's profile Send private message
Reply with quote
Post  
You need to define unique channel names. Having duplicate names will cause problems in dashboard and analysis.

In dashboard mode, the duplicate channels will both update the same gauge, causing erroneous readings.
In analysis, data is funneled into a single channel name, so you will have problems importing and displaying data.

Hope this resolves the confusion!


_________________
Brent Picasso
Founder, Autosport Labs
Facebook | Twitter
View user's profile Send private message Send e-mail
Reply with quote
Post  
brentp wrote:
You need to define unique channel names. Having duplicate names will cause problems in dashboard and analysis.

In dashboard mode, the duplicate channels will both update the same gauge, causing erroneous readings.
In analysis, data is funneled into a single channel name, so you will have problems importing and displaying data.

Hope this resolves the confusion!


Ah, that does help. Is there anyway to delete or rename existing channels? In some ways it would be nice to have no predefined channels, only hardware or virtual channel resources that i could then name myself. But i guess that could get ugly.

For example, I would like to use "Speed" for my speed sensor and not the GPS speed as it is by default.

View user's profile Send private message
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum