by redneck » Sat Feb 18, 2012 3:33 am
Thanks, but we already figured that part out. What we're (well, actually Omega is sleeping right now) trying to do right now is get the plane to fly the course. So, I've been playing around with some numbers. The following numbers are for example only, and will NOT be hard-coded. If I want to takeoff from KLAX, and immediately start a holding pattern at SMO R-360, I take a direct entry. No problems there. Then, I turn to the outbound leg. I think we might have screwed that one up (turning 180 degrees to the right, assuming a standard pattern, will not necessarily have me on a track opposite the direction of the course). Then, we turn 180 degrees to the right again (once again, I believe to be an error - Omega was trying to teach me Nasal while tired), and then fly directly to the fix, and repeat (yes, more errors). Now, I had thought, maybe we could make the holding function generate a second route manager which will be activated when the pilot activates the auto holding pattern option. Omega wasn't too thrilled with this idea, and I really have no idea how hard it would be to replicate the route manager, which I understand to be written in the core source code, into Nasal.
One idea I came up with to solve this problem is to create gps waypoints without creating a waypoint in the route manager. This will NOT require us to create a second route manager, either. So, let's continue with the above example, since it's simple. Let's say I'm at 250 KIAS at 7000, and winds are calm. This should give me a ground speed of roughly 267 kts. Converting that to knots/minute gives us a value of 4.45. So, now, let's assume standard 1-minute legs. So, we will fly directly to SMO. Reaching SMO presents us with a problem: by how much do we turn right to get on the outbound leg? So, we reset set a new property in gps[2] to define the location of the abeam position and turn to it. It will have gps coordinates to define its location, which means, we'll be able to get the bearing. We get the coordinates by using the following formula:
r * acos[sin(lat1) * sin(lat2) + cos(lat1) * cos(lat2) * cos(lon2 - lon1)], where r = the radius of the earth in nm (3437.74677), and x is the following:
x = [sin(lat1/57.2958) * sin(lat2/57.2958)] + [cos(lat1/57.2958) * cos(lat2/57.2958) * cos(lon2/57.2958 - lon1/57.2958)].
I plan to take that formula and turn it around so that we have lat2 and lon2 being determined by distance and direction from SMO.
I'm starting to have doubts about my planned method of going about this. I took a look at math.nas, and found there are no functions for finding the sine or cosine. Furthermore, this method seems to be quite a daunting task. But I've always been a perfectionist, and I want this to work right. I read here a few times that anything is possible with enough time and Nasal. I'm getting a decent grasp of Nasal thanks to my previous (however limited) programming experience. If you have suggestions towards solving this problem, I will be very grateful. I'm having a blast with this plane.
OTOH, making a second route manager for the 787-8, dedicated to hold patterns still doesn't seem like a bad idea to me. If we could just have it enter a list of waypoints such as, based on the above example: SMO, SMO/090/4.45, SMO/150/8.9, SMO/180/4.45, and then have it repeatedly check the accuracy of the waypoints based on wind conditions to produce a 1 minute inbound leg, then that would be awesome.
EDIT: I just got this awesome idea. It's not perfect. But it will work for now until we can get something perfect. I need to know how to make an offset waypoint in a gps, just like you would in the roue manager like fix/rad/dist. Here's my idea. We keep changing the waypoint in the gps to make the plane fly to where we want it to fly to. The set of waypoints would be calculated as follows:
Direct
fix
fix/radial+90/groundspeed / 60
fix/radial + 150/2 * groundspeed / 60
fix/radial + 180/groundspeed / 60
repeat
Teardrop
fix
fix/radial + 150/2 * groundspeed / 60
fix/radial + 180/groundspeed / 60
stay in pattern defined by direct.
Parallel
fix
fix/radial + 210/2 * groundspeed/60
left turn to fix, and then stay in pattern as defined in direct.
Call Signs: redneck, ATCredn (unspecified freq atc)
FGFSCopilotFGFSCopilotATCEditionSystem SpecsModel: Alienware M15x, OS: Windows 7 Professional 64-bit, RAM: 3 GB, CPU: Intel i3 quad core at 2.4 GHz, GPU: Nvidea GeForce GTX 460M 1.5 GB GDDR5