# Mass Distribution between Car Tires

1. Apr 20, 2010

### dougk16

Hi all,

I'm writing a car simulation for a game engine, and this problem has me going bonkers. For a car with known mass and center of mass, how can you figure out the "share" of mass that each tire is supporting? For standard tire arrangements (4 tires on 2 axles) I know it's just a ratio based on distance to center of mass, no problem. And I can figure it out for most cases similar to this. But I want my users to be able to put ANY number of tires at ANY points on the chassis, and here I don't know how to figure out how much mass each tire should support.

Keep in mind that the simulation is completely rigid, including the tires.

The only solution I've come up with that both kind of makes sense and works out mathematically is to recursively subdivide the tires in the longitudinal direction like this:

1.) In 2d (top-down) Find out all the tires above and below the (x,y) center of mass and split them into two groups.

2.) For each group, find an imaginary "axle" by averaging the tires' distances to the center of mass. You'll end up with 2 axles and each will have a ratio describing the percentage of mass it's supporting.

3.) Treat each axle like another center of mass and repeat steps 1.) and 2.) until you can't subdivide anymore. By compounding the ratios on each subdivision, you'll know the percentage of mass each tire is supporting in the y direction. Multiply this ratio by the mass of the car divided by 2 and you have the longitudinal share of mass on each tire.

4.) Repeat above 3 steps in latitudinal direction.

Hope that makes sense. Thank you for any insight.

Last edited: Apr 20, 2010
2. Apr 21, 2010

### log0

You have got:

$$m = \sum m_{i}$$

$$r = 1/m \sum m_{i} r_{i}$$

This can be written as:

$$A x = b$$

$$A = (r_{1}, r_{2}, ..., r_{n})$$

$$x = (m_{1}, m_{2}, ..., m_{n})$$

$$b = r m$$

You are looking for x:

$$x = A^{-1} b$$

For n != 3 see linear least squares:

$$x = A^{+} b$$

Last edited: Apr 21, 2010
3. Apr 21, 2010

### dougk16

I appreciate your reply log. I've been puzzling over it for about half an hour now, but I'm not well-versed in math notation, and I'm not sure how to apply this to my situation. Could I trouble you for a brief example? For example, let's say we plot a rectangle (width=6, height=10, lower left corner at the origin) representing the car chassis on a graph. The car's mass is 1500kg, the center of mass is at {3, 4}. Tires are at {2, 7}, {5, 9}, {1, 3}, and {4, 1}. What mass is each tire supporting? These are the numbers I used to test my solution, so it'd be interesting if our solutions matched up.

4. Apr 21, 2010

### log0

You have to solve the linear system:

$$Ax=b$$

$$A=\begin{pmatrix} 2 & 5 & 1 & 4 \\ 7 & 9 & 3 & 1 \end{pmatrix}$$

$$b=1500\begin{pmatrix} 3 \\ 4 \end{pmatrix}$$

The solution is:

$$x=A^{-1}b=\begin{pmatrix} 154 \\ 470 \\ 82 \\ 439 \end{pmatrix}$$

This is usually done numerically. If you have Matlab or http://www.gnu.org/software/octave/" [Broken] try:

A = [2 5 1 4; 7 9 3 1]
b = 1500 * [3; 4]
x = A\b

If you are using C++, boost::numeric::ublas should have a matrix inversion routine I think.

You might notice that the sum of the masses is 1145kg. The solution is approximate(least squares). http://en.wikipedia.org/wiki/Overdetermined_system" [Broken]

Last edited by a moderator: May 4, 2017
5. Apr 21, 2010

### dougk16

Thank you again, log. With those numbers in there your reasoning is much clearer to me. However, 1145kg seems like quite a deviation from 1500kg. Also, the tire's that are furthest from the center of mass are supporting the most mass, which might be right, but doesn't make sense to me.

Is your method a standard way of tackling the problem?

6. Apr 21, 2010

### log0

Nope.

I checked the numbers. The solution is exact. But there is an additional constraint that I violated:

$$\sum m_{i} = m$$

The solution will give you an offset center of mass:

$$r = \begin{pmatrix} 3.93 \\ 5.24 \end{pmatrix} = 1500 / 1145 * \begin{pmatrix} 3 \\ 4 \end{pmatrix}$$

I think it should be possible to correct the masses to get it right. Just haven't figured out how yet.

7. Apr 21, 2010

### dougk16

I'm a little confused...for your solution to be exact, the center of mass has to be adjusted? I don't see how different placements of tires could change the center of mass so significantly. I mean yea technically the tires have to have some mass, and therefore they might throw off the center of mass of the whole car, but you could mount the car on really light table legs or something and they wouldn't move the center of mass much at all, and you're back to square one.

8. Apr 22, 2010

### log0

No, this means my description of the problem has been incorrect.

The equation to solve is:

$$Ax=\sum x_{i} * r$$

The weights we are looking for are also on the right side of the equation. I don't see a standard way to solve this one, sorry. So you have to stick with your current algorithm. Just make sure that your calculated mass distribution always fulfills the center of mass equation. If the result is equal to your given center of mass then your algorithm is correct.

Edit:
Well there is a way using a nonlinear solver:
http://sunsite.univie.ac.at/textbooks/octave/octave_19.html" [Broken]
http://devernay.free.fr/hacks/cminpack.html" [Broken]

Example(Octave):
function y = f(x)
A = [2 5 1 4; 7 9 3 1];
r = [3; 4]
y = [A*x-sum(x)*r; sum(x)-1500];
endfunction
[m, info] = fsolve("f", [1; 1; 1; 1])

Returns:
m = [274; 256; 402; 567]

This should be correct as sum(m) = 1500 and A*m = [4500; 6000].

Last edited by a moderator: May 4, 2017
9. Apr 24, 2010

### dougk16

I'm not sure my solution is correct, because the 'top' two tires have the same mass share, and the bottom two have the same mass share (I lost the sheet with the exact numbers). With my solution for example, if you had a 120kg bridge (center of mass in the center) supported by three pillars, two at both ends, and one right in the middle, all three would support 40kg. Your solution has the middle pillar supporting 60kg and the other two 30kg.

I wish I had three scales on hand so I could test this in real life, because from a common sense point of view, both solutions seem valid to me.

I tried myself to find some kind of algebraic way to solve those equations, but failed hard. Do you know if there's some easy way to solve it? I'm not working in C/C++, so I couldn't use those libraries unless I ported them.

10. Apr 25, 2010

### log0

To verify your solution calculate the center of mass using your mass points. If it matches the given center of mass. Then your solution is a valid one.

Your problem is that you have an overdetermined system. Take your bridge with three support points. If it had two you would get one solution. Valid solutions for three points are 40-k/2, 40+k, 40-k/2. If you add another point your solution will be a plane and so on.

To reduce the number of solutions you have to introduce additional constraints(reduce your solution space). One could be to force a uniform mass distribution(minimize mass difference). I could try to write down the equation if you are still interested.

Well assuming it is a linear system was an easy but wrong one(my first try). I don't see a simple way to solve it. Maybe you could restrict yourself to configurations you can solve, like 2, 3, 4 wheels.

What language are you using. Many languages allow to call foreign functions.

11. Apr 25, 2010

### log0

Here is another analogy to your problem:

A rigid four legs table will always wobble, a three legged won't. So your problem exists in the real world too.

12. Apr 25, 2010

### dougk16

Good point. I was thinking that since in our case the table legs are on springs (the car's suspension and tire deformation) it would be a little more uniform, but I suppose even if springs limited the wobble, you could easily have one leg supporting more weight.

I'm working in ActionScript 3.0 for now, and although technically I can make calls to libraries in pretty much any language, for practical purposes I'm limited to just AS3.

As for satisfying the center of mass equation, are you saying A*x-sum(x)*r should equal zero?

The numbers from my solution are [312.5; 312.5; 437.5; 437.5], so if that's the case, my numbers are wrong :(

For now that's exactly what I'm doing, constraining the possible ways in which tires can be arranged, but it would be great if I could have arbitrary arrangements.

Thanks for your patience with this problem :)

13. Apr 26, 2010

### jack action

I've been following this thread since the beginning and looking actively for an answer. I think I found something, but I can't explain why it works, though. It's more intuitive than anything else. Here I go:

$$WR_{ix} = \frac{\frac{1}{\left|x_i\right|}}{\sum{\frac{1}{\left|x_n\right|}}}$$

$$WR_{iy} = \frac{\frac{1}{\left|y_i\right|}}{\sum{\frac{1}{\left|y_n\right|}}}$$

$$WR_i =\frac{1}{2}\left( WR_{ix}+WR_{iy}\right)$$

Where:

$$WR_i$$ is the weight ratio on the ith wheel.
$$\left|x_i\right|$$ is the absolute distance between th ith wheel and the CG in the x direction.
$$\left|y_i\right|$$ is the absolute distance between th ith wheel and the CG in the y direction.
$$\sum{\frac{1}{\left|x_n\right|}}$$ is the sum of the $$\frac{1}{\left|x_i\right|}$$ from all wheels.
$$\sum{\frac{1}{\left|y_n\right|}}$$ is the sum of the $$\frac{1}{\left|y_i\right|}$$ from all wheels.

For your example the reaction force for each wheel gives (wrt the weight W):

{2,7} --> 0.25595 W
{5,9} --> 0.13691 W
{1,3} --> 0.35119 W
{4,1} --> 0.25595 W

That's seems logic since the closer wheel has the larger reaction force (and vice versa) and the two wheels that are at the same distance from the CG have the same reaction force. And it works with traditional arrangement too (i.e. wheel aligned together). Furthermore, if the CG lies directly over one wheel, the reaction force of that wheel becomes 1 W and all others 0.

EDIT: I did another check and it doesn't work with traditional arrangement. I guess I have to work on my theory some more!

Last edited: Apr 26, 2010
14. Apr 26, 2010

### log0

Let's summarize.

To get a valid solition you have to fulfill the following constraints (use this to verify your algorithms):

$$i \in [1, n]$$

$$\sum x_{i} - m = 0$$

$$\sum x_{i}r_{i} - mr = 0$$

To get an optimal solution(homogeneous mass distribution) we introduce a penalty function:

$$m_{avg} = m / n$$

$$p = \sum(x_{i}-m_{avg})^{2}$$

We are looking for the extremum(minimum) of p:

$$\nabla p = 0$$

The problem is, that adding gradient of p as an additional constraint breaks the convergence of the solver(Octave's fsolve cancels without any solution). We need a weaker constraint here.

Is this an option? http://labs.adobe.com/technologies/alchemy/" [Broken]

Last edited by a moderator: May 4, 2017
15. Apr 26, 2010

### dougk16

That looks very cool. It'd still be nice to find an easy way to solve this problem, but being able to compile C to Flash is just cool in general. I hope that project gains momentum.

I've tried various permutations of my original algorithm, and even though they all satisfy the first equation, none of them satisfy the center of mass equation. So it looks like the only way to come close to solving this so far is numerically.

Last edited by a moderator: May 4, 2017
16. Apr 26, 2010

### dougk16

Ha, I found an algorithm that satisfies the top half of the matrix, i.e. 4500, but is a little off for the 6000 part...so close!

17. Apr 27, 2010

### log0

I am curious. What are your errors for mass and center of mass? Have you tried it with other positions?

18. Apr 27, 2010

### dougk16

I tried it with some different numbers and configurations with 2<=n<=4. With our working set in this thread, it came back [333.33..; 166.66..; 333.33..; 666.66..], which turns out to be [4500; 5500;];

With another set [1 4 1 5; 7 9 1 1;] it came back [214.29; 428.57; 428.57; 428.57], which is [4500; 6214];

19. Apr 27, 2010

### log0

Center of mass would be [3; 3.7].
Center of mass [3; 4.14]

That's quite good. Do you mind to post your algorithm?

20. Apr 27, 2010

### dougk16

Jeez, just typed out a whole post describing my algorithm, and hit submit, only to have a timeout and lose my work...so here's an abridged version:

tire weights = [(1-topY/L)*(1-leftXTop/WTop)*m; (1-topY/L)*(1-rightXTop/WTop)*m; (1-bottomY/L)*(1-leftXBottom/WBottom)*m; (1-bottomY/L)*(1-rightXBottom/WBottom)*m];

Where:

topY = The average absolute y distance of the "top" two tires to the y component of the center of mass;
bottomY = The average absolute y distance of the "bottom" two tires to the y component of the center of mass;
leftX* = The absolute x distance of a "left" tire to the x component of the center of mass;
rightX* = The absolute x distance of a "right" tire to the x component of the center of mass;
W* = the distance between left/right tires.
L = topY - bottomY;
m = car mass;

Sorry that it's sloppy...just didn't have the patience to do it neatly again.

Last edited: Apr 28, 2010