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

FSX IS this possible with a 2d pop-up XML gauge?

Messages
116
Country
england
Thanks gents :)
Now working correctly:
007.jpg
 
Messages
116
Country
england
Today I’ll be attempting to add the DME, but as I want further distances than the VOR can offer, it’s going to have to be done using gps variables and lat/long.
I had a few attempts but so far the only result is 3125nm when I’m only 2 nm away 😄
 
Messages
116
Country
england
well, seems to be working now :)

009.jpg




Just testing the XML...still have to get the actual 'drum' done.

Still have to code the switch, and some other small things.

TEST CODE :
Code:
<Element>
<Select>
<Value>(A:Nav active frequency:1,Khz) 108200 == if{
(A:PLANE LATITUDE, degrees) (&gt; C:fs9gps:GeoCalcLatitude1, degrees)
(A:PLANE LONGITUDE, degrees) (&gt; C:fs9gps:GeoCalcLongitude1, degrees)
52.0972 (&gt; C:fs9gps:GeoCalcLatitude2, degrees)
-0.0571 (&gt; C:fs9gps:GeoCalcLongitude2, degrees)
(C:fs9gps:GeoCalcBearing, degrees)
(C:fs9gps:GeoCalcDistance, nmiles)
(&gt;L:DMEDistance1, nmiles)
</Value>
</Select>
</Element>

Ps
Tom, in your earlier replie you mention just entering the co-ordinates directly into the GeoCalcLat2 and Long2... i took that tip and done that, and that was what made it work ...it seems. with the added
52.0972 (&gt;L:VOR_UKBA_lat, degrees) -0.0571 (&gt;L:VOR_UKBA_lon, degrees) it was giving me a DME of 3125nm
🤷‍♂️
 
Last edited:
Messages
116
Country
england
Switch tested and working :

012.jpg


XML:
<Element>
<Position X="688" Y="230" />
<Select>
<Value>(L:BearingSwitch,enum)</Value>
<Case Value="0">
<Image Name="SwitchB0.bmp">
<Axis X="15" Y="34" />
</Image>
</Case>
<Case Value="1">
<Image Name="SwitchB1.bmp">
<Axis X="32" Y="16" />
</Image>
</Case>
<Case Value="2">
<Image Name="SwitchB2.bmp">
<Axis X="20" Y="33" />
</Image>
</Case>
<Case Value="3">
<Image Name="SwitchB3.bmp">
<Axis X="32" Y="19" />
</Image>
</Case>
</Select>
</Element>

<Element>
<Position X="687" Y="74" />
        <Image Name="radio_compass_green_needle2.bmp">
            <Axis X="6" Y="55" />
        </Image>
 <Rotate>
            <Value>(A:Nav active frequency:1,Khz) 108200 == (L:BearingSwitch,enum) 1 == &amp;&amp; if{ (L:Bearing22, radians) (A:PLANE HEADING DEGREES MAGNETIC, radians) - pi + } (A:Nav active frequency:1,Khz) 112150 == (L:BearingSwitch,enum) 2 == &amp;&amp; if{ (L:Bearing22, radians) (A:PLANE HEADING DEGREES MAGNETIC, radians) - pi + } (A:Nav active frequency:1,Khz) 115000 == (L:BearingSwitch,enum) 3 == &amp;&amp; if{ (L:Bearing22, radians) (A:PLANE HEADING DEGREES MAGNETIC, radians) - pi + } </Value>
</Rotate>
<Delay PixelsPerSecond="40" />
</Element>

XML:
<Area Left="652" Top="176" Width="40" Height="50">
            <Cursor Type="DownArrow" />
            <Click>(L:BearingSwitch, enum) -- d 0 &lt; if{ 3 } (&gt;L:BearingSwitch, enum)</Click>
        </Area>
<Area Left="711" Top="176" Width="40" Height="50">
            <Cursor Type="UpArrow" />
            <Click>(L:BearingSwitch, enum) ++ d 3 &gt; if{ 0 } (&gt;L:BearingSwitch, enum)</Click>
        </Area>
 
Messages
116
Country
england
The <Delay PixelsPerSecond="40" /> doesnt seem to do much, tried 400, 20,200 and also DegreesPerSecond. The needle currently snaps into position, and i'd like it to swing.

Is this not working due to not having a Nonlinearity table? and if so is there a way around that ?
 

tgibson

Resource contributor
Messages
10,716
Country
us-california
This is what I used:

<Delay DegreesPerSecond="80"/>

and it should be INSIDE the Rotate command.


XML:
<Rotate>

            <Value>(A:Nav active frequency:1,Khz) 108200 == (L:BearingSwitch,enum) 1 == &amp;&amp; if{ (L:Bearing22, radians) (A:PLANE HEADING DEGREES MAGNETIC, radians) - pi + } (A:Nav active frequency:1,Khz) 112150 == (L:BearingSwitch,enum) 2 == &amp;&amp; if{ (L:Bearing22, radians) (A:PLANE HEADING DEGREES MAGNETIC, radians) - pi + } (A:Nav active frequency:1,Khz) 115000 == (L:BearingSwitch,enum) 3 == &amp;&amp; if{ (L:Bearing22, radians) (A:PLANE HEADING DEGREES MAGNETIC, radians) - pi + } </Value>
           <Delay DegreesPerSecond="80"/>
</Rotate>
 
Messages
116
Country
england
Maddz said:
have some code that recognizes / detects when a switch, with 3 positions, (1 down, 0 middle, 2 up) has gone from 2 to 0 and when it does, it puts (A:TOTAL FUEL QUANTITY) into (>L:EAFS) - COMPLETED AND 2 OTHER TANKS (LSGS - UKBA) ADDED


I wouldn’t know where to start with this one but maybe have to dial a frequency in order for the quantity to show on the gauge? is that even possible? YES - COMPLETE.

bearing / distance of airport from current position. Maybe a compass face with a needle pointing to bearing. Old type drum DME readout maybe - TO DO - COMPLETE.

DME added and tested, working :)

15.jpg


Read many post on the 'Drum' and the @ExtDigit wiki post to achieve this. The code is a mix of contributions from members here so thanks all 🙇‍♂️🙇‍♂️
The longest part was the X and Y positioning - bloody nightmare!

XML:
<Macro Name="ExtDigit">
@1 sp0
@3 0 &gt;
if{ l0 10 @3 pow * sp0 }
l0 int 10 @2 pow % 10 @2 1 - 0 max pow / int
</Macro>

<Update>
        (L:DMEDistance1, nmiles) 0 max sp2
    </Update>

<!-- 1000's -->
<Element>
      <Position X="875" Y="49"/>
      <MaskImage Name="DMEwindow2.bmp">
         <Axis X="884" Y="61"/>
      </MaskImage>
      <Image Name="NumberStrip2.bmp" >
</Image>
<Shift>
         <Value>l2 100 % s1 99.7 &gt;= l1 99.7 - * @ExtDigit(l2,4,0) +</Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="-1"/>
            <Item Value="10" X="0" Y="-157"/>
         </Nonlinearity>
            <Failures>
            <SYSTEM_ELECTRICAL_AVIONICS Action="Freeze"/>
         </Failures>
      </Shift>
   </Element>
<!-- 100's -->
<Element>
      <Position X="875" Y="49"/>
      <MaskImage Name="DMEwindow2.bmp">
         <Axis X="897" Y="61"/>
      </MaskImage>
      <Image Name="NumberStrip2.bmp" >
</Image>
<Shift>
         <Value>l2 100 % s1 99.7 &gt;= l1 99.7 - * @ExtDigit(l2,3,0) +</Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="-1"/>
            <Item Value="10" X="0" Y="-157"/>
         </Nonlinearity>
            <Failures>
            <SYSTEM_ELECTRICAL_AVIONICS Action="Freeze"/>
         </Failures>
      </Shift>
   </Element>
<!-- 10s -->
   <Element>
      <Position X="875" Y="49"/>
      <MaskImage Name="DMEwindow2.bmp">
         <Axis X="911" Y="61"/>
      </MaskImage>
      <Image Name="NumberStrip2.bmp">
</Image>
<Shift>
         <Value>l2 10 % s1 9.7 &gt;= l1 9.7 - * @ExtDigit(l2,2,0) +</Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="-1"/>
            <Item Value="10" X="0" Y="-157"/>
         </Nonlinearity>
         <Failures>
            <SYSTEM_ELECTRICAL_AVIONICS Action="Freeze"/>
         </Failures>
      </Shift>
   </Element>
<!-- 1s -->
   <Element>
      <Position X="875" Y="49"/>
      <MaskImage Name="DMEwindow2.bmp">
         <Axis X="926" Y="61"/>
      </MaskImage>
      <Image Name="NumberStrip2.bmp">
</Image>
<Shift>
         <Value>l2 1 % @ExtDigit(l2,1,0) +</Value>
         <Nonlinearity>
            <Item Value="0" X="0" Y="-1"/>
            <Item Value="10" X="0" Y="-157"/>
         </Nonlinearity>
         <Failures>
            <SYSTEM_ELECTRICAL_AVIONICS Action="Freeze"/>
         </Failures>
      </Shift>
   </Element>


And as the old Colombo would : There is just one thing

When selecting a station the DME number rolls will initially snap the the distance instead of moving to the numbers. Count-down or up movement is fine. (when moving)
If i add a delay, when it reaches the end of the number tape it rolls back to 1 instead of rolling over, with out the delay it rolls over nicely.

Can a delay be implemented this way?
 

tgibson

Resource contributor
Messages
10,716
Country
us-california
Not that I know of, because the rollover problem you encountered before would also happen in this case.
 
Messages
116
Country
england
Alright - I feel like I should recognise the aircraft. Bristol Britannia or similar?
Do the gauges look that bad? 😂 I think I see what you do with the window frames shape/ style being similar?

Lockheed L049 constellation (A2A)
Bristol is where I live 🙂 UK
 
Last edited:
Messages
116
Country
england
So I've come across something i haven't done before which is having many conditions true for a needle to move

The conditions are:
A certain frequency to be tuned
and
5 switches to be in a certain position

Im putting the code in the <Rotate> command.

This works on it's own:


XML:
tided up for easier reading

<Value>
    (A:Nav active frequency:1,Khz) 108200 ==
    (L:BearingSwitch,enum) 1 ==
    (L:CodeSwitch, enum) 2 ==
    (L:CodeSwitch2, enum) 1 ==
    (L:CodeSwitch3, enum) 0 ==
    (L:CodeSwitch4, enum) 2 == &amp;&amp; &amp;&amp;
    if{ (L:Bearing22, radians) (A:PLANE HEADING DEGREES MAGNETIC, radians) - pi + } </Value>

but i need another 2 'blocks' like this for the other 2 frequencies and other code switch positions and all within the <Rotate> command
All my efforts so far has failed.
I try like so:

XML:
<Value>
    (A:Nav active frequency:1,Khz) 108200 == (L:BearingSwitch,enum) 1 ==
    (L:CodeSwitch, enum) 2 == (L:CodeSwitch2, enum) 1 ==
    (L:CodeSwitch3, enum) 0 == (L:CodeSwitch4, enum) 2 ==
    &amp;&amp; &amp;&amp; &amp;&amp;
    if{ (L:Bearing22, radians) (A:PLANE HEADING DEGREES MAGNETIC, radians) - pi + }
    (A:Nav active frequency:1,Khz) 112150 == (L:BearingSwitch,enum) 2 ==
    (L:CodeSwitch, enum) 0 == (L:CodeSwitch2, enum) 0 ==
    (L:CodeSwitch3, enum) 1 == (L:CodeSwitch4, enum) 0 ==
    &amp;&amp; &amp;&amp; &amp;&amp;
    if{ (L:Bearing22, radians) (A:PLANE HEADING DEGREES MAGNETIC, radians) - pi + }
    (A:Nav active frequency:1,Khz) 115000 == (L:BearingSwitch,enum) 3 ==
    (L:CodeSwitch, enum) 0 == (L:CodeSwitch2, enum) 2 ==
    (L:CodeSwitch3, enum) 2 == (L:CodeSwitch4, enum) 0 ==
    &amp;&amp; &amp;&amp; &amp;&amp;
    if{ (L:Bearing22, radians) (A:PLANE HEADING DEGREES MAGNETIC, radians) - pi + }
</Value>

with different variations of &amp;&amp; ect. but cant get more than 1 to work.
tried with || (OR) too
like so

XML:
(A:Nav active frequency:1,Khz) 108200 == (L:BearingSwitch,enum) 1 ==

    (L:CodeSwitch, enum) 2 == (L:CodeSwitch2, enum) 1 ==

    (L:CodeSwitch3, enum) 0 == (L:CodeSwitch4, enum) 2 ==

    &amp;&amp; &amp;&amp; &amp;&amp;

    if{ (L:Bearing22, radians) (ApLANE HEADING DEGREES MAGNETIC, radians) - pi + } >||<

    (A:Nav active frequency:1,Khz) 112150 == (L:BearingSwitch,e...................ect ect

but so far unsuccessful
 
Last edited:
Messages
116
Country
england
Gotchya' !

XML:
 <Value> (L:CodeSwitch, enum) 2 == (L:CodeSwitch2, enum) 1 == (L:CodeSwitch3, enum) 0 ==
     (L:CodeSwitch4, enum) 2 == (A:Nav active frequency:1,Khz) 108200 ==
     (L:BearingSwitch,enum) 1 ==
     and and and and and
     if{ (L:Bearing22, radians) (A:PLANE HEADING DEGREES MAGNETIC, radians) - pi + }
     (A:Nav active frequency:1,Khz) 112150 == (L:BearingSwitch,enum) 2 ==
     (L:CodeSwitch, enum) 0 == (L:CodeSwitch2, enum) 0 ==
     (L:CodeSwitch3, enum) 1 == (L:CodeSwitch4, enum) 0 ==
     and and and and and
     if{ (L:Bearing22, radians) (A:PLANE HEADING DEGREES MAGNETIC, radians) - pi + }
     (L:CodeSwitch, enum) 0 == (L:CodeSwitch2, enum) 2 ==
     (L:CodeSwitch3, enum) 2 == (L:CodeSwitch4, enum) 0 ==
     (A:Nav active frequency:1,Khz) 115000 == (L:BearingSwitch,enum) 3 ==
     and and and and and
     if{ (L:Bearing22, radians) (A:PLANE HEADING DEGREES MAGNETIC, radians) - pi + }
     els{ 0 (>L:Bearing22, degrees)
</Value>
 
Messages
116
Country
england
Here it is, to find the station, you ( I ) now have to enter a 4 digit code (bottom right) selected with switches (analog) otherwise the LR-ADF will not give a bearing.
Another layer of security from the fuel bandits! (its very expensive now-a-days ya'know!) 😄

Also changed the background colour

16.jpg
 
Last edited:
Messages
116
Country
england
I want to simulate this unit running on its own power source and not the aircraft.
I also want a little hand crank dynamo type thing that will simulate recharging the battery.
Done a little research found some things but I think I could do it more simply
my idea is to have the hand crank knob, do 1 full rotation, and each rotation will add 0.2v. 5 rotations will make 1v
30 rotations make 6v ect.

so each time the knob is clicked put 0.2 (>L:UnitPower, unit) (volts, number, enum?) then set the Lvar to not go above 6v (6v just an example for now)
set (L:UnitPower) as a condition to be above X amount with everything that runs on power.
and have a timer decrement the (L:UnitPower) over time

so for example:
<Value> (L:CodeSwitch, enum) 2 == (L:CodeSwitch2, enum) 1 == (L:CodeSwitch3, enum) 0 ==
(L:CodeSwitch4, enum) 2 == (A:Nav active frequency:1,Khz) 108200 ==
(L:BearingSwitch,enum) 1 ==
and and and and and

changed to (part of Adf code)

<Value>(L:UnitPower) 3 &gt; (L:CodeSwitch, enum) 2 == (L:CodeSwitch2, enum) 1 == (L:CodeSwitch3, enum) 0 ==
(L:CodeSwitch4, enum) 2 == (A:Nav active frequency:1,Khz) 108200 ==
(L:BearingSwitch,enum) 1 ==
and and and and and and

so if unit power falls below 3 the Adf needle won’t move.
 
Messages
116
Country
england
Made a start with the crank handle. Click and hold and it will rotate infinitely.
(Also Better looking compass and also now rotates with aircraft heading)

17.jpg


Code:
<Area Left="880" Top="320" Width="119" Height="220">
<Cursor Type="Hand" />
<Tooltip>Battery Dynamo Crank</Tooltip>
<Click Repeat="Yes">(L:CrankHandle,percent) ++ 99 % (&gt;L:CrankHandle,percent)</Click>
</Area>

With this the value of (L:CrankHandle) goes from 0 - 98 then restarts from zero.
Many rotations of the knob is required to reach 98 - simulating winding the dynamo crank.
Therefore, i plan on writing the code to add ~0.5v (>L:UnitBatPwr, number) each time the knob reaches 98.
Eventually (L:UnitBatPwr) will have a value of ~20v
Code timer to decrement this Lvar over time
add to logic > (L:UnitBatPwr) 6 &gt;
When below 6v ''Batt Dead''

Re-crank the handle to recharge the battery.

Don't have time today to go any further, so hopefully finish it the weekend.
 
Top