Wednesday, November 14, 2007

SUL37 in the media

Today there is an article about SUL37 in the newspaper NyTeknik. The paper version is a whole page with pictures and stuff, but the text is also available here: www.nyteknik.se, it's in swedish though.

Sunday, September 30, 2007

Weapons for FSX

Contrary to my intentions I have not posted much lately. I've started my new work and it takes a lot of my time, but primarily much of my mental focus. However I have been able to do some stuff that so far is more like a prototype than anything actually working. I've been working on adding weapons to FSX.

The main idea is to add weapon objects into the simulated world through a SimConnect client, simulate their behaviour (i.e. guidance) and then calculate and project the damage they inflict on other simulated objects. Simple enough. But it's much harder to implement than you might think first.

Due to the fact that the SimConnect communication is asynchronous, I cannot guarantee that the positions for my weapon objects correspond 100% to the other objects in the simulated world. This not a big problem when the weapons are fired since they are then free objects that aren't really affected by any other objects. However, before the weapons are fired, they are firmly connected to the aircraft's hardpoints and to avoid them jerking around, another solution had to be found. My idea is to make all possible ordinance for the aircraft a part of the 3D model. Then my SimConnect client tells the model what weapons should be visible at what hardpoint. When a weapon is released, my program simply tells the model to hide that weapon and replaces it with a new free object at that position. The drawback is that you have to edit the 3D model of the aircraft to allow it carry new weapon types. But compared to the alternative, I think it's acceptable.

The big problem is to position the new object. I'm not getting very good precision. It differs up to a meter or two. To position the new object (the weapon) I calculate a vector to the hardpoint from the center of the aircraft. Then I split this 3D vector into a 2D vector and a difference in latitude. The 2D vector is then used to calculate a latitude and longitude based on the aircraft's latitude and longitude. First I used a totally spherical earth model, since it's easiest and fastest, and I didn't think it would matter that much. But when I didn't get the precision I wanted I switched to WGS84 which is supposedly what FSX use. WGS84 did however not give me that much better precision, if any. I can't figure out where the problem is. Is it my formulas, is it in the communication with FSX or is it possibly a problem within FSX? I don't know if I will spend much more time on this or if I will just I accept the lack of precision. As it is now it's at least better than nothing.

Other things I have worked on is a crude targeting system similar to what you would find in early types of the Sidewinder missile - just point at the target and get a value of how good lock you have. Better targeting and communication, with for instance a targeting radar program, will be introduced later. I've also been able to make the released weapons fly where I want them to, and even make targeted aircrafts loose control and go down into the ground. Engine fire seems to be an exclusive feature for the player aircraft so I will have to add my own smoke and fire, and also make explosions when a missile hits a target. Further down the line I also plan to add multiplayer weapons and AI aircrafts that fights back, perhaps even SAMs and AAA shooting from the ground. But first I need to get the most simple stuff working.

Wednesday, July 11, 2007

New Project

The SUL37 project was recently expanded to also include a J35 simulator (SUL35). Though this is an older aircraft which means less systems for me to make programs for, it seems to require the same type of programs. One program for simulating the sight, though not really a HUD I think it was some sort of gyro stabilized reflector sight. One program for the radar and one for some sort of flight computer and simulation of all the systems. I don't really know much about what kind of system the J35 has, but I guess I will find out.

I will not start a new blog for this the SUL35 project, but rather write about it here instead. Now I need to do a lot of research to find out what I need to do. But it will not be necessary to do anything for a while yet. First the mechanical and electrical stuff have to fixed, and that is not my responsibility.

The cockpit is a former Swedish air force J 35J and is fairly complete, except for two gauges and the stick. But this is stuff that will be fixed in one way or another.

Tuesday, July 3, 2007

My thoughts about radar - part 1

When I got the opportunity to try the AJSH37 simulator at F7 airbase in Såtenäs, I never got to see the radar display in action. The reason for this, they said, was that it was still classified. I thought that was a little strange since this is an obsolete aircraft that was about to be scrapped and there isn't really anything from this system that is used in the new JAS39, except perhaps for shooting boundaries displayed in some weapon modes. When I tried the AJSH37 simulator at SAAB they also thought it was a bit strange but unfortunately their simulator did not have any simulation of the radar image. I got to see the symbology though. And we've been able to get a few glimpses of the radar image through different showcase movies from the air force, and there are a few scenes showing the radar in the film "Älskar älskar inte".

However, at F7 though I never got to see the radar display itself, I got to see the unit that produced the radar image. It was a locker as large as a couple of fridges. The whole simulator was housed in a room as large as tennis court. Inside the locker there were two large vertically placed silver coated glass plates with the topography of Sweden (and some areas around) etched into i. Basically you could say it was a silvery 3D map of the area of operation. The reason there were two plates is that Sweden is a very long country, and it was easier to handle this way. Just above the surface of this 3D map there was a moving unit with a light source, representing the radar of the aircraft, and a camera picking up the light from a "God's perspective". It might sound a bit strange, but it's actually really genius, considering this sim was built in the early 70's. If you think about it, it is almost the way a radar really works.


Take a flashlight and lay it on an uneven surface, like a gravel road, lightening along the surface. Then view the surface from above. You will notice that all bumps will produce small shadows behind them, all in the direction away from the light source. The parts of the surface receiving light are all visible from the the light source, the other parts are dark. So what you see from above is exactly the same as from the flashlight, only from a different perspective. The radar receiver in an airplane is located in the same place as the sender, "light source", not a few miles ahead and above the airplane. However radar also gives you depth information so it's a piece of cake to translate it into a "God's view".

This is a somewhat simplistic view of how a radar works, not considering refraction, jitter effect, polarization etc. But for the purpose of a Viggen simulator it's good enough. After my visit to F7 I started thinking about the possibility to make a similar radar simulation with 3D hardware, using OpenGL. I will discuss this in part 2.

Sunday, July 1, 2007

Been busy

I've been very busy at work the last 6 months, so not much have been done on the programs. However I'm now unemployed (have a new work starting in September) which means I have a lot of time to spend on this project. Some progress have been made. It's now possible to give the flight computer data about runway directions on takeoff and landing waypoints and channels for the TILS landing system. For normal waypoints two angles can be defined to mark borders. This is then presented in the radar display (CI).

Further more I have implemented a drift in the navigation, which means that over time the navigation system will be slightly off course. And to counter this you can fix your position by known positions. Since I haven't implemented the radar simulation, radar fixes are not possible. So for the moment you can only fix your position optically.

The whole simulator has now been moved into the bus and has been on tour a few times already. You can find pictures of the move here. This is a part of the project I'm not really involved in since I live several hundred miles from where the simulator is located and can not work with it physically. However in the future I will write some about the hardware since it's imperative to know how that works to understand what I am doing. Now that I've moved the programming diary to this blog, I also hope updates will be more frequent.