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

Magnetos switches

Messages
85
I'm building a warbird with L1 L2 R1 R2 toggle switches for the magnetos, I have tried just about every combination of animation tags and can't get them working.

Do I need to add something to the .cfg file for the proper magneto support?

Thanks
 
Is this for an XML gauge or is it for 3d model XML animation?
 
XML, thanks!

I gathered it was XML, what I asked was...

...is this for a displayable GAUGE?

-or

...is this for an animated part in the model?

This is critical to know because the XML syntax is completely different between the two choices.

Some "trickery" is involved using the stock key_events for magneto switch(es) control, since by default FS doesn't support separate switches for them...

...everything is modeled based on a "rotary ignition switch" model. :rolleyes:
 
...for an animated part in a model.

Okay, now we need to know if this is for FS9 or FSX? The two version's XML schema is similar, but not quite identical...

Essentially, the key_events (commands) for a single engine are limited to the following:

Code:
MAGNETO1_OFF
MAGNETO1_RIGHT 
MAGNETO1_LEFT
MAGNETO1_BOTH
MAGNETO1_START

Please take note that the above commands assume a single rotary switch that will control both Magneto #1L and #1R. Thus it is necessary to "fake independence" with some custom logic and custom L:variables.

It will be necessary to design a "logic tree" such that you have full control over the "physical position" of each toggle switch -AND- use that information to transmit the appropriate command to the sim.

Rational names for the L:variables might be:

(L:Eng1MagLeft,bool)
(L:Eng1MagRight,bool)
(L:Eng1MagStart,bool)

Since the above must be done irrespective of the sim engine (FS9 vs. FSX), there's little point in pre-writing any specific XML script at this point.

As I consistently emphasized to my students years ago when I taught at the University of Florida, Gainesville...

"If you can't solve the problem with pencil and paper, how can you reasonably expect to tell the computer?" :teacher:
 
FSX... that's good to know...

Let's explore the logic for controlling the Left Mag Switch for Engine 1...

We need to create conditional command(s) that will include each of the FOUR possible switch states for the Engine 1 Magneto toggle switches:

00 - both OFF
01 - right ON
11 - both ON
10 - left ON

Engine1 Mag Switch Left Control Logic:
Code:
IF 
   Left Mag Switch Engine1 is OFF
   AND
   Right Mag Switch Engine 1 is OFF
THEN
   set Left Mag Switch Engine1 ON
   AND
   set MAGNETO1_LEFT

IF
   Left Mag Switch Engine1 is OFF
   AND
   Right Mag Switch Engine 1 is ON
THEN
   set Left Mag Switch Engine1 ON
   AND
   set MAGNETO1_BOTH

IF
   Left Mag Switch Engine1 is ON
   AND
   Right Mag Switch Engine 1 is ON
THEN
   set Left Mag Switch Engine1 OFF
   AND
   set MAGNETO1_RIGHT

IF
   Left Mag Switch Engine1 is ON
   AND
   Right Mag Switch Engine 1 is OFF
THEN
   set Left Mag Switch Engine1 OFF
   AND
   set MAGNETO1_OFF

Note that this is "pseudo-code" used in the logic flow, which will require translation into actual XML script. Note also that each individual switch defined in your modeldef.xml file will require the full check for all four possibile conditions, although the command for the switch position will control one specific 3d switch position.

The next step will be to "translate" each of the four pseudo-code into a single <Code>xxx</Code> section for a <MouseRect>xxx</MouseRect> entry in your modeldef.xml file.

Note that the <Code>xxx</Code> script for the Eng1MagRight switch is identical to what's below, EXCEPT for the single line that controls the 3d modeled switch:
1 (>L:Eng1MagRight,bool)
I will leave it here and allow you to complete the task as homework... :teacher:

Code:
<Code>
  <!-- SCRIPT FOR ENGINE 1 LEFT MAG SWITCH CONTROL-->
  <!-- LEFT OFF RIGHT OFF -->
  (L:Eng1MagLeft,bool) 0 ==
  (L:Eng1MagRight,bool) 0 ==
  and
  if{
      1 (>L:Eng1MagLeft,bool)
      (>K:MAGNETO1_LEFT)
    }
    
  <!-- LEFT OFF RIGHT ON-->
  (L:Eng1MagLeft,bool) 0 ==
  (L:Eng1MagRight,bool) 1 ==
  and
  if{
      1 (>L:Eng1MagLeft,bool)
      (>K:MAGNETO1_BOTH)
    }
  
  <!-- LEFT ON RIGHT ON-->
  (L:Eng1MagLeft,bool) 1 ==
  (L:Eng1MagRight,bool) 1 ==
  and
  if{
      0 (>L:Eng1MagLeft,bool)
      (>K:MAGNETO1_RIGHT)
    }

  <!-- LEFT ON RIGHT OFF-->
  (L:Eng1MagLeft,bool) 1 ==
  (L:Eng1MagRight,bool) 0 ==
  and
  if{
      0 (>L:Eng1MagLeft,bool)
      (>K:MAGNETO1_OFF)
    }
</Code>
 
Back
Top