- Messages
- 1,564
- Country
hehe, yeah. I hadn't thought about the Pause case but after reading your response I tried Pausing and now I understand.it's buggy
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.
hehe, yeah. I hadn't thought about the Pause case but after reading your response I tried Pausing and now I understand.it's buggy
I tried to copy what you had posted here in the wiki. Obviously I'm missing something. Probably the variable names are wrong as well.Let's start the other side: why don't you post your code so I can see where is the problem?
Tom
<Macro Name="GetElapsed">
(P:Absolute time,seconds) (>L:time1,number) - abs 100 *
</Macro>
<Macro Name="SetElapsed">
(P:Absolute time,seconds) (>L:time2,number) 100 *
</Macro>
<!-- Engine Limitations Exceeded -->
<Element>
<Select>
<Value>(A:Turb eng1 N2, percent) 104.9 > (L:eng1_stop,number) 0 == and
if{ @SetElapsed(L:time1,number) }</Value>
</Select>
</Element>
<Element>
<Select>
<Value>@GetElapsed(L:time2,number) 15 >
if{ (>K:TOGGLE_ENGINE1_FAILURE) } }</Value>
</Select>
</Element>
Vololiberista: Another curious thing I noticed was that (P:Absolute time,seconds) counts backwards!
Thats because code (and maybe coders) are from an alternate universe... Totally backwards..![]()
I don't think you need the L: in (L:time2,number) in @GetElapsed(L:time2,number).
Simply use @GetElapsed(time2,number)
Walter
I tried to copy what you had posted here in the wiki. Obviously I'm missing something. Probably the variable names are wrong as well.
<Macro Name="GetElapsed">
(P:Absolute time,@2) (L:@1,@2) - abs
</Macro>
<Macro Name="SetElapsed">
(P:Absolute time,@2) (>L:@1,@2)
</Macro>
<Element>
<Select>
<Value>
(A:Turb eng1 N2, percent) 104.9 > (L:eng1_stop,number) 0 == and
if{ @SetElapsed(time1,seconds) 1 (>L:eng1_stop,number) }
</Value>
</Select>
</Element>
<Element>
<Select>
<Value>
@GetElapsed(time1,seconds) 15 > (L:eng1_stop,number) 1 == and
if{ (>K:TOGGLE_ENGINE1_FAILURE) 2 (>L:eng1_stop,number) }
</Value>
</Select>
</Element>
When blackbox displays the L var values they are in tenths of a second i.e. 0.xx
Another curious thing I noticed was that (P:Absolute time,seconds) counts backwards!
<Macro Name="GetElapsed">
(P:Absolute time,@2) (>L:@1,@2) - abs
</Macro>
<Macro Name="SetElapsed">
(P:Absolute time,@2) (>L:@1,@2)
</Macro>
<Macro Name="GetElapsed">
(P:Absolute time,seconds) (>L:time1,number) - abs
</Macro>
<Macro Name="SetElapsed">
(P:Absolute time,seconds) (>L:time2,number)
</Macro>
<Macro Name="GetElapsed">
( P:Absolute time,@2) (>L:@1,@2) - abs
</Macro>
<Macro Name="GetElapsed">
(P:Absolute time,@2) (L:@1,@2) - abs
</Macro>
Timers can be Blinker or Elapsed Time (cumulative time) variety. There's a good wiki entry that discusses the blink-type timers a little more thoroughly. The Elapsed Time types can be based on cycle counting or P:Absolute Time.
Here's a simple elapsed time example based on gauge update cycle counting. It assumes an update rate of 18 cycles per second and is analogous to the cycle counting approach used in Bill Leaming's script above -- and note this is the logic structure suggested by Bill in his reply#2:
In this example, the els{ ... 0.5 - 0 max ... } line is inserted to accomodate engine cooling that could occur before the 5 minute failure point is reached. Maybe not quite realistic, but you get the idea.Code:<Update Frequency="18"> (A:TURB ENG ITT:1, celsius) 906 > if{ (L:Eng1Exceed906CNumCycles, enum) ++ (>L:Eng1Exceed906CNumCycles, enum) } els{ (L:Eng1Exceed906CNumCycles, enum) 0.5 - 0 max (>L:Eng1Exceed906CNumCycles, enum) } (L:Eng1Exceed906CNumCycles, enum) 18 60 * 5 * >= if{ (>K:TOGGLE_ENGINE1_FAILURE) 0 (>L:Eng1Exceed906CNumCycles, enum) } </Update>
Hope this adds to both Bill's responses.
Bob
<Gauge Name="Turbine Overheat Manager" Version="1.0">
<Size X="5" Y="5" />
<Update Frequency="18">
<!-- Make Active -->
(L:Turbine Overheat Manager Initializer,bool) 0 ==
(A:TURB ENG ITT:1, celsius) 410 > and
(A:TURB ENG ITT:2, celsius) 410 > and
if{ 1 (>L:Turbine Overheat Manager Initializer,bool) }
<!-- Cooling Reset -->
(L:Turbine Overheat Manager Initializer,bool) 1 ==
(A:TURB ENG ITT:1, celsius) 398 <: and
(A:TURB ENG ITT:2, celsius) 398 <: and
if{ 0 (>L:Turbine Overheat Manager Initializer,bool)
0.5 (>L:Eng1Exceed906CNumCycles, enum)
0.5 (>L:Eng2Exceed906CNumCycles, enum) }
(L:Turbine Overheat Manager Initializer,bool) 0 ==
(A:TURB ENG ITT:1, celsius) 415 > and
if{ (L:Eng1Exceed906CNumCycles, enum) ++ (>L:Eng1Exceed906CNumCycles, enum) }
els{ (L:Eng1Exceed906CNumCycles, enum) 0.5 - 0 max (>L:Eng1Exceed906CNumCycles, enum) }
(L:Eng1Exceed906CNumCycles, enum) 18 60 * 5 * >= if{ (>K:TOGGLE_ENGINE1_FAILURE) 0 (>L:Eng1Exceed906CNumCycles, enum) }
(L:Turbine Overheat Manager Initializer,bool) 0 ==
(A:TURB ENG ITT:2, celsius) 412 > and
if{ (L:Eng2Exceed906CNumCycles, enum) ++ (>L:Eng2Exceed906CNumCycles, enum) }
els{ (L:Eng2Exceed906CNumCycles, enum) 0.5 - 0 max (>L:Eng2Exceed906CNumCycles, enum) }
(L:Eng2Exceed906CNumCycles, enum) 18 60 * 5 * >= if{ (>K:TOGGLE_ENGINE2_FAILURE) 0 (>L:Eng2Exceed906CNumCycles, enum) }
</Update>
</Gauge>
EDITED
Tom
PS: maybe would be better to open a new thread if this has to continue; I think we would be a little off topic here.
(A:TURB ENG ITT:1, celsius) 906 >
if{ (L:Eng1Exceed906CNumCycles, enum) ++ (>L:Eng1Exceed906CNumCycles, enum) }
els{ (L:Eng1Exceed906CNumCycles, enum) 0.5 - 0 max (>L:Eng1Exceed906CNumCycles, enum) }
(L:Eng1Exceed906CNumCycles, enum) 18 60 * 5 * >= if{ (>K:TOGGLE_ENGINE1_FAILURE) 0 (>L:Eng1Exceed906CNumCycles, enum) }