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

Magneto coding, incorrect. (Partially solved..)

Messages
206
Country
us-idaho
Here we go fellas.. silly questions starting now. Hit 'back' to avoid!

I'm trying to correct this gauge. I believe the idea behind it, is to allow it to function with a cold/dark state, and to require both mags to be selected, for the aircraft to start while using a custom engine start lever. I've isolated that the following bit of code is corrupt, and probably needs re-written. Maybe I can get some advice?

Currently, the aircraft won't engage both mags when the 'CTRL+E' function is used. (And will produce undesirable effects). Also, the engine will die if I turn off/on mag 1, and then turn off JUST mag 2. Otherwise I can cycle 2 with no problem...

I need to write a simple magneto gauge, to take this ones place. Any hints please?

- Joseph


Code:
<Element>
            <Select>
                  <Value>   
               
                (L:WATER_TEMP,enum) (A:RECIP ENG1 RADIATOR TEMPERATURE, Celsius) !=
                    if{
                        (A:RECIP ENG1 RADIATOR TEMPERATURE, Celsius) (>L:WATER_TEMP,enum)
                    }
           
                (L:LEVER_STARTER,enum) 0 ==
                    if{
                        (L:BTN_MAGNETO_1,enum) 1 ==
                            if{
                                (L:BTN_MAGNETO_2,enum) 0 ==
                                    if{
                                        (A:RECIP ENG LEFT MAGNETO:1,enum) 0 !=
                                            if{
                                                (>K:MAGNETO1_LEFT,enum)
                                            }
                                    }
                                    els{
                                        (A:RECIP ENG RIGHT MAGNETO:1,enum) 0 !=
                                            if{
                                                (>K:MAGNETO1_BOTH,enum)
                                            }
                                    }                   
                            }
                            els{
                                (L:BTN_MAGNETO_2,enum) 1 ==
                                    if{
                                        (A:RECIP ENG RIGHT MAGNETO:1,enum) 0 !=
                                            if{
                                                (>K:MAGNETO1_RIGHT,enum)
                                            }
                                    }
                                    els{
                                        (A:RECIP ENG LEFT MAGNETO:1,enum) 0 !=
                                            if{
                                                (>K:MAGNETO1_OFF,enum)
                                            }
                                    }               
                            }
                    }
                    els{
                        (L:BTN_MAGNETO_1,enum) 1 ==
                        (L:BTN_MAGNETO_2,enum) 1 == and
                        (A:SIM ON GROUND,enum) 1 == and
                            if{
                                (>K:MAGNETO1_START,enum)
                                0 (>L:LEVER_STARTER,enum)
                            }
                    }
                   

                    (A:GENERAL ENG COMBUSTION:1,enum) 1 ==
                        if{
                            (L:LEVER_STARTER,enum) 1 ==
                                if{
                                    0 (>L:LEVER_STARTER,enum)
                                }
                        }

                  </Value>
            </Select>
      </Element>
 
There's no need for a enum.

(>K:MAGNETO1_LEFT)
gives the engine number 1, or 2, 3, 4. and gives the magneto state RIGHT, LEFT, OFF, and START. It's all there.
 
Thanks..

I've been comparing with the default Piper Cub magneto gauge, and trying to come up with one that will work with the L variables that were originally assigned in the modeldef.

ackk!

- Joseph
 
Okay, I've made some headway.
This is what I've got so far. The magnetos work correctly now, however the animation for the magneto buttons is assigned an L var in the model. The one problem is on the event 'engine auto start' (ctrl+e) the animation for the mags doesn't operate.

How would I write a code to incorporate my L var when the auto start takes place?

Also, the L var 'LEVER_STARTER' is associated with the lever animation for a hand-crank starter. It doesn't complete it's animation, so I need to add a delay timer of some kind there..

Also, need to correct the code so as not to use a race condition, or rapid-fire.

Attached current code:

Code:
    <Element>
            <Select>
                  <Value>  
                                      
            (L:BTN_MAGNETO_1, number) 0 ==
            (L:BTN_MAGNETO_2, number) 0 ==
            and if{ (>K:MAGNETO1_OFF) }

            (L:BTN_MAGNETO_1, number) 1 ==
            (L:BTN_MAGNETO_2, number) 0 ==
            and if{ (>K:MAGNETO1_LEFT) }

            (L:BTN_MAGNETO_1, number) 0 ==
            (L:BTN_MAGNETO_2, number) 1 ==
            and if{ (>K:MAGNETO1_RIGHT) }

            (L:BTN_MAGNETO_1, number) 1 ==
            (L:BTN_MAGNETO_2, number) 1 ==
            and if{ (>K:MAGNETO1_BOTH) }
                      
            (L:LEVER_STARTER,enum) 1 ==
            if{
            (>L:LEVER_STARTER,enum) 0 ==
            if{ (>K:TOGGLE_STARTER1)
            els{ (A:GENERAL ENG STARTER ACTIVE,bool) 0 ==

            }
                      
           (A:GENERAL ENG COMBUSTION:1,enum) 1 ==
            if{
           (L:LEVER_STARTER,enum) 1 ==
            if{
            0 (>L:LEVER_STARTER,enum)
            }
                </Value>
            </Select>
      </Element>
 
Last edited:
For your cntl E problem, I think this code may help. It will NOT work as is, since I am using it with more complicated system that relies on a L:Start variable as well.

What it does is read the current FS mag settings, and forces the L:mag1 (etc.) variable to that value. The L:mag1 variable is used to display the position of the mag knobs. The code is for a 4 engine plane.

Code:
   <Element>
      <Select>
       <Value>(A:Recip eng left magneto:1,bool) 2 * (A:Recip eng right magneto:1,bool) + (&gt;L:magkey1, enum)
              (A:Recip eng left magneto:2,bool) 2 * (A:Recip eng right magneto:2,bool) + (&gt;L:magkey2, enum)
              (A:Recip eng left magneto:3,bool) 2 * (A:Recip eng right magneto:3,bool) + (&gt;L:magkey3, enum)
              (A:Recip eng left magneto:4,bool) 2 * (A:Recip eng right magneto:4,bool) + (&gt;L:magkey4, enum)
              (L:magkey1, enum) (L:mag1, enum) != (L:Start1, enum) 1 != &amp;&amp; if{ (L:magkey1, enum) (&gt;L:mag1, enum) }
              (L:magkey2, enum) (L:mag2, enum) != (L:Start1, enum) 2 != &amp;&amp; if{ (L:magkey2, enum) (&gt;L:mag2, enum) }
              (L:magkey3, enum) (L:mag3, enum) != (L:Start1, enum) 3 != &amp;&amp; if{ (L:magkey3, enum) (&gt;L:mag3, enum) }
              (L:magkey4, enum) (L:mag4, enum) != (L:Start1, enum) 4 != &amp;&amp; if{ (L:magkey4, enum) (&gt;L:mag4, enum) }
      </Value>
      </Select>
   </Element>

The number coding for the L:mag1 (etc.) variables is:

OFF - 0
RIGHT - 1
LEFT - 2
BOTH - 3

Hope this helps,
 
I'll take a look see...
Thanks Tom.

The trick, so far, is that FSX is set up for a 4-way switch, rather than two press-buttons.

Back to the code..I'll report what I find.
- Joseph
 
I believe I've got this one now...

Tom, I tried what you suggested. That works, the only problem is that the L var(s) for the mags are only tied into a click animation within the .mdl, so putting them in 'sync' with the A:var for the mags disallows them from being operated via mouse rect.

The following code, does, however work, with these two exceptions;

1.) Mags for L/R don't read 'true' upon Engine Auto Start. With that said, the engine won't run using just the auto start either..
2.) Mags will stay 'on', or 'off' regardless of hot key selection for 'm+'.

The good news is, no constant firing. And No adverse effects of running with mag L/R = true, rather than using the 'both' variable.

Any suggestion to further refine this code is generously welcome. I am, however pretty satisfied.
- Joseph

Code:
<Update Frequency="1">                      
            <!-- Left Magneto On -->
            (L:BTN_MAGNETO_1, number) 0 != 
            (A:RECIP ENG LEFT MAGNETO:1,enum) 1 !=              
            and if{
            (>K:MAGNETO1_LEFT) }
           
            <!-- Left Magneto Off -->
            (L:BTN_MAGNETO_1, number) 1 != 
            (A:RECIP ENG LEFT MAGNETO:1,enum) 0 !=              
            and if{
            1 (>K:MAGNETO1_DECR) }
                       
             <!-- Right Magneto On -->
            (L:BTN_MAGNETO_2, number) 0 !=
            (A:RECIP ENG RIGHT MAGNETO:1,enum) 1 !=          
            and if{
            (>K:MAGNETO1_RIGHT) }   
           
            <!-- RIGHT Magneto Off -->
            (L:BTN_MAGNETO_2, number) 1 != 
            (A:RECIP ENG RIGHT MAGNETO:1,enum) 0 !=              
            and if{
            1 (>K:MAGNETO1_DECR) }  
           
             <!-- Magnetos Off -->
            (L:BTN_MAGNETO_1, number) 1 !=
            (A:RECIP ENG LEFT MAGNETO:1,enum) 0 !=
            and if{
            (L:BTN_MAGNETO_2, number) 1 !=
            (A:RECIP ENG RIGHT MAGNETO:1,enum) 0 !=
            and if{
            (>K:MAGNETO1_OFF) }            
}
}
                   
             <!-- Starter 1 -->            
            (L:LEVER_STARTER,enum) 1 ==
            if{
            (>L:LEVER_STARTER,enum) 0 ==
            if{
            (>K:TOGGLE_STARTER1)          
            els{
            (A:GENERAL ENG STARTER ACTIVE,bool) 0 == }
                   
            <!-- Starter 2 -->          
           (A:GENERAL ENG COMBUSTION:1,enum) 1 ==
           if{
           (L:LEVER_STARTER,enum) 1 ==
           if{
           0 (>L:LEVER_STARTER,enum) }
           }
     </Update>
 
Last edited:
Back
Top