Archived

This topic is now archived and is closed to further replies.

Guest fbnweoghnwd

Offsetting numbers in a radar altimeter

Recommended Posts

I'm making a digital radar altimeter for FSX. I've got vertical strips containing the digits; the code for the "ones" and "tens" column looks like this (there are also columns for 100s, 1000s, and 10000s): 00.000,00.000True-64.000,197.000True0.000,22.0000.00010.00000.000,00.000True-50.000,197.000True0.000,22.0000.00010.000It's working fine, except that when I'm at ground level, it displays the height as 3 ft. Is there a way to offset it by 3 feet so that it reads "0" when it's sitting on the ground? A 747 pilot might not care, but this is for a chopper, so the difference isn't trivial!

Share this post


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

Well, you could subtract 3 from the value, but realize that is the way that they are supposed to work!The 3' is the height of the antenna above ground! :)

Share this post


Link to post
Share on other sites

The 3' is the height above ground your 'sensor' is in the chopper. I believe there's a way to zero it with the aircraft.cfg, but I don't remember off the top of my head.

Share this post


Link to post
Share on other sites

Hello Try (A:SIM ON GROUND,bool) if{ (A:Radio height, feet) (>L:radalt,feet) } %((A:Radio height, feet) (L:radalt,feet) - )%!d! Works for any aircraft.

Share this post


Link to post
Share on other sites

>>that is the way that they are supposed to work!That's what I suspected. If I were a rw chopper pilot, this would keep me awake all night long!>>The 3' is the height above ground your 'sensor' is in the>>chopper. I believe there's a way to zero it with the>>aircraft.cfg, but I don't remember off the top of my head.I think the number offset comes from the static_cg_height, but I would think that changing this will screw up my contact points. I'll try it and see what happens. I'll also try your code, pve.I guess what I need to do first is decide whether to keep the offset (wacky but rw), or get rid of it (much more useful but not rw).

Share this post


Link to post
Share on other sites

>I guess what I need to do first is decide whether to keep the>offset (wacky but rw), or get rid of it (much more useful but>not rw). Realize that forcing the value to be zero when on ground might "look pretty," but until actual touchdown, the radar altimeter will STILL BE REPORTING 3' AGLThe digital readout will simply drop from 3' AGL to 0' instantly... :-roll If it really, really bothers you all that much, it would be more consistent to simply subtract 3.0 from your displayed value... all the time!You could then state that your radar altimeter has been "calibrated" to compensate for the reflector's height above ground... :-beerchug

Share this post


Link to post
Share on other sites

>>If it really, really bothers you all that much, it would be more consistent to simply subtract 3.0 from your displayed value... all the time!How would I go about doing that, Bill? I tried putting a subtraction operand on the RADIO HEIGHT value, but couldn't get it working.

Share this post


Link to post
Share on other sites

(P:Units of measure,enum) 2 == if{ (A:RADIO HEIGHT, meters) 0.91439 - } els{ (A:RADIO HEIGHT, feet) 3 - }

Share this post


Link to post
Share on other sites

Works great Bill...thanks yet again!And thanks to WarpD and pve as well.:-cool

Share this post


Link to post
Share on other sites
I'm making a digital radar altimeter for FSX. I've got vertical strips containing the digits; the code for the "ones" and "tens" column looks like this (there are also columns for 100s, 1000s, and 10000s):
			<Element id="Altitude Display - 1s">				<FloatPosition>00.000,00.000</FloatPosition>				<Image id="radalt_numbers.bmp" Name="radalt_numbers.bmp">					<Transparent>True</Transparent>					<Axis>-64.000,197.000</Axis>					<Bright>True</Bright>				</Image>				<MaskImage id="radalt_mask.bmp" Name="radalt_mask.bmp">				</MaskImage>				<Shift id="Shift">					<Scale>0.000,22.000</Scale>					<Expression id="Expression">						<Minimum>0.000</Minimum>						<Maximum>10.000</Maximum>						<script>(P:Units of measure, enum) 2 == if{ (A:RADIO HEIGHT, meters) } els{ (A:RADIO HEIGHT, feet) } abs 99999 min 0 max 10 % 1 / flr</Script>					</Expression>				</Shift>			</Element>			<Element id="Altitude Display - 10s">				<FloatPosition>00.000,00.000</FloatPosition>				<Image id="radalt_numbers.bmp" Name="radalt_numbers.bmp">					<Transparent>True</Transparent>					<Axis>-50.000,197.000</Axis>					<Bright>True</Bright>				</Image>				<MaskImage id="radalt_mask.bmp" Name="radalt_mask.bmp">				</MaskImage>				<Shift id="Shift">					<Scale>0.000,22.000</Scale>					<Expression id="Expression">						<Minimum>0.000</Minimum>						<Maximum>10.000</Maximum>						<script>(P:Units of measure, enum) 2 == if{ (A:RADIO HEIGHT, meters) } els{ (A:RADIO HEIGHT, feet) } abs 99999 min 0 max 100 % 10 / flr</Script>					</Expression>				</Shift>			</Element>

It's working fine, except that when I'm at ground level, it displays the height as 3 ft. Is there a way to offset it by 3 feet so that it reads "0" when it's sitting on the ground? A 747 pilot might not care, but this is for a chopper, so the difference isn't trivial!

Share this post


Link to post
Share on other sites

Bill, I used something like this, it recalibrates once the aircraft is on the ground. The problem is that it does not calibrate for suspension squish quite as I like it..

<Macro Name="RAD">(P:Units of measure, enum) 2 == if{ (A:RADIO HEIGHT, meters) } els{ (A:RADIO HEIGHT, feet) }</Macro><Update>(A:SIM ON GROUND, bool) (G:Var1) 1 == @RAD (L:RADCALIBRATE, enum) - 0 == ! and and if{ 0 (>G:Var1) }(A:SIM ON GROUND, bool) (G:Var1) 0 == and if{ @RAD (>L:RADCALIBRATE, enum) 1 (>G:Var1) }(A:SIM ON GROUND, bool) ! (G:Var1) 1 == and if{ 0 (>G:Var1) }</Update>!-- Use this value --><Value>@RAD (L:RADCALIBRATE, enum) - </Value>

PS - I see this is an old thread --- Oh well.Roman

Share this post


Link to post
Share on other sites
PS - I see this is an old thread --- Oh well.Roman
No problem, Roman!Actually, I meant to add a bold comment at the top to indicate that this was a "necroed thread."You see, since the forum software change, XML script examples shared in the past are now "invisible!"So, whenever I have to search the forums for any reason and notice some "working example" posted, I "resurrect the dead" and encapsulate the XML script in

Share this post


Link to post
Share on other sites