Build Your Own Freaking Fast FlightGear PC

Building your own PC

I’ve debated whether it is worth posting an article about building your own PC. Anyone who’s a serious builder can come up with something that fits their budget and performance requirements better than I can. Anyone who’s not a serious PC builder might be better off not messing around with the idea. It’s easy to get yourself into trouble and ruin parts if you don’t know a little bit about what you are doing.  On the other hand, it isn’t that hard, and the end result can be a great system for minimum cost.

The Basics

It isn’t really that hard to build your own PC.  If you are capable of careful work, know how to screw things together, and don’t mind spending the extra time to research and order parts, then it’s really not too bad.  The big payoff in the end is you can have exactly the machine you want at a price that is probably cheaper than anything you could buy off the shelf.  Another plus is that you will have a system you can potentially upgrade in the upcoming months and years to stay current without needing to buy a whole new machine every 6 months.

There are some basic things you will need to buy: a case, a power supply, a motherboard, a processor, memory, a heatsink and cooling fan, a video card, a hard drive, and a DVD drive.

Where do you even start?

This is all motivated because my current desktop PC was creaky and old.  It had been over a year since I had done any upgrades, and my current machine was a cheap, low-end system to start with.

So let me describe my own thought process.  Years ago I used to build all my own machines, but then I kind of gave it up.  Technology changes so fast and I completely lost track of all the different processor sockets, ram types, amd versus intel cpu options, SATA, PCI express, etc.

A few years ago I went to the Dell website and speced out a decent low cost machine.  I ran that for a while and it was fine, so I hopped back onto the Dell site to see what I could find.  Unfortunately by the time I ticked off a couple options to build my own machine, I was way over the budget I was hoping to spend, and I just wasn’t see the options and the level of control to build the machine I wanted — something that would be a killer FlightGear machine.

There are some really great gaming PC builders like Alienware and WidowPC.  I took a look at their web sites and wow! it doesn’t take much to spend several thousand $$$ with one of those places.  I’m sure you get a great machine, but that was way out of my league.  I was hoping to stay well under $1000.  I found another PC builder that seemed more in my pricing ball park: www.cyberpowerpc.com.  In addition they tell you the *exact* parts you are picking and give you tons of options.  Unfortunately I managed to quickly go over budget with them too.  I started thinking about specing out a machine at cyberpowerpc, and then going to an online parts store, buying the individual parts, and putting them all together myself.  But before I got too far through their site, I got completely lost in the myriad of options.

I decided I’d go visit a parts seller directly and see what I could find there.  Two of my favorite sites are New Egg: www.newegg.com (they seem to have some of the lowest prices going, and offer free shipping on many items) and MEI: www.microcenter.com (MEI has a local store in my town and often has good sales if you watch their mailings.)  But alas, I floundered trying to find a set of parts at either of these places.

Sigh … I give up!  I need help!

To The Rescue … !!!

My little brother saved me.  He had already done all the hard research work and had recently built a couple different machines at different price/performance points for his own work.  Thanks little brother!  It really helped to be presented with a complete list of compatible parts as a starting point.  I ended up with a system that was pretty much in my budget and performed better than I was hoping.  In my case my brother sold me some spare parts as part of the deal so I ended up coming out even better than if I was doing this all myself from scratch.

Here is the list of parts and their corresponding prices on newegg:

  • Case: Antec Sonata Proto (black) $65
  • Power supply: OCZ Fatal1ty 550W $70
  • Motherboard:  Asus M4A88TD-V EVO/USB3 $120
  • Processor: AMD Phenom II X4 965 Black Edition 3.4Ghz $140
  • After market heat sync: (from my brother’s surplus) $50
  • Memory: OCZ Gold 4Gb 240-Pin DDR3 1333 SDRAM (PC3 10600)  $50
  • Hard Drive: Seagate Barracuda 1TB 7200RPM SATA 3.0G b/s $60
  • Generic CD/DVD drive: $20
  • Video Card: Palit GeForce GTX 470 1280Mb 320-bit GDDR5 PCI Express 2.0 x16: $260

Total: $835

The Details …

Everyone has their own opinions, different goals and different budgets — one size doesn’t fit all.  The PC world moves fast and I can’t even find the same memory any more.  But generally 4Gb of DDR3 1333 memory is going to run about $50.  Most people will want to make adjustments for their own preferences, their own budget, and the parts that are available at the time.

The case: Antec is a big name in the case world — in case you didn’t know that.  (Also that was a pun in case you missed it.)  The Sonata Proto is a basic medium tower case.  3 x 5-1/4″ bays, 2 x 3.5″ bays, and 4 internal hard drive bays.  It is a solid case, looks clean and professional, has plenty of upgrade potential and has a few nice features.  (1) the external bays are setup for slide in rails, but I didn’t have any rails. 🙁  I looked online to see if I could order some and then checked the manual and found out that each bay cover has the rails tucked into the back side.  I just had to pop them off — wow, how cool is that!  (2) the internal hard drive bays come with anti-vibration gell grommets.  Another little nice extra.  These are things you might not think about at the shop but you sure appreciate once you get home!

The power supply: I just went with the part my brother speced out.  But don’t skimp out here to save a buck.  If you are building a gaming PC or a FlightGear PC, you will want a high end video card and those absolutely suck power.  Modern video cards are powerful self contained multi-core CPU’s … all on a card with their own cooling fans and everything.  The video card I installed required two (2) 25W power cords direct from the power supply to the video card — in addition to the power the card can pull from the PCI express slot.  This is an area where things can get tricky, but definitely check the specs and requirements of your video card and make sure you pick a power supply that can deliver.  I can tell you from personal experience that you can limp on an underpowered or marginal power supply, but add a little heat or do something that pulls a bit of extra current and your system can go unstable and crash or generate errors.  It can be *very* frustrating!  So don’t skimp on power!

Next up is the CPU: your basic choices are between Intel and AMD.  This is where I start to lose track and my eyes glaze over.  Generally it seems like Intel’s fastest processor usually beats AMD’s fastest processor, but you pay a premium for Intel.  AMD usually gives you better bang for the buck.  I went with the AMD Phenom 965.  There’s always a sweet spot in the price curve where going to a faster processor starts costing a *lot* more for just a little bit of improvement.  I can’t afford to buy the best of the best, so I don’t need to pay the ultimate premium to buy Intel’s flagship processor.  I went for good performance and a good price.

Motherboard: One thing to notice when building your own PC is that usually the CPU + Motherboard + Memory need to be carefully matched.  Generally by the time you get around to wanting upgrade in 6-12 months there is going to be a different socket standard for plugging your CPU into your motherboard, there will be a different memory interface standard, and you’ll end up needing to upgrade all three of these at the same time.  It just is what it is …  On my brother’s recommendation I went with the ASUS M4A88TD-V EVO/USB3.  It supports the AMD Phenom processors and DD3 memory.  There are many motherboard options.  Asus is usually a pretty good name and a lot of the variants center around what extra stuff gets bundled onto the motherboard … sound, video, networking, usb ports, esata, and support for other peripherals.

Memory: I went with my brother’s surplus part stock again here, but he only sold me 4Gb.  I decided I needed at least 8Gb total.  But when I went shopping, I couldn’t find an exact match for what I already had.  I poked around, got some help from a tech guy, and came home with a pair of 4Gb DDR modules (2 x 4Gb).  Add that to the 4Gb I already had and I was up to 12Gb total.  Rock on! 🙂  I found that for DD3 1333 memory you are going to be spending about $50 per 4Gb of RAM.

Video Card: This is a critical component of a gaming PC.  I am building a system to run FlightGear which is a professional flight simulator, but my graphics needs are very similar to other high end 3d games.   I have been running nvidia 3d video cards for many years and feel they offer the best drivers and quality for PC game level systems.  Additionally I do most of my work under Linux, and nVidia definitely has the strongest and most solid linux support.  So I go with nvidia graphics hardware, period.  Originally I was shooting for a card in the range of an nVidia GeForce  GTX 450, but the general principle is to get as much as you can afford.   I ended up with a GTX 470 which was more than I could afford … try and explain that to your wife. 🙂

What about Windows Software?  Isn’t that expensive to buy when it doesn’t come bundled with your new 64bit PC?

This is a tough one for me to answer.  Actually it’s easy.  I run Linux.  Go to your old PC, download the latest Fedora (or Ubuntu, or Suse, or your favorite distro) install ISO, burn it to a DVD and you are ready to install Linux on your new PC.  Full 64 bit support for free!!!  If you are a windows geek and insist on genuine MS proprietary software … well that’s tougher.  A lot of people can get a free or discounted copy of Windows through work or school if they can show a work or school purpose for the machine.  It doesn’t hurt to ask — unless your sys admins are psycho and black list you from this point on — not saying that would ever happen.  But seriously, these days 75-95% of what you do is in your web browser anyway.  Linux has open-office, firefox, google chrome, thunderbird, a full development system, flash, skype, gimp and all the tools you would want to use … and most of the time they are free.  Come on!  You are building your own system, you might as well go the whole way and install Linux on it.  Games?  They are just a waste of your time anyway, besides you are building this machine to run FlightGear which works really well in Linux.  If you really want to spend money with Microsoft and really want to play games, get an Xbox360.  Your remaining excuses are now weak and flimsy!  Your wife or girl friend or grandmother doesn’t care; she just wants to get on facebook, play farmville, and look at cute kitty cat pictures, that is just as easy with Linux.  Ok, QED, done deal … L I N U X   6 4   b i t ! ! !

Final Thoughts

You are probably wondering about things that I ignored or skimmed past.  Monitor?  Keyboard? Networking?  Assembly instructions?  Cabling?

Monitor and keyboard?  I just use the one from my last computer.  If you want something bigger or better, go ahead and get it and plug it in.  If you get a super high resolution display, you might need two DVI cables which the GTX 470 supports.  The GTX 470 also has HDMI output and another output that is used in the Mac world for their super high res displays.  Networking? It’s built onto the motherboard.

Assembly instructions?  Well it’s always an excellent idea to skim the manuals for the parts you just bought.  They’ll often times include critical information.  For instance, the ASUS motherboard manual suggests that if you want to boot of your SATA DVD drive, you should plug it into SATA port 5 or 6 and then go into the bios settings and set that port range to emulate IDE.  It turns out the the SATA/IDE setting works on blocks of ports, and you want to leave the lower blocks set at SATA so you can maximize the performance of your hard drive.  But hey, this stuff is fun to figure out, that’s why we build our own PC’s, right? 🙂

If you try building your own PC and get stuck, please hesitate to email me. 🙂  I don’t have time to do free PC assembly support.

Looking at all the options:  building your own PC is still a great way to get a super performing machine at minimal price.  You get to pick and choose all the specific parts and options so you get exactly what you want.  If you are jumping in and haven’t  built a machine in a while or ever, then feel free to use my shopping list (above) as a starting point and then you can make modifications from there depending on your budget and performance requirements.  Spend as much as you can afford!  Work slowly and carefully as you assemble the parts.  Enjoy running FlightGear at 60 fps with all the bells and whistles turned on!

Real-time UAS Simulation and Visualization

Real-time UAS Simulation and Visualization

In previous posts I’ve described the process of carefully modelling the basic geometry and mass properties of a UAS in YASim to provide a real time flight dynamics simulation of the aircraft in FlightGear.  I also described how we carefully modelled the blended body shape of our UAS using airfoil plots and spline curves.  These curves were then imported into MoI and used as the basis to generate a smooth, flowing, organic surface shape.  MoI is able to export the model as a 3d triangle mesh in a variety of formats including 3ds.

Model Cleanup

FlightGear can directly import 3ds models and render them in the simulator.  However, I found that my model needed be cleaned up in several respects.  All of this discussion relates to Blender – a very capable open-source 3d modeling tool. This isn’t intended to be a blender tutorial, but a brief overview of the steps involved in preparing a model for use within FlightGear

  1. Surface smoothing: If you click on the above thumbnail you will see that the basic model imported from MoI is “faceted” or in other words, the triangle surfaces are flat and you don’t see the intended smooth curved surface.  One of the first steps required is to select each “Object” and select “Set Smooth” in the “Buttons Window”.  Repeat for each object in the model.
  2. Inside-out surfaces: I decided for simplicity, I would export the model in the .ac3d format (a text based format) for final use in FlightGear.  When I did the export I discovered many of the surfaces where inside out — the face normals were pointing in rather than out.  This causes the surface to be displayed inside out and shaded wrong in FlightGear.  So the next step required is to turn on the display of face normals, select each object individual (right mouse click), enter “Edit Mode” <tab> key, and flip the face normals if needed.
  3. Orientation: FlightGear allows you to add an xml wrapper around your model to adjust the orientation of your model (flip it by 90 degrees for example) in case the model was developed for a different coordinate frame layout.  However, since I was doing all the prep work anyway, I rotated the heading of my model by 90 degrees in blender so I didn’t need any extra transforms when drawing the model inside FlightGear.
  4. Scaling: For convenience and due to the scale of this design, all the original work was done in inches.  This transfered to the MoI model and thus to the blender and flightgear models as well.  However, FlightGear requires units of meters so the model was grossly oversized when imported into the simulator.  Blender has a scale function, so I selected the entire model and scaled it by a factor of 0.0254 to convert from inches to meters.
  5. Control Surfaces: this aircraft is a flying wing and has as very simple control system.  Each wing has a strip elevon that runs the length of the wing.  Aileron and elevator inputs are mixed (summed) to produce the actual control surface deflection.  In the real UAV, this mixing is accomplished in the flight control software.  On an RC airplane this mixing would be done inside the pilot’s transmitter on the ground.  In FlightGear, the mixing is done through the YAsim xml config file.  Blender has a cut function accessed by typing “Shift-K”.  I went into top view mode, drew lines for the control surface cuts and cut the mesh to create the elevons.

Textures and Painting and UV Unwrapping

This could be the subject of a book just by itself, but let me give a really quick summary.

Blender has a cool feature called “UV Unwrap” which is found in the “Mesh” menu when you are in “Edit Mode”.  There are several unwrap options, but I found “Unwrap (Smart mode)” worked the best for my purposes.  The following image shows how blender unwraps the mesh (in this case the wings and elevons.)  In the bottom panel I selected “UV/Image Editor” and it shows the unwrapped mesh image.

Now here’s the cool thing.  You can save this image out to a file and then import it back in.  Blender will use the imported image to texture the file exactly as it has been unwrapped.  So with this template image you would see a model that looks like a wireframe.  I then loaded up the images in blender and labeled each panel with a big number.  Inside FlightGear (or osgviewer) I could then identify which number corresponded to which panel (top left, bottom right, etc.)  I further edited the template file to include this extra information.  The result when drawn in FlightGear looks like this:

Now I have my “paint kit”.  I can load up the templates in gimp (or photoshop), create a new layer, and draw my color schemes and markings over the top.  For the wing panels, I did a quick hack of a coast guard-ish color scheme which looks like this:

I then export just the marking/paint layer back out to my texture files that the model references and the “finished” result looks like this:

This is still a work in progress.  I have yet to animate the control surfaces.  I also need to add a spinning propeller.  The paint scheme is just a quick example and could use many many improvements.

With the paint kit established, a variety of paint schemes can be developed.  Here are two more examples:

Official ATI scheme:

A gray camouflage scheme:

Summary

There are many steps required to model a new aircraft design in FlightGear.  Primarily this involves creating a flight dynamics (physics) model and a 3d model of the design.  Each step requires several sub-steps and there is always room for improvements and refinements.  This is an example of an R/C scale UAV.  Full scale aircraft are much more complicated involve detailed cockpits, many more animations, much more complicated 3d meshes, and much more work texturing and painting.  Hopefully I have provided a taste of what’s involved.  With a little effort any one can jump in and learn the tools to build simulated aircraft.  But it does take time and patience.

Finally, here is a (sorry, kind of crude) youtube video showing the model flying inside FlightGear:

3D Modelling with MoI

3D Modelling with MoI

MoI (Moment of Inspiration) is a really interesting 3d modelling tool.  There are two things that separate it from other tools in my view.

1. It has a very simple and intuitive interface.

2. It has powerful and intuitive primatives for drawing and manipulating curves and 3d surfaces. For example MoI allows you to define 2d (or even 3d) curves and then stretch a 3d curved surface between your curved lines–possibly with additional guide curves to control the shape.  Like with any tool, it takes a little thought, practice, and planning to break down the structure and represent it using primatives, but MoI allows you to quickly create and edit some very complex and almost “organic” shapes.

You may refer to my previous post related to modeling with perl.  I used a perl script (math + airfoil data + spline curves) to carefully define exact lengthwise slices along the fuselage.  I then imported these curves into MoI and stretched a “network” surface over them.  It’s about a 10 minute job in MoI and I have a beautifully smooth curved fuselage.

I adjusted my perl script to also generate the exact airfoil profile at the wingtip and imported that curve in the correct 3d location.  This allowed me to quickly built an entire wing using the “sweep” function.  I then added a motor tube (which is just an extruded circle to make a cylinder.)

I used a similar approach to create a nice curvy winglet.  from the picture you can see I designed two different styles of winglets.  I think I like the looks of the drooping winglets better.  I don’t know yet what we’ll end up with on the real aircraft.  We’ll probably design the wing tip so we can mount any winglet design that we’d like.  You can also see in the background that I was playing around with designing a shaped vertical stab.  These will mount inboard and be the primary yaw stabilizer.  It took me no more than 10 minutes to create each winglet shape in MoI.

The ultimate goal is to create an accurate 3d mesh of the aircraft.  This will be combined with the dynamics model to produce a realistic and visually compelling real time simulation of the design in FlightGear.  MoI has several mesh export options and allows you to tune the mesh density so it is a perfect front end design tool for really nice 3d models.

MoI is a really awesome 3d design tool.  I can’t speak highly enough about it.  I am merely a novice at 3d modeling, you can browse the MoI forum and find many incredibly brilliant designs that the experts are creating. MoI is a commercial application, but if you are building “organic” shapes with curved surfaces, it is worth every penny.

Physics Modelling

Dynamics (Physics) Modelling and Flight Simulation

There are many great tools available to help engineers design and develop new aircraft and flight control systems.  One such tool is the flight simulator.  More specifically: an open source flight simulation such as FlightGear. Being open-source FlightGear is flexible and adaptable and can be used to solve or explore new scenarios that a proprietary software applications may never have anticipated.

FlightGear + YASim

Here I describe the process of modelling a flying wing in FlightGear using the built in “YASim” physics engine.

A brief word on yasim (wiki documentation): YASim is a physics engine that inputs a physical description of the airframe, the wing and tail surfaces, engines, landing gear, weight and balance, etc. In addition you input cruise performance numbers and approach performance numbers. YASim has a built in solver that computes approximate lift/drag curves for your model and then physically models the individual components in real time to produce the overall dynamic behavior of the vehicle.

For this example we are modelling a flying wing. To do this in yasim, I defined the inboard 3/4 of the flying wing as the main wings, and the outboard 1/4″ of the flying wing as the tail. Yasim allows you to define any number of surfaces in any arrangement, but this approach works out pretty well.

Visualization (Blender)

Notice that yasim “mirrors” the wing and hstab automatically so you only define one side in the configuration file. Visualizing your yasim configuration can be very helpful and can help eliminate math mistakes and typos. Here is a link to a Blender YASim import plugin. The image above shows the result of importing the flying wing configuration into blender.

Tuning

Once the basic model has been crafted, it can be flown inside FlightGear.  If you have provided correct geometry, correct weight and balance information, correct propulsion information, and correct cruise and approach performance values, YASim will create a model that flies very much like the real thing.  However, YASim makes many internal assumptions and isn’t perfect, and most of the time we don’t have perfect data for our aircraft.  So once the initial model is created it is worth flight testing and adjusting various parameters to tune the model towards real world performance.

For instance, control surface effectiveness can be tuned to get the correct rotational rates.  Engine power can be tuned to get the correct rate of climb.  Because YASim is designed around a solver that computes lift and drag for your design, if you increase the power of your engine, yasim will reduce lift and increase drag so that your specified cruise speed will still be met.  Essentially this gives you an aircraft that is draggier but has better climb performance.  In my case, our wing has an incredibly efficient glide ratio, so I ended up reducing power substantially from my initial guess.  This created a wing with much less drag and much more lift.  Climb performance was reduced, acceleration is slowed, but now it will glide forever just like in real life.

Design Testing

Because YASim uses the physical geometry of the design to compute forces and moments at each surface and then sums all of these up to produce the overall flight dynamics of the aircraft, it is possible to make changes to the airframe in simulation and observe the effects in the simulator.  For instance, the flying wing design in this example has twin vertical stabilizers.  If I want to test the effect on lateral (yaw) stability of moving these surfaces fore or aft, I can do that in YASim.  A quick tweak to the config file is all that it takes to adjust the location of a surface.  I leveraged the FlightGear autopilot + a simple nasal script to fly a scripted flight pattern.  Basically I stabilize in straight and level flight.  Then I input 1 second of full right aileron deflection, followed by 2 seconds of full left aileron deflection, followed by leveling the wings.  Through this maneuver I plot the “side slip” angle (beta).  This gives me an indication how straight the aircraft tracks through the maneuver with different vertical stab locations.

In the above graph the line number (0.48, 0.58, etc.) corresponds to the distance of the vstab behind the nose in meters (this design has a wing span of about 2.3m.)  As you can see the further rearward the vstabs are placed, the more stable the design becomes (the straighter it tracks and the more quickly it recovers.)  You may also see that as the vstabs are pushed towards the CG (about 0.37m behind the nose) the stability starts to diverge rapidly.  But as the vstabs are pushed back to about 0.68m behind the nose, the stability increases, but we are starting to hit diminishing returns.  According to yasim, we could push the vstab further back and get more stability, but perhaps not a lot more.

Other Uses for  Simulation Modelling

Besides basic flight dynamics modelling and validation, a simulator can be very useful in many other areas of aircraft development.  Flight control systems can be prototyped and tested.  Higher level flight control systems (route following, circle holds, autonomous landings, etc.) can be effectively prototyped and developed within a simulator. Even payload systems can be modeled and prototyped inside a simulator.  Any work that can be done at an engineer’s desk in the comfort of their office will be far more productive than in the field under harsh conditions when the pressure is on.  And when something developed in simulation works exactly right in the real world on the first try it is just very very cool!

Conclusion

This is just a simple example, but it shows some of the power that a flight simulator can bring to the arena of aircraft design.  Simulators are never perfect so you have to keep in mind how far you can push them and what data you can trust to pull out of them.  As a design evolves and as you gain real world flight experience with the actual design, you can validate the simulator against real flight data and adjust and improve the simulation model.  This design cycle leads to a positive feedback loop which creates a more and more realistic simulation model that yields more and more useful simulation results.