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

K:Variable in Element section - Single switching ?

Messages
542
Country
australia
I have the following , it's intent is to automatically release a bomb at ,
- 5.1 seconds to go to target/impact , if aircraft is at 400kts and 500'agl .

Code:
<!-- trigger bomb release switch -->     
      <Element>
        <Select>
            <Value>   (L:TTR time, seconds) 4.99 &gt; (L:TTR time, seconds) 5.11 &lt; and
            if{ 1 (&gt;K:RELEASE_DROPPABLE_OBJECTS)
                     }
            </Value>
        </Select>
      </Element>
Ordinarily the K:Variable would fire continuously ( flooding ) , to prevent that I limit it's function with
the visibility condition .
The visibility time window is time duration 0.12 seconds resulting in approx 38 firings ,
so you end up with 38 bombs deployed .

I have been unable to reduce the time window ( 0.12 seconds ) , if I attempt to do so
it does not function .

What I am after is a Single switching of the K;Variable that would result in a single bomb dropped .

Any ideas on how to trigger a single firing of the K:Variable would be appreciated .

Cheers
Karol
 
vou could use a counter

Code:
<!-- trigger bomb release switch -->   
      <Element>
        <Select>
            <Value>
                  (L:TTR time, seconds) 4.99 &gt;
                   (L:Bomb_CT,number) 1 &lt;
                  and
                    if{
                     1 (&gt;K:RELEASE_DROPPABLE_OBJECTS)
                      1 (&gt;L:Bomb_CT,number)
                     }
            </Value>
        </Select>
      </Element>

Edi
 
Hi Edi

Thank you for the above code .
I tried it , got no results .
I then started to have some doubts about the GPS time variable that I was using ,
so I rounded the 4.99 to 5 , still no results .

I ran a test on the (A:GPS WP ETE,seconds) variable and found that it will not show decimals of a second ,that appears to be the basis of my problems .

At 400kts distance covered in 1 second is ,
400 x 6076 /3600 = 675 feet
so obviously full seconds will never deliver the required accuracy .

It is still possible to have the accuracy simply by replacing " Time To Run " with
" Distance to Run " that will return the necessary accuracy .

Following is full current code that I am using at 400kts , 500'agl ,
Code:
<!-- START  Locked Waypoint -->    
     <Element>
          <Position X="3" Y="134"/>
           <Text X="20" Y="10" Bright="Yes" Length="3" Font="Gloucester MT Extra Condensed" FontSize="9" Color="#93FF72" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">
            <String>%WPT%</String>
           </Text>
    </Element>      
    <Element>
        <Visible>(@c:FlightPlanIsActiveWaypointLocked,Bool) 1 == </Visible>
<!-- time count down readout to bomb release -->                                  
            <Element>
                <Position X="78" Y="155"/>
                    <FormattedText X="80" Y="22" Font="Tahoma" FontSize="11" LineSpacing="11" Adjust="LEFT" Color="#FF0000" Bright="Yes">                                          
                        <String>%WPT  LOCKED%\n%    TTR: %((A:GPS WP ETE,seconds) 5.1 -)%!3d%</String>
                    </FormattedText>
            </Element>
<!-- trigger bomb release switch -->    
      <Element>
        <Select>
            <Value>   (A:GPS WP ETE,seconds) 4.99 &gt; (A:GPS WP ETE,seconds) 5.11 &lt; and
            if{ 1 (&gt;K:RELEASE_DROPPABLE_OBJECTS)
                     }
            </Value>
        </Select>
      </Element>    
    </Element>
<!-- off switch of locked waypoint -->                            
      <Element>
        <Select>
            <Value>   (A:GPS WP ETE,seconds) 3.95 &gt; (A:GPS WP ETE,seconds) 4.11 &lt; and
            if{ 0 (&gt;@c:FlightPlanIsActiveWaypointLocked,Bool)
                     }
            </Value>
        </Select>
      </Element>                            
    <Element>
      <Visible>(@c:FlightPlanIsActiveWaypointLocked,Bool) 1 == (P:Local time,seconds) 1.5 % 0.5 &lt; and </Visible>  
          <Element>
          <Position X="22" Y="135"/>
           <Text X="20" Y="11" Bright="Yes" Length="3" Font="Tahoma" FontSize="12" Color="#FF0000" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">
            <String>%*%</String>
           </Text>
        </Element>
    </Element>
<!-- END  Locked Waypoint -->

To declare a Waypoint as a target , that Waypoint is Locked by following Mouse switch ,
clicking Waypoint Locked activates the next Wpt as a target and bombs are automatically released at appropriate time .
Code:
(@c:FlightPlanIsActiveWaypointLocked,Bool) ! (&gt;@c:FlightPlanIsActiveWaypointLocked,Bool)

Ch
 
Karol,
If you have the location of the target you can calculate the distance to go. When that falls below the desired distance, drop the sucker.
Roy
 
Edi

The (A:GPS WP ETE,minutes) gives the time to run to the current active Wpt ( next Wpt ) of a flight plan at the aircraft's current Groundspeed .
I use the Waypoint Lock to restrict or isolate the current active Wpt as the target , additionally by locking the Wpt the aircraft will fly all the way to
that Wpt if on autopilot , it will not execute "turn anticipation " , you will see in my longer code that immediately after release it switches the Waypoint Lock OFF allowing
the aircraft to resume the flight plan if on autopilot .

Roy

Yes , you are right , I ran tests withe the GPS distance to run in feet and found that it gives values in blocks rather than progressive incremental values .
The GPS module while very good does have limitations , It is of 'horse and cart' vintage developed many years ago when conservation of resources or
computer overheads was of critical importance , it was never updated to reflect the more powerful computers that are now commonly available .
While the GPS module does a wonderful job for most purposes , there are some functions where it's sluggishness shows up .

I do currently have the Lat/Long of the current active Wpt (target) , so it will require a Geocalc from the aircraft to that position , I've done several of
those type of Geocalcs and they run beautifully and smoothly .

If I am able to restrict the K:Variable to dropping just one bomb ( I have serious doubts that I will be able to achieve that ) then I would be
able to chart various (A) run distances to target , (B) Speeds , (C) heights agl , by using the Synthetic ILS with intercept instrument to an accuracy
of about +/- 1 foot.
The release trigger would be distance to run in feet calculated from both speed and height , even though the data readout would appear as time in seconds ,
- initially time to release
- then time to impact

Cheers
Karol
 
Karol, not to be overly pedantic but the more correct term is K:Event since these are "commands". :teacher:
 
Using a Geocalc I have now managed to to reduce the K:Event firing down from 38 to 2 .

Still unable to get the desired one firing of the K:Event ! ! !

Following is full code that I am currently using ,

1. Update section .
Code:
      <Update Hidden="Yes">       
        <Frequency>18</Frequency>   
    (@c:FlightPlanIsActiveWaypointLocked,Bool) 1 ==
      if{
           (A:GPS WP NEXT LAT, degrees) (>@c:GeoCalcLatitude1,degrees)
           (A:GPS WP NEXT LON, degrees) (>@c:GeoCalcLongitude1,degrees)
           (A:PLANE LATITUDE,degrees) (>@c:GeoCalcLatitude2,degrees)
           (A:PLANE LONGITUDE,degrees) (>@c:GeoCalcLongitude2,degrees)
             (@c:GeoCalcBearing,degrees) (>L:BearingTargetPos,degrees)
             (@c:GeoCalcDistance,nmiles) (>L:DistanceTargetPos,nmiles)
        }   
      </Update>

2. Functional code .
Code:
<!-- START  Locked Waypoint -->     
     <Element>
          <Position X="3" Y="134"/>
           <Text X="20" Y="10" Bright="Yes" Length="3" Font="Gloucester MT Extra Condensed" FontSize="9" Color="#93FF72" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">
            <String>%WPT%</String>
           </Text>
    </Element>       
    <Element>
        <Visible>(@c:FlightPlanIsActiveWaypointLocked,Bool) 1 == </Visible>
<!-- time count down readout to bomb release -->                                   
            <Element>
                <Position X="78" Y="155"/>
                    <FormattedText X="80" Y="22" Font="Tahoma" FontSize="11" LineSpacing="11" Adjust="LEFT" Color="#FF0000" Bright="Yes">                                           
                        <String>%WPT  LOCKED%\n%    TTR: %((A:GPS WP ETE,seconds) 5.1 -)%!3d%</String>
                    </FormattedText>
            </Element>
      <Element>
        <Select>
            <Value>   (L:DistanceTargetPos,nmiles) 6076 * (&gt;L:FEETtoTargetDist, feet)
            </Value>
        </Select>
      </Element>           
<!-- trigger bomb release switch NOTE @ 400kts Dist 3443 feet is equivalent to 5.1 seconds -->       
      <Element>
        <Select>
            <Value>   3405 3443 (L:FEETtoTargetDist, feet) rng
            if{ 1 (&gt;K:RELEASE_DROPPABLE_OBJECTS)
                     }
            </Value>
        </Select>
      </Element>     
    </Element>
<!-- off switch of locked waypoint -->                             
      <Element> 
        <Select>
            <Value>   3302 3350 (L:FEETtoTargetDist, feet) rng
            if{ 0 (&gt;@c:FlightPlanIsActiveWaypointLocked,Bool)
                     }
            </Value>
        </Select>
      </Element>                             
    <Element>
      <Visible>(@c:FlightPlanIsActiveWaypointLocked,Bool) 1 == (P:Local time,seconds) 1.5 % 0.5 &lt; and </Visible>   
          <Element>
          <Position X="22" Y="135"/>
           <Text X="20" Y="11" Bright="Yes" Length="3" Font="Tahoma" FontSize="12" Color="#FF0000" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">
            <String>%*%</String>
           </Text>
        </Element>
    </Element>
<!-- END  Locked Waypoint -->

3. Mouse section .
Code:
(@c:FlightPlanIsActiveWaypointLocked,Bool) ! (&gt;@c:FlightPlanIsActiveWaypointLocked,Bool)

Operation description.
1. The FlightPlanIsActiveWaypointLocked is switched to On (locked) .
2. The code automatically triggers the K:Event releasing bombs at 3443' prior to Wpt (target) , 3443' is equivalent to 5.1 seconds to run .
The code automatically sets FlightPlanIsActiveWaypointLocked to Off an instant after bomb release .

Cheers
Karol
 
Shot #1
The above code is in the Right Hand MFD , is text in red . The "WPT" button selects Waypoint Locked .
At moment of release , bombs visible in Pave Tack .
The red text and locked function disappear a fraction of a second later .
1 Release_Panel.jpg


Shot #2
2 Release_View.jpg
 
Last edited:
A piece of advice... if you want a boolean value to be true, SET it to true. If you want it to be false, SET it to false. Do not 'toggle' boolean values as you are always assuming (bad choice) that they have a specific value before the toggle. Also when you explicitly set a boolean value, your code is 1000% more readable in six months. Honest. :)

As for your two objects... you get two because you're using a 'window' to control when you trigger the drop and a completely different 'window' for turning off the bool to initiate the drop. I can guarantee there's plenty of time simply because of the distance separation between the two windows. Instead of using a window to turn OFF the drop code... you need to use the fact that you did indeed trigger a drop to turn off the drop code.
 
I agree, something like "if you are less than 3350 ft from the target AND you have NOT dropped a bomb, drop a bomb. Now set the bomb dropped flag to true so the first statement will not repeat.
 
A piece of advice... if you want a boolean value to be true, SET it to true. If you want it to be false, SET it to false. Do not 'toggle' boolean values as you are always assuming (bad choice) that they have a specific value before the toggle. Also when you explicitly set a boolean value, your code is 1000% more readable in six months. Honest. :)

As for your two objects... you get two because you're using a 'window' to control when you trigger the drop and a completely different 'window' for turning off the bool to initiate the drop. I can guarantee there's plenty of time simply because of the distance separation between the two windows. Instead of using a window to turn OFF the drop code... you need to use the fact that you did indeed trigger a drop to turn off the drop code.

I agree, something like "if you are less than 3350 ft from the target AND you have NOT dropped a bomb, drop a bomb. Now set the bomb dropped flag to true so the first statement will not repeat.

Wow ! ... fantastic , thanks , I really appreciate that , I'm not sure how to implement that , but I will definitely give it a try .

Regards the 'two objects' , I had noticed that I was always getting multiples of 2 , I thought to mention it , but foolishly didn't , I should have as it represented evidence .

Cheers
Karol

PS:
I ran a test flight to check for accuracy , even though this arrangement is at a basic stage and has not been calibrated for accuracy .

1. In the Right Hand MFD I created a DTO (Direct To) to a VOR ( JCW ) that was 48 nm away from the aircraft .
2. Engaged autopilot to fly the DTO .
3. Then switched On the 'WaypointLocked' release function .
4. The 48 nm track enabled the autopilot to remove all Track Errors as is indicated at bottom of radar display .
5. This arrangement automatically released the bombs at the 3443' to run to target (VOR) .
6. In the Pave Tack instrument you can see the VOR antenna immediately below the second bomb blast .
I was a little surprised at the accuracy as to date the arrangement was all based on blind faith .
3 Release_view.jpg
 
Last edited:
Now, maybe this would work??

Code:
<!-- trigger bomb release switch -->
      <Element>
        <Select>
            <Value>
                  (L:FEETtoTargetDist, feet) 3443 &lt;
                  (L:Bomb_CT,number) 1 &lt;
                  and
                    if{
                     1 (&gt;K:RELEASE_DROPPABLE_OBJECTS)
                      1 (&gt;L:Bomb_CT,number)
                     }
            </Value>
        </Select>
      </Element>

(L:Bomb_CT,number) must set before the run to zero.
"1" could be variable set by the WSO. so you could select how may bombs you want to use.


Code:
what shows (A:GPS WP ETE,minutes)?

If you use minutes i wanted to know, if you get decimals?
If yes, you could recalculate the decimals into seconds.

1min : 60 = 0.016666sec
i had a similar probleme with another variable.

Edi

PS
Code:
 I had noticed that I was always getting multiples of 2 ,

so you probleme is solved.More or less;-)
 
Last edited:
Karol,

If (@c:FlightPlanIsActiveWaypointLocked,Bool) is the flag variable that contols the release of the bomb, then all the logic can be coded depending on flag's value:

Code:
<Update>
   ......
  (@c:FlightPlanIsActiveWaypointLocked,Bool) 1 ==
     if{
          (A:GPS WP NEXT LAT, degrees) (>@c:GeoCalcLatitude1,degrees)
          (A:GPS WP NEXT LON, degrees) (>@c:GeoCalcLongitude1,degrees)
          (A:PLANE LATITUDE,degrees) (>@c:GeoCalcLatitude2,degrees)
          (A:PLANE LONGITUDE,degrees) (>@c:GeoCalcLongitude2,degrees)
          (@c:GeoCalcBearing,degrees) (>L:BearingTargetPos,degrees)
          (@c:GeoCalcDistance,nmiles) (>L:DistanceTargetPos,nmiles)        
          (L:DistanceTargetPos,feet) 3443 &lt;
          if{
               (>K:RELEASE_DROPPABLE_OBJECTS)
               0  (>@c:FlightPlanIsActiveWaypointLocked,Bool)
            }  
       }
</Update>

Startig from that point you can add as much as needed for different situations.

Note on GPS Avars: they are actualized once a second, or perhaps less, but definitely not at frame rate, so using their elapsed time values might not give expected results (as you have already noticed)


Tom
 
Hi Tom

It Works ! ....Wow does it ever .

I ran your method and it works brilliantly , I am now getting one bomb dropped on each occassion .
I really don't know how to thank you enough , but , Thank you for your wonderful solution .

What amazes me is that the solution is so very elegant .

Once again Tom , my sincere thanks .
Cheers
Karol
 
Last edited:
For information , the following is the code that I am currently using .

1. Update section .
Code:
<!-- Can use either (&gt;K:RELEASE_DROPPABLE_OBJECTS)  or  (&gt;K:ROTOR_BRAKE)
     as the trigger in the Update
     Rotor brake is only applicable if Ripple bomb switch is installed
     Drop number must be set and Time interval set if more than 1 bomb is
     being set at that switch instrument
     Ripple Bomb Switch only works in FSX -->
      <Update Hidden="Yes">    
        <Frequency>18</Frequency>
   (@c:FlightPlanIsActiveWaypointLocked,Bool) 1 ==
     if{
          3251 (&gt;L:DistToRun,feet)
 
          (A:GPS WP NEXT LAT, degrees) (&gt;@c:GeoCalcLatitude1,degrees)
          (A:GPS WP NEXT LON, degrees) (&gt;@c:GeoCalcLongitude1,degrees)
          (A:PLANE LATITUDE,degrees) (&gt;@c:GeoCalcLatitude2,degrees)
          (A:PLANE LONGITUDE,degrees) (&gt;@c:GeoCalcLongitude2,degrees)
          (@c:GeoCalcBearing,degrees) (&gt;L:BearingTargetPos,degrees)
          (@c:GeoCalcDistance,nmiles) (&gt;L:DistanceTargetPos,nmiles)    
          (L:DistanceTargetPos,feet) (L:DistToRun,feet) &lt;
          if{
               (&gt;K:RELEASE_DROPPABLE_OBJECTS)
               0  (&gt;@c:FlightPlanIsActiveWaypointLocked,Bool)
            }
       } 
   </Update>

2. Functional code .
Code:
<!-- START  Locked Waypoint -->  
     <Element>
          <Position X="3" Y="134"/>
           <Text X="20" Y="10" Bright="Yes" Length="3" Font="Gloucester MT Extra Condensed" FontSize="9" Color="#93FF72" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">
            <String>%WPT%</String>
           </Text>
    </Element>
<!-- Dist in feet per second  and  time in sec fr Release to Target -->    
      <Element>
        <Select>
            <Value>
               (A:GROUND VELOCITY, knots) 6076 * (&gt;L:DistPerKnot,feet)
               (L:DistPerKnot,feet) 3600 / (&gt;L:DistPerSecond,number)
               (L:DistToRun,feet) (L:DistPerSecond,number) / (&gt;L:TimeToRun,number)
            </Value>
        </Select>
      </Element>

    <Element>
        <Visible>(@c:FlightPlanIsActiveWaypointLocked,Bool) 1 == </Visible>    
<!-- time count down readout to bomb release -->                                
            <Element>
                <Position X="78" Y="155"/>
                    <FormattedText X="80" Y="22" Font="Tahoma" FontSize="11" LineSpacing="11" Adjust="LEFT" Color="#FF0000" Bright="Yes">                                        
                        <String>%WPT  LOCKED%\n%    TTR: %((A:GPS WP ETE,seconds) (L:TimeToRun,number) -)%!3d%</String>
                    </FormattedText>
            </Element>
    </Element>                          
    <Element>
      <Visible>(@c:FlightPlanIsActiveWaypointLocked,Bool) 1 == (P:Local time,seconds) 1.5 % 0.5 &lt; and </Visible>
          <Element>
          <Position X="22" Y="135"/>
           <Text X="20" Y="11" Bright="Yes" Length="3" Font="Tahoma" FontSize="12" Color="#FF0000" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">
            <String>%*%</String>
           </Text>
        </Element>
    </Element>
<!-- END  Locked Waypoint -->

3. Mouse section .
Same as in above posts .

I have made several changes , the reason being that any changes made to the "Distance to Run at release" value will result in compensation of
the TTR time countdown readout .
The TTR will now always countdown to zero at time of release regardless of Speed or Height used .
It is of course dependant on the "Distance to Run at release" value set in the Update Geocalc .

The following lists several "Distance to Run " values for various Speeds and Heights agl ,
Code:
Below are listed the 3 aspects .
1. Set "Distance to Run at release" value into the Update of the xml  .
2 . Set autopilot Speed and TFR values ( TFR = Height agl ).

****************************
400 KIAS @     500' TFR  =>  3251

500 KIAS @     500' TFR  =>  4119

*****************************
400 KIAS @   2,000' TFR  =>  4845

500 KIAS @   2,000' TFR  =>  7054

****************************
400 KIAS @   4,000' TFR  =>  5874

500 KIAS @   4,000' TFR  =>  8136

****************************

Previously at this forum we created a Ripple Bomb switch that enabled both the Number of Bombs and the Time Interval to be set .
An Event Handler dll Rotor Brake to be assigned to controllers to effect release of a string of bombs , refer following link ,
http://www.fsdeveloper.com/forum/threads/programmable-switch-help-needed.426006/

The comment section prior to the Update above advises that Either K: Event can be used in the Update .
The Rotor Brake K:Event will work as long as the Ripple Switch exists in the panel .

You must set a Number value , and a Time interval if you wish time separation in the Ripple Switch .
Then click WPT to switch On the Waypoint Locked ,
it will then automatically releas a string of bombs when the TTR countdown reaches zero .
You can set any number of bomb from 1 to a greater number .

Sorry about the length of this post , but it may be of use to some .

Cheers
Karol
Shot of multiple bomb being deployed automatically
4 Release_view.jpg
 
Last edited:
Evaluation of " Heading " versus " Bearing "

Need help , I'm stuck , the intention is to subtract a 360 degree based direction from another 360 degree based direction .
I'm sorry , but I'll probably make a hash of trying to describe it , but I'll try , hopefully the screenshot will help .

I have a display that subtracts the Bearing to a target from the aircraft's Heading .
It gives Arrowhead indications of the turn direction required to get both direction values the same , you are then on track to target , the arrows are coarse indicators ,
the fine indication is provided by a angular difference readout , if it's zero , then you are precisely lined up on the Run In .

The following code is what I'm using ,
The second line in the "Comment" removes the anomaly in the right hemisphere , but causes problems in left hemisphere .
*** The "Problem" is the second line in the "Select" section .
Code:
<!-- # 1 LH ...  (A:Plane heading degrees gyro, degrees) (L:MagRelBrgOfTgt, degrees) - (&gt;L:RelBrgOfTgt, degrees)
     # 2 RH ...  360 (A:Plane heading degrees gyro, degrees) (L:MagRelBrgOfTgt, degrees) - - /-/ (&gt;L:RelBrgOfTgt, degrees)       -->
      <Element>
        <Select>
            <Value>(L:BearingTargetPos,degrees) (A:GPS MAGVAR, degrees) - (&gt;L:MagRelBrgOfTgt, degrees)
                   (A:Plane heading degrees gyro, degrees) (L:MagRelBrgOfTgt, degrees) - (&gt;L:RelBrgOfTgt, degrees)
            </Value>
        </Select>
      </Element>
<!-- Direction of turn advice ... R & D only will be eventually removed   -->   
        <Element>
           <Position X="5" Y="16"/>
             <FormattedText X="80" Y="10" Font="Tahoma" FontSize="9" LineSpacing="10" Adjust="Left" Color="#349F34" Bright="Yes">
                <String>%Diff  %((L:RelBrgOfTgt, degrees) abs )%!6.2f!%  %((L:RelBrgOfTgt, degrees) 0 &lt; if{ 'turn R' } els{ 'turn L' } )%!s!</String>
             </FormattedText>
        </Element> 
<!-- Relative angular difference between Heading and Bearing to target  -->
        <Element>
           <Position X="55" Y="4"/>
             <FormattedText X="53" Y="10" Font="Tahoma" FontSize="9" LineSpacing="10" Adjust="Left" Color="#349F34" Bright="Yes">
                <String>%Rel  %((L:RelBrgOfTgt, degrees))%!6.2f!\{dplo= }%</String>
             </FormattedText>
        </Element>
<!-- LH green arrow ... required turn direction indicator  -->     
   <Element>
     <Visible>(L:RelBrgOfTgt, degrees) 0 &gt;</Visible>     
        <Element>
           <Position X="115" Y="0"/>
             <FormattedText X="9" Y="14" Font="Tahoma" FontSize="14" LineSpacing="14" Adjust="Right" Color="#00FF00" Bright="Yes">
                <String>%((L:RelBrgOfTgt, degrees) 0 &gt; if{ '&lt;' } )%!s!</String>
             </FormattedText>
        </Element>
       </Element>
<!-- RH green arrow ... required turn direction indicator  --> 
   <Element>
     <Visible>(L:RelBrgOfTgt, degrees) 0 &lt;</Visible> 
        <Element>
           <Position X="164" Y="0"/>
             <FormattedText X="9" Y="14" Font="Tahoma" FontSize="14" LineSpacing="14" Adjust="Left" Color="#00FF00" Bright="Yes">
                <String>%((L:RelBrgOfTgt, degrees) 0 &lt; if{ '>' } )%!s!</String>
             </FormattedText>
        </Element>                     
       </Element>

The attached shot details the problem .

How do I subtract them ?

Cheers
Karol
Bomb_NAV.jpg
 
Last edited:
Hi Karol,

A familiar problem ...LoL

What you probably want is to substract to headings (whatever their values), and the difference should be between -180 and +180 degrees , under all circumstances ..Right ??
So to get an indication if you should turn left (positive value) or right (negative value) to fly to the target.

Use something like this:

Code:
(A:PLANE HEADING DEGREES MAGNETIC,degrees) (L:MagneticHeadingToTarget,degrees)  - dnor d 180 &gt; if{ 360 - }  (&gt;L:Direction,number)


Rob
 
PS:
To explain: the problem with the direction Arrow < and > in #4,5,6 is not caused by hemisphere, but by the heading and bearing values.
Like: if one is just below 360 and the other just over 0 (so a very little difference), a simple substraction works for the Arrows (because eg. rotating the needle 20 degrees or 340 degrees gives the same display) but NOT for the direction (< or >)

Like in #4: the < queue is telling you to make a 299 degrees turn to the left instead of a 61 degrees turn to the right.
The correction in my code solves this..
Hope you get it now ??

Cheers, Rob
 
Last edited:
Hi Rob

Thank you , Thank you , it's fantastic !

Like a petulant child . I tried it immediately , at a distance from the target I did a series of orbits using heading hold , both to the left and right ,
it worked a charm , then did a series of bombing runs on a variety of targets , it was an absolute delight to use .

I spent 2 days ' trying ' to resolve this problem with a series of scripts so I understand your description.
I think that your code is utterly awesome , love it .
I have copied both your replies and will study them further , and specifically the code step by step to understand and learn from it .

The Bomb NAV instrument is now complete and fully functional in all aspects .
In the "first" display the accuracy is +/- 6 inches .
In the "second" display , I suspect that the accuracy would be of a similar tolerance , one one hundreths of a degree is rather good .
Will still tinker with text readouts to optimise it for pilots use .

Again , Thanks .
Cheers
Karol
 
Back
Top