• 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

You need to be more specific - EXACTLY what behavior do you want when the conditions are not fulfilled?

First, do you really need the L: variable? Use it only when it is used in other parts of the gauge, or needed for other gauges too. Otherwise just use the condition itself and don't load that condition into an L: variable. That's a waste of code.

Do you want the switch to be disabled? In this case a Visible line in the Mouse section will remove the click spot and nothing will happen when they try.

Do you want the switch to move but nothing happens? In this case there needs to be a condition and IF statement in the Click line to change/not change an L: variable in that case.

Do you want the switch to move, and something else to happen? (error message, etc.). Then this behavior needs to be coded in the Click line.

Hope this helps,
 
A great big thank you

Thank you so much guys with all your guidance on this, got it and works as exactly as I envisioned.

I kept the (L:VAR) as it is used in two spots and it wont display in the display string unless the conditions are meet. The switch element works as intended now as i went with using the origanal format. I went with the <Visible> string to disable the switch, feeling that is what usually happens (nothing).

Code:
<Visible>(A:BRAKE PARKING POSITION,bool) 1 == 
(A:SIM ON GROUND,bool) 1 == &amp;&amp; </Visible>

All that is left is putting some faults into the guage. The APU XML's I have looked at have the light, but no actual triggers to work it.

Which brings me to my last question...

What would i place into the code to have the fault light trigger between two values. Using Volts as one of the conditions i would like it to trigger between 5 volts and 20 volts. and "off" above or below these values. Is there a way? I can't find anything in the SDK that leads me to it.

Thanks again and have found this a vaulable experience and consider myself very lucky to have two knowledgable people as youselves offering their assistance, as painful as it must of been. I will post the final version for all when I am completed.

Greg
 
Off the top of my head, try using 5 20 rng in the <Visible> tag. This means the return is "true" only between 5 and 20 (volts).

Code:
<Visible>(A:APU_Volts,volts) 5 20 rng</Visible>
 
Once again a BIG THANK YOU

Thanks again it works, although im sure it has some errors, or a better way to write it. But never less it works. I learned a lot from you gentlemen and really appreaciate all your support and patience.

Greg

Here is the final result

Code:
 REMOVED SEE BELOW (Due to significant changes)
 
Last edited:
AHHHHHHHHHH Just when you think your done!!!

Sorry, just me again.

I used the new guage last night and started noticing things i didn't like or never made sense. most of it was cleaning up the xml a bit (see the edited version in the above post). What I found was that when you turned on either the APU or GPU you could hit the stop button on either switch and shut down the "APU" and leaving the other switch in run mode with no power. to prevent this i created two <Visible> lines in the mouse section.

Code:
<Visible>(L:STARTGROUNDCART,bool) 1 == (A:APU GENERATOR ACTIVE,bool) 1 == &amp;&amp; </Visible>

Code:
<Visible>(L:APU Run,bool) 1 == (A:APU GENERATOR ACTIVE,bool) 1 == &amp;&amp; </Visible>

Basically i felt you can't turn off what isn't on. This works great "IF" and wait for it.....

your only using one unit, see maybe im not as stupid as I thought.

So the problem with this now is when "both" units are running and you turn one off the other switch remains in "run" mode and the APU shuts off isolating the stop switches.

so how do I convience the guage that when "both units" are running you shut one down it leaves the APU running and just turns of that one switch?

Thanks and sorry for being such a pain in the.....

Greg
 
Oh my. The best I can do at the moment is post the scripts I'm using for APU and GPU myself. Perhaps you can discover the logic I'm using. Although this is XML script for a 3d model, the "stuff" contained in <CallbackCode> sections is directly copy/pasteable into a 2d gauge's <Click> section.

In the Ground Power Switch, the second time I check for -1, I check the state of the APU switch. If it is "off" then it's okay to shut down the APU, otherwise it's left running and only the "physical switch" is set off and the APU is left running.

Ground Power Switch:
Code:
      <MouseFlags>LeftSingle+RightSingle+WheelUp+WheelDown</MouseFlags>
      <CallbackCode>
        (M:Event) 'LeftSingle' scmp 0 ==
        if{ (L:B737_GRND_Pwr, enum) ++ 1 min (>L:B737_GRND_Pwr, enum) }
        (M:Event) 'WheelDown' scmp 0 ==
        if{ (L:B737_GRND_Pwr, enum) ++ 1 min (>L:B737_GRND_Pwr, enum) }
        (M:Event) 'RightSingle' scmp 0 ==
        if{ (L:B737_GRND_Pwr, enum) -- -1 max (>L:B737_GRND_Pwr, enum) }
        (M:Event) 'WheelUp' scmp 0 ==
        if{ (L:B737_GRND_Pwr, enum) -- -1 max (>L:B737_GRND_Pwr, enum) }
        (L:B737_GRND_Pwr, enum) -1 == if{ 0 (>L:B737_GRND_Pwr_ON,enum) (E:LOCAL TIME,seconds) 0.5 + (>L:Reset,enum) 1 (>L:XMLSND5,bool) }
        (L:B737_GRND_Pwr, enum) -1 == (L:B737_APU_PwrSwitch, enum) 0 == and if{ 0 (>K:APU_GENERATOR_SWITCH_SET) (>K:APU_OFF_SWITCH) 0 (>L:B737_APU_Bus1_Tied,enum) 0 (>L:B737_APU_Bus2_Tied,enum) }
        (L:B737_GRND_Pwr, enum) 1 == if{ (>K:APU_STARTER) 1 (>K:APU_GENERATOR_SWITCH_SET) 1 (>L:B737_APU_Bus1_Tied,enum) 1 (>L:B737_APU_Bus2_Tied,enum) 1 (>L:B737_GRND_Pwr_ON,enum) (E:LOCAL TIME,seconds) 0.5 + (>L:Reset,enum) 1 (>L:XMLSND5,bool) }
      </CallbackCode>

APU Switch:
Code:
  <MouseFlags>LeftSingle+LeftRelease+RightSingle+WheelUp+WheelDown+Leave</MouseFlags>
      <CallbackCode>
        (M:Event) 'RightSingle' scmp 0 ==
        if{ (L:B737_APU_PwrSwitch, enum) -- 0 max (>L:B737_APU_PwrSwitch, enum) (>K:0x11001) }
        (M:Event) 'WheelUp' scmp 0 ==
        if{ (L:B737_APU_PwrSwitch, enum) -- 0 max (>L:B737_APU_PwrSwitch, enum) (>K:0x11001) }
        (M:Event) 'LeftSingle' scmp 0 ==
        if{ (L:B737_APU_PwrSwitch, enum) ++ 2 min (>L:B737_APU_PwrSwitch, enum) (>K:0x11001) }
        (M:Event) 'WheelDown' scmp 0 ==
        if{ (L:B737_APU_PwrSwitch, enum) ++ 2 min (>L:B737_APU_PwrSwitch, enum) (>K:0x11001) }
        (L:B737_APU_PwrSwitch, enum) 0 == if{ (>K:APU_OFF_SWITCH) 0 (>K:APU_GENERATOR_SWITCH_SET) 0 (>L:B737_APU_Bus1_Tied,enum) 0 (>L:B737_APU_Bus2_Tied,enum) }
        (L:B737_APU_PwrSwitch, enum) 1 == if{ 1 (>K:APU_GENERATOR_SWITCH_SET) }
        (L:B737_APU_PwrSwitch, enum) 2 == if{ (>K:APU_STARTER) 1 (>L:XMLSND5,bool) (E:LOCAL TIME,seconds) 2 + (>L:Reset,enum) }
        1 (>L:XMLSND1,bool)
      </CallbackCode>
 
Thanks Bill

Got and the best part it never took me a day + to figure it out. Thanks for the direction. Ended up looking like this:

GPU UNIT

Code:
<Click>(L:APU Run,bool) 0 == if{ (>L:StartGroundCart,bool) 0 (>K:APU_GENERATOR_SWITCH_SET) 0 (>L:dsd_fsx_sound_id_31,number) (>K:APU_OFF_SWITCH) } 
(L:APU Run,bool) 1 == if{ 1 (>K:APU_GENERATOR_SWITCH_SET) 0 (>L:dsd_fsx_sound_id_31,number) 0 (>L:StartGroundCart) }</Click>

APU UNIT

Code:
<Click>(L:StartGroundCart,bool) 0 == if{ (>L:APU Run,bool) 0 (>K:APU_GENERATOR_SWITCH_SET) 0 (>L:dsd_fsx_sound_id_20,number) (>K:APU_OFF_SWITCH) 1 (>L:dsd_fsx_sound_id_30,number) } 
(L:StartGroundCart,bool) 1 == if{ 1 (>K:APU_GENERATOR_SWITCH_SET) 0 (>L:dsd_fsx_sound_id_20,number) 1 (>L:dsd_fsx_sound_id_30,number) 0 (>L:APU Run,bool) }</Click>

Thanks Greg

P.S. Sorry All but felt that needed to remove the above code due to significant changes. If this is not the norm, please let me know. Will post the final version shortly.
 
Ok Here it is the final final version of my gauge

Once again thanks Bill, Tom and the 377 viewers at the time of this post secretly rooting me on. It's all greatly appreaciated. The best part I learned a huge amount about XML.

So what i ended up with was an aux power unit with both a GPU and APU. The two units for appearance act independently of each other. What I achieved in the build was:

1. In order for the GPU to function the aircraft must be parked with the brake on. When this conditions are met the GPU becomes available. If conditions are not met the GPU shuts off automatically.

2. A "fault" was created on start up due to low voltage. This gives the appearance that the fault light is actually doing something. Something I could not find in other gauges.

3. The APU and GPU work independently of each other and after a bit of struggle, will not turn off the other switch or the "APU" variable if running.

The only item I could not change was the start sequence, both switches go to their start case value. I dont think there is anything to prevent, Although I could be wrong. To me this seems right, becuase working on ships this is common when starting a main engine or ancillary machinary either the aux gen or emergency gen will enter their respective start procedure in the event of a failure, and when there is'nt they enter back into "off" or "standby" mode. So to me this would seem normal as a back up when switching power supply.

BOTH OFF.jpg GPU AVAIL.jpg START.jpg APU ON.jpg GPU ON.jpg BOTH ON.jpg

Code:
Gauge Name="Aux Power Control" Version="1.0">
   <Image Name="aux_pwr_background.bmp"/>
   <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>
   <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_gpu_switch_stop.bmp" Luminous="Yes"/>
         </Case>
         <Case Value="1">
            <Image Name="popup_gpu_switch_run.bmp" Luminous="Yes"/>
         </Case>
         <Case Value="2">
            <Image Name="popup_gpu_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,bool) 1 ==)%{if}%((A:APU Volts, volts))%!3.1f!% APU%{end}</String>
      </Text>
   </Element>
   <Element>
      <Position X="125" Y="22"/>
      <Select>
         <Value Minimum="0" Maximum="2">(L:APU Run,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="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>
      <Select>
         <Value>(A:APU GENERATOR SWITCH,bool) (A:APU Volts, volts) 20 &lt; and if{ 1 (>L:GPUFAULT,bool) } els{ 0 (>L:GPUFAULT,bool) }</Value>
      </Select>
   </Element>      
   <Element>
       <Position X="50" Y="52"/>
       <Select>
          <Value>(L:GPUFAULT,bool)</Value>
          <Case Value="0">
             <Image Name="fault_off.bmp"/>
          </Case>
          <Case Value="1">
             <Image Name="fault_on.bmp"/>
  	  </Case>
      </Select>		 
    </Element> 
   <Element>
      <Select>
         <Value>(L:GPUAVAIL,bool) 0 == if{ (L:APU Run,bool) 0 == if{ (>L:StartGroundCart,bool) 0 (>K:APU_GENERATOR_SWITCH_SET) 0 (>L:dsd_fsx_sound_id_31,number) (>K:APU_OFF_SWITCH) } 
         (L:APU Run,bool) 1 == if{ 1 (>K:APU_GENERATOR_SWITCH_SET) 0 (>L:dsd_fsx_sound_id_31,number) 0 (>L:StartGroundCart) } }</Value>
      </Select>
   </Element> 
    <Mouse>
      <Area Left="90" Top="24" Width="18" Height="28">
	 <Visible>(A:BRAKE PARKING POSITION,bool) 1 == (A:SIM ON GROUND,bool) 1 == &amp;&amp; </Visible>
         <Cursor Type="Hand"/>
         <Tooltip>START GPU</Tooltip>
         <Click>1 (>L:StartGroundCart,bool) 1 (>K:APU_STARTER) 1 (>K:APU_GENERATOR_SWITCH_SET) 2 (>L:dsd_fsx_sound_id_31,number)</Click>
      </Area>
      <Area Left="90" Top="46" Width="18" Height="23">
         <Visible>(L:STARTGROUNDCART,bool) 1 == (A:APU GENERATOR ACTIVE,bool) 1 == &amp;&amp; </Visible>
         <Cursor Type="Hand"/>
         <Tooltip>STOP GPU</Tooltip>
         <Click>(L:APU Run,bool) 0 == if{ (>L:StartGroundCart,bool) 0 (>K:APU_GENERATOR_SWITCH_SET) 0 (>L:dsd_fsx_sound_id_31,number) (>K:APU_OFF_SWITCH) } 
         (L:APU Run,bool) 1 == if{ 1 (>K:APU_GENERATOR_SWITCH_SET) 0 (>L:dsd_fsx_sound_id_31,number) 0 (>L:StartGroundCart) }</Click>
      </Area>
      <Area Left="127" Top="24" Width="18" Height="28">
         <Cursor Type="Hand"/>
         <Tooltip>Start APU</Tooltip>
         <Click>1 (>L:APU Run,bool) 1 (>K:APU_STARTER) 1 (>L:dsd_fsx_sound_id_29,number) 1 (>K:APU_GENERATOR_SWITCH_SET) 2 (>L:dsd_fsx_sound_id_20,number)</Click>
      </Area>
      <Area Left="127" Top="46" Width="18" Height="23">
      <Visible>(L:APU Run,bool) 1 == (A:APU GENERATOR ACTIVE,bool) 1 == &amp;&amp; </Visible>
         <Cursor Type="Hand"/>
         <Tooltip>Start APU</Tooltip>
         <Click>(L:StartGroundCart,bool) 0 == if{ (>L:APU Run,bool) 0 (>K:APU_GENERATOR_SWITCH_SET) 0 (>L:dsd_fsx_sound_id_20,number) (>K:APU_OFF_SWITCH) 1 (>L:dsd_fsx_sound_id_30,number) } 
         (L:StartGroundCart,bool) 1 == if{ 1 (>K:APU_GENERATOR_SWITCH_SET) 0 (>L:dsd_fsx_sound_id_20,number) 1 (>L:dsd_fsx_sound_id_30,number) 0 (>L:APU Run,bool) }</Click>
      </Area>
      <Area Left="162" Top="29" Width="30" Height="30">
         <Cursor Type="Hand"/>
         <Tooltip>FIRE SUPRESSION</Tooltip>
         <Click>1 (>K:APU_EXTINGUISH_FIRE)</Click>
      </Area>
   </Mouse>
</Gauge>

Once again thank you. This was a very positive learning experience for me and greatly appreaciate all the help I recieved.

Sincerly

Greg Swift
 
Last edited:
Once again thank you. This was a very positive learning experience for me and greatly appreaciate all the help I recieved.

You are most welcome, Greg. I'm glad to hear you've got it sorted out. Actually, it was simply serendipity that I happened to be working on a nearly identical project at the time as you were... :rotfl:
 
This is what I use on my Bell 222 helicopter, you'll have to modify it to match your gauge bitmaps though.

Code:
<Gauge Name="GPU Control" Version="1.0">
   <Image Name="gpu_bckgrnd.bmp"/>
   <Element>
      <Position X="158" Y="125"/>
      <Select>
         <Value>(L:StartGroundCart,bool)</Value>
         <Case Value="1">
            <Image Name="gpu_on.bmp"/>
         </Case>
      </Select>
   </Element>
   <Element>
      <Position X="158" Y="172"/>
      <Select>
         <Value>(L:StartGroundCart,bool)</Value>
         <Case Value="1">
            <Image Name="gpu_off.bmp"/>
         </Case>
      </Select>
   </Element>
   <Element>
      <Position X="158" Y="215"/>
      <Text Bright="Yes" X="85" Y="30" Length="6" Fixed="Yes" Font="Arial" Color="RED" Adjust="Center" VerticalAdjust="Top">
         <String>%((A:APU Volts, volts))%!3.1f! Volts)  d 0 == ?)%!3d!</String>
      </Text>
   </Element>
   <Mouse>
      <Area Left="180" Top="140" Width="10" Height="30">
         <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="180" Top="190" Width="10" Height="30">
         <Cursor Type="Hand"/>
         <Tooltip>STOP GPU</Tooltip>
         <Click>0 (>L:StartGroundCart,bool)




        0 (>K:APU_GENERATOR_SWITCH_SET) (>K:APU_OFF_SWITCH)




      </Click>
      </Area>
   </Mouse>
</Gauge>
 
Back
Top