FSDeveloper Community

Go Back   FSDeveloper Community > Microsoft Flight Simulator development > Aircraft Design > Gauges

Gauges Use this forum for all your gauges related discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 10 Dec 2011, 11:15
mike november mike november is offline
  germany
Location: Close to Flensburg
Join Date: Dec 2010
Posts: 64
XML Code Help needed

Hi there,

I am working on a Caution Panel for a helicopter project and am stuck on some of the code...

1. Generator Lights are coded like this:

<Element id="No.1 Generator OFF">
<FloatPosition>60.000,30.000</FloatPosition>
<Visibility>(A:GENERAL ENG GENERATOR ACTIVE:1,bool) 0.5 &gt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if{ 0 } els{ 1 }</Visibility>
<SizeScale>1.400</SizeScale>
<Image id="Caution_No1_Generator_ON.bmp" Name="Caution_No1_Generator_ON.bmp">
<Transparent>True</Transparent>
</Image>
</Element>


Basically they work fine, but, they maintain lit when the battery is switched off....

2. Hydraulic Pressure Lights are coded like this:

<Element id="Aux Servo Press">
<FloatPosition>170.000,245.000</FloatPosition>
<Visibility>(A:Engine HYDRAULIC PRESSURE,Pounds per square foot) 1008000 &lt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if { 1 } els { 0 }</Visibility>
<SizeScale>1.400</SizeScale>
<Image id="Caution_Aux_Servo_Press_ON.bmp" Name="Caution_Aux_Servo_Press_ON.bmp">
<Transparent>True</Transparent>
</Image>
</Element>

They aren't doing anything

3. Fuel Low Lights are coded like this:

<Element id="FWD Fuel Low">
<FloatPosition>62.000,138.000</FloatPosition>
<Visibility> (A:Fuel Tank Right Main Quantity,gallons) 40 &lt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if { 0 } els{ 1 }</Visibility>
<SizeScale>1.400</SizeScale>
<Image id="Caution_Fwd_Fuel_Low_ON.bmp" Name="Caution_Fwd_Fuel_Low_ON.bmp">
<Transparent>True</Transparent>
</Image>
</Element>

They also don't do nothing...


Any help would be highly appreciated.
Reply With Quote
  #2  
Old 10 Dec 2011, 11:28
chris's Avatar
chris chris is offline
  indonesia
Join Date: Jan 2009
Posts: 453
The second two have a space between the 'if/else' and the '{'.

The first one you could possibly use;

A:ELECTRICAL MASTER BATTERY,Bool

instead of the partial panel variable.

I've never used partial panels like that, I usually put them in the the failures section ... I feel a little test gauge coming on ...

Last edited by chris; 10 Dec 2011 at 11:35. Reason: speeling
Reply With Quote
  #3  
Old 10 Dec 2011, 11:47
mike november mike november is offline
  germany
Location: Close to Flensburg
Join Date: Dec 2010
Posts: 64
Hey Chris, thanks a lot, will try that out asap
Reply With Quote
  #4  
Old 10 Dec 2011, 21:26
mike november mike november is offline
  germany
Location: Close to Flensburg
Join Date: Dec 2010
Posts: 64
Ok, problems solved. Actually the usage of the "ELECTRICAL MASTER BATTERY" value made no difference, but while looking at that line of code again, I suddenly knew it...

Here's what I did:
<Visibility>(A:GENERAL ENG GENERATOR ACTIVE:1,bool) 0.5 &lt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if{ 1 } els{ 0 }</Visibility>
Reply With Quote
  #5  
Old 17 Feb 2012, 06:25
mike november mike november is offline
  germany
Location: Close to Flensburg
Join Date: Dec 2010
Posts: 64
OK, here I am again. The Caution Panel still working as it is expected to do, I drilled new holes into my panel to fill them with lights. Unfortunately, they do display right on lamptest, the don't display on the set condition. Anyone here to help me up that horse?

1. Battery_Hot_Light

This Light should be lit in case, that Battery is ON, respective Generator is ON and a certain amount of time has passed...

Quote:
<SimGauge.Gauge id="Gauge" ArtDirectory="F:/Mk41">
<FloatPosition>0.000,0.000</FloatPosition>
<Size>26,26</Size>
<Image id="RED_Off.bmp" Name="RED_Off.bmp">
<Transparent>True</Transparent>
</Image>
<Element id="Lamptest">
<FloatPosition>0.000,0.000</FloatPosition>
<Visibility>(L:Lamp_Test,bool) 0.5 &gt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if{ 1 } els{ 0 }</Visibility>
<Image id="RED_ON.bmp" Name="RED_ON.bmp">
<Transparent>True</Transparent>
<Bright>True</Bright>
<Luminous>True</Luminous>
</Image>
</Element>
<Element id="Battery_Hot">
<FloatPosition>0.000,0.000</FloatPosition>
<Visibility>(A:ELECTRICAL MASTER BATTERY,bool) 0.5 &gt; (A:GENERAL ENG GENERATOR ACTIVE:1,bool) 0,5 &gt; and if{ 1 } els{ 0 }</Visibility>
<Image id="RED_ON.bmp" Name="RED_ON.bmp">
<Transparent>True</Transparent>
<Bright>True</Bright>
<Luminous>True</Luminous>
</Image>
</Element>
</SimGauge.Gauge>
2. Load_On_Hook_Light

his is to be lit, when there ist something attached to either sling or hoist.

Quote:
<SimGauge.Gauge id="Gauge" ArtDirectory="F:/Mk41">
<FloatPosition>0.000,0.000</FloatPosition>
<Size>26,26</Size>
<Image id="RED_Off.bmp" Name="RED_Off.bmp">
<Transparent>True</Transparent>
</Image>
<Element id="Lamptest">
<FloatPosition>0.000,0.000</FloatPosition>
<Visibility>(L:Lamp_Test,bool) 0.5 &gt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if{ 1 } els{ 0 }</Visibility>
<Image id="GREEN_ON.bmp" Name="GREEN_ON.bmp">
<Transparent>True</Transparent>
<Bright>True</Bright>
<Luminous>True</Luminous>
</Image>
</Element>
<Element id="Hoist">
<FloatPosition>0.000,0.000</FloatPosition>
<Visibility>(L:SLING OBJECT ATTACHED:0,bool) 0.5 &gt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if{ 1 } els{ 0 }</Visibility>
<Image id="GREEN_ON.bmp" Name="GREEN_ON.bmp">
<Transparent>True</Transparent>
<Bright>True</Bright>
<Luminous>True</Luminous>
</Image>
</Element>
<Element id="External_Load">
<FloatPosition>0.000,0.000</FloatPosition>
<Visibility>(L:SLING OBJECT ATTACHED:1,bool) 0.5 &gt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if{ 1 } els{ 0 }</Visibility>
<Image id="GREEN_ON.bmp" Name="GREEN_ON.bmp">
<Transparent>True</Transparent>
<Bright>True</Bright>
<Luminous>True</Luminous>
</Image>
</Element>
</SimGauge.Gauge>
3. Auto_Catch_Light

Here I want the light to work, when the "pickup mode" of sling/hoist is activated...

Quote:
<SimGauge.Gauge id="Gauge" ArtDirectory="F:/Mk41">
<FloatPosition>0.000,0.000</FloatPosition>
<Size>26,26</Size>
<Image id="RED_Off.bmp" Name="RED_Off.bmp">
<Transparent>True</Transparent>
</Image>
<Element id="Lamptest">
<FloatPosition>0.000,0.000</FloatPosition>
<Visibility>(L:Lamp_Test,bool) 0.5 &gt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if{ 1 } els{ 0 }</Visibility>
<Image id="AMBER_ON.bmp" Name="AMBER_ON.bmp">
<Transparent>True</Transparent>
<Bright>True</Bright>
<Luminous>True</Luminous>
</Image>
</Element>
<Element id="Hoist">
<FloatPosition>0.000,0.000</FloatPosition>
<Visibility>(A:SLING HOOK IN PICKUP MODE:0,bool) 0.5 &gt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if{ 1 } els{ 0 }</Visibility>
<Image id="AMBER_ON.bmp" Name="AMBER_ON.bmp">
<Transparent>True</Transparent>
<Bright>True</Bright>
<Luminous>True</Luminous>
</Image>
</Element>
<Element id="External_Load">
<FloatPosition>0.000,0.000</FloatPosition>
<Visibility>(A:SLING HOOK IN PICKUP MODE:1,bool) 0.5 &gt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if{ 1 } els{ 0 }</Visibility>
<Image id="AMBER_ON.bmp" Name="AMBER_ON.bmp">
<Transparent>True</Transparent>
<Bright>True</Bright>
<Luminous>True</Luminous>
</Image>
</Element>
</SimGauge.Gauge>
Thanks in advance for your help.
Reply With Quote
  #6  
Old 17 Feb 2012, 17:59
n4gix n4gix is offline
  unitedstates
Location: Hammond, Indiana
Join Date: Sep 2006
Posts: 8,528
Quote:
Originally Posted by mike november View Post
Ok, problems solved. Actually the usage of the "ELECTRICAL MASTER BATTERY" value made no difference, but while looking at that line of code again, I suddenly knew it...

Here's what I did:
<Visibility>(A:GENERAL ENG GENERATOR ACTIVE:1,bool) 0.5 &lt; (A:PARTIAL PANEL ELECTRICAL,enum) ! and if{ 1 } els{ 0 }</Visibility>
That really makes no sense at all. A 'bool' type variable can only ever be either 0 or 1...

Also, it has been mentioned many times that even the programmers have stated that the only guaranteed value is 0 (zero). Because of rounding errors, frequently instead of 1 we might actually get 0.999999998, which of course would cause a check for 1 to fail.

Best chance for success is to always check for zero or not-zero

(A:GENERAL ENG GENERATOR ACTIVE:1,bool) 0 == (battery off)
(A:GENERAL ENG GENERATOR ACTIVE:1,bool) 0 != (battery on)
__________________
Bill Leaming
3d Modeler Max/GMax
C & XML Gauge Programmer
Eaglesoft Development Group
http://eaglesoftdg.com

Intel® Core™ i7-3770k 4.2GHz - Crucial 16GB DDR3 - Dual Radeon HD770 1GB DDR5 (Crossfire) - Eco II Watercooling - Win7 64bit
Intel® Core™ i7-2600k 3.4GHz - Crucial 4GB DDR3 - NVIDIA GeForce GTX550Ti 1GB - Win7 64bit
Intel® Core™ i7-860 2.8GHz - Crucial 8GB DDR3 - NVIDIA GeForce GTS240 1GB - Win8 64bit
NOTE: Unless explicitly stated otherwise, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...
Reply With Quote
  #7  
Old 17 Feb 2012, 18:04
mike november mike november is offline
  germany
Location: Close to Flensburg
Join Date: Dec 2010
Posts: 64
Hey Bill,

thx for the reply. The funny thing is, my code, as false as it may be, works flawless... for whatever reason...
Reply With Quote
  #8  
Old 17 Feb 2012, 18:26
n4gix n4gix is offline
  unitedstates
Location: Hammond, Indiana
Join Date: Sep 2006
Posts: 8,528
Quote:
Originally Posted by mike november View Post
Hey Bill,

thx for the reply. The funny thing is, my code, as false as it may be, works flawless... for whatever reason...
Well of course it does, after all 0.5 is definitely less than 1.0...

It's just a very strange way of writing boolean logic!
__________________
Bill Leaming
3d Modeler Max/GMax
C & XML Gauge Programmer
Eaglesoft Development Group
http://eaglesoftdg.com

Intel® Core™ i7-3770k 4.2GHz - Crucial 16GB DDR3 - Dual Radeon HD770 1GB DDR5 (Crossfire) - Eco II Watercooling - Win7 64bit
Intel® Core™ i7-2600k 3.4GHz - Crucial 4GB DDR3 - NVIDIA GeForce GTX550Ti 1GB - Win7 64bit
Intel® Core™ i7-860 2.8GHz - Crucial 8GB DDR3 - NVIDIA GeForce GTS240 1GB - Win8 64bit
NOTE: Unless explicitly stated otherwise, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...
Reply With Quote
  #9  
Old 17 Feb 2012, 18:27
mike november mike november is offline
  germany
Location: Close to Flensburg
Join Date: Dec 2010
Posts: 64
Oh, eeeeeeeeeeeeh... true
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help with Animations fsnewbie Modeling 17 10 Mar 2010 17:28
Gauge code question lionheart Gauges 1 12 Aug 2009 14:58
Wonderfull error list supercar1000 FSX Planner 4 06 Aug 2008 12:59
ILS Altitude Alan McGaughey Airport Design Editor 18 06 Aug 2008 04:49


All times are GMT -4. The time now is 11:06.

Kirsch designed by Andrew & Austin


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.