• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FSXA External Power Supply

Messages
278
Country
ca-britishcolumbia
I have decided to add a external power supply to my aircraft (it has one in real life). I found one thread that lead me to where I'm at. My question is i have two volt strings (one for the APU and one for the GPU. Is their a way to use L: var to have them work independently? The switches do, but cant get the strings to repeat. Thanks for any help.

Greg

Code:
<Gauge Name="Aux Power Control" Version="1.0">
   <Image Name="aux_pwr_background.bmp"/>
   <Element>
      <Position X="88" Y="22"/>
      <Select>
         <Value Minimum="0" Maximum="2">(L:StartGroundCart,bool) (A:APU PCT STARTER, percent) near +</Value>
         <Case Value="0">
            <Image Name="popup_apu_switch_stop.bmp" Luminous="Yes"/>
         </Case>
         <Case Value="1">
            <Image Name="popup_apu_switch_run.bmp" Luminous="Yes"/>
         </Case>
         <Case Value="2">
            <Image Name="popup_apu_switch_start.bmp" Luminous="Yes"/>
         </Case>
      </Select>
   </Element>


[COLOR="Red"]   <Element>
      <Position X="22" Y="8"/>
      <Text Bright="Yes" X="50" Y="12" Length="8" Fixed="Yes" Font="Arial" Color="RED" FontHeight="14" Adjust="Center" VerticalAdjust="Center">
         <String>%(1&gt; (L:StartGroundCart,bool) ! and if 1 (A:APU:1 Volts, volts))%!3.1f! GPU  d 0 == ?)%!3d!</String>
      </Text>
   </Element>


   <Element>
      <Position X="22" Y="20"/>
      <Text Bright="Yes" X="50" Y="12" Length="8" Fixed="Yes" Font="Arial" Color="RED" FontHeight="14" Adjust="Center" VerticalAdjust="Center">
         <String>%(1&gt; (L:APU Run,number) ! and if 1 (A:APU Volts, volts))%!3.1f! APU  d 0 == ?)%!3d!</String>
      </Text>
   </Element>[/COLOR]


   <Element>
      <Position X="20" Y="52"/>
      <Select>
         <Value>(A:BRAKE PARKING POSITION, bool)</Value>
         <Case Value="0">
            <Image Name="gpu_avail_off.bmp" Luminous="Yes"/>
         </Case>
         <Case Value="1">
            <Image Name="gpu_avail_on.bmp" Luminous="Yes"/>
         </Case>
      </Select>
   </Element>
   <Element>
      <Position X="125" Y="22"/>
      <Select>
         <Value Minimum="0" Maximum="2">(L:APU Run,number) (A:APU PCT STARTER, percent) near +</Value>
         <Case Value="0">
            <Image Name="popup_apu_switch_stop.bmp" Luminous="Yes"/>
         </Case>
         <Case Value="1">
            <Image Name="popup_apu_switch_run.bmp" Luminous="Yes"/>
         </Case>
         <Case Value="2">
            <Image Name="popup_apu_switch_start.bmp" Luminous="Yes"/>
         </Case>
      </Select>
   </Element>
   <Mouse>
      <Area Left="90" Top="24" Width="18" Height="28">
         <Cursor Type="Hand"/>
         <Tooltip>START GPU</Tooltip>
         <Click>1 (>L:StartGroundCart,bool) 1 (>K:APU_STARTER) 1 (>K:APU_GENERATOR_SWITCH_SET)</Click>
      </Area>
      <Area Left="90" Top="46" Width="18" Height="23">
         <Cursor Type="Hand"/>
         <Tooltip>STOP GPU</Tooltip>
         <Click>0 (>L:StartGroundCart,bool) 0 (>K:APU_GENERATOR_SWITCH_SET) (>K:APU_OFF_SWITCH)</Click>
      </Area>
      <Area Left="127" Top="24" Width="18" Height="28">
         <Cursor Type="Hand"/>
         <Tooltip>Start APU</Tooltip>
         <Click>1 (>L:APU Run,number) 1 (>K:APU_STARTER) 1 (>K:APU_GENERATOR_SWITCH_SET)</Click>
      </Area>
      <Area Left="127" Top="46" Width="18" Height="23">
         <Cursor Type="Hand"/>
         <Tooltip>Start APU</Tooltip>
         <Click>0 (>L:APU Run,number) 0 (>K:APU_GENERATOR_SWITCH_SET) (>K:APU_OFF_SWITCH)</Click>
      </Area>
   </Mouse>
</Gauge>
 
APU:1 won't work, since no index is supported. There can be one, and only one APU.

This is completely fubared syntax:

  1. <String>%(1&gt; (L:APU Run,number) ! and if 1 (A:APU Volts, volts))%!3.1f! APU d 0 == ?)%!3d!</String>
  2. 1&gt; (L:APU Run,number) is backwards. It should be:
    (L:APU Run,number) 1 &lt;
  3. ! What is this supposed to do? It is a "not" operator and makes no syntatic sense here.
  4. 1 (A:APU Volts, volts) I have no idea whatever what you intend here, as there's no comparison operator.
  5. and if This is meaningless. The operator "if" must be {if}. The "and" has no function here since it's not followed by the closing parenthesis.
  6. APU d 0 == ?)%!3d! This is meaningless as well, since it isn't preceeded by the evaluate "%" operator.

Try simply writing out in pseudo-code precisely what you seek to display...
 
Thanks Bill

Ok bear with me, What i am attmepting to do is have two digital readouts, one for the GPU and one for the APU
(pic 1) Screenshots-01.jpg
and when the GPU is running would like to see the APU readout 0.0 and vice versa.
(pic 2) Screenshots-02.jpg

I dont even know if this can be done, but was hoping to use the L: var to trick fsx, if you may, to thinking they were seperate.

and hopefully this code makes more sense. Was taking shots in the dark trying to get it to work.

Code:
<Element>
      <Position X="22" Y="8"/>
      <Text Bright="Yes" X="50" Y="12" Length="8" Fixed="Yes" Font="Arial" Color="RED" FontHeight="14" Adjust="Center" VerticalAdjust="Center">
         <String>%( (L:StartGroundCart,bool) 1&lt; (A:APU Volts, volts))%!3.1f! GPU%</String>
      </Text>
   </Element>
   <Element>
      <Position X="22" Y="20"/>
      <Text Bright="Yes" X="50" Y="12" Length="8" Fixed="Yes" Font="Arial" Color="RED" FontHeight="14" Adjust="Center" VerticalAdjust="Center">
         <String>%( (L:APU Run,number) 1&lt; (A:APU Volts, volts))%!3.1f! APU%</String>
      </Text>
   </Element>
 
Okay, I see what you want, and your <String> is closer, but still has errors. The XML <String> schema is a stone-cold PITA to get right the first time:

Code:
         <String>%( (L:StartGroundCart,bool) 1&lt; (A:APU Volts, volts))%!3.1f! GPU%</String>

There is no space between the comparator and the operator 1 &lt;

There is no {if} to complete the conditional expression.

Try:
Code:
         <String>%((L:StartGroundCart,bool) 1 &lt;)%{if}%(A:APU Volts, volts)%!3.1f!% GPU%{end}</String>
 
Disappears on start

Thanks for help with this Bill.
Used you code as suggested. Now when you turn either on the string disappears. Any suggestions. Frantically reading the SDK trying to make sense of it.

pic2.jpg

Code:
 <Element>
      <Position X="22" Y="8"/>
      <Text Bright="Yes" X="50" Y="12" Length="8" Fixed="Yes" Font="Arial" Color="RED" FontHeight="14" Adjust="Center" VerticalAdjust="Center">
         <String>%((L:StartGroundCart,bool) 1 &t;)%{if}%(A:APU Volts, volts)%!3.1f!% GPU%{end}</String>
      </Text>
   </Element>
   <Element>
      <Position X="22" Y="20"/>
      <Text Bright="Yes" X="50" Y="12" Length="8" Fixed="Yes" Font="Arial" Color="RED" FontHeight="14" Adjust="Center" VerticalAdjust="Center">
         <String>%((L:APU Run,number) 1 &lt;)%{if}%(A:APU Volts, volts)%!3.1f!% APU%{end}</String>
      </Text>
   </Element>
 
Missing character in the first &lt; but I suspect that you want them to display whenever the L:var is ON (1), which would be "1 ==" or "0 &gt;". Either way will work.
Code:
 <Element>
      <Position X="22" Y="8"/>
      <Text Bright="Yes" X="50" Y="12" Length="8" Fixed="Yes" Font="Arial" Color="RED" FontHeight="14" Adjust="Center" VerticalAdjust="Center">
         <String>%((L:StartGroundCart,bool) 1 ==)%{if}%(A:APU Volts, volts)%!3.1f!% GPU%{end}</String>
      </Text>
   </Element>
   <Element>
      <Position X="22" Y="20"/>
      <Text Bright="Yes" X="50" Y="12" Length="8" Fixed="Yes" Font="Arial" Color="RED" FontHeight="14" Adjust="Center" VerticalAdjust="Center">
         <String>%((L:APU Run,number) 1 ==)%{if}%(A:APU Volts, volts)%!3.1f!% APU%{end}</String>
      </Text>
   </Element>
 
Wont display voltage.

Bill, thank you, thank you, thank you, for your time with this.

The script is now comming on independently, but wont display the voltage. I can't see anything wrong with the code, but am going to try playing around with. Is there anything obvious? Thanks again.

Greg

Screenshot-02.jpg

Code:
<Element>
      <Position X="22" Y="8"/>
      <Text Bright="Yes" X="50" Y="12" Length="8" Fixed="Yes" Font="Arial" Color="RED" FontHeight="14" Adjust="Center" VerticalAdjust="Center">
         <String>%((L:StartGroundCart,bool) 0 &gt;)%{if}%(A:APU Volts, volts)%!3.1f!% GPU%{end}</String>
      </Text>
   </Element>
   <Element>
      <Position X="22" Y="20"/>
      <Text Bright="Yes" X="50" Y="12" Length="8" Fixed="Yes" Font="Arial" Color="RED" FontHeight="14" Adjust="Center" VerticalAdjust="Center">
         <String>%((L:APU Run,number) 1 ==)%{if}%(A:APU Volts, volts)%!3.1f!% APU%{end}</String>
      </Text>
   </Element>
 
Yep! My bad! :(

The display variable needs double-parenthesis! As I said before, <Script> XML schema is strict and completely unforgiving! :eek:

Code:
((A:APU Volts, volts))

Code:
   <Element>
      <Position X="22" Y="8"/>
      <Text Bright="Yes" X="50" Y="12" Length="8" Fixed="Yes" Font="Arial" Color="RED" FontHeight="14" Adjust="Center" VerticalAdjust="Center">
         <String>%((L:StartGroundCart,bool) 0 &gt;)%{if}%((A:APU Volts, volts))%!3.1f!% GPU%{end}</String>
      </Text>
   </Element>
   <Element>
      <Position X="22" Y="20"/>
      <Text Bright="Yes" X="50" Y="12" Length="8" Fixed="Yes" Font="Arial" Color="RED" FontHeight="14" Adjust="Center" VerticalAdjust="Center">
         <String>%((L:APU Run,number) 1 ==)%{if}%((A:APU Volts, volts))%!3.1f!% APU%{end}</String>
      </Text>
   </Element>
 
A GREAT BIG THANKS Bill

Thanks Bill, works perfect. Does reading code ever get easy? I thank you for your patience and helping learn the inner workings of FSX.

Greg
 
Whats wrong with this logic

Thanks Tom for the words of encouragment, lol. I have made some progress and now getting tired and frustrated. I have been playing with the GPU available light most of the night now.

My logic is that the GPU will be only available while the plane is on the ground or must have a really long extension cord. So my logic, although limited is this:

GPU is available if the plane is on the ground and the parking brake is on. So looking through the SDK i came up with two Sim variables and came up with this:

Code:
<Value>(L:GPUAVAIL,bool) 1 == (A:PLANE ALT ABOVE GROUND, feet) 0 &lt; AND 1 (&gt;A:BRAKE PARKING POSITION, bool)</Value>

In my mind it should be reading the
(L:VAR) as the GPU Unit
1 == Available if equal
(A:PLANE....) 0&lt As actually being on the ground
AND 1 (&gt;A:BRAKE....) as having the park brake set

Where am i going wrong. I have tried several combinations and still nothing. Thank for any help.

Greg

if interested here is the code so far:

Code:
<Gauge Name="Aux Power Control" Version="1.0">
   <Image Name="aux_pwr_background.bmp"/>
   <Element>
      <Position X="88" Y="22"/>
      <Select>
         <Value Minimum="0" Maximum="2">(L:StartGroundCart,bool) (A:APU PCT STARTER, percent) near +</Value>
         <Case Value="0">
            <Image Name="popup_apu_switch_stop.bmp" Luminous="Yes"/>
         </Case>
         <Case Value="1">
            <Image Name="popup_apu_switch_run.bmp" Luminous="Yes"/>
         </Case>
         <Case Value="2">
            <Image Name="popup_apu_switch_start.bmp" Luminous="Yes"/>
         </Case>
      </Select>
   </Element>
   <Element>
      <Position X="22" Y="8"/>
      <Text Bright="Yes" X="50" Y="12" Length="8" Fixed="Yes" Font="Arial" Color="RED" FontHeight="14" Adjust="Center" VerticalAdjust="Center">
         <String>%((L:StartGroundCart,bool) 1 ==)%{if}%((A:APU Volts, volts))%!3.1f!% GPU%{end}</String>
      </Text>
   </Element>
   <Element>
      <Position X="22" Y="20"/>
      <Text Bright="Yes" X="50" Y="12" Length="8" Fixed="Yes" Font="Arial" Color="RED" FontHeight="14" Adjust="Center" VerticalAdjust="Center">
         <String>%((L:APU Run,number) 1 ==)%{if}%((A:APU Volts, volts))%!3.1f!% APU%{end}</String>
      </Text>
   </Element>
   <Element>
      <Position X="20" Y="52"/>
      <Select>
         <Value>(L:GPUAVAIL,bool) 1 == (A:PLANE ALT ABOVE GROUND, feet) 0 &lt; AND 1 (&gt;A:BRAKE PARKING POSITION, bool)</Value>
         <Case Value="0">
            <Image Name="gpu_avail_off.bmp" Luminous="Yes"/>
         </Case>
         <Case Value="1">
            <Image Name="gpu_avail_on.bmp" Luminous="Yes"/>
         </Case>
      </Select>
   </Element>
   <Element>
      <Position X="125" Y="22"/>
      <Select>
         <Value Minimum="0" Maximum="2">(L:APU Run,number) (A:APU PCT STARTER, percent) near +</Value>
         <Case Value="0">
            <Image Name="popup_apu_switch_stop.bmp" Luminous="Yes"/>
         </Case>
         <Case Value="1">
            <Image Name="popup_apu_switch_run.bmp" Luminous="Yes"/>
         </Case>
         <Case Value="2">
            <Image Name="popup_apu_switch_start.bmp" Luminous="Yes"/>
         </Case>
      </Select>
   </Element>
   <Element>
      <Position X="154" Y="32"/>
      <Select>
         <Value>(A:APU ON FIRE DETECTED, bool)</Value>
         <Case Value="0">
            <Image Name="popup_apu_fire_off.bmp"/>
         </Case>
         <Case Value="1">
            <Image Name="popup_apu_fire_on.bmp" Bright="Yes"/>
         </Case>
     </Select>		 
   </Element>
   <Element>
       <Position X="50" Y="52"/>
       <Select>
          <Value>(A:APU ON FIRE DETECTED, bool)</Value>
          <Case Value="0">
             <Image Name="fault_off.bmp"/>
          </Case>
          <Case Value="1">
             <Image Name="fault_on.bmp"/>
  	  </Case>
      </Select>		 
    </Element>
    <Mouse>
      <Area Left="90" Top="24" Width="18" Height="28">
         <Cursor Type="Hand"/>
         <Tooltip>START GPU</Tooltip>
         <Click>1 (>L:StartGroundCart,bool) 1 (>K:APU_STARTER) 1 (>K:APU_GENERATOR_SWITCH_SET)</Click>
      </Area>
      <Area Left="90" Top="46" Width="18" Height="23">
         <Cursor Type="Hand"/>
         <Tooltip>STOP GPU</Tooltip>
         <Click>0 (>L:StartGroundCart,bool) 0 (>K:APU_GENERATOR_SWITCH_SET) (>K:APU_OFF_SWITCH)</Click>
      </Area>
      <Area Left="127" Top="24" Width="18" Height="28">
         <Cursor Type="Hand"/>
         <Tooltip>Start APU</Tooltip>
         <Click>1 (>L:APU Run,number) 1 (>K:APU_STARTER) 1 (>K:APU_GENERATOR_SWITCH_SET)</Click>
      </Area>
      <Area Left="127" Top="46" Width="18" Height="23">
         <Cursor Type="Hand"/>
         <Tooltip>Start APU</Tooltip>
         <Click>0 (>L:APU Run,number) 0 (>K:APU_GENERATOR_SWITCH_SET) (>K:APU_OFF_SWITCH)</Click>
      </Area>
      <Area Left="162" Top="29" Width="30" Height="30">
         <Cursor Type="Hand"/>
         <Tooltip>FIRE SUPRESSION</Tooltip>
         <Click>1 (&gt;K:APU_EXTINGUISH_FIRE)</Click>
      </Area>
   </Mouse>
</Gauge>
 
Reverse Polish Notation is used in XML...

The general form for setting a custom L:variable's value is:

(condition1,unit) (condition2,unit) and if{ (>L:variable,unit) }


This is meaningless:
Code:
<Value>(L:GPUAVAIL,bool) 1 == (A:PLANE ALT ABOVE GROUND, feet) 0 &lt; AND 1 (&gt;A:BRAKE PARKING POSITION, bool)</Value>

Even if formatted correctly it wouldn't work because the aircraft is never going to be less than 0' above the ground! :eek:

Use the (A:SIM ON GROUND,bool) variable instead.

Correctly formated then, it should be:
Code:
(A:BRAKE PARKING POSITION,bool) (A:SIM ON GROUND,bool) and 
   if{ 1 (>L:GPUAVAIL,bool) }

In pseudo-code normal sentence format:
if (parking brake set) and (plane on ground) then (GPU Available) is TRUE.
 
I missing something

Thanks Bill

So thinking in reverse, from the way i normally do, this makes sense. Sorry i look at things and say OK how do I turn it on. With code I believe they would call the term reverse enginering, lol.

So using the proper format, the (L:VAr) wont trigger the case values. I took out the "and if" statement and it would trigger in the air, but would remain "on" when on the ground regardless of parking brake. Am i missing something to trigger the Case Values? Also with (L:Var), are we just just telling it something to complete the sentence, or does the computer actually read it it to trigger values?

Code:
<Element>
      <Position X="20" Y="52"/>
      <Select>
         <Value>(A:BRAKE PARKING POSITION,bool) (A:SIM ON GROUND,bool) and if{ 1 (>L:GPUAVAIL,bool) }</Value>
         <Case Value="0">
            <Image Name="gpu_avail_off.bmp" Luminous="Yes"/>
         </Case>
         <Case Value="1">
            <Image Name="gpu_avail_on.bmp" Luminous="Yes"/>
         </Case>
      </Select>
   </Element>
 
You have to think about what you are doing in that code. Note that the section containing your expression is called Value. That means that the expression inside those tags will provide the *value* for the Case statements that follow.

What is the value of this statement?

Code:
         <Value>(A:BRAKE PARKING POSITION,bool) (A:SIM ON GROUND,bool) and if{ 1 (>L:GPUAVAIL,bool) }</Value>

Why, I don't really know. The computer might figure it out, but it almost certainly won't be what you expected! My guess is that this statement is "true" all the time, since it successfully goes to completion.

Now, this statement has a value:

Code:
         <Value>(A:BRAKE PARKING POSITION,bool) (A:SIM ON GROUND,bool) and </Value>

If Brake Parking Position is not 0 and Sim On Ground is not 0, then this expression's value is 1, if not it's 0. So this most likely will work:

Code:
<Element>
      <Position X="20" Y="52"/>
      <Select>
         <Value>(A:BRAKE PARKING POSITION,bool) (A:SIM ON GROUND,bool) and }</Value>
         <Case Value="0">
            <Image Name="gpu_avail_off.bmp" Luminous="Yes"/>
         </Case>
         <Case Value="1">
            <Image Name="gpu_avail_on.bmp" Luminous="Yes"/>
         </Case>
      </Select>
   </Element>

If you need to also have an L: variable (not needed for this code, however), then AFAIK you would need two elements:

Code:
<Element>
      <Select>
         <Value>(A:BRAKE PARKING POSITION,bool) (A:SIM ON GROUND,bool) and (>L:GPUAVAIL,bool) </Value>
      </Select>
   </Element>
<Element> 
       <Position X="20" Y="52"/>
       <Select>
         <Value>(L:GPUAVAIL,bool) </Value>
      <Case Value="0">
            <Image Name="gpu_avail_off.bmp" Luminous="Yes"/>
         </Case>
         <Case Value="1">
            <Image Name="gpu_avail_on.bmp" Luminous="Yes"/>
         </Case>
      </Select>
   </Element>

The first element could also be in the Update section, if you prefer.

Hope this helps,
 
Thanks for the assist Tom. Here is your suggested script with some minor corrections... :D

Code:
<Element>
      <Position X="20" Y="52"/>
      <Select>
         <Value>(A:BRAKE PARKING POSITION,bool) (A:SIM ON GROUND,bool) and </Value>
         <Case Value="0">
            <Image Name="gpu_avail_off.bmp" Luminous="Yes"/>
         </Case>
         <Case Value="1">
            <Image Name="gpu_avail_on.bmp" Luminous="Yes"/>
         </Case>
      </Select>
   </Element>

If you need to also have an L: variable (not needed for this code, however), then AFAIK you would need two elements:

Code:
<Element>
      <Select>
         <Value>
              (A:BRAKE PARKING POSITION,bool) (A:SIM ON GROUND,bool) and
              if{ 1 (>L:GPUAVAIL,bool) } els{ 0 (>L:GPUAVAIL,bool) }
         </Value>
      </Select>
   </Element>
<Element> 
       <Position X="20" Y="52"/>
       <Select>
         <Value>(L:GPUAVAIL,bool) </Value>
      <Case Value="0">
            <Image Name="gpu_avail_off.bmp" Luminous="Yes"/>
         </Case>
         <Case Value="1">
            <Image Name="gpu_avail_on.bmp" Luminous="Yes"/>
         </Case>
      </Select>
   </Element>
 
OK, So as the goes on why does it seem to get more complex

A big thanks to you both, for your patience and help with this.

So if im understanding this correctly....

Code:
   <Element>
      <Select>
         <Value>(A:BRAKE PARKING POSITION,bool) (A:SIM ON GROUND,bool) and if{ 1 (>L:GPUAVAIL,bool) } els{ 0 (>L:GPUAVAIL,bool) }</Value>
      </Select>
   </Element>

This Element is basically giving the (L:Value) it meaning by saying that the (Brake/Sim) conditions are combined in this variable being able to both be true or false.

Then this allows us to:

Code:
<Element>
      <Position X="20" Y="52"/>
      <Select>
         <Value>(L:GPUAVAIL,bool)</Value>
         <Case Value="0">
            <Image Name="gpu_avail_off.bmp" Luminous="Yes"/>
         </Case>
         <Case Value="1">
            <Image Name="gpu_avail_on.bmp" Luminous="Yes"/>
         </Case>
      </Select>
   </Element>

to create this code that allows to illiminate a light as to whether the GPU is available or not. So far working perfectly. As did the other example.

So with this i figured i then could actually isolate the Start/Run/Stop swith with the same (L:Var) to actually prevent start up of the GPU if in the "true" condition.

Code:
   <Element>
      <Position X="88" Y="22"/>
      <Select>
         <Value Minimum="0" Maximum="2">(A:APU PCT STARTER, percent) if{ 1 (>L:GPUAVAIL,bool) }</Value>
         <Case Value="0">
            <Image Name="popup_apu_switch_stop.bmp" Luminous="Yes"/>
         </Case>
         <Case Value="1">
            <Image Name="popup_apu_switch_run.bmp" Luminous="Yes"/>
         </Case>
         <Case Value="2">
            <Image Name="popup_apu_switch_start.bmp" Luminous="Yes"/>
         </Case>
      </Select>
   </Element>

<Value Minimum="0" Maximum="2">(A:APU PCT STARTER, percent) if{ 1 (>L:GPUAVAIL,bool) }</Value>

So using this logic I read it as the button will start the GPU (condition) if the (L:Var) is True.

What i get in reality is Case Value 2 remains and the GPU starts with no indication. Regardless if the (L:Var) is true or false.

Changing it to

Code:
<Value Minimum="0" Maximum="2">(>L:GPUAVAIL,bool) if{ 1 (>A:APU PCT STARTER, percent) near + }</Value>

Gave me Case Value 1. I tried several other sentences, but all basically had the same effect.

So what is the difference between this logic with an added condition and the three Case Values? Can the switch even be isolated from turning on what is the actually APU regardless of what conditions and (L:Var) I try to apply?

This is actually very interesting and educational, I really appreaciate you sharing your knowledge and experience with me to writing this stuff. Thank you both again

Greg
 
The short answer is that you are trying the same thing again, and we already told you you can't do that. You are trying to use an IF statement followed by Case statements. You CAN'T do that.
 
Not only that, but you're also trying to control the same (L:GPUAVAIL,bool) variable in two different places. This (L:GPUAVAIL,bool) variable is boolean; meaning it should only ever be "true" or "false" (1 or 0).

If you want to have more than two probable outcomes, then you should use either "number" or "enum" for the units.

Honestly, if you simply first write out (in simple english) your logic chain, then trace through with a pencil to validate the logic tree...

...then it will be time to "translate" that into XML script.
 
Last edited:
OK I'M AN IDIOT or just can't see things that are probably obvious, I dont know

Thanks Guys,

I'm sure your patience is wearing thin with me and just wating for the XML Code police to take me and my SDK away or at least the guy in white jackets.

Ok i finally get what your saying about the {if} statements, as much as I write the sentence, ignore the urge to add it with case values. I also am starting to understand the true/false with the bool.

Bear with me please, im the verge of of melt down, not really, but am thinking hiring a 8 year old to write the code in 5 minutes then look at me like im stupid.

So sifting through code and the SDK to find examples I keep getting the same theme

Code:
 <Value>(Expression:Variable, unit) (Expression:Variable, Unit) operator</Value>

So if i am still right in assuming the element written gives my (L:VAR) it's meaning in this case Brake/Ground is either true or false.

Code:
<Value>(A:BRAKE PARKING POSITION,bool) (A:SIM ON GROUND,bool) and if{ 1 (>L:GPUAVAIL,number) } els{ 0 (>L:GPUAVAIL,number) }</Value>

which works well with two case values. So following my logic this should mean that

Code:
<Value Minimum="0" Maximum="2">(L:GPUAVAIL,number) (A:APU PCT STARTER, percent) near +</Value>

when the condition of the (L:VAR) being true is meet it will start the GPU. Which it sorta does with two case values but never the third. In this example, the guage displays when:

the (L:GPUAVAIL,number) is "True" I get Case Value 1 displayed then when started i get Case Value 2 then back to 1 - and the APU displays on.

When "False" I get Case Value 0 then when started Case Value 2 then back to 0 - and the APU still turns on regardless of the False condition.

I have tried various combinations of various Comparison, Bit and Logical Operators all with different effect but never displaying the third Case Value, although i did get a flicker once or twice; and the APU in all cases will start.

So am i correct in assuming that the way the (L:VAR) is written it will only allow two case values?

Also am i wasting my time to have this condition in the Start/Run/Stop switch as regardless of condition as there is only 1 APU starter and I'm trying to make (A:APU PCT STARTER, percent) perform seperately with the GPU and APU.

Thanks for your input as i'm really trying to get my head wrapped around this and although i think it may be easier to do a double deluxe crossword in a foreign language.

Greg
 
Images of code dancing through my head

Laying in bed trying to sort this out in my mind had to get up and pass this along before i wrote more bad code and wasted time on something that would never work. Two questions keep surfacing.

1.) What do I actually want the switch to do?

answer: Isolate/disable the start/run/stop switch when the plane is not on the ground with the parking brake on. as with GPU avail light thus preventing start up on that switch.

as i am using the same (A:APU PCT STARTER) variable to control two "seperate" switches is this part of the problem or am i looking in the wrong direction.

2.) Do I need to start looking at different expressions to provide the desired outcome?

ie the (G:VAR). or am I making it far more difficult than it needs to be?

thanks
Greg
 
Back
Top