• 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.

FS2004 Perplexed!

Messages
1,468
Country
italy
Could someone have a look at the code below to see if there is an error or if I am doing something wrong. Many thanks.

The intended action is that when an engine runs down it trips the generator automatically and at the same time physically moves the switch to the trip position. For engine 4 generator this works perfectly. but for engine 3 it does not. The switch remains in the previous set position. There are differences between engine 3 and 4 generator switches. In that the engine 4 switch has three postions and engine 3 has 2. Engine 3 is correct in reality. So I need to change engines 1,2 and 4 to match engine 3 generator. Engines 1,2 and 4 generator switches all correctly trip. The switches are controlled by Gvars. Many thanks
Code:
    <Element>  ///////// code to trip the switch when engines stop//This code works///////
      <Select>
           <Value>(A:GENERAL ENG4 GENERATOR ACTIVE,bool) 0 == (L:E4GEN_running,bool) 0 == and
(L:E4GEN,number) 2 == and (L:GMS4,bool) 0 == and
if{ 1 (>L:GMS4,bool) 0 (>L:E4GEN_running,bool) }</Value>
      </Select>
   </Element>

 ///////// code triggered by the trip code///////
<Value>(L:GMS4,bool) 0 == if{ (A:GENERAL ENG4 GENERATOR ACTIVE,bool) 0 == (L:E4GEN_running,bool) 1 == and
if{ 1 (&gt;G:Var1) 0 (&gt;L:KvarKW4,number) 0 (&gt;L:E4GEN_running,bool) 1 (>L:GMS4,bool) } }</Value>

   <Mouse>
<Tooltip>E4 Main Gen</Tooltip>
      <Area Top="0" Bottom="30">
        <Cursor Type="Hand"/>  ///////// close///////
         <Click>0 (&gt;G:Var1) (L:E4GEN_running,bool) 1 == (A:GENERAL ENG4 GENERATOR ACTIVE,bool) 1 == and
if{ 0 (&gt;K:TOGGLE_ALTERNATOR4) (&gt;L:E4GEN,number) 0 (>L:E4GEN_running,bool) }</Click>
      </Area>
      <Area Top="31" Bottom="147">
         <Cursor Type="Hand"/>  ///////// on///////
          <Click>2 (&gt;G:Var1) (L:E4GEN_running,bool) 0 == (A:GENERAL ENG4 GENERATOR ACTIVE,bool) 0 == and
if{ (&gt;K:TOGGLE_ALTERNATOR4) 2 (&gt;L:E4GEN,number) 1 (>L:E4GEN_running,bool) }</Click>
      </Area>
      <Area Top="148" Bottom="177">
         <Cursor Type="Hand"/>   ///////// trip///////
         <Click>1 (&gt;G:Var1) (L:E4GEN_running,bool) 1 == (A:GENERAL ENG4 GENERATOR ACTIVE,bool) 1 == and
if{ (&gt;K:TOGGLE_ALTERNATOR4) 0 (&gt;L:E4GEN,number) 0 (>L:E4GEN_running,bool) }</Click>
      </Area>
   </Mouse>>
Code:
<Element>  ///////// code to trip the switch when engines stop///////This code doesn't work//
      <Select>
           <Value>(A:GENERAL ENG3 GENERATOR ACTIVE,bool) 0 == (L:E3GEN_running,bool) 0 == and
(L:E3GEN,number) 2 == and (L:GMS3,bool) 0 == and
if{ 1 (>L:GMS3,bool) 0 (>L:E3GEN_running,bool) }</Value>
      </Select>
   </Element>

 ///////// code triggered by the trip code///////
<Value>(L:GMS3,bool) 0 == if{ (A:GENERAL ENG3 GENERATOR ACTIVE,bool) 0 == (L:E3GEN_running,bool) 1 == and
if{ 1 (&gt;G:Var1) 0 (&gt;L:KvarKW3,number) 0 (&gt;L:E3GEN_running,bool) 1 (>L:GMS3,bool) } }</Value>

   <Mouse>
      <Tooltip>E3 Main Gen</Tooltip>     
      <Area Top="148" Bottom="177">
         <Cursor Type="Hand"/>   ///////// trip///////
         <Click>0 (&gt;G:Var1) (L:E3GEN_running,bool) 1 == (A:GENERAL ENG3 GENERATOR ACTIVE,bool) 1 == and
if{ (&gt;K:TOGGLE_ALTERNATOR3) (&gt;L:E3GEN,number) 0 (>L:E3GEN_running,bool) }</Click>
      </Area>
      <Area Top="0" Bottom="147">
         <Cursor Type="Hand"/>    /////////on///////
         <Click>1 (&gt;G:Var1) (L:E3GEN_running,bool) 0 == (A:GENERAL ENG3 GENERATOR ACTIVE,bool) 0 == and
if{ (&gt;K:TOGGLE_ALTERNATOR3) 2 (&gt;L:E3GEN,number) 1 (>L:E3GEN_running,bool) }</Click>
      </Area>
   </Mouse>
 
Code:
 0 (&gt;K:TOGGLE_ALTERNATOR4) (&gt;L:E4GEN,number) 0 (>L:E4GEN_running,bool)

Code:
(&gt;K:TOGGLE_ALTERNATOR3) (&gt;L:E3GEN,number) 0 (>L:E3GEN_running,bool)

I'm pretty sure that E3/4GEN should have a value assigned.
 
Code:
 0 (&gt;K:TOGGLE_ALTERNATOR4) (&gt;L:E4GEN,number) 0 (>L:E4GEN_running,bool)

Code:
(&gt;K:TOGGLE_ALTERNATOR3) (&gt;L:E3GEN,number) 0 (>L:E3GEN_running,bool)

I'm pretty sure that E3/4GEN should have a value assigned.
I think that was part of the problem H. The value should have been zero. The other problem is that the switches have to work back to front. In that the steady and starting state is 1 not 0. When everything goes live they switch to zero so had to be manually switched back to the 1 state. I have programmed that in now so that they stay in the 1 state. So now it seems to work.

Code:
<Element> this code causes the generator trip
      <Select>
           <Value>(A:GENERAL ENG3 GENERATOR ACTIVE,bool) 0 == (L:E3GEN_running,bool) 0 == and
(L:E3GEN,number) 2 == and (L:GMS3,bool) 0 == and
if{ 1 (>L:GMS3,bool) 0 (>L:E3GEN_running,bool) }</Value>
      </Select>
   </Element>

And this is the generator switch code
Gauge Name="E3 Main Generator Switch" Version="1.0">
   <Element>
      <Select>
         <Value>(G:Var1)</Value>
         <Failures>
            <SYSTEM_ELECTRICAL_PANELS Action="1"/>
         </Failures>
        
         <Case Value="0">
            <Image Name="GC_CLOSE.bmp"/>           
         </Case>       
         <Case Value="1">
            <Image Name="GC_TRIP.bmp"/>
         </Case>
      </Select>
   </Element>
   <Element>
      <Select>
         <Value>(L:GMS3,bool) 0 == if{ (A:GENERAL ENG3 GENERATOR ACTIVE,bool) 0 == (L:E3GEN_running,bool) 1 == and
         if{ 1 (&gt;G:Var1) 0 (&gt;L:KvarKW3,number) 0 (&gt;L:E3GEN_running,bool) 1 (>L:GMS3,bool) } }</Value>
      </Select>
   </Element>
      <Element>
      <Select>
         <Value>(L:GMS3a,bool) 0 == if{ (L:GMS3,bool) 0 == (A:GENERAL ENG3 GENERATOR ACTIVE,bool) 0 == and (L:E3GEN_running,bool) 0 == and
if{ 1 (&gt;G:Var1) 1 (>L:GMS3a,bool) } }</Value>
      </Select>
   </Element>  
   <Mouse>
      <Tooltip>E3 Main Gen</Tooltip>
      <Area Top="0" Bottom="147">
         <Cursor Type="Hand"/>
         <Click>0 (&gt;G:Var1) (L:E3GEN_running,bool) 0 == (A:GENERAL ENG3 GENERATOR ACTIVE,bool) 0 == and
     if{ (&gt;K:TOGGLE_ALTERNATOR3) 2 (&gt;L:E3GEN,number) 1 (>L:E3GEN_running,bool) }</Click>
      </Area>           
      <Area Top="148" Bottom="177">
         <Cursor Type="Hand"/>
         <Click>1 (&gt;G:Var1) (L:E3GEN_running,bool) 1 == (A:GENERAL ENG3 GENERATOR ACTIVE,bool) 1 == and
     if{ (&gt;K:TOGGLE_ALTERNATOR3) 0 (&gt;L:E3GEN,number) 0 (>L:E3GEN_running,bool) }</Click>
      </Area>
      
   </Mouse>
</Gauge>
 
Back
Top