Calculated channel - brake bias

Discussion on the Lua Scripting capabilities for RaceCapture/Pro. Also see the <a href="http://autosportlabs.net/RaceCapturePro_Lua_Scripting">Lua Scripting Guide</a>

Moderators: JeffC, stieg

Post Reply
smallspeed
Posts: 43
Joined: Mon Nov 30, 2015 1:08 pm
Location: Leicester, UK

Calculated channel - brake bias

Post by smallspeed »

I have a twin master cylinder brake set up with a balance bar, and two pressure sensors for front and rear brake line pressure
Has anyone with a similar setup created a calculated / math channel to work out brake balance from these inputs? Would be really useful for set up, either in the form of two dials showing front and rear as percentages, or one dial that’s part red part green showing percentage with a number under in..

Obviously there’s more to it than just Pf / (Pf + Pr) but it’s more how to set up so it displays properly..
I wouldn’t want it showing in real time per-se more just a screen I can go to when initially dialing a car in before headed out on track

PS14
Posts: 97
Joined: Fri Feb 12, 2016 11:27 pm
Location: NY

Post by PS14 »

I'm not a lua expert but i'll try to help. If your pulling two analog channels then try this from the Lua Scripting examples. you'll end up with a virtual guage that will show front bias as a percent of front plus rear. should get you started in the right direction. prior to all this technology I've always set my bias in the shop by pressing the pedal until the frt guage showed 300, then read the rear psi. I have a feel for what I need the rear to be at 300psi frt as a starting point. works as a simple check if for say last race you turned the knob like crazy. Dave

--10Hz update
setTickRate(10)

--Create channel: "BrakeBias"
--Sample rate: 10Hz
--Logging precision: 0 decimal points
--min/max: 0/100
--Units: "%"
--getAnalog(0) is Front brake press sensor channel
--getAnalog(1) is Rear brake press sensor channel
avgId = addChannel("BrakeBias", 10, 0, 0, 100, "%")

function brakeBias()
local a1 = getAnalog(0)
local a2 = getAnalog(1)
setChannel(avgId, (a1 / (a1+ a2))
end
end

function onTick()
brakeBias()
end

MikeD
Posts: 39
Joined: Sun May 29, 2016 11:55 am
Location: Austria
Contact:

Post by MikeD »

Hi, yeah, have done it, though with another brand display and a bargraph element instead of a dial...
Next to the formula you posted already I used a minimum pressure, before calculation is perfomed (something like "If brakepress front is greater than 3 bar then calculate value, else value = 50%... or zero... whatever you prefer).
That helps to rule out a division by zero (assuming rear press can't be negative ;-)) and from a visual point of view I also prefer it as with very low pressures the number/dial would be useless nervous anyway.

I'm not sure why you have in mind to use two dials when you already have the percentage front-to-rear calculated?! With the minimum/maximum of the calculated parameter being either 0 and 100 or whatever you want the dial will point straight up in the middle when you have 50% brakebias, and you can easily observe how the bias moves around with varying pressures, before even dialing in the bias.
Of course you can set other MIN/MAX to have you prefered bias straight in the middle of the dial as well, for even less brain work (if you know your car wants 60% front distribution then arrange MIN/MAX so that the 60% value is right in the middle of the scale for example.

smallspeed
Posts: 43
Joined: Mon Nov 30, 2015 1:08 pm
Location: Leicester, UK

Post by smallspeed »

My comment re: two dials is basically showing front and rear on separate gauges. This is raw pressure though, and I’d like to get to percentage (ie taking into account piston sizes, numbers, pads, disc sizes etc - effectively calculating brake torque % (f vs r) calculated from line pressures

This isn’t as something to monitor or use regularly - it’s just for set up to “re zero” the car or for reference once I had a good setting for a particular track / conditions

My plan would be to press the pedal to a reasonable pressure with the ABS off and then adjust and repeat to get close to the right setting before heading out in the car / taking it to the track

smallspeed
Posts: 43
Joined: Mon Nov 30, 2015 1:08 pm
Location: Leicester, UK

Post by smallspeed »

Sorry, also meant to say thanks for the pointer - I will have a go at setting something up this week

smallspeed
Posts: 43
Joined: Mon Nov 30, 2015 1:08 pm
Location: Leicester, UK

Post by smallspeed »

This has become a bit more of a lua question so will repost in that section of the forum to get some input there, but hopefully have a solution if anyone else needs this option

brentp
Site Admin
Posts: 6274
Joined: Wed Jan 24, 2007 6:36 am

Post by brentp »

Good topic! Moved to Lua scripting.
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter

Post Reply