Jump to content

  • Log In with Google      Sign In   
  • Create Account

CombatWombat

Member Since 28 May 2000
Offline Last Active Yesterday, 07:39 AM

#5157004 Calculating pressure transfer between pipes

Posted by CombatWombat on 30 May 2014 - 12:27 PM

If it's for a game, it's got to be a pretty strange game where the incompressible assumption causes problems.

 

If it's for an engineering problem, there are off the shelf products both paid and open to solve fluid problems.  Computational Fluid Dynamics code.

 

If it's purely to learn and play:

When you lose the incompressible assumption it becomes simultaneously a fluid dynamics and thermodynamics problem. 

You will need to learn about:

Bernoulli / Energy equation

Thermodynamic Properties

The basic laws of thermodynamics

 

It's a big subject and it's hard to advise you more specifically without knowing where you are starting from.




#5153997 Modeling some flight physics.

Posted by CombatWombat on 16 May 2014 - 07:08 AM

I think you're having a hard time because you may not be clear what your end goal should look like.  A well described question is halfway answered.

 

You say it's on rails.  But then you want to account for angle of attack and wingspan while having a constant force driving you forwards.  You seem to be creating a hodgepodge of rails and physics based behavior.  I caution that such a hybrid may create strange edge-case behaviors and may tend to be unintuitive.

 

Let's break this down to the simplest forces you need to fly.  Airplane, dragon, whatever.

Lift, thrust, drag, gravity.

 

You can use simple lift coefficient for lift force.

Its sounds like you want thrust to be constant forward. 

You can use simple drag coefficients to get a drag force.

Gravity is gravity.

 

For your rotional control you have 3 axis.

Pitch, roll, yaw.

 

Here is where you need to better define your control scheme.  Should the triggers roll you directly?  Should they be mapped to angle of attack of left and right wings?  Should they be mapped to give an aileron effect (left wing down, right wing up)?  How do you pitch?  You need a tail.  Ditto for yaw. 




#5153990 Whats a good mathematical model for heat transfer?

Posted by CombatWombat on 16 May 2014 - 06:51 AM

Start by thinking about it as heat energy, not as temperature.

You can get temperature from the internal energy by having the mass and thermal heat capacity of the objects.

The difference in temperature drives a flow of heat energy between the objects.

A thermal resistance slows this flow.

 

It works like Ohms law.  (E=IR)

But with thermal-ness it would be (T = QR)

where T is temperature delta, Q is heat flow, R is thermal resistance.

 

How you calculate R is the crux of how complicated your system is!  For a simple "looks good enough" you can just base it on surface area of the objects in contact with a scaling factor. 

For a more accurate effect, you'd have to deal with things like arriving at a convection coefficient which is brilliantly convoluted to calculate.  For round objects there are some natural logs that show up in the calculation of R.  There are Nussault numbers and Prandl numbers.  You can go nuts here.

 

Your specific example of heat transfer from oil->water is an example of a heat exchanger.

 

If you can be more specific about what you need to accomplish, we can advise you better.




#5153985 A Rose by Any Other Name...

Posted by CombatWombat on 16 May 2014 - 06:34 AM

Writing assembly in this day and age might be the real WTF smile.png

 

Hey, it's not entirely useless if you want to play with microcontrollers.

 

 

(Ok, most of them have C compilers these days...ahem...)




#5153634 Cars differentials, open, locked and preload

Posted by CombatWombat on 14 May 2014 - 01:29 PM

First you need a more general description for the velocities.

 

A differential is a bevel gear implementation of a planetary gear train. 

For an automotive type differential where the bevel gear ratio is 1:1, the velocities must satisfy:

(VL - VH)/(VR - VH) = -1

where VL = left drive shaft velocity

VR = right drive shaft velocity

VH = housing & ring gear velocity

 

You can see the derivation of this here:

http://books.google.com/books?id=QNj87rJZIpUC&pg=PA373&lpg=PA373&dq=KINEMATIC+EPICYCLIC+GEARING+DIAGRAMS&source=bl&ots=w9OLebHeMw&sig=1Ut2U15xCnXa53MPhdU8bEHbI_A&hl=en&sa=X&ei=RYZzU7HyHc6zsAT9-4H4DA&ved=0CDsQ6AEwAzgK#v=onepage&q=KINEMATIC%20EPICYCLIC%20GEARING%20DIAGRAMS&f=false

(Or refer to any kinematics of machinery text)

 

Add up net moments on the components:

The ringgear/housing has a moment on it from the pinion gear.  (This comes from your engine/transmission model).

A reaction moment comes from the pin which mounts the center bevel gear.

The center bevel gear in turn applies moments to each output shaft.

The output shafts have reaction moments from the tire & brake models.

The output shafts have reaction moments between them to enforce the velocity rule from earlier.

 

The various locking & lsd differentials add more forces/moments to these components.  Exactly which components are effected depends on the specific type.

Simple example would be viscous style which has a locking effect as a function of velocity difference between the shafts.

Add another moment to each axle.  Essentially (leftAxle Velocity - rightAxleVelocity) * someConstant.

 

To directly answer your question on "preload".

Certain types of lsd utilize friction clutches to couple between the two output shafts.  Usually these are angled to be sensitive to the torque input to the differential.  "Preload" means that even with zero torque transmitted, there is still some coupling torque between the output shafts. 

 

A good search term would be "torque in epicyclic gear trains".

 

 

 

 

 




#5103122 Unmaintainable code

Posted by CombatWombat on 21 October 2013 - 07:22 AM

extern float woozy;
extern float blackout;

I think this about sums it up.




#5090653 Stupid noob questions regarding radius...

Posted by CombatWombat on 31 August 2013 - 02:09 PM

If I understand your problem correctly:

You want to generate a random point (x,y) for a player that owns the chunk of circle between 0deg-15deg and your circle radius is 1 unit...

 

Randomly generate a vector as a length of 0-1 and an angle between 0-15deg.

The end point of that vector will be

x = L * cos(angle)

y = L * sin(angle)

 

You need to watch the convention of the sin/cos function you are using with regards to degrees vs radians.




#4847948 Fighter Jet HUD

Posted by CombatWombat on 11 August 2011 - 03:53 PM

So how exactly would I go about writing this. I need to figure out where the horizon is relative to the screen position I guess? So I first need to calculate the position of the horizon and then transform that to screen space (I know how to do that second part). Any idea how to do the first?


The artificial horizon is just a matter of finding the "forward" and "up" vectors of your jet. You grok this from it's orientation matrix/quaternion. Then you just draw the correct rung of the ladder to the center of the screen/hud/whatever. So as an example, you find your forward vector is actually pointed straight along the Y axis (assuming Y is UP!), you would just draw the "+90" rung in the middle.

Then, for the flight path marker, just take your velocity vector and normalize it, then basically plot this against your artificial horizon.

Some HUDs I have seen do funny things with offsetting the artificial horizon with respect to yaw and side slip, so beware of that if you are going to a very realistic effect.


#4838990 2d car with simple suspension physics

Posted by CombatWombat on 22 July 2011 - 10:22 AM

So if I understand you correct, I should not add a collision force/impulse to keep the car from the ground. Rather, I should just compress the spring. Next, this will result in the two masses connected to the spring each getting a force directed from each other, which should be equal in magnitude.

Strictly speaking "you" don't do anything explicitly in your code to compress the spring. The motion of the bodies should do this automagically.

Hmm, or perhaps not? The spring can store potential energy (like gravity) so it doesn't completely obey newton's third law. At least on some level of abstraction, if I understand it correct.

You should be worrying about "the equal and opposite" on a per joint basis.
IE: Wheel pushes on spring with 10N. Spring pushes on wheel with 10N.
Will you get 10N out the other side of the spring? Probably, but not always. What happens if you want to model your spring as having some mass?

You might want to look into the basics of drawing "free-body-diagrams". This might help you understand how forces interact between components.

The wheel will get the most acceleration because it is the lightest of the two bodies, so it will probably collide again. I suspect this will result in jittery motion. Maybe I should do the same calculations several times each frame to reduce this?

This is true of about any spring simulation. Doubly true where you have a maintained collision (resting contact). I would suggest using RK4 integration with a suitably small timestep, and using a damper (shock absorber to us 'mericans) along with your spring. Maybe someone can come along and make suggestions on how to make the collision response more robust.

With the springs having only one freedom of movement, the spring length will in some cases have to become infinitely long to get out of the ground. That is when the car is colliding with a surface perpendicular to the spring axis. What is the best way to deal with this? I am thinking in the lines of having an angular spring as well.

Springs don't work perpendicularly. You need another constraint to handle this. IE: Model a linkage that actually holds your wheel to the car, and then let the spring just worry about springynes. So when your wheel runs into this perpendicular surface, then load goes into this new constraint (and then into the body of the car, probably stopping it abruptly). The spring likely never deflects.

When compressing the spring, this will add energy to it. And since this energy is not based on the mechanical energy of the car, isn't there a danger for unstable and somewhat random motions? Proposed solution: Take the desired absorbed energy of the car, and use the spring constant to calculate the distance based on this energy. Artificially move rest of the car out of the collision area.

You put energy into your car to move it in the first place. Or it had some, as a byproduct of elevation. The spring is just storing some of this temporarily, and will give it back (minus any absorbed by the dampers) to the car body when it extends to original length.

In my opinion you are trying to over think this a bit. Model your components so that they behave individually. Now model constraints to glue them together. The details should sus themselves out.


#4838026 2D Physics -- applying friction to masses

Posted by CombatWombat on 20 July 2011 - 10:33 AM

Friction is a force, so it should not be acting on velocity directly as you have it. (vel /= 1 + f * dt;)? And I don't know what the /= is supposed to accomplish.

Don't check your value against *exactly* zero, rather...
if( abs(Velocity) > 0 )
frictionForce = -Velocity.unit * someScalarValue;

This says, "if my speed (velocity implies direction) is bigger than nothing, then lets add friction"
-Velocity.unit: "Friction will act in the opposite direction of my velocity, to slow us down" (Unit implies a vector of length 1.0)
someScalarValue "Friction is effected by things like materials, temperature, etc"

Sum the value of this friction force along with any other forces. Now multiply this sum by InvertedMass.

Now apply that acceleration to your velocity.

This implementation may still weeble wobble back and forth around zero speed, depending on integrator behavior.


#4822182 Formula 1 Engine simulation

Posted by CombatWombat on 11 June 2011 - 03:56 PM

Octacon,

It appears you want to do a (fairly) simple simulation of your car accelerating. This is not too difficult. Things get difficult if you want to add turning and such.

In a summary type fashion, here is what you need to do.

1) Determine forces acting on the car.
2) Integrate the forces to the momentum of the car.
3) Solve for the velocity of the car by taking momentum * invMassOfTheCar
4) Integrate velocity into the position of the car.
5) Display your car.
6) Feed your current speed back into the system. You will use speed*tiresize*gears (roughly) to find engine RPM. This lets you find torque driving the car. This lets you solve for the values you need in step 1.
Repeat as necessary.

I suggest you look into the articles on: GafferOnGames
This covers the basics of integration and timestep fixation you will need.
This is also a good introduction to simulating car physics: MarcoMonster Car Physics


PARTNERS