----------------------------------------------------------------------
-- node DownCounter
----------------------------------------------------------------------

node DownCounter( Time : int; Restart : bool ) returns ( Ctr : int );
let
  Ctr = Time -> if Restart 
                  then Time
                  else if pre(Ctr) > 0 
                         then pre(Ctr) - 1
                         else pre(Ctr);
tel

----------------------------------------------------------------------
-- node DownCounters
-- each flow instance has its own "memory"
----------------------------------------------------------------------
node DownCounters( Time1,Time2 : int; Restart : bool ) 
returns ( Ctr1,Ctr2 : int );
let
  Ctr1 = DownCounter(Time1,Restart);
  Ctr2 = DownCounter(Time2,Restart);
tel