# Flight Simulator Tutorial #4 – matrix allocation and input parameter formulas (roll rate, pitch rate, throttle)

This section explains the top level functionality of the model, it also allocates the data and formula arrays needed for manipulating the scene image. The roll rate, pitch rate and throttle formulas are implemented in the worksheet.

[sociallocker][/sociallocker]

1. george says:

Well it was mostly last night and I managed to get away without the after midnight supper at the church.
Unfortunately I am not able to answer this one since I have not done any work yet. I am sure it can be done but I need to take at least one day maybe more. For sure 2 points are enough and sometimes all you see is ground or sky. The instruments are closer to implementation than anything else and I know how to do it but not to the last detail yet. It’s a good practice to document (in tutorials) everything before moving on to implement a new feature. It seems slow but it si actually the best, the fastest and the safest way to do it (in the long run). I now go to the coaster for instance and don’t understand much of what I did. I don’t want to repeat the same mistake of rushing to implement a lot of things without good documentation.

2. Peter says:

I wasn’t expecting replies Easter weekend!

There are two issues running here. I was looking at the area chart which could be used used to provide the basic ground/sky reference and the equivalent artificial horizon instrument. These require straight lines to two points will do.

I calculated the screen v at which the horizon intersects the edge of the viewport from the condition that the horizon is 90deg away from the zenith.

3. george says:

Limiting the range is hard. Even if you don’t see any lines (you are flying up vertically) the model is slow. Somehow the total number of virtually displayable points (seen or unseen) slows the model down. When you are far away you can see them all so you cannot plot just a subset.

4. Peter says:

For the area chart you just need values for v corresponding to u=-5.0 and +5.0 (I did 0.0 too). These values frequently lie well outside the v range of -3.0 to +3.0 but this is not an issue. An extra dataset is needed to put the correct colors in place for inverted flight.

5. george says:

Thanks, Peter. You have a very nice machine there. It’s good you tried the surface chart. I will use it for sure (the idea is priceless) but now I am swamped with work. The problem is not the decimals but cos is not 1. Use sin=alpha and cos = sqtr(1-alpha^2) and it shuouldn’t break down. You can also use a taylor expansion of 2-3 terms of you wish. If you put cos=1 it’s like cursing to heaven. Anyway check for speed too, I bet you don’t gain anything significant (probably less than a couple of percent.

6. Peter says:

George
I am getting about 3 fps on the first model with Excel 2010 on a core i3 desktop (2 core running 32 bit Windows).

I put your area chart behind the scatter chart and visually it works well in providing a night sky (don’t know what the sun is doing there!) I think this will be worthwhile particularly if you move to fewer triangles for your ground mesh. As it is, there were times when I couldn’t tell whether I was flying inverted or whether I was in subterranean flight looking up – somewhat disorienting!

I also tried changing your sequentially applied rotations by small angle approximations. Numerically the differences were in the 5 decimal place so made no difference at first but the errors could accumulate until the point where your resulting large transformation is no longer a pure rotation. Not worth the risk.

7. george says:

Do you by any chance see an improvement in speed from 2007 to 2010? I mean mostly for files with large charts like the flight simulator.
How fast (fps) does the model run on your machine on 2007?

8. Peter says:

Just checking – hope you don’t think I am being rude. Without such effects you would achieve something more akin to a highway in the sky than flight.

I use Office 2010. I did install a copy of 2003 on a netbook in order to change color charts back to black and white patterns (a deprecated feature in 2010!) prior to publication but the machine is very limited.

9. george says:

I need to do that eventually. This can be easily adjusted in one of the next model to introduce friction (speed quadratic) and a gravity force, but my first model is “in space” (no gravity yet). It will take just a couple of more formulas after I extract the pitch angle from the scene. Which version of Excel are you using?

10. Peter says:

I am concerned by your formula relating airspeed to engine throttle setting. The airspeed is more sensitive to the rate of climb/descent than it is to the throttle. The cyclist or downhill skier are constrained by terrain but the pilot can convert hieght into speed wherever he wishes.