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

Insert a precise execution delay in XML code

Messages
137
Country
us-southcarolina
I have a catapult sound effect that i created that i want to use in place of the one supplied with the COP3 carrier ops package. One of the differences in my SoundFX is that there is a building of pressure sound before the actual launch sound. Right now the launch section of the code sequence of events is...

Check Launch condition "state", if "1" then
Condition for launch met
Play sound
execute launch

I want to add a delay of .8 sec between the time the sound PLAY is triggered and when the actual launch is executed. A "Launch" is executed if the Launch "State" is "1", the relevant code section (FS9 schema) is as follows...

Code:
<Update Frequency="0"/>
// Other code testing other "states".....
// Launch condition met, ie L:RCB_CatapultState = 1, Launch when engine reaches desired output level (set per aircraft in a "ini" file)  ...

<Element>
  <Select>
    <Value>
      (L:RCB_CatapultState,enum) 1 ==
      if{
        (A:ENG1 N1 RPM,percent) (L:COP_CatapultLaunchN1,number) &gt;
        (A:GENERAL ENG1 THROTTLE LEVER POSITION,percent) 90 &gt; &amp;&amp;
        if{
          (&gt;K:PARKING_BRAKES)
          1 (&gt;L:COP_CatapultLaunchSound,enum) // PLAY SOUND Starts Here....
// want to INSERT .8 sec DELAY HERE then execute following LAUNCH section....
          (P:ABSOLUTE TIME,seconds) (&gt;G:Var1)                    (* Var1: timer *)
          (A:GROUND VELOCITY,knots) 1.688 * (&gt;G:Var2)            (* Var2: Groundspeed at launch-start in ft/sec *)
          (L:COP_CatapultLaunchSpeed,number)
              (A:AIRCRAFT WIND Z,knots) - 1.688 * (&gt;G:Var3)      (* Var3: Groundspeed at launch-end in ft/sec *)
          (G:Var3) (G:Var2) - (G:Var2) * (G:Var3) (G:Var2) - sqr
              2 / + (L:COP_CatapultDistance,number) / (&gt;G:Var4)  (* Var4: required decelleration A in ft/secSQR *)
          2 (&gt;L:RCB_CatapultState,enum)
        }
        els{
          (A:BRAKE PARKING POSITION,bool) ! (A:SIM ON GROUND,bool) ! ||
          if{ 0 (&gt;L:RCB_CatapultState,enum) }
        }
      }
    </Value>
  </Select>
</Element>

I have looked at examples of some delays routines but found nothing that seems to fit my application since in this case the update freq is 0 and i don't want to Start the sound PLAY again.
I thought maybe a timer "loop" of some kind ?
Could someone please point me in the right direction?

thanks

Joel
 
Code:
<Element>
  <Select>
   <Value>
     (L:RCB_CatapultState,enum) 1 ==
     if{
       (A:ENG1 N1 RPM,percent) (L:COP_CatapultLaunchN1,number) &gt;
       (A:GENERAL ENG1 THROTTLE LEVER POSITION,percent) 90 &gt; &amp;&amp;
       if{
         (&gt;K:PARKING_BRAKES)
         1 (&gt;L:COP_CatapultLaunchSound,enum)
         (L:COP_CatapultLaunchSound,enum) 1 == (G:Var8) 0 == and if{ 1 (>G:Var8) }
         (L:COP_CatapultLaunchSound,enum) 0 == (G:Var8) 1 == and if{ 2 (>G:Var8) }
         (G:Var8) 2 ==
         if{
         (P:ABSOLUTE TIME,seconds) (&gt;G:Var1)                    (* Var1: timer *)
         (A:GROUND VELOCITY,knots) 1.688 * (&gt;G:Var2)            (* Var2: Groundspeed at launch-start in ft/sec *)
         (L:COP_CatapultLaunchSpeed,number)
             (A:AIRCRAFT WIND Z,knots) - 1.688 * (&gt;G:Var3)      (* Var3: Groundspeed at launch-end in ft/sec *)
         (G:Var3) (G:Var2) - (G:Var2) * (G:Var3) (G:Var2) - sqr
             2 / + (L:COP_CatapultDistance,number) / (&gt;G:Var4)  (* Var4: required decelleration A in ft/secSQR *)
         2 (&gt;L:RCB_CatapultState,enum)
       }
       els{
         (A:BRAKE PARKING POSITION,bool) ! (A:SIM ON GROUND,bool) ! ||
         if{ 0 (&gt;L:RCB_CatapultState,enum) 0 (>G:Var8) }
       } }
     }
   </Value>
  </Select>
</Element>

First, check that Var8 is unused and, in case of doubt, assign a L: var.
Var8 is used to check that the catapult sound has been played, so if the sound is triggered and plays, it switches to "1". After the sound has stopped playing, Var8 switches to "2", which will trigger the rest of the code.
For repeated launches in the same session, Var8 is reset when the plane has left the ground.
 
..... so if the sound is triggered and plays, it switches to "1". After the sound has stopped playing, Var8 switches to "2", which will trigger the rest of the code.
For repeated launches in the same session, Var8 is reset when the plane has left the ground.

thanks for the code. Unfortunately this won't work for my application in that the actual "launch" SFX is .8 sec into the whole sound .wav file. In the SoundFX you hear, steam filling and charging the pistons, then at .8 sec the catapult is tripped. the whole file is about 3.5 sec long which includes the trail off. So i need a way to run a timer once the SFX starts to play so the actual "Launch" of the aircraft is in sync with the launch sound in the file and not after the file ends

I guess I could cut the file into a "pre Launch" and "Launch" SFX files, run the "Pre Launch" using your code and when it's done run the Launch SFX follwed by the Launch code. This would work as long as you didn't hear a blip or delay when the sound files change (ie one ends and the other starts) ?? I could try that.

But would prefer to keep the file whole and use timer if it's possible.

Thanks

Joel
 
Joel,

Why do you want Update Frequency=0? If you use the default 18 Hz, it seems one of several methods would be to begin a simple cycle count in Update once (L:COP_CatapultLaunchSound,enum) is set =1, then after 14 cycles (equals 0.8 sec), proceed with the Launch section.

Something like ... (not tested but you get the idea)
Code:
<Update Frequency="18">
   (L:CountLaunchDelayCycles, bool) 1 ==
       if{
           (L:LaunchDelayCycles, enum) ++ (>L:LaunchDelayCycles, enum)
           (L:LaunchDelayCycles, enum) 14 &gt;=
               if{
                   1 (>L:ProceedWithLaunch, bool)
                   0 (>L:LaunchDelayCycles, enum)
                   0 (>L:CountLaunchDelayCycles, bool)
               }
       }
</Update> 
<Element>
   <Select>
       <Value>
           (L:RCB_CatapultState,enum) 1 ==
               if{
                   (A:ENG1 N1 RPM,percent) (L:COP_CatapultLaunchN1,number) >
                   (A:GENERAL ENG1 THROTTLE LEVER POSITION,percent) 90 > &amp;&amp;
                       if{
                           (>K:PARKING_BRAKES)
                           1 (>L:COP_CatapultLaunchSound,enum)
                           1 (>L:CountLaunchDelayCycles, bool)
                           (L:ProceedWithLaunch, bool) 1 ==
                               if{
                                   (P:ABSOLUTE TIME,seconds) (>G:Var1)                    (* Var1: timer *)
                                   (A:GROUND VELOCITY,knots) 1.688 * (>G:Var2)            (* Var2: Groundspeed at launch-start in ft/sec *)
                                   (L:COP_CatapultLaunchSpeed,number)
                                   (A:AIRCRAFT WIND Z,knots) - 1.688 * (>G:Var3)      (* Var3: Groundspeed at launch-end in ft/sec *)
                                   (G:Var3) (G:Var2) - (G:Var2) * (G:Var3) (G:Var2) - sqr
                                   2 / + (L:COP_CatapultDistance,number) / (>G:Var4)  (* Var4: required decelleration A in ft/secSQR *)
                                   2 (>L:RCB_CatapultState,enum)
                                   0 (>L:ProceedWithLaunch, bool)
                               }
                       }
                       els{
                       (A:BRAKE PARKING POSITION,bool) ! (A:SIM ON GROUND,bool) ! ||
                       if{ 0 (>L:RCB_CatapultState,enum) }
                       }
               }
       </Value>
   </Select>
</Element>
Apologies for the poor tab indents

Bob
 
Last edited:
thanks for the code. Unfortunately this won't work for my application in that the actual "launch" SFX is .8 sec into the whole sound .wav file. In the SoundFX you hear, steam filling and charging the pistons, then at .8 sec the catapult is tripped. the whole file is about 3.5 sec long which includes the trail off. So i need a way to run a timer once the SFX starts to play so the actual "Launch" of the aircraft is in sync with the launch sound in the file and not after the file ends

You should have mentioned that initially, since my first attempt looked much like Bob's, using a delay timer based on update cycles. But I scratched that for the simpler one above.

Code:
<Element>
  <Select>
   <Value>
    (L:RCB_CatapultState,enum) 1 ==
    if{
      (A:ENG1 N1 RPM,percent) (L:COP_CatapultLaunchN1,number) &gt;
      (A:GENERAL ENG1 THROTTLE LEVER POSITION,percent) 90 &gt; &amp;&amp;
      if{
        (&gt;K:PARKING_BRAKES)
        1 (&gt;L:COP_CatapultLaunchSound,enum)
        (L:COP_CatapultLaunchSound,enum) 1 == if{ 1 (>G:Var8) }
        (G:Var8) 1 &gt;= and if{ (G:Var8) ++ (>G:Var8) }
        (G:Var8) 15 &gt;=
        if{
        (P:ABSOLUTE TIME,seconds) (&gt;G:Var1)                    (* Var1: timer *)
        (A:GROUND VELOCITY,knots) 1.688 * (&gt;G:Var2)            (* Var2: Groundspeed at launch-start in ft/sec *)
        (L:COP_CatapultLaunchSpeed,number)
            (A:AIRCRAFT WIND Z,knots) - 1.688 * (&gt;G:Var3)      (* Var3: Groundspeed at launch-end in ft/sec *)
        (G:Var3) (G:Var2) - (G:Var2) * (G:Var3) (G:Var2) - sqr
            2 / + (L:COP_CatapultDistance,number) / (&gt;G:Var4)  (* Var4: required decelleration A in ft/secSQR *)
        2 (&gt;L:RCB_CatapultState,enum)
      }
      els{
        (A:BRAKE PARKING POSITION,bool) ! (A:SIM ON GROUND,bool) ! ||
        if{ 0 (&gt;L:RCB_CatapultState,enum) 0 (>G:Var8) }
      } }
    }
   </Value>
  </Select>
</Element>

One gauge update cycle is 1/18th second, so do the math if you need to adjust the launch treshhold (currently 15 cycles = 15/18 th second).
 
Last edited:
Joel,

Why do you want Update Frequency=0?
Bob

Bob,

This is not my code so i have no idea why "Update Frequency=0". I just wanted to add this mod delay timer to the code so it would sync with my SoundFX which is why i wanted to add the delay. I do know that this XML file works in conjunction with a DLL that does the heavy lifting of actually launching the aircraft. It's is part of the COPS3 (Carrier Ops 3) package. I don't know if changing the Update Freq will break the gauge or not. The COPS3 package was written 10 years ago. I wrote the original author but got no response. I have to figure that there is a reason the Update Freq is set to 0 but I have no idea why. If an update is not functionaly needed in the original design would it make sense to set update Freq to 0 to save CPU cycles?
 
You should have mentioned that initially,

I'm sorry I thought I did, but I guess I didn't give enough detail up front. My Bad.

Like with Bob's code, i don't know if i can change the Freq rate without breaking the gauge. I will give it a shot and see and let you know.

Back to your "Play till done" method. Since it's not dependent on Update Freq I had another idea on how to use it and keep from cutting my SoundFX file in 2 pieces.... Say I created a new sound file, .8 sec long of silence, lets call it Timer.wav. Could I then....

Start Play of both Catapult SFX and Timer.wav
Use your example of play til end to detect Timer.wav end, then
Execute Launch Code

Would something like that work and not be dependent on a timer based on Update Freq ?? can 2 sound files be played at the same time ?

Joel
 
I have a rather complex arrangement with the Steward's Light on the OH panel. It comes on when cabin crew wish to make contact and then goes off shortly after. If "I" click the light it depresses, lights up and dings. If I right click, that sets off the cabin safety briefing followed by a message from the cabin and then a codeshare briefing in the local language (triggered by the ICAO regional code). In this example (L:Sound_BAsafety,enum) which is about 5 minutes long is allowed to play out the light stays on an extra 8.5 seconds while the cabin crew relay a message to the flightdeck. Subsequent to that the codeshare message is played. Hope you can make some sense of this snippet.
Code:
<Mouse>
         <Tooltip>Cabin Call</Tooltip>
         <Cursor Type="Hand"/>
    <Click Kind="LeftSingle+LeftRelease+RightSingle+RightRelease">
            (M:Event) 'LeftSingle' scmp 0 == if{ (L:CABIN CALL,number) ! (&gt;L:CABIN CALL,number)     
2 (>L:Sound_attend2a,enum)
1 (>L:CAB LIGHT ON,number) }
            (M:Event) 'LeftRelease' scmp 0 == if{ (L:CABIN CALL,number) ! (&gt;L:CABIN CALL,number)   
0 (>L:Sound_attend2a,enum)
0 (>L:CAB LIGHT ON,number) }
(M:Event) 'RightSingle' scmp 0 ==  if{ (L:CABIN CALL,number) ! (&gt;L:CABIN CALL,number)   
2 (>L:Sound_attend2a,enum)
1 (>L:CAB LIGHT ON,number) }
(M:Event) 'RightRelease' scmp 0 == if{ (L:CABIN CALL,number) ! (&gt;L:CABIN CALL,number)   
0 (>L:Sound_attend2a,enum)
0 (>L:CAB LIGHT ON,number) 1 (>L:Sound_BAsafety,enum)
1 (>L:Monitor_Sound, bool) }
        </Click>   
   </Mouse>


<Gauge Name="Safety Vid" Version="1.0">
<Image Name="SWAP.bmp"/>
<Update>
(L:Monitor_Sound, bool)
if{ (L:Sound_BAsafety,enum) ! if{ 0 (>L:Monitor_Sound, bool) 1 (>L:Sound_mes2,enum) (P:local time, seconds) 8.5 + (>L:CAB LIGHT 2,number) }
}
</Update>


       <!-- Code Share Safety Briefings -->
<Element>
      <Select>
        <Value>(A:SIM ON GROUND, bool) 1 ==
        if{ (L:CAB LIGHT 2,number) 0 &gt; (P:local time, seconds) (L:CAB LIGHT 2,number) 8 + &gt; and (L:sound_played,bool) 0 == and
        if{ 1 (>L:rnicao,bool) } }</Value>
 </Select>
   </Element>
  
   <Element>
      <Select>
        <Value>(A:SIM ON GROUND, bool) 0 == (L:rnicao,bool) 1 == and if{ 0 (>L:rnicao,bool) }</Value>
 </Select>
   </Element>
  
<Element>
      <Select>
         <Value>(L:Nav_Info_LetterApt1,number) chr (L:Nav_Info_LetterApt2,number) chr scat 'LI' scmp ! if{ 3 (>L:icao,number) }</Value>
      </Select>
   </Element>   
    <Element>
      <Select>
         <Value>(L:plydicao3,bool) 0 == (A:SIM ON GROUND, bool) 1 == and (L:rnicao,bool) 1 == and (L:icao,number) 3 == and
         if{ 1 (>L:Sound_itsafe,enum) 1 (>L:plydicao3,bool) }</Value>
      </Select>
   </Element>
</Gauge>
 
All,

Changing the Update Freq breaks the gauge. I tried both code versions from Bob and Heretic. The sound plays and the "Launch" starts at the desired point but then the aircraft quickly stutters and stops and the sound repeats. There is no Launch. So....

IF... Update Freq = "0" is required in this case for proper operation as designed by the author, then, while frowned upon by many, could this be a good use of an old fashion hard coded GOTO type loop (assuming you can do that in XML) counter that "watches the clock" and then proceeds after .8 sec work in this case without dependency on the update Freq?

Joel
 
I've spotted and corrected an error in my code. If the timer trigger condition only tests for Var8 to be larger than 1, it won't ever be executed when Var8 is exactly 1.
 
I've spotted and corrected an error in my code. If the timer trigger condition only tests for Var8 to be larger than 1, it won't ever be executed when Var8 is exactly 1.
Thanks. I tried the fix but it still breaks the gauge. No repeat in the sound but still no launch, same studdering then stop of the aircraft. I tried leaving your change in place but changing the Update Freq rate back to "0" but I get the same stuttering results AND the sound is repeated so i don't know if the Freq rate is breaking the gauge or not.

Can you do a hard coded GOTO loop that checks elapsed time in XML code ?

I'm thinking of installing Doug Dawsons XML Sound gauge and see if the "Timer.wav" approach i mentioned above might work ???

thanks for the effort and any help

Joel
 
Joel,

Is there any other XML gauge in your aircraft's panel that uses a standard 18 Hz Update section, or that does not yet have an Update section in it (one in which you can add an <Update> section)?

If so, and assuming there are no other issues in your Launch gauge, then just cut the lines of script I show in the Update sample above and paste them into the Update section of the other gauge. My example uses L:Vars which can be read across the panel set.

Bob
 
Joel,

Is there any other XML gauge in your aircraft's panel that uses a standard 18 Hz Update section, or that does not yet have an Update section in it (one in which you can add an <Update> section)?

If so, and assuming there are no other issues in your Launch gauge, then just cut the lines of script I show in the Update sample above and paste them into the Update section of the other gauge. My example uses L:Vars which can be read across the panel set.

Bob

Bob,

This is the panel config for the COP3 Gauge Panel. The Catapult Gage is in this panel ....gauge05=COP3!Catapult, 0,0....

*********
//---------- COP3 Control Panel ------------
[Window17]
size_mm=73,12 //52,12
visible=0
window_size= 0.45, 0.015//0.045,0.015
window_pos= 0.55, 0.02
background_color=16,16,16
ident=10080 //DO NOT CHANGE THIS VALUE
nomenu=1

gauge00=COP3!ControlPanel, 0,0,52,12 //Has no Update section
gauge01=COP3/CarrierZones!dsd_carrier_zones,0,0 // is a GAU file
gauge02=COP3/Config!config, 0,0,,, ./gauges/COP3/Config.ini // is the ini file for the gauge
gauge03=COP3/Sound!dsd_xml_sound3, 0,0,,, ./gauges/COP3/Sound.ini // Doug Dawson's XML sound dll - calls the sound INI file
gauge04=COP3!Arrester, 0,0 // Has Update Freq set to "0"
gauge05=COP3!Catapult, 0,0 // Has Update Freq set to "0"
gauge06=COP3/SpeedControl!xml2ipc, 0,0 // appears to be Doug Dawson's XML to IPC dll, assume to do with FSUIPC which this gauge requires?
gauge07=COP3!SonicBoomControl, 0,0 // Update Freq set to "6"

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


There are 2 other panels that are part of this Carrier ops package

*************
//------------- COP3 IFOLS Meatball ----------------------
[Window18]
size_mm=477,215
visible=0
window_size= 0.2,0.12
window_pos= 0.0,0.1
background_color=0,0,0
ident=10081 //DO NOT CHANGE THIS VALUE
nomenu=1

gauge00=COP3!IFLOLS, 0,0,477,215 // No Update Section

//------------- COP3 Position Display ------------
[Window19]
size_mm=180,110
visible=0
position=2
ident=10082 //DO NOT CHANGE THIS VALUE
nomenu=1
background_color=16,16,16

gauge00=COP3!PositionDisplay,5,5,170,100 // No Update Section

***********


The above gauges are reference by ID in by the "Control Panel" in the first listed window.

So are you saying that I should level the Update Freq ="0" and add you update code to the "control panel" reference above?

Thanks

Joel
 
Add this to the ControlPanel gauge:
Code:
<Update>
   (L:CountLaunchDelayCycles, bool) 1 ==
       if{
           (L:LaunchDelayCycles, enum) ++ (>L:LaunchDelayCycles, enum)
           (L:LaunchDelayCycles, enum) 14 &gt;=
               if{
                   1 (>L:ProceedWithLaunch, bool)
                   0 (>L:LaunchDelayCycles, enum)
                   0 (>L:CountLaunchDelayCycles, bool)
               }
       }
<Update/>
and leave the Update section in the Catapault gauge alone. I believe that visible=1 will need to be part of the ControlPanel config detail for that to work.

Or, create a new gauge like:
Code:
<Gauge Name="Background Update Gauge" Version="1.0">
    <Size X="1" Y="1" />
    <Update>
        (L:CountLaunchDelayCycles, bool) 1 ==
            if{
                (L:LaunchDelayCycles, enum) ++ (>L:LaunchDelayCycles, enum)
                (L:LaunchDelayCycles, enum) 14 &gt;=
                    if{
                        1 (>L:ProceedWithLaunch, bool)
                        0 (>L:LaunchDelayCycles, enum)
                        0 (>L:CountLaunchDelayCycles, bool)
                    }
            }
    <Update/>
</Gauge>
and add it to the panel.cfg file. visible=1 for this one.

Bob
 
Last edited:
Sorry .. just read that visible=0 for your Window17. So, I would go the new gauge route.

Or check the other 16 windows (if visible=1) to see if they have an XML gauge in which you can edit/add Update
 
Joel,

The solution to your request is simple but you need to follow proper steps.

First of all, ignore Frequency="0" command as it does nothing but execute the gauge at standard 18 HZ speed.
Second, before messing with code you must focus on the logic that is necessary for the code to work.

I will give you an example based on what you posted, I don't know which other factors that are not depicted there could affect it, but more important that the code itself is the reasoning used.

Here, you have these logical parameters:

1- Catapult is armed
(L:RCB_CatapultState,enum) 1 ==

2- Conditions for catapult to enable launch
(A:ENG1 N1 RPM,percent) (L:COP_CatapultLaunchN1,number) >
(A:GENERAL ENG1 THROTTLE LEVER POSITION,percent) 90 > and


3 - Conditions for sound to start playing (only once, not repeating)
(L:CatapultSoundInit,seconds) 0 ==

4- Conditions for catapult to launch
(P:ABSOLUTE TIME,seconds) (L:CatapultSoundInit,seconds) - 0.8 >

Now you start arranging code:

(A:ENG1 N1 RPM,percent) (L:COP_CatapultLaunchN1,number) >
(A:GENERAL ENG1 THROTTLE LEVER POSITION,percent) 90 > and s10
(L:CatapultSoundInit,seconds) 0 == and

Tells to enable launch and play the sound. You need to save the status for enabling the launch in a register
(s10) that you'll use later.

(P:ABSOLUTE TIME,seconds) (L:CatapultSoundInit,seconds) s0 - 0.8 > l0 0 != and
if{ *** launch the catapult ** }

Catapult launches after 0.8 seconds of sound playing. After launch, timer (and catapult) conditions reset.
See that CatapultSoundInit var value is saved into s0 register and used later to prevent executing this
snippet if CatapultSoundInit equals 0.

(A:BRAKE PARKING POSITION,bool) ! (A:SIM ON GROUND,bool) ! l10 ! and
(L:CatapultSoundInit,seconds) 0 == and

if{ *** disarm catapult **** }
While launch is not enabled (l10 !) and the launch process hasn't started yet -once started it cannot be stopped-
(CatapultSoundInit var value is 0) if brakes are off or aircraft is in flight, the launch is disarmed.

Now the code:

Code:
<Element>
  <Select>
    <Value>
      (L:RCB_CatapultState,enum) 1 ==
      if{
            (A:ENG1 N1 RPM,percent) (L:COP_CatapultLaunchN1,number) >
            (A:GENERAL ENG1 THROTTLE LEVER POSITION,percent) 90 > and s10
            (L:CatapultSoundInit,seconds) 0 == and
            if{
                 (>K:PARKING_BRAKES)
                 1 (>L:COP_CatapultLaunchSound,enum) // PLAY SOUND Starts Here....
                 (P:ABSOLUTE TIME,seconds) (>L:CatapultSoundInit,seconds)
              }
            (P:ABSOLUTE TIME,seconds) (L:CatapultSoundInit,seconds) s0 - 0.8 > l0 0 != and
            if{
                (P:ABSOLUTE TIME,seconds) (>G:Var1)                    (* Var1: timer *)
                (A:GROUND VELOCITY,knots) 1.688 * (>G:Var2)            (* Var2: Groundspeed at launch-start in ft/sec *)
                (L:COP_CatapultLaunchSpeed,number)
                (A:AIRCRAFT WIND Z,knots) - 1.688 * (>G:Var3)      (* Var3: Groundspeed at launch-end in ft/sec *)
                (G:Var3) (G:Var2) - (G:Var2) * (G:Var3) (G:Var2) - sqr
                2 / + (L:COP_CatapultDistance,number) / (>G:Var4)  (* Var4: required decelleration A in ft/secSQR *)
                2 (>L:RCB_CatapultState,enum)
                0 (>L:CatapultSoundInit,seconds)
             }
            (A:BRAKE PARKING POSITION,bool) ! (A:SIM ON GROUND,bool) ! l10 ! and
            (L:CatapultSoundInit,seconds) 0 == and
            if{ 0 (>L:RCB_CatapultState,enum) 0 (>L:CatapultSoundInit,seconds) }
      }
    </Value>
  </Select>
</Element>

Hope this works for you (or almost!)

Tom
 
Just stumbled onto this thread ....

The COPS3 package was written 10 years ago. I wrote the original author but got no response.
Well, that would be me; but I don't recall an EMail or PM from you.
And my EMail address hasn't changed in the past 23 years ;)

As to the gauge UpdateFrequency as in
Code:
<Update Frequency="x"/>
Beware
- x=1,2,3,4,6,9,18 are indeed exact update frequencies.
- x=0,10,11,12,13,14,15,16,17 gives exactly the same update frequency as 18 (so each 55.55 msec)
- x=7,8 gives exactly the same update frequency as 9 (so each 111.10 msec)
- x=5 gives exactly the same update frequency as 6 (so each 166.66 msec)

As to using schedule ticks for timers: personally, I don't like that; since it's not reliable.
Two examples:
- When framerate drops below 18, schedules are sometimes lost. So at frequency 18, occasionally it's only 16/17 schedules per seconds.
- When the sim is PAUSED: the FS time stops, but the ticks counter goes on (gauges, at least XML-gauges, are stilll scheduled when FS is paused)

As to your Original question:
The simplest and most straightforward would be to add another state, in which you set a 0.8 sec counter.
Meaning the Brakes are released 0.8 sec after the sound is started.

Of course, there are other solutions, but for these kind of control gauges I prefer software "state-machines" because they are so easy to read with straighforward logic.

So the whole gauge would become:

Code:
<Update Frequency="0"/>

<Element>
  <Select>
    <Value>
      (L:RCB_CatapultState,enum) 0 ==
      if{
        (L:DSD_Catapult_Zone_Valid,bool) (L:COP_GlobalZone,bool) || (A:SIM ON GROUND,bool) &amp;&amp;
        if{
          (A:BRAKE PARKING POSITION,bool)
          if{ 1 (&gt;L:RCB_CatapultState,enum) }
        }
      }
    </Value>
  </Select>
</Element>

<Element>
  <Select>
    <Value>
      (L:RCB_CatapultState,enum) 1 ==
      if{
        (A:ENG1 N1 RPM,percent) (L:COP_CatapultLaunchN1,number) &gt;
        (A:GENERAL ENG1 THROTTLE LEVER POSITION,percent) 90 &gt; &amp;&amp;
        if{
          (P:ABSOLUTE TIME,seconds) (&gt;G:Var1)                     (* sets current time *)
          1 (&gt;L:COP_CatapultLaunchSound,enum)                     (* starts the sound *)
          2 (&gt;L:RCB_CatapultState,enum)  
        }
        els{
          (A:BRAKE PARKING POSITION,bool) ! (A:SIM ON GROUND,bool) ! ||
          if{ 0 (&gt;L:RCB_CatapultState,enum) }
        }
      }
    </Value>
  </Select>
</Element>

<Element>
  <Select>
    <Value>
      (L:RCB_CatapultState,enum) 2 ==
      if{
        (P:ABSOLUTE TIME,seconds) (G:Var1) - 0.8 &gt;               (* 0.8 sec. passed ?? (or any other value dictated by your soundFX *)
        if{
          (&gt;K:PARKING_BRAKES)
          (P:ABSOLUTE TIME,seconds) (&gt;G:Var1)                        (* Var1: timer *)
          (A:GROUND VELOCITY,knots) 1.688 * (&gt;G:Var2)            (* Var2: Groundspeed at launch-start in ft/sec *)
          (L:COP_CatapultLaunchSpeed,number)
              (A:AIRCRAFT WIND Z,knots) - 1.688 * (&gt;G:Var3)      (* Var3: Groundspeed at launch-end in ft/sec *)
          (G:Var3) (G:Var2) - (G:Var2) * (G:Var3) (G:Var2) - sqr
              2 / + (L:COP_CatapultDistance,number) / (&gt;G:Var4)  (* Var4: required decelleration A in ft/secSQR *)
          3 (&gt;L:RCB_CatapultState,enum)
        }
      }
    </Value>
  </Select>
</Element>


<Element>
  <Select>
    <Value>
      (L:RCB_CatapultState,enum) 3 ==
      if{
        2 (&gt;L:longitudinal_velocity_control,number)
        (P:ABSOLUTE TIME,seconds) (G:Var1) - (G:Var4) * (G:Var2) + d (&gt;L:longitudinal_velocity_value,number) (G:Var3) &gt;
        if{
          0 (&gt;L:longitudinal_velocity_control,number)
          0 (&gt;L:RCB_CatapultState,enum)
        }
      }
    </Value>
  </Select>
</Element>


Rob
 
Rob,
thx for the response. I reletively new here and didn't know yu were around or i would have PMed you. Don't know why you didn't get email i sent 5 days ago. I'm glad to know your around. Many of the guys that did alot of the FSF9 and early FSX stuff have moved on to other things.

I just tried Bob's solution above before i saw your post and it works first time through but subsequent launches there is no delay so the "counter" is not resetting.
Setup a practice area around your original at TFFG forming a loop. TFFG to a carrier I placed about 10 knm offshore and 40 deg left, then then continue left back around to TQPF where I placed arrester and Catapult zones, swing around to Princess Juliana, then down to St Barts where I added zones for that approach down over the mountain, then back to TFFG. It all works great. I use your gauge at all stops except the carrier where I use the FSX cables for arresting but your gauge for launch.

I will give your code a shot. Nothing like getting it from the source.

Thanks

Joel
 
Rob, et al
Works like a charm. And easy to adjust. thanks so much Rob.
If your still following, I have one thing I noticed about the gauge and don't know if it's the gauge or if it's the aircraft I'm using. The instructions say that the Launch start is tripped to the Engine N1 value as defined in the config.ini, and i can see in the code that it's is looking at N1. I originally set that value in the ini file at 100 but i was not getting a launch, even spooled up to 106. I kept moving that value down and finally got a launch when the CatapultLaunchN1 value was set at 85, but the N1 needle on the cockpit engine gauge was reading a touch over 100. I noticed that the N2 was at 85. I did a couple of test, and in my case Launch seems to be following the N2 value. Not a big deal since setting it at 85 gets me over 100 for launch but I wondered why this was happening, especially since I can see the calls to N1 in the code. I was wondering if there could be a crossed wires bug in the aircraft code. I'm using the Lotus Sims L-39. Any ideas ?

Thanks
 
Back
Top