Pulse

Overview

A pulse allows to maintain a Value published state during a certain duration before publishing the reset content.

Note

Errors on a pulse Value are never considered as pulse and are published as if no pulse was configured.

@startuml
skinparam backgroundColor transparent
robust "Pulse value" as pulse
robust "External value" as value

@0
value is 0
pulse is 0

@1
value is 10
pulse is 10
value -> pulse : Trigger

@2
pulse is 0

@pulse
@1 <-> @2 : 1s

@3
value is 20
pulse is 20
value -> pulse : Trigger

@3.5
value is 10
pulse is 10
value -> pulse : Trigger

@pulse
@3 <-> @4 : 1s

@4.5
pulse is 0

@pulse
@3.5 <-> @4.5 : 1s

@enduml

  • The External value is the source of the pulse.

  • The Pulse value is the resulting value as published by OnSphere.

  • The blue arrow indicates that the value is read by OnSphere.

  • The red arrow indicates the duration of the pulse. If it overlaps with another, it indicates that the timer was reset by the change.

Example

This can be used for example to keep a door opened for some duration when a button is pressed, so the person has time to enter the room before it closes.

Options

Type

Two type of pulse are available:

  • Pulse on change : Only triggers the pulse when the value changes.

    @startuml
skinparam backgroundColor transparent
robust "Pulse value" as pulse
robust "External value" as value

@0
value is 0
pulse is 0

@1
value is 10
pulse is 10
value -> pulse : Trigger

@pulse
@1 <-> @2 : 1s

@2
pulse is 0

@3
value -> pulse : Trigger

@enduml

    New read when the underlying data didn’t change, doesn’t re-trigger the pulse.

    @startuml
skinparam backgroundColor transparent
robust "Pulse value" as pulse
robust "External value" as value

@0
value is 0
pulse is 0

@1
value is 10
value -> pulse : Trigger
pulse is 10

@1.5
value -> pulse : Trigger

@pulse
@1 <-> @2 : 1s

@2
pulse is 0

@enduml

    New read when the underlying data didn’t change, doesn’t re-trigger the pulse.

    @startuml
skinparam backgroundColor transparent
robust "Pulse value" as pulse
robust "External value" as value

@0
value is 0
pulse is 0

@1
value is 10
value -> pulse : Trigger
pulse is 10

@1.5
value -> pulse : Trigger
value is 20
pulse is 20

@pulse
@1 <-> @2 : 1s

@pulse
@1.5 <-> @2.5 : 1s

@2.5
pulse is 0

@enduml

    New read when the underlying data changed, re-triggers the pulse.

  • Pulse on read : Triggers the pulse when the value is read. This mean that the pulse will be updated on each value.

    @startuml
skinparam backgroundColor transparent
robust "Pulse value" as pulse
robust "External value" as value

@0
value is 0
pulse is 0

@1
value is 10
pulse is 10
value -> pulse : Trigger

@pulse
@1 <-> @2 : 1s

@2
pulse is 0

@3
value -> pulse : Trigger
pulse is 10

@4
pulse is 0

@pulse
@3 <-> @4 : 1s

@enduml

    New read when the underlying data didn’t change, re-triggers the pulse.

    @startuml
skinparam backgroundColor transparent
robust "Pulse value" as pulse
robust "External value" as value

@0
value is 0
pulse is 0

@1
value is 10
pulse is 10
value -> pulse : Trigger

@pulse
@1 <-> @2 : 1s

@1.5
value -> pulse : Trigger

@pulse
@1.5 <-> @2.5 : 1s

@2.5
pulse is 0

@enduml

    New read when the underlying data didn’t change, extends the pulse.

    @startuml
skinparam backgroundColor transparent
robust "Pulse value" as pulse
robust "External value" as value

@0
value is 0
pulse is 0

@1
value is 10
pulse is 10
value -> pulse : Trigger

@pulse
@1 <-> @2 : 1s

@1.5
value is 20
pulse is 20
value -> pulse : Trigger

@pulse
@1.5 <-> @2.5 : 1s

@2.5
pulse is 0

@enduml

    New read when the underlying data changed, re-triggers the pulse.

Ignore reset

By default the pulse will clear itself when the reset value is published by the source of the value.

@startuml
skinparam backgroundColor transparent
robust "Pulse value" as pulse
robust "External value" as value

@0
value is 0
pulse is 0

@0
value -> pulse : Trigger

@1
value is 10
pulse is 10
value -> pulse : Trigger

@2
pulse is 0

@pulse
@1 <-> @2 : 1s

@3
value is 20
pulse is 20
value -> pulse : Trigger

@pulse
@3 <-> @4 : 1s

@3.5
value is 0
pulse is 0
value -> pulse : Trigger

@enduml

When the ignore reset is activated, if the reset value is published, the pulse will ignore it and wait for the timer to expire.

@startuml
skinparam backgroundColor transparent
robust "Pulse value" as pulse
robust "External value" as value

@0
value is 0
pulse is 0

@0
value -> pulse : Trigger

@1
value is 10
pulse is 10
value -> pulse : Trigger

@2
pulse is 0

@pulse
@1 <-> @2 : 1s

@3
value is 20
pulse is 20
value -> pulse : Trigger

@pulse
@3 <-> @4 : 1s

@3.5
value is 0
value -> pulse : Trigger

@4
pulse is 0

@enduml