April 21, 200323 yr Last step before heading south (by car..).This seems to work too: (L:test, bool) 1 == if{ 5064 (A: PLANE LONGITUDE,degrees) 60 * + 2018 (A: PLANE LATITUDE,degrees) 60 * - atg2 rddg 90 + (>K:HEADING_BUG_SET) }A lot of work to do of course with calcs of Lon (cos etc.)See you later.Jan"Procul Negotiis" Jan "Beatus ille qui procul negotiis..."
April 25, 200323 yr Arne,Followed your directions (Thanks!) and this brought me in a sort of hyper/parabolic course to W53.2 E8; I presume you live there, close to a lake and a highway?!(Get inside, it's raining overthere according "Active Sky"!)The heading from EHGG at first was 089, but coming closer (30 NM) it became 80 ....60 and finally made the plane circle in a radius of about 3 NM, starting from the south, anticlockwise.At first i had a problem with your formula not showing up, but after erasing the sign for degree (Temp?) after Heading Bug Set, it showed up in the fmc. (I think it's pretty complicated!!)....(>K:HEADING_BUG_SET) )%!d! Jan "Beatus ille qui procul negotiis..."
April 25, 200323 yr >Arne,>>Followed your directions (Thanks!) and this brought me in a>sort of hyper/parabolic course to W53.2 E8; I presume you live>there, close to a lake and a highway?!(Get inside, it's>raining overthere according "Active Sky"!)It's still dry and I live 10 nm east of that point, I chose it because of the beautiful lake and the fact that the coordinates are easy to remember for me.>The heading from EHGG at first was 089, but coming closer (30>NM) it became 80 ....60 and finally made the plane circle in a>radius of about 3 NM, starting from the south, anticlockwise.It is normal that you enter something like a circle near to the target.I had a look in my math books, great circle is not too complicated:distance:cos(distnm/60)=sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon2-lon1)(use acos to get distance)heading:sin(hdg)=cos(lat1)*sin(lon2-lon1)/sin(distnm/60)(use asin to get heading, for sin(lon2-lon1)>0 you fly eastward, sin(lon2-lon1)<0 means westward so use 360-hdg for heading)I'll try to wrap that in XML.Arne Bartels
April 25, 200323 yr I was learning the same thing a little bit on a website teaching course and heading for seamen and found these ones:Distance between (j0 , q0) and (j1 , q1) (coordinates) = 60 Jan "Beatus ille qui procul negotiis..."
April 25, 200323 yr The sin formula doesn't work properly for heading (north-south ambiguity), your cos might be better (east-west ambiguity, but easier resolvable). However my code doesn't work at the moment, the distance is perfect, the heading goes havoc.Distance : (* the lats and lons for convenience in radians and stored in L: vars*) 53.2 dgrd (>L:Lat2rad,number) (A:PLANE LATITUDE, degrees) dgrd (>L:Lat1rad,number) 8.0 (A:PLANE LONGITUDE, degrees) - dgrd (>L:DiffLonrad,number) (*Distance calc*) (L:Lat2rad,number) sin (L:Lat1rad,number) sin * (L:Lat2rad,number) cos (L:Lat1rad,number) cos * (L:DiffLonrad,number) cos * + acos (>L:Distrad,number)...(L:Distrad,number) rddg 60 * )%!.1f!nmArne Bartels
April 26, 200323 yr Arne,As a sidestep i can use your last formula as a trigger:(L:test, bool) 1 == 53.2 dgrd (>L:Lat2rad,number) (A:PLANE LATITUDE, degrees) dgrd (>L:Lat1rad,number) 8.0 (A:PLANE LONGITUDE, degrees) - dgrd (>L:DiffLonrad,number) (L:Lat2rad,number) sin (L:Lat1rad,number) sin * (L:Lat2rad,number) cos (L:Lat1rad,number) cos * (L:DiffLonrad,number) cos * + acos (>L:Distrad,number) (L:Distrad,number) rddg 60 * 100 < && if{ 3000 (>K:AP_ALT_VAR_SET_ENGLISH) 210 (>K:AP_SPD_VAR_SET) (etc.) }The distances are looking good.Using the first formula showes some differences in distance varying 5-10%, but using them together:%( 8.0 (A:PLANE LONGITUDE, degrees) - (A:PLANE LATITUDE, degrees) dgrd cos * s053.2 (A:PLANE LATITUDE, degrees) - s1 atg2 rddg 360 + 360 % (A:MAGVAR,degrees) - near d (L:test, bool) 1 == if{ (>K:HEADING_BUG_SET) })%!d! %( l0 sqr l1 sqr + sqrt 60 * )%!.1f!NMDoes the plane circle over "your lake" with 210 kts at 3000 ft.Jan"Procul Negotiis" Jan "Beatus ille qui procul negotiis..."
April 26, 200323 yr Hello Arne and Jan,I've been reading your posts about this topic and I too want to make an FMC. I'm working on a 757 panel with all xml gauges and so far it looks great. I'd like to have a working FMC for this panel. Using the code from Arne's post above, #9665, I was able to make the plane follow a course to a waypoint. I have set up the lat and long, in decimal, of each waypoint of a flight plan to variables, ie (L:W1lat, enum) is waypoint 1 latitude, (L:W1long, enum) is waypoint 1 longitude. After that, I check how close the plane is to the next waypoint and if it is 1nm from the waypoint, then the next waypoint is loaded. The wayoints are loaded into (L:Waylat, enum) and (L:Waylong, enum). I put those variables to the code that Arne posted in place of the lat and long he put.So far, this works. The plane will turn to the next waypoint and follow that heading until it is 1nm from it.Jan, you said you could load info from a database with the xml gauge? What kind of database and how do you do this?If you want to see my code for all of this, let me know. It might be a bit messy, but it works.David
April 26, 200323 yr David, Welcome in the discussion!Arne is the pro and i am the pupil.Very nice to hear you are busy with an 757 xml, well..me too (767).I like to see your codes and a pic of the panel.Here is one of my pedestal with FMC.The Database is nothing more than several flightplans (copy's of a "base plan" with different navdata, altitudes, weights, speed- , radiosettings etc.)Clicking one of the buttons of the fmc will make it possible to choose a certain prefab plan)Jan"Procul Negotiis" Jan "Beatus ille qui procul negotiis..."
April 26, 200323 yr I think I have it now. After some confusions what is start and target and an incorrect space before an if:%( (* the lats and lons for cnvenience in radians and stored in L: vars*) 53.289 dgrd (>L:Lat2rad,number) (A:PLANE LATITUDE, degrees) dgrd (>L:Lat1rad,number) 7.93 (A:PLANE LONGITUDE, degrees) - dgrd (>L:DiffLonrad,number) (*calculate distance in radians *) (L:Lat1rad,number) sin (L:Lat2rad,number) sin * (L:Lat1rad,number) cos (L:Lat2rad,number) cos * (L:DiffLonrad,number) cos * + acos (>L:Distrad,number) (* calculate heading in degrees *) (L:Lat2rad,number) sin (L:Lat1rad,number) sin (L:Distrad,number) cos * - (L:Lat1rad,number) cos (L:Distrad,number) sin * / acos rddg (>L:Hdg,number) (* eliminate east-west ambiguity*) (L:DiffLonrad,number) sin 0 < if{ 360 (L:Hdg,number) - (>L:Hdg,number) } (* correct for magnetic deviation *) (L:Hdg,number) (A:MAGVAR,degrees) - near 360 + 360 % (* set heading *) d (>L:Hdg,number) (>K:HEADING_BUG_SET) (* display the stuff *) (L:Hdg,number) )%!d! %((L:Distrad,number) rddg 60 * )%!.1f!nmI used a bit too much L: vars, but they are chosen, because they have names, therefore they are easier to follow as G:Vars, s l pairs, or d r pairs.I tested it for PHNL to EDWX (Hawaii Germany) in the Concorde at 16X simulation speed and it took only half an hour, always with dist and brg correct according to GPS.Arne Bartels
April 26, 200323 yr Arne,In one word: amazing!One question: How did you converse the LAT/LON coordinates?I mean eg: N33.38.43 and W084.25.62Jan"Procul Negotiis" Jan "Beatus ille qui procul negotiis..."
April 26, 200323 yr Always two there are, a master and an apprentice :(I'm attaching some pics of a current flight KLAX-KDFW. Main, Overhead, Radio, Throttle, and Center. I will post the code I'm using for the FMC route in another reply, since I've reached the maximum attachments allowed. The route is KMIA-TJSJ.Jan, how do you access a database through xml? Can it just be a text file with the lat. and long. coordinates in decimal and other flight plan data?David
April 26, 200323 yr Ok, here's the FMC route code text file. Hmmmm, it seems I can't upload anymore, unless I delete some.Anyway, here's the code and it is a bit long: 25.553 (>L:W1lat, enum) -79.274 (>L:W1long, enum) 25.2998 (>L:W2lat, enum) -78.18 (>L:W2long, enum) 25.218 (>L:W3lat, enum) -77.9598 (>L:W3long, enum) 25.028 (>L:W4lat, enum) -77.45 (>L:W4long, enum) 23.983 (>L:W5lat, enum) -76 (>L:W5long, enum) 23.58 (>L:W6lat, enum) -75.264 (>L:W6long, enum) 23.13 (>L:W7lat, enum) -74.38 (>L:W7long, enum) 22.1315 (>L:W8lat, enum) -72.445 (>L:W8long, enum) 21.704 (>L:W9lat, enum) -71.642 (>L:W9long, enum) 21.44 (>L:W10lat, enum) -71.135 (>L:W10long, enum) 20.517 (>L:W11lat, enum) -69.633 (>L:W11long, enum) 20 (>L:W12lat, enum) -68.817 (>L:W12long, enum) 19.2605 (>L:W13lat, enum) -67.6395 (>L:W13long, enum) 18.408 (>L:W14lat, enum) -66.412 (>L:W14long, enum) 18.446 (>L:W15lat, enum) -65.9895 (>L:W15long, enum) 15 (>L:Waymax, enum) (L:FMCload, bool) 0 == if{ 1 (>L:Waynum, enum) 1 (>L:FMCload, bool) }(L:Wayloaded, bool) 1 == (L:Waypointdist, enum) 1.02 < & if{ (L:Waynum, enum) 1 + (>L:Waynum, enum) }(L:Waymax, enum) 1 + (>L:way2max, enum) (L:Waynum, enum) 1 == (L:way2max, enum) (L:Waynum, enum) > & if{ (L:W1lat, enum) (>L:Waylat, enum) (L:W1long, enum) (>L:Waylong, enum) } (L:Waynum, enum) 2 == (L:way2max, enum) (L:Waynum, enum) > & if{ (L:W2lat, enum) (>L:Waylat, enum) (L:W2long, enum) (>L:Waylong, enum) } (L:Waynum, enum) 3 == (L:way2max, enum) (L:Waynum, enum) > & if{ (L:W3lat, enum) (>L:Waylat, enum) (L:W3long, enum) (>L:Waylong, enum) } (L:Waynum, enum) 4 == (L:way2max, enum) (L:Waynum, enum) > & if{ (L:W4lat, enum) (>L:Waylat, enum) (L:W4long, enum) (>L:Waylong, enum) } (L:Waynum, enum) 5 == (L:way2max, enum) (L:Waynum, enum) > & if{ (L:W5lat, enum) (>L:Waylat, enum) (L:W5long, enum) (>L:Waylong, enum) } (L:Waynum, enum) 6 == (L:way2max, enum) (L:Waynum, enum) > & if{ (L:W6lat, enum) (>L:Waylat, enum) (L:W6long, enum) (>L:Waylong, enum) } (L:Waynum, enum) 7 == (L:way2max, enum) (L:Waynum, enum) > & if{ (L:W7lat, enum) (>L:Waylat, enum) (L:W7long, enum) (>L:Waylong, enum) } (L:Waynum, enum) 8 == (L:way2max, enum) (L:Waynum, enum) > & if{ (L:W8lat, enum) (>L:Waylat, enum) (L:W8long, enum) (>L:Waylong, enum) } (L:Waynum, enum) 9 == (L:way2max, enum) (L:Waynum, enum) > & if{ (L:W9lat, enum) (>L:Waylat, enum) (L:W9long, enum) (>L:Waylong, enum) } (L:Waynum, enum) 10 == (L:way2max, enum) (L:Waynum, enum) > & if{ (L:W10lat, enum) (>L:Waylat, enum) (L:W10long, enum) (>L:Waylong, enum) } (L:Waynum, enum) 11 == (L:way2max, enum) (L:Waynum, enum) > & if{ (L:W11lat, enum) (>L:Waylat, enum) (L:W11long, enum) (>L:Waylong, enum) } (L:Waynum, enum) 12 == (L:way2max, enum) (L:Waynum, enum) > & if{ (L:W12lat, enum) (>L:Waylat, enum) (L:W12long, enum) (>L:Waylong, enum) } (L:Waynum, enum) 13 == (L:way2max, enum) (L:Waynum, enum) > & if{ (L:W13lat, enum) (>L:Waylat, enum) (L:W13long, enum) (>L:Waylong, enum) } (L:Waynum, enum) 14 == (L:way2max, enum) (L:Waynum, enum) > & if{ (L:W14lat, enum) (>L:Waylat, enum) (L:W14long, enum) (>L:Waylong, enum) } (L:Waynum, enum) 15 == (L:way2max, enum) (L:Waynum, enum) > & if{ (L:W15lat, enum) (>L:Waylat, enum) (L:W15long, enum) (>L:Waylong, enum) } %((L:Waypointdist, enum))%!.1f!nm %((L:Waynum, enum))%!s! %((L:FMCnav, bool))%!s! %((L:LNav, bool))%!s!(L:FMCnav, bool) 1 == (L:LNav, bool) 1 == & if{ (L:Waylong, enum) (A:PLANE LONGITUDE,degrees) - (A:PLANE LATITUDE,degrees) dgrd cos * s0 (L:Waylat, enum) (A:PLANE LATITUDE,degrees) - s1 atg2 rddg 360 + 360 % (A:MAGVAR,degrees) - near d (>K:HEADING_BUG_SET) }(L:Waylong, enum) (A:PLANE LONGITUDE,degrees) - (A:PLANE LATITUDE,degrees) dgrd cos * (>L:Save1, enum) (L:Waylat, enum) (A:PLANE LATITUDE,degrees) - (>L:Save2, enum)(L:Save1, enum) sqr (L:Save2, enum) sqr + sqrt 60 * (>L:Waypointdist, enum)1 (>L:Wayloaded, bool)
Create an account or sign in to comment