Three integer variables are used: l as leak for the cumulated leak, t as global system time for the seconds and x as state timer.

When in its first state, the gaz burner is leaking, but it cannot leak forever and, after a while, it reaches its non-leaking state. Then again, it starts leaking.

Numerical constants control the transitions between the leaking and non-leaking states. The system cannot be in the leaking state more than a numerically given amount of time (9 below). And the system must stay in the non-leaking state for more than another given amount of time (49 below).

program gaz_burner02 C Check maximum leaking rate of a gaz burner: Nicolas Halbwachs and Laure Gonnord integer t, l, x external alea logical alea t = 0 l = 0 x = 0 do while(.true.) do while(x.le.9.and.alea()) t = t + 1 l = l + 1 x = x + 1 enddo x = 0 do while(x.le.49.or.alea()) t = t + 1 x = x + 1 enddo x = 0 C Check the leakage rate if(6*l.gt.t+50) then print *, "unsafe" endif enddo end logical function alea() read *, x if(x.gt.0.) then alea = .TRUE. else alea = .FALSE. endif return end