Jump to content
The simFlight Network Forums

wawax

Members
  • Posts

    7
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling
  • Location
    Midsomer

wawax's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. My A332 sometimes during a flight turns left, makes circle and then continues the route. I can't find any pattern of this behaviour. It happens on longer routes. E.g. today flight from Canada to Ireland through NAT: in the middle of the route leg it just turned left. It was long leg, about 300nm. But other legs (also long) were ok. I found that this sometimes happens on waypoints which have IAS limit set to 0 (not by me, but in navdata). Usually removing the limit solves that problem. But I still don't know why it happens. I found that this can can be related to magdec.bgl. However I updated this file (http://www.aero.sors.fr/navaids.html) and nothing changed. Any ideas?
  2. Thanks. -- Autopilot IAS mode -- Version: 0.1 -- -- This script enables IAS mode for every autopilot. It should work correctly for both climb and descent. -- IAS mode means, the aircraft keeps IAS unchanged during climb/descent, but adjusts vertical speed. -- You can use smooth throttle changes to modify pitch of the aircraft. -- The script uses VS mode but adjusts it every n seconds to keep the IAS stable -- -- In some aircrafts autopilot may be unable to set IAS. It depends on .air config file -- Use Aired to enable it if needed -- -- To start/restart: -- 1. set desired altitude and IAS -- 2. start usual VS mode on AP -- 3. run the script -- -- To stop do only one of following: -- 1. Set 0x66D0 offset to 0 -- 2. kill the script -- 3. script will stop itself 1000ft before set altitude -- -- In all cases, the aircraft will continue to climb/descent until reaching desired altitude! -- Autopilot usually is able to finish climb/descent smoothly starting approx. 500ft before set altitude. -- -- Just in case you use colon as decimal separator in your OS. print(os.setlocale("C")) assert(os.setlocale'C') -- Static variables max_clb_vs = 3500 -- max climb, ft/min min_clb_vs = 100 -- min climb min_des_vs = -100 -- min descent max_des_vs_default = -3000 -- max default descent max_des_vs = max_des_vs_default -- max descent (will be modified in case of low AGL altitude) ias_margin = 1 -- acceptable speed difference, should be > 0, kts alt_margin = 1000 -- when to switch IAS mode back to VS, ft minimum_agl = 500 -- at what AGL we should level off aircraft during descent frequency = 2 -- repeat every n seconds, 2 is default, too frequent won't work -- Initiate variables last_ias = ipc.readSW(0x02BC) / 128 start = 1 -- run the script ipc.writeUB(0x66D0, 1) -- switch on the led (if used) while start == 1 do -- Check FS variables curr_alt = ipc.readDD(0x0570) / 65536 / 65536 * 3.28084 ap_alt = ipc.readSD(0x07D4) * 3.28084 / 65536 curr_ias = ipc.readUW(0x02BC) / 128 ap_ias = ipc.readUD(0x07E2) ap_vs = ipc.readSW(0x07F2) sleep = frequency * 1000 curr_agl = ipc.readSW(0x0020) * 3.28084 / 256 acceleration = curr_ias - last_ias --------------------------------------------------------------------------- -- For tests you can enable the lines below -- -- Set ap_ias in case you can't do it in the aircraft -- ap_ias = 120 -- -- Show variables on screen ipc.display("curr_alt="..curr_alt.."\nap_alt="..ap_alt.."\ncurr_ias="..curr_ias.." \nap_ias="..ap_ias.."\nap_vs="..ap_vs.."\nacceleration="..acceleration.."\ncurr_agl="..curr_agl.."\nmax_des_vs="..max_des_vs) -- --------------------------------------------------------------------------- -- Descent limitation when flying on low altitude if (curr_alt - curr_agl - minimum_agl) * -1 > max_des_vs_default * -1 then if curr_alt > ap_alt then -- we are during descent max_des_vs = (curr_alt - curr_agl - minimum_agl) * -1 -- level off when less than minimum over AGL if max_des_vs > 0 then max_des_vs = 0 end if ap_vs < max_des_vs then ipc.control(65894) -- increase AP_VS ipc.control(65894) -- increase AP_VS end end else max_des_vs = max_des_vs_default end -- CLIMB MODE if curr_alt < ap_alt - alt_margin then -- we are below ias_margin if curr_ias <= ap_ias - ias_margin then if acceleration <= 0 then if ap_vs > min_clb_vs then ipc.control(65895) -- decrease AP_VS end end if acceleration < 0.5 then -- decrease AP_VS faster if ap_vs > min_clb_vs then ipc.control(65895) end end elseif curr_ias > ap_ias + ias_margin then -- we are above ias_margin if acceleration > 0 then if ap_vs < max_clb_vs then ipc.control(65894) -- increase AP_VS end end if acceleration > 0.5 then -- increase AP_VS faster if ap_vs < max_clb_vs then ipc.control(65894) end end else -- we are within ias_margin, using acceleration helps react in advance if acceleration > 0 then ipc.control(65894) else ipc.control(65895) end end -- DESCENT MODE elseif curr_alt > ap_alt + alt_margin then -- we are above ias_margin if curr_ias <= ap_ias - ias_margin then if acceleration <= 0 then if ap_vs > max_des_vs then ipc.control(65895) -- decrease AP_VS end end if acceleration < 0.5 then -- decrease AP_VS faster if ap_vs > max_des_vs then ipc.control(65895) end end elseif curr_ias > ap_ias + ias_margin then -- we are below ias_margin if acceleration > 0 then if ap_vs < min_des_vs then ipc.control(65894) -- increase AP_VS end end if acceleration > 0.5 then -- increase AP_VS faster if ap_vs < min_des_vs then ipc.control(65894) end end else -- we are within ias_margin, using acceleration helps react in advance if acceleration > 0 then ipc.control(65894) else ipc.control(65895) end end else -- we are within alt_margin start = 0 -- let the AP do the rest ipc.writeUB(0x66D0, 0) -- switch off the led (if used) -- exit loop and stop the script end --exit loop by pressing button attached to FS offset if ipc.readUB(0x66D0) == 0 then start = 0 end -- we need last_ias to calculate acceleration last_ias = curr_ias -- here we set frequency of adjustments ipc.sleep(sleep) end -- end of the script
  3. I created LUA script which adds IAS mode to autopilot. It should work with every aircraft that has autopilot. It works as an overlay to VS mode. It works quite stable, as it uses both speed and acceleration values to determine proper vertical speed. The tests have shown that it works good for climb as well as descent. Additionaly it is able to detect low altitude and limit descent. I use the script for ATR72 in P3D. As you probably know, Flight 1 ATR panel doesn't work with P3D, so I use free panel. This panel lacks IAS mode, which worked very well in F1 ATR. My script seems to be quite good replacement. But it will work with any aircraft. I have no permission to add lua file to this post. If anyone is interested, please let me know, I'll send it using e-mail.
  4. Thanks. That's other solution. Creating Lua will be easier for me than writing in C.
  5. Thanks. That's pity. As I know, there are some gauges written in C, which are able to dump fuel. If that gauge could communicate via L:Var with XML gauge, I could send command to decrease fuel in certain tank. I must see whether such gauge exists. Unfortunately, I don't know C, so I'm unable to write one.
  6. Sorry, I have written too briefly. I use FS2004. Flight Simulator has different types of variables used in gauges. The best known are L:Vars (public variables set in gauges) and G:Vars (those stay only inside one gauge). A: E: and P:Vars are those, you can get from FS using offsets (the list is here: http://msdn.microsoft.com/en-us/library/cc526981.aspx). In gauges, they have own names, which can be used. The last type are K:Vars, which are nothing else than controls shown in FSUIPC documentation (http://msdn.microsoft.com/en-us/library/cc526980.aspx, and in FSUIPC file: List of FS2004 controls.pdf). One can read A, E and P variables, but changing them is possible only via K (events). It is easier in FSUIPC, because one may change offset directly. This way it isn't possible in XML gauge (as I know, but I hope to be wrong). Now I look for control (K:Var), which will allow me to change fuel level in tanks. In list of FS2004 control I found ADD_FUEL_QUANTITY, but as written in ESP, this only adds fuel. I look for something like REMOVE_FUEL_QUANTITY. Regards, Slawek
  7. Hello! I try to change fuel level in one of tanks. It's quite easy, thanks to you Pete, in FSUIPC - change some offsets and that's it. Unfortunately I have to do it in XML gauge. I created APU for VasFMC A320 panel and I'd like it to burn some fuel. I managed to get actual fuel level, change it, but I can't write it. I look for K:Variable, which is appropriate to write new fuel level. I know, it is called FUEL TANK LEFT MAIN LEVEL, and it is writable (as shown on ESP website, as well as in offset description in FSUIPC for programmers). But this is A:Variable. Do you know the name of K:Variable which is responsible for writing fuel level? I found only fuel selectors on list of events. Or maybe I should try to write it some other way?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.