Sign in to follow this  
jspan_com

Altimeter Warning Light

Recommended Posts

I am using the code by PH-JVH for the Altimeter Warning Light. The goal is that the Altimeter warning light should illuminate (+/-) 750 feet before the selected altitude (Autopilot Altitude Lock Var). The original code:(A:Autopilot altitude lock var, feet) (A:Indicated altitude, feet) - abs d 300 >= r 1000 <= &&AltitudeAnd the code I am using:(A:Autopilot altitude lock var, feet) (A: Indicated altitude, feet) - abs d 250 >= r 1000 <= && It seem to be working on the ground, but when test flying it does not. By looking on the different elements and using the Callback.doc by Arne Bartels as reference, we have the following: 1. "(A:Autopilot altitude lock var, feet) (A: Indicated altitude, feet) - abs" subtracts the first two stack entries and returns the absolute value (removes "-").2. "d" duplicates last stack entry.3. "250" ">=" (">=" gives 1 if last stack entry is greater than or equal to forelast stack entry) "r" (swaps last two stack entries).4. "1000" "<=" ("<=" gives 1 if last stack entry is smaller than or equal to forelast stack entry).5. "&&" ("&&" logical AND, if both last stack entries are 1 gives 1 otherwise 0).I must admit that I cannot fully understand what happens with the "- abs d 250 >= r 1000 <= &&" statement!I have coded a new AP for this aircraft (ATR42-500) and the relevant "ALT" and "VS" commands look like this://---> (A:Autopilot altitude lock, bool)(A:Autopilot altitude lock, bool)/---> (A:Autopilot vertical hold var, feet per minute) 100 / flr 1000 + 4 %/--->/---> %<HELPID_AUTOPILOT_VSI_HOLD> (%((A:Autopilot altitude lock, bool))%{if}%<TOOLTIPTEXT_ON>%{else}%<TOOLTIPTEXT_OFF>%{end})(>K:AP_PANEL_ALTITUDE_HOLD) + (>K:TOGGLE_AFTERBURNER1)(>K:AP_PANEL_ALTITUDE_HOLD) + (>K:TOGGLE_AFTERBURNER1)//--->I appreciate help on this issue! I hope that all coding can be read as the original code as I first wrote this posting with the "Message format" box unchecked, then edited this message with the "Message format" box checked.

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Hi,This code (tested) gives a warninglight, when indicated altitude is 100-900 feet below or above the selected (autopilot) altitde.(A:Autopilot altitude lock var, feet) (A:Indicated altitude, feet) - abs d 100 >= r 900 <= && Hope it helpes,Jan"Procul Negotiis"PS Is there a problem with the autopilotcode?

Share this post


Link to post
Share on other sites

Hi Jan,I have tested this Altimeter on the MSFS 737_400 and another 737-400 and the result is the same, it seem to work only when the aircraft is on the ground. This Altitude Warning Light is integrated in a new Altimeter, so the error might be there? Here's the complete code for the Altimeter Gauge:(A:Circuit general panel on, bool)(A:Autopilot altitude lock var, feet) (A: Indicated altitude, feet) - abs d 100 >= r 900 <= &&(A:Indicated Altitude,feet) 100000 + 100000 % d 100 % 100 / r 100 / flr d 100 / flr r 100 % 99 == if{ + } (A:Indicated Altitude,feet) 100000 + 100000 % d 100 % 100 / r 100 / flr d 10 / 10 % flr r 10 % 9 == if{ + } (A:Indicated Altitude,feet) 100000 + 100000 % 1000 % 100 /(A:Indicated Altitude,feet) 100 /%((A:Kohlsman setting hg,mbar))%!04.0f!%((A:Kohlsman setting hg,inHg))%!04.2f!http://forums.avsim.com/user_files/24036.jpg

Share this post


Link to post
Share on other sites

Hi,You are right.Didn't test it completely, but it could be the sequence of the 'sI give you the code of a working altimeter, so you can test it and rewrite the gauge for your own panel.Jan"Procul Negotiis"

Share this post


Link to post
Share on other sites

Hi Jan,Wow! Thanks a lot :).I will start the work ASAP with the code of yours! I did also change the sequence of the elements, but with no apparent success. I have also been checking the ATR42 AFCS MCP codes without finding any errors, even though I am a bit in doubt about the "VS" and "ALT" functions which uses the same A:Var. But the test on the default MSFS 737 gave the same negative result, so the ATR MCP is presumeably allright, but you never know.. I will report back here on the result of the reworked Altimeter and Altimeter Warning Light.

Share this post


Link to post
Share on other sites

Jan(!)The VS and ALT modes in the autopilot are a different story!In the "standard version" you can only select or hold the altitude and in- or decrease vertical speed.The roll modes (LNAV, NAV1, HDG, LOC etc.) are generally no problem, but the pitch!!Working myself trying to get some decent ALT, GS, VNAV, FLCH and VS modes.You have to work with weight, thrustrating, baropressure, temperature, windspeed, trim- and elevator axis and "more" and that is really complicated in xml.First make some L:Var's to assign to the VS and ALT HOLD switches and give them a function eg:(L:ALT,bool) ! (>L:ALT,bool) can change a "light"You can use it in combination with:(L:alt,bool) (A:Autopilot altitude lock, bool) &&Then the function: (L:ALT,bool) 1 == if{ (>K:AP_ALT_HOLD) } els{ (>K:AP_ALT_HOLD_OFF) }etc.This way you can make a lot of combinations.Try to use some VS SET events etc.Hope the altimeter is useful.Jan"Procul Negotiis"

Share this post


Link to post
Share on other sites

Hi Jan,Thank you for the Altimeter, it has many good elements which I will have a look on with great interest. I have only set up a "standard" version of VS and ALT, to do more at this stage with my rather limited XML experience would be far too difficult and complicated!Regarding the Altimeter and Altimeter warning light: I have an ALT & CRS(2) Selector which is part of the ATR42 AFCS (Automatic Flight Control System). By looking on the MSFS Beech_Baron Altitude Selector.xml I found these lines in the section:(G:Var1) if{ (>K:AP_VS_VAR_DEC) } els{ (>K:AP_ALT_VAR_DEC) }(G:Var1) if{ (>K:AP_VS_VAR_INC) } els{ (>K:AP_ALT_VAR_INC) }.. and they are used in the ALT & CRS2 Selector and NOW it seem to be working :-). I will perform some test flights later to check the Altimeter and Altimeter Warning Light functionality more in detail. Thanks a lot for your help, it has been most useful:).

Share this post


Link to post
Share on other sites

Too bad that one file attachment is no longer available for D/L. Maybe I would be able to decipher my problem from there. What I'm trying to do is to make a relatively simple voice gauge for my virtual co-pilot project that is suppose to play a sound 1000ft before the preselected altitude is reached, either in climb or descend.I'm having just the same problem as Jan - it works on the ground, I can trigger it by changing the values in the AP altitude preselect window as much as I wish, but once that I leave the ground and climb to the preselected altitude, nothing happens.Help please . . .

Share this post


Link to post
Share on other sites

Here is a warning light I use, Flashes @ 1000 above or below selected altitude. Change the timer for L:var to trigger sound. (A:AUTOPILOT ALTITUDE LOCK VAR, feet) (A:PLANE ALTITUDE,feet) - abs s0 1200 < l0 1000 > && (P:absolute time, number) 1.5 % 0.5 > *

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this