• "Frankly, I know what's wrong but don't know how to fix it." - Bernie Ecclestone.

# A spool differential as "active differential" help needed.

Discussion in 'Racer Physics and Technical' started by smr597, Mar 14, 2013.

1. ### smr597

Messages:
51
Ratings:
+14
So my idea is to create a fully spool/welded differential through a script (mostly at learning purpose).
Right now in the racer docs we have this code:
Code:
```/*
* Viscous Differential
*/

#include "racer.oxs"

float OnDifferential(int diffIndex)
{
const float coeff=2000.0;
float v1,v2;
float torque;

// Velocities of the wheels (rad/s)
v1=GetSystemFloat("car0.wheel2.rotvel");
v2=GetSystemFloat("car0.wheel3.rotvel");

// Push towards equal velocities
torque=-coeff*(v2-v1);
}```
This differential uses speed difference to apply a torque coeficient, good for some balance between the powered wheels. But you cant actually get a fully locked (spool/welded) differential with this method.

Now from my learning I understand that angular velocity and torque are a totally different characters in this case and are not related as I thought at first.
Previously I thought that when both wheels have the same torque, they spinn equally but I was wrong.
I learned that only a open differential has torque equal on both wheels and tottally different angular velocity's on each wheel.

So in my theory a spool/welded differential will have equal angular velocity's and different torques on the wheels.
So here comes my equation how I think a spool differential would look in code:

Code:
```// ratio of velocity difference
float velocityRatio=0.5f;
// Velocities of the wheels (rad/s)
leftSpeed=GetSystemFloat("car0.wheel2.rotvel");
rightSpeed=GetSystemFloat("car0.wheel3.rotvel");

if ( velocityRatio>0.5f)
velocityRatio = (leftSpeed/rightSpeed)/2;
else
velocityRatio = (rightSpeed/leftSpeed)/2;
```
and my input to the wheels should ideally be like this:
Code:
```// torqueInput is suposed to be the final torque ((tEngine)*gearRatio*finalDriveRatio)
leftTorque=(torqueInput * (1-velociotyRatio)) ;
rightTorque=(torqueInput * velociotyRatio) ;
//leftTorque=(torqueInput * 0.5f) ;
//rightTorque=(torqueInput * 0.5f) ;
```
As you can see my idea is to transfer torque from one side to the other via speed difference ratio.
My question is, is this the right approach?
Or does anyone have a better idea?

2. ### Mr Whippy

Messages:
2,977
Ratings:
+455
Hmmm...

Seems very complicated to make sure speeds and torques remain equal.

Can't you just use the limited slip differential and put a big pre-load on it before it allows differential speeds?

In theory if your engine makes say 500Nm peak and 1st gear is 4:1 and final drive is 3:1, then 1st gear torque is about 6000N, so having a pre-load of 6000N or more should mean no possibility of having the diff operate un-locked.

Hmmmm...!?

Dave

3. ### Cosmo°

Messages:
282
Ratings:
+52
If you want a spool differential in Racer, differentials.diff0.type=4 provides this functionality already. If you're using this as an example to try out some scripting/coding, then I'm wondering how you plan to set the "wheel torque" that you calculate above. As far as I know, we have no access to torque output per wheel on a 2WD vehicle, only partially through the AWD hack/powergearing.