Jump to content
Sign in to follow this  
rcbarend

Transient variable goes by so quickly !!

Recommended Posts

Guest Skymed

So taking Robs advice on determining a change of state of a variable, I can tell if the engine starts or stops using this sequence, which gives me a momentary +1 when it starts and a momentary -1 when it stops: (A:ENG1 COMBUSTION,bool) (L:CBE,enum) - (>L:CBE2,enum) (A:ENG1 COMBUSTION,bool)(>L:CBE,enum) What I need to do is start a timer when the combustion stops, ie (L:CBE2,enum) is equal to -1.Easy so far. Problem is this is a fleeting variable change, because as soon as the gauge is updated again, (L:CBE2,enum) becomes 0 and the timer stops. The timer needs to count to 1200 seconds, so even changing update frequencies is not going to prevent the (L:CBE2,enum) from flipping to 0 and stopping the timer.So how do I "capture" the state of engine off to use it to make a timer run?Steve

Share this post


Link to post
Share on other sites

Steve, Looks like a hot start alarm, preventer etc.... This is not tested but my have some insight to it. Not sure what L:CBE2 is, but it may not be necessary. (A:ENG1 COMBUSTION,bool) (L:CBE,enum) - (>L:CBE2,enum) d -1 == if{ 1 (>L:starttimer,enum) } (A:ENG1 COMBUSTION,bool)(>L:CBE,enum) (L:starttimer,enum) 0 > if{ (L:starttimer,enum) 1200 > if{ 0 (>L:starttimer,enum) } els{ (L:starttimer,enum) 6 + (>L:starttimer,enum) } }Regards,Roman(KGRB)[body vlink=#777c8e" alink="#777c8e][table border=0" cellpadding="0" cellspacing="0" width="240" bgcolor="#777c8e" height="95][tr][td width=20" height="95][table border=0" cellpadding="0" cellspacing="0" width="20" height="95][tr][td]http://home.new.rr.com/spokes2112/images/blank.jpg[/td][/tr][tr][td]http://home.new.rr.com/spokes2112/images/blank.jpg[/td][/tr][tr][td][a href=http://www.wheelchairaviators.org]http://home.new.rr.com/spokes2112/images/button.jpg[/a][/td][/tr][tr] [td][a href=http://www.packers.com]http://home.new.rr.com/spokes2112/images/button.jpg[/a][/td][/tr][tr] [td][a href=http://www.eaa.org]http://home.new.rr.com/spokes2112/images/button.jpg[/a][/td][/tr] [/table][/td][td width=200]http://home.new.rr.com/spokes2112/images/test.gif[/td][td width=20" height="95][table border=0" cellpadding="0" cellspacing="0" width="20" height="95][tr][td]http://home.new.rr.com/spokes2112/images/blank.jpg[/td][/tr][tr][td]http://home.new.rr.com/spokes2112/images/blank.jpg[/td][/tr][tr][td][a href=http://www.friendsofcrivitzairport.com]http://home.new.rr.com/spokes2112/images/button.jpg[/a][/td][/tr][tr] [td][a href=http://www.microsoft.com/games/flightsimulator/]http://home.new.rr.com/spokes2112/images/button.jpg[/a][/td][/tr][tr] [td][a href=http://www.fltplan.com]http://home.new.rr.com/spokes2112/images/button.jpg[/a][/td][/tr] [/table][/td][/tr][/table][/body]


20AUG21_Avsim_Sig.png?dl=1  FS RTWR   SHRS F-111   JoinFS   Little Navmap 
 

 

Share this post


Link to post
Share on other sites

Steve,Not sure what you want, but you could use something like:(A:ENG1 COMBUSTION,bool) ! if{ (P:Absolute Time,seconds) 1200 + (>L:CBE,number) } (P:Absolute Time,seconds) (L:CBE,number) > if{ (>"What you want") }Jan"Beatus Ille Procul Negotiis"

Share this post


Link to post
Share on other sites
Guest Skymed

Well, I am trying to start a timer after the engine has shut down to run for 1200 seconds. This way I will know if the engine has been started in the last 20 minutes. If greater than 1 sec and less than 1200 secs engine is still hot, if 0 engine is cold. Doug Dawson built me a C gauge to do this with, but I have no idea of C programming and am trying to build it XML.Steve

Share this post


Link to post
Share on other sites

Hi,You might try this:(A:ENG1 COMBUSTION,bool) if{ 1 (>L:Engine1 Cooling needed,bool) }(A:ENG1 COMBUSTION,bool) 0 == if{ (L:Engine1 Cooling needed,bool) (G:Var1) 0 == * (* Checks for cooling delay needed *)if{ (P:Absolute time,seconds) (>G:Var1) } (* Wait for Cool Down *) }(A:ENG1 COMBUSTION,bool) 0 == (L:Engine1 Cooling needed,bool) * if{ (G:Var1) 1200 + (P:Absolute time,seconds) < if{ 0 (>L:Engine1 Cooling needed,bool) 0 (>G:Var1) } }Didn't try but should work.As soon as the engine stops, starts the timer. When it reaches 1200 secs, the engine is cool and ready for restart or whatever.You can use && instead of *, the same resultHope this helpsTom

Share this post


Link to post
Share on other sites

Hi,This simple one gives a "HOT" signal as long as determined (in this case 10 seconds); hereafter an "OK" sign pops up.When the engine is restarted, all signals vanish.(A:ENG1 COMBUSTION,bool) != if{ (P:Absolute Time,seconds) 10 + (>L:Cooling,number) }%((A:ENG1 COMBUSTION,bool) ! (P:Absolute Time,seconds) (L:Cooling,number) < and)%{if}%HOT%{end}%((P:Absolute Time,seconds) (L:Cooling,number) > )%{if}%OK%{end}Jan"Beatus Ille Procul Negotiis"

Share this post


Link to post
Share on other sites
Guest Skymed

Well, thanks to you all for helping. I thought I would post my solution here, in case anyone else ever needs to do this: (A:ENG1 COMBUSTION,bool) 1 == if{ 1 (>L:Engine1Cooling,enum) 0 (>L:startcount,enum) } (A:ENG1 COMBUSTION,bool) 0 == (L:Engine1Cooling,enum) 1 == && if{ 1 (>L:startcount,enum) 2 (>L:COMBUSTION,enum) } (L:startcount,enum) 1 == if{ (L:Timeengstart,enum) 1200 <= if{ (L:Timeengstart,enum) 0.166 + (>L:Timeengstart,enum) } } els{ 0 (>L:Timeengstart,enum) }A simple couter that increments once per second, up to 1200 seconds, used to time engine cool down period after the engine is shutdown. (L:COMBUSTION,enum) is used for triggering other variables elsewhere.Thanks again,Steve

Share this post


Link to post
Share on other sites

Steve,Just to note something that you may want to control:0.166 (P:Simulation rate, number) * if it shall work with different sim rates.It is not necessary if you use elapsed time (seconds, minutes).Regards,Tom

Share this post


Link to post
Share on other sites
Guest Skymed

Tom,Good point. I will try and make that work.........except I have no idea how..........yet !!steve

Share this post


Link to post
Share on other sites

Hi Steve,As Tom said, making timers by counting the scheduling of gauge might not be what you want, because gauge scheduling (unlike the FS "clock") is independant of the simulation rate.Where you (probably ??) usually want to timers to use FS-time.Now the most simple way of timing something is:Start timer:(P:ABSOLUTE TIME,seconds) (>G:Var1)Test for timer elapse:(P:ABSOLUTE TIME,seconds) (G:Var1) - "your value in sec" >if{ }The adavantage of using "ABSOLUTE TIME" over "LOCAL TIME" and "ZULU TIME" is, that it isn't influenced by timezone changes and the "midnight" problem (where LOCAL TIME is reset to 0)Cheers, Rob Barendregt

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...