v-warten

hio/nwt-gus-hi/v-warten

Delays triggering of an incoming pulse by specified time
v-warten
@/v-warten
Delays triggering of an incoming pulse by specified time
Zeitnumber
Time to delay in seconds
Startpulse
Resets current countdown, starts new countdown
Neustartpulse
Resets current countdown, i.e. cancels the delay
v-warten
Fertig
wartet?
Zeit
Start
Neustart
wartet?boolean
Outputs true when delay is in progress
Fertigpulse
Pulses once the delay is over
To use the node in your project you should have the hio/nwt-gus-hi library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

node {
    void evaluate(Context ctx) {
        if (isInputDirty<input_RST>(ctx)) {
            clearTimeout(ctx);
            emitValue<output_ACT>(ctx, false);
        } else if (isInputDirty<input_SET>(ctx)) {
            TimeMs dt = getValue<input_T>(ctx) * 1000;
            setTimeout(ctx, dt);
            emitValue<output_ACT>(ctx, true);
        } else if (isTimedOut(ctx)) {
            emitValue<output_DONE>(ctx, true);
            emitValue<output_ACT>(ctx, false);
        }
    }
}

Tabular tests

__time(ms)TSETRSTDONEACT
00.5no-pulseno-pulseno-pulsefalse
10000.5pulseno-pulseno-pulsetrue
15000.5no-pulseno-pulseno-pulsetrue
15010.5no-pulseno-pulsepulsefalse
20000.5pulsepulseno-pulsefalse
25000.5pulseno-pulseno-pulsetrue
26002no-pulseno-pulseno-pulsetrue
27002no-pulsepulseno-pulsefalse
30012no-pulseno-pulseno-pulsefalse