Modelling/simulation of physics in software
Modelling/simulation of physics in software
Author
Discussion

anonymous-user

Original Poster:

84 months

Sunday 16th October 2005
quotequote all
There have been a couple of things over the past couple of years that I've been interested in modelling in software to test theories or find out exactly how certain changes would affect things. For example - grip levels at each of the four tyres depending on weight transfer under cornering/braking/acceleration etc. and how that is affected by different spring and damping rates. Another example - traffic flow depending on lane discipline, etc.

Now the problem is - I have no idea how to go about this. So, my question is, does anyone have any recommendations for books or websites to find out the basic approach?

aldi

9,288 posts

267 months

Sunday 16th October 2005
quotequote all
Grip levels on tyres vs. weight transfer - there's a free game called Racer that has supposedly accurate curves and modelling of car grip and general physics stuff, and you can set your own parameters if you can make sense of the files/editors.

Racer website said:

PHYSICS FEATURES

* Full 6 degree of freedom motion of the car chassis.
* Independent suspension for all wheels.
* Suspension features: springs, dampers, anti-rollbar, rollcenter, anti-pitch.
* Wheel features: camber, wheel hop (the wheels have mass), toe.
* Tires: Pacejka tire model, relaxation length.



Lane dicipline... hmmm... I guess you'd want a load of car-objects clicking down a looping road, and be able to tweak parameters like how aggressively they move left, how fast they'l go, how close they'l get to the car infront, how many cars there are etc. then be able to read off how many cars per sec. are passing a certain point? It doesnt sound hard but I guess it depends how pretty you want it to look, you could go from anywhere from no display, a text mode screen, simple bitmaps moving around... maybe even look at creating you own 'total conversion' for one of the older game engines that are knocking around now e.g. the old half-life engine or quake engines? that would be cool... I'm sure some actual programmers will be allong soon to give you the right answer anyway

>> Edited by aldi on Sunday 16th October 22:48

docevi1

10,430 posts

278 months

Monday 17th October 2005
quotequote all
email me and I'll reply back - I did my dissertation on this

anonymous-user

Original Poster:

84 months

Monday 17th October 2005
quotequote all
Cheers guys.

Aldi - good call on using a 3D gaming engine. Might be something to be gained from looking at 3D gaming development books too as it's something I've not been involved with in the past.

Doc - YHM

dilbert

7,741 posts

261 months

Monday 17th October 2005
quotequote all
I think you need to decide if you are planning to interpolate or extrapolate.

With something like tyre friction, there are so many variables that if you want to get an accurate result you have to have quite a bit of experimental data, to either base your model on, or at the least check it against.

The basic physics of the forces involved is relatively straightforward, it's really just a question of finite element analysis.

The friction, tyre compound, surface texture, surface type, tyre and road temperature, effects of lubricants (water), the applied surface forces, yada, yada, yad.....

The best way of solving the second sort of problem is the deterministic approach. You get a whole bunch of tyres, and surfaces, and under different circumstances perform tests. These tests can then form the basis of your model.

For the model it's self, I'd suggest learning to program, but alternatives are things like Mathcad or maybe even MS excel.

Obviously the interpolation/extrapolation issue raises it's head, because the test data is the expensive bit. The less test data you have, the more extrapolation you have to do. That's usually a bad thing because the further into the unknown your model goes, the less accurate it's likely to be.

>> Edited by dilbert on Monday 17th October 11:38

>> Edited by dilbert on Monday 17th October 11:39

anonymous-user

Original Poster:

84 months

Monday 17th October 2005
quotequote all
Thanks Andy.

I spend my days programming in Java, C# and the like so that side of things isn't too much of a problem. But, my usual tasks are server side web stuff or simple GUI apps, etc. I've never really played with anything that involves creating a model in software, hence looking for any pointers to basic info on this to get my head around the usual way of handling it.

Interpolation/extrapolation - I'm not *really* looking at going into it in that much detail at the moment. It's just little projects to satisfy my own curiosity and give me something to play with. So, for example, I'm not really planning on being able to precisely calculate the level of grip available in the real world, more to be able to compare the difference between different lines through a particular corner, taking into account the way the weight gets distributed at different stages of the corner depending on where you brake, turn in, etc. etc.

Plotloss

67,280 posts

300 months

Monday 17th October 2005
quotequote all
Says to me, very very very very hardcore maths to be honest...

dilbert

7,741 posts

261 months

Monday 17th October 2005
quotequote all
Well if the programming is OK, and the test data isn't too much of an issue, you have most of the battle sorted.

I suppose it could be considered hardcore maths. I think if you tried it on paper you might find that it is.

Computers are great for real maths. My maths isn't really that great, and I always amaze myself at some of the things that I can achieve with a bit of patience, a computer and half an idea.

There's stuff that completely went over my head at uni, I'd still struggle to explain them, but if you give me a computer and a compiler, I can make it happen.

Just remember that when it all comes down to it, there are only really four operators (* / + -), no matter how complicated it looks. Ok there's trig and logs too, but that's really just about it.

For the in car forces, I think I'd start from a member class. When I say member I don't mean "member function" I mean member in the sense of a beam or structural element in your car. Perhaps calling the class "beam" is a better idea!

The beam class has to have two linked lists, one for each end, and in it, are pointers to other beams, to show connectivity, and some form of polar co-ordinate system that allows you to describe the angular relationship between the beams.

The beam class will need to have three values to describe absolute strength, springyness, and damping action.

You then need the beams to be in a list that describes the structure being modelled as a whole, and an engine that simply traverses the list until all the forces have been resolved.

At each vertex you calculate the total magnitude and direction of the force from one beam into the others, and propogate the numbers on the basis of the angular relationship between the beams.

An interesting project I'm sure.

aldi

9,288 posts

267 months

Monday 17th October 2005
quotequote all
LexSport said:
Cheers guys.

Aldi - good call on using a 3D gaming engine. Might be something to be gained from looking at 3D gaming development books too as it's something I've not been involved with in the past.

Doc - YHM


Just had a quick google, you can download the full source for Quake III from the ID Software site but that wasn't really what I was thinking of, more allong the lines of hacking together some car models and a big circular 'track' using standard editors, and I think you can do scripting of object behaviour - I'm just thinking it might be possible to hack something pretty together that way without doing much work. If you just want 'the answer' of course then technically you don't need any display at all and could do it in basic but if you want to create something ace then post up a copy when you've finished

GreenV8S

31,024 posts

314 months

Monday 17th October 2005
quotequote all
There is commercial software around that does 3D suspension modelling to predict dynamic weight transfer, geometry changes etc. Very useful if you're designing suspension and want to know where to put the pickup points, what anti-roll bars to fit, how much body roll you're going to get etc. But it isn't cheap.

dilbert

7,741 posts

261 months

Monday 17th October 2005
quotequote all
Yeah, I always did write crap software.....
..... Never had any fancy pictures.

Shucks.

annodomini2

6,971 posts

281 months

Monday 17th October 2005
quotequote all
Use Matlab/Simulink due to the level of the maths.

Frik

13,690 posts

273 months

Monday 17th October 2005
quotequote all
GreenV8S said:
There is commercial software around that does 3D suspension modelling to predict dynamic weight transfer, geometry changes etc. Very useful if you're designing suspension and want to know where to put the pickup points, what anti-roll bars to fit, how much body roll you're going to get etc. But it isn't cheap.
The industry standard software is MSC.ADAMS (or Automatic Dynamic Analysis of Mechanical Systems) which has a particular package for vehicles called ADAMS/Car. I did my final year project at university using this software and it is an incredibly capable package - you can model the behaviour accurately of full car models doing all sorts of manoeuvres. However consequently it ain't easy to use and it ain't cheap neither.

For anyone interested, the basic architecture solves sets of simple vector loop equations using Lagrangian formulae.

It is probably a lot more advanced than you need though. My original intention was to model a car that already existed (our previous FS car) and compare setup changes on the model with the real thing. In reality, the model is so sophisticated that it took all my time just to get it to work and I never really got to investigate setup changes

The problem with all this kind of work is, as mentioned, the tyres. They are damn near impossible to model mathematically. Consequently you have to rely on extrapolated data from tests on real tyres. One of the main problems of my model is that the tyres I was using had a realistic tendency to pull to one side. ADAMS/Car does not flip the wheels on left and right sides so consequently the tyres caused the car to pull sideways

dilbert is spot on. There are simply far too many variables that cannot easily be calculated that I think this really would be a rather difficult task.

d-man

1,019 posts

275 months

Monday 17th October 2005
quotequote all
Hmmm....
I do a lot of physics programming at work and I've written vehicle dynamics simulations in the past.

I agree with a lot of what has already been said, if you want to accurately model the behaviour of a real car and how it responds to setup changes, that is very hard indeed. It probably isn't feasible to even attempt something like that to be honest. Of course you can just record how the real car behaves in lots of different configurations and then replay them, but that isn't especially interesting and doesn't involve any physics at all.

It is possible to just have a go at seeing how 'a car' behaves in different configurations though, you won't get any data out that you can use in terms of real values for a car, but it does help you to really understand how setup is likely to affect handling, rather than just accepting that it is 'how things work'. That isn't to say it'd be very easy though...


At a high level, the physics of a car isn't that complicated. Its a rigid body with forces acting on it at each wheel, you can get freeware rigid body solvers that can shortcut you having to write your own here. Add spring / damper pairs to give you a simple represenation of suspension and you've got the basis of a vehicle. Tune the spring and damper constants so it is stable. From there you can go as simple or as complicated as you like. A good starter is to simply try adding some forces to the vehicle in different places and see what happens. It should transfer weight etc in the way you expect.

The tyre model is the hardest part to get to give sensible results, let alone realistic ones. Even just considering a flat ground with a uniform surface, there are a lot of variables to consider here. You'll need at least slip angle, slip ratio and the normal force on the tyre.

You can then go on to model pretty much whatever you like, engines, gearboxes, differentials, more complicated suspension setup etc.

Books like Milliken & Milliken's Race Car Vehicle Dynamics and one that I've just noticed Race Car Vehicle Dynamics : Problems, Answers and Experiments which also seems to include some simulation software (might be want you want if you just want to see what happens, rather than write something yourself) are useful, but expensive.

Frik

13,690 posts

273 months

Tuesday 18th October 2005
quotequote all
d-man said:
Books like Milliken & Milliken's Race Car Vehicle Dynamics and one that I've just noticed Race Car Vehicle Dynamics : Problems, Answers and Experiments which also seems to include some simulation software (might be want you want if you just want to see what happens, rather than write something yourself) are useful, but expensive.
Good suggestion, the first book is the bible as far as race car dynamics go. I had an old copy of the other book (minus the CD-ROM admittedly) and it is a good accompaniment to RCVD but will not tell you an awful lot on its own.