Advertisement

Aircraft physics once again

Started by January 01, 2015 03:21 PM
9 comments, last by Stainless 10 years, 1 month ago

Hi again, I still have problems with calculating proper forces for my jet motion. I can’t find any revelant data that could help me so I came with my own conclusions.

i use forumla: (i aplly all forces every frame)












dt = timebetween_frames;
Acceleration = (drag+lift+thrust+gravity) / mass; //vector
pos = pos + (vel * dt); //vector
vel = vel + (Acceleration * dt); //vector

frc.jpg

so lets take a look at first image you can see 4 lines there (red – drag, yellow – velocity, pink – thrust, green – lift)

Main problem for now is wrong calculation of velocity vector since drag doesn’t make velocity vector to cover with thrust vector (which is the pitch vector of the jet) , so the problem is right there calculation of drag and lift vectors (and maybe the rotation itself which for now I don’t know really how to handle)

You can take a look to see how the jest behaves (don’t mind when you will see that jet before takeoff looses velocity from 140 to 40 m/s it was a collision bug which is now fixed)

Velocity vector is always above thrust and i cant make angle of attack smaller than 20 degress and that means why do i even need it when its useless here ;]

Jet goes up whenever it should go almost straight forward or go down..

Now when you see that velocity vector almost never reaches thrust vector , the angle of attack itself is way too big to generate proper lift coefficient (which is 1.72 at 20 degrees and 0.5 at 0 degrees) whenever it reaches beyound -5 – 20 degs its set to 0.2

Still angle of attack is the angle between thrust vector and velocity vector, because when wind (practically theres no wind and no wind means wind moves with speed less than 7 km/h)

does not move the wind direction itself should be Normalized(–thrust_vector ) – be aware I don’t use –thrust_vector but the thrust_vector normalized itself I think the angles are the same with or without -.

So even when lift coeff is 0.2 it produces too much lift (maybe too much or the drag itself is calculated wrong)

Also they say lift is prependicular to plane pitch ? or was it velocity vector but since they do not say if then lift is situated to the right or to the left or its upsidedown or what I calculate the lift vector direction by getting vehicle pitch and right vectors and making a cross product of that so the lift always acts in the up direction relative to vehicle matrix)

DRAG:

I divided drag into three main forces (slide ‘drag’ forces)

They match the axes of an aircraft take a look at thick lines:

frc2.jpg

Green – front drag – front area

Red – side drag – side area

Yellow – top drag – top area

Soo again take a look at the picture

Velocity vector is acting somehow up so the most acting drag in this case it top drag

then front drag, and side drag do not acts. To find how much drag is produced for these surfaces I used dot product for that.

Since they say drag acts only in the opposite direction that object is moving (velocity vector)












dotfront = absnf(Dot(Normalize(Thrust),veln));
dotup = absnf(Dot(updir,veln));
dotside = absnf(Dot(sidedir,veln));


//nothe that drag coeff are fixed
FRONT_DRAG = Normalize(-vel) * dotfront * (0.080 * ((dens * squareSpeed)/2.0) * FRONT_AREA);
SIDE_DRAG = Normalize(-vel) * dotside * (0.50 * ((dens * squareSpeed)/2.0) * SIDE_AREA);
TOP_DRAG = Normalize(-vel) * dotup * (1.10 * ((dens * squareSpeed)/2.0) * TOP_AREA);

DragForce_vec = FRONT_DRAG + SIDE_DRAG + TOP_DRAG;

Now to simplify that: if you take a look at that picture with thick lines every thick line is dotted with velocity vector and that says how much surface drag we will produce so when jet is falling straight down without any rotations only the top area drag acts with full force

Anyway heres another video, short one showing what I get

When lift produces the force that moves velocity vector up the drag should it somehow negate but it doesnt work.

I am completely out of ideas how could I fix this.

Perhaps others will be willing to spend several hours to fully understand your post. But you have:

"First of all..."

"Second thing..."

"Third thing..."

"Main problem..."

Then:


how could I fix this

"Fix" what? blink.png

I would strongly suggest you succinctly ask ONE question or clearly describe ONE problem, posting only information relevant to that question or problem. For me, you've asked far too many questions, described far too many problems, and posted far too much information. Also, color coding can be nice, but, e.g., I can't read the yellow text at all - it's too faint.

Just for my edification, what is absnf? I googled it and found nothing.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Advertisement

the question is about calculating drag and lift, absnf is my funciton its a template function that returns absolute value

"Main problem for now is wrong calculation of velocity vector since drag doesn’t make velocity vector to cover with thrust vector (which is the pitch vector of the jet) , so the problem is right there calculation of drag and lift vectors (and maybe the rotation itself which for now I don’t know really how to handle)"

Anyway buck i thought that the more describe the problem it will be easier for someone to reply/solve tongue.png

since lift and drag are related to calculate proper velocity i thought it woul be good to put everything there.

Videos show that jet is moving upwards instead of flying almost plain forward or going down.

I deleted that first of all etc but i think it contains revelant data.

Anyway i cant make it shorter now ;[ <cries badly>

And yes i know putting whole code and that surface area pictures are useless. i just wanted to describe everything clearly. Now i really dont know how to change it.

oh and






template <class type> type __fastcall absnf(type x){ if (x < 0 ) return -x;  return x; }
[[Sorry: I accidentally hit the downarrow when scrolling down the page on my phone... Someone want to counter that for me?]]
If you haven't already, take a look at the open source flight simulator "flightgear". It's flight dynamics model is extremely well documented, proven and tested, and even contributed to by people with massive real world experience, such as nasa and aircraft manufacturers. It uses a scripting language for its flight dynamics (called nasal if I remember) so you could use the scripts directly under an interpreter you create yourself, or simply blackbox and reimplement them, if you are not wanting to be infected by the license.

In short though this is possibly a solved problem. Please let meknow how you get on and if this helps.

Firstly your simulation of lift and drag is far too simple.

Both are very dependant on aircraft state, very very dependant.

To see just how much you need to understand if you are going to roll your own read and understand this.

https://www.pegasus-europe.org/AIAA_Pegasus/Papers/Boucher_EdA.pdf

I am actually writing my own flight model at the moment so I am going through the same thing.

If I were to start again, I would look at jbsim as a reference bible. Apart from the seriously wierd way they have handled the input files, it's really good.

Here is the drag definition for a F16

Properties are input values, so CDDh is dependant on the air pressure (in pounds per square foot) ,wing area (in square feet), alpha, and elevator position

The formula is CDDh = qbar-psf * Sw-sqft * CDdHT;

Where CDdHT is a table lookup based on alpha and elevator position.


       <axis name="DRAG">
            <function name="aero/coefficient/CDDh">
                <description>Drag_due_to_horizontal_tail_deflection</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                      <table name="CDdHT">
                          <independentVar lookup="row">aero/alpha-rad</independentVar>
                          <independentVar lookup="column">fcs/elevator-pos-rad</independentVar>
                          <tableData>
                                      -0.4360  -0.2180  0.0000  0.2180  0.4360
                              -0.1750  0.2170   0.1740  0.1560  0.1810  0.2300
                              -0.0870  0.0940   0.0550  0.0410  0.0620  0.1010
                               0.0000  0.0810   0.0400  0.0210  0.0390  0.0760
                               0.0870  0.1060   0.0610  0.0400  0.0570  0.1010
                               0.1750  0.1660   0.1190  0.0960  0.1140  0.1580
                               0.2620  0.2520   0.2030  0.1820  0.2020  0.2400
                               0.3490  0.4040   0.3620  0.3470  0.3710  0.4160
                               0.4360  0.6280   0.5880  0.5770  0.6010  0.6370
                               0.5240  0.8750   0.8400  0.8260  0.8520  0.8800
                               0.6110  1.1270   1.0950  1.0840  1.1020  1.1250
                               0.6980  1.3650   1.3340  1.3260  1.3380  1.3560
                               0.7850  1.5170   1.4870  1.4780  1.4820  1.4890
                          </tableData>
                      </table>
                </product>
            </function>
            <function name="aero/coefficient/CDmach">
                <description>Drag_due_to_mach</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                      <table>
                          <independentVar>velocities/mach</independentVar>
                          <tableData>
                              0.0000  0.0000
                              0.8100  0.0000
                              1.1000  0.0230
                              1.8000  0.0150
                          </tableData>
                      </table>
                </product>
            </function>
            <function name="aero/coefficient/CDDlef">
                <description>Drag_due_to_leading_edge_flap_deflection</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>fcs/lef-pos-rad</property>
                      <table>
                          <independentVar>aero/alpha-rad</independentVar>
                          <tableData>
                              -0.1750  0.0030
                              -0.0870  0.0010
                               0.0000  0.0000
                               0.0870  0.0010
                               0.1750  0.0020
                               0.2620  0.0040
                               0.3490  0.0070
                               0.4360  0.0110
                               0.5240  0.0150
                               0.6110  0.0190
                               0.6980  0.0230
                               0.7850  0.0240
                          </tableData>
                      </table>
                </product>
            </function>
            <function name="aero/coefficient/CDDflaps">
                <description>Drag_due_to_trailing_edge_flaps</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>fcs/tef-pos-norm</property>
                    <value>0.0800</value>
                </product>
            </function>
            <function name="aero/coefficient/CDgear">
                <description>Drag_due_to_gear</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>gear/gear-pos-norm</property>
                    <value>0.0270</value>
                </product>
            </function>
            <function name="aero/coefficient/CDDsb">
                <description>Drag_due_to_speedbrake_deflection</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>fcs/speedbrake-pos-rad</property>
                      <table>
                          <independentVar>aero/alpha-rad</independentVar>
                          <tableData>
                              -0.1750 -0.0545
                              -0.0870 -0.0225
                               0.0000  0.0096
                               0.0870  0.0590
                               0.1750  0.1244
                               0.2620  0.2182
                               0.3490  0.2324
                               0.4360  0.2029
                               0.5240  0.1435
                               0.6110  0.1046
                               0.6980  0.1363
                               0.7850  0.1196
                          </tableData>
                      </table>
                </product>
            </function>
            <function name="aero/coefficient/CDq">
                <description>Drag_due_to_pitch_rate</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>velocities/q-aero-rad_sec</property>
                    <property>aero/ci2vel</property>
                      <table>
                          <independentVar>aero/alpha-rad</independentVar>
                          <tableData>
                              -0.1750  -1.2650
                              -0.0870  -2.1390
                              0.0000  -0.3080
                              0.0870  1.4020
                              0.1750  3.3690
                              0.2620  5.1350
                              0.3490  6.8800
                              0.4360  10.0600
                              0.5240  13.2010
                              0.6110  15.8720
                              0.6980  23.2170
                              0.7850  24.1050
                          </tableData>
                      </table>
                </product>
            </function>
            <function name="aero/coefficient/CDq_Dlef">
                <description>Drag_due_to_pitch_rate_and_leading_edge_flap_deflection</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>velocities/q-aero-rad_sec</property>
                    <property>aero/ci2vel</property>
                    <property>fcs/lef-pos-rad</property>
                      <table>
                          <independentVar>aero/alpha-rad</independentVar>
                          <tableData>
                              -0.1750  0.0670
                              -0.0870  0.0340
                              0.0000  0.0280
                              0.0870  0.0290
                              0.1750  0.0330
                              0.2620  0.0590
                              0.3490  0.0610
                              0.4360  0.0270
                              0.5240  0.0360
                              0.6110  0.0470
                              0.6980  0.0290
                              0.7850  0.0150
                          </tableData>
                      </table>
                </product>
            </function>
        </axis>
Advertisement

braindigitalis yeah i looked at the code i didint find any scripts etc all i found is rotation math for the moments etc. nothing more anyway Stainless post is really good, seriosuly that pdfcontains really good data that can help me alot however i did not understand the lookup table below.

Again derivatives Integrals are the things i don't understand and somehow i couldn't learn it, so i am now i a dead spot, now its up to me to learn that math which is undoable ;]

thanks for the help

anyway... stupid question for now i am really tired and i will stop to solve it for a day ( i will try tommorow) i read that pdf somehow and i am almost sure this paper doesnt cover full drag i mean the slide force isnt covered (or maybe it is) so if not is there any other poaper that tells how many drag forces act on the aircraft?

thanks again

i am trying to decrypt:


        <function name="aero/coefficient/CDq">
                <description>Drag_due_to_pitch_rate</description>
                <product>
                    <property>aero/qbar-psf</property>
                    <property>metrics/Sw-sqft</property>
                    <property>velocities/q-aero-rad_sec</property>
                    <property>aero/ci2vel</property>
                      <table>
                          <independentVar>aero/alpha-rad</independentVar>
                          <tableData>
                              -0.1750  -1.2650
                              -0.0870  -2.1390
                              0.0000  -0.3080
                              0.0870  1.4020
                              0.1750  3.3690
                              0.2620  5.1350
                              0.3490  6.8800
                              0.4360  10.0600
                              0.5240  13.2010
                              0.6110  15.8720
                              0.6980  23.2170
                              0.7850  24.1050
                          </tableData>
                      </table>
                </product>
            </function>

what these numbers say i don see any relation to the angle and drag

Hi WiredCat

This is why I recommended flightgear, as the app has a bunch of code for reading and applying these constants from the fdm. It is likely buried deep, so you might want to ask on their irc channel on Freenode about the architecture and layout of the program.

yeah ill try those forums as soon as they unban me,, funny thing is they say that someone was sending spam from my ip...

This topic is closed to new replies.

Advertisement