Which paper is about computing the Sprung Mass of Vehicle?

In order to implement a car in UE4 ,I read the src code sample_vheicle in PhysX SDK.

When I read the function Create4WVehicle,I find it first compute SimulationData.

But I’m not clear about how to compute the sprung masses of each suspension spring.
Which paper or pdf link explain the formulation of it?

I know how to use Jacobian and GaussisSeidel Iter when I learn Bullet Physics Engine.

I can’t understand the meaning of g0,g1,g2 ,and why build the matrix A in this way?

//Compute the sprung masses of each suspension spring using a helper function.
	PxF32 suspSprungMasses[4];
	PxVehicleComputeSprungMasses(4, wheelCentreOffsets, chassisCMOffset, chassisMass, 1, suspSprungMasses);
if(numSprungMasses>=4)
	{
		const PxU32 d0=(gravityDirection+1)%3;
		const PxU32 d1=(gravityDirection+2)%3;

		const PxF32 mbar = totalMass/(numSprungMasses*1.0f);

		//See http://en.wikipedia.org/wiki/Lagrange_multiplier
		//particularly the section on multiple constraints.

		//3 Constraint equations.
		//g0 = sum_ xi*mi=xcm	
		//g1 = sum_ zi*mi=zcm	
		//g2 = sum_ mi = totalMass		
		//Minimisation function to achieve solution with minimum mass variance.
		//f = sum_ (mi - mave)^2 
		//Lagrange terms (N equations, N+3 unknowns)
		//2*mi  - xi*lambda0 - zi*lambda1 - 1*lambda2 = 2*mave

		MatrixNN A(numSprungMasses+3);
		VectorN b(numSprungMasses+3);

		//g0, g1, g2
		for(PxU32 i=0;i<numSprungMasses;i++)
		{
			A.set(0,i,sprungMassCoordinates[i][d0]);	//g0
			A.set(1,i,sprungMassCoordinates[i][d1]);	//g1
			A.set(2,i,1.0f);							//g2
		}
		for(PxU32 i=numSprungMasses;i<numSprungMasses+3;i++)
		{
			A.set(0,i,0);								//g0 independent of lambda0,lambda1,lambda2
			A.set(1,i,0);								//g1 independent of lambda0,lambda1,lambda2
			A.set(2,i,0);								//g2 independent of lambda0,lambda1,lambda2
		}
		b[0] = totalMass*(centreOfMass[d0]);			//g0
		b[1] = totalMass*(centreOfMass[d1]);			//g1
		b[2] = totalMass;								//g2

		//Lagrange terms.
		for(PxU32 i=0;i<numSprungMasses;i++)
		{
			//Off-diagonal terms from the derivative of f
			for(PxU32 j=0;j<numSprungMasses;j++)
			{
				A.set(i+3,j,0);
			}
			//Diagonal term from the derivative of f
			A.set(i+3,i,2.f);

			//Derivative of g
			A.set(i+3,numSprungMasses+0,sprungMassCoordinates[i][d0]);
			A.set(i+3,numSprungMasses+1,sprungMassCoordinates[i][d1]);
			A.set(i+3,numSprungMasses+2,1.0f);

			//rhs.
			b[i+3] = 2*mbar;
		}

We want to find the mass supported by each suspension line so that a) the sum of all the masses equals the mass of the car b) the centre of mass of all the suspension lines matches the centre of mass of the vehicle’s rigid body. The problem is that when nbWheels >= 4 there are many solutions that satisfy the total mass and centre of mass constraints. We need to choose one of these solutions and we want to choose the one that we think is the best one. How might we we do that? What is the best choice? Choosing a mass distribution that has the smallest variance seems like a good choice. Why is this a good choice? Imagine a car with 8 wheels. A valid solution might place all the weight at the front and the rear wheels but almost none in the middle. That doesn’t sound right, does it? It’s not impossible but it would be a very strange car that had such a mass distribution. A more likely solution will attempt to more evenly spread the mass around the whole vehicle. Choosing a solution with the smallest mass variance makes sense.

I recommend you follow the link to lagrange multipliers in the code you posted above. Lagrange multipliers are the obvious way to minimise functions that are subject to constraints. In this case we want to minimise the variance of the sprung masses subject to the constraints of total mass and centre of mass.

g0 enforces the x-coordinate of the the centre of mass
g1 enforces the z-coordinate of the centre of mass
g2 enforces the total mass
f expresses the function we want to minimise (the variance of the sprung masses)

I’ll just give a little more background to help understand why we ended up using Lagrange multpliers. I mentioned that there were multiple solutions to the sprung masses when nbWheels >= 4. The system of equations is underdetermined (https://en.wikipedia.org/wiki/Underdetermined_system). This means that there are more unknowns than equations. In our case we have two equations for the centre of mass (x and z) and another equation for the total mass. That only adds up to three equations. That is sifficient if we have only 3 wheels. If we have 4 wheels, however, we end up with an undetermined problem with multiple solutions. We need to add extra constraints to the problem to remove this underdeterminism so that we end up with the same number of equations as unknowns. The extra constraint is that we want the sprung masses to have the smallest possible variance. Using the formulation of Lagrange multipliers we are able to express our system of constraints as a determined problem with unique solution.

The Implementation details are very helpful to make it clear.
I have read the Lagrange Multipliers in Wiki page and I think I’m clear now.
3 constraints -> 3 lambda.
4 wheels sprung mass -> mi i<0-3>
4 derivative for each mi
//Lagrange terms (N equations, N+3 unknowns)
//2mi - xilambda0 - zilambda1 - 1lambda2 = 2*mave

The result of Ax = b is [m0 m1 m2 m3 lambda0 lambda1 lambda2]

Thank you so much.