OcaNumericObserver

A online version of the AES70 specification of this class can be found at http://docs.deuso.de.

The class is a subclass of OcaAgent().

This class defines the properties

Name

JavaScript Type

AES70 Type

State

OcaObserverState

OcaObserverState

ObservedProperty

OcaProperty

OcaProperty

Threshold

number

OcaFloat64

Operator

OcaRelationalOperator

OcaRelationalOperator

TwoWay

boolean

OcaBoolean

Hysteresis

number

OcaFloat64

Period

number

OcaTimeInterval

Furthermore, it inherits the properties ClassID, ClassVersion, ObjectNumber, Lockable, Role, Label, Owner, State, ObservedProperty, Threshold, Operator, TwoWay, Hysteresis and Period.

class OcaNumericObserver(objectNumber, device)

Observer of a scalar numeric or boolean property (“target property”) of a specified object. Does not work for array, list, map, struct, or string properties. OcaNumericObserver emits an Observation event under certain conditions. There are three kinds of conditions:

  • Numeric comparison . The target property value meets a certain comparison condition. A selection of comparison operators is available. Such observations are called “asynchronous observations”.

  • Timer expiry . The value of the Period property, if nonzero, is a the time interval for the recurrent timed emission of Observation events. Such events (“periodic observations”) are emitted regardless of the target property’s value.

  • Combination of (1) and (2) . If a numeric comparison and a nonzero period are both specified, then the Observation event is emitted when the timer expires and the numeric comparison is true. Such observations are called “conditional-periodic observations”.

This is a weakly typed class. Its threshold is specified as an OcaFloat64 number.

  • For unsigned integer targets, the threshold and target are both coerced to OcaUint64 before comparing.

  • For signed integer targets, the threshold and target are both coerced to OcaInt64 before comparing.

  • For boolean values, the threshold hreshold and target are both coerced to OcaUint8 , True is assigned the value One, False is assigned the value Zero.

Note that this coercion may result in rounding errors if the observed datatype is of type OcaUint64 or OcaUint64. An OcaNumericObserver instance and the property it observes are bound at the time the OcaNumericObserver instance is constructed. For static devices, construction will occur during manufacture, or possibly during a subsequent hardware configuration step. For reconfigurable devices, construction might be done by online controllers as part of device configuration sessions. This class is normally used for monitoring readings of sensor readings, but may be used equally well for watching workers’ parameter settings.

OcaNumericObserver.OnHysteresisChanged

type: PropertyEvent.<number>

This event is emitted when the property Hysteresis changes in the remote object. The property Hysteresis is described in the AES70 standard as follows. Hysteresis that is used when observing the property value. This indicates which amount must be added/subtracted from the <b>Threshold </b>value to raise or re-enable the <b>Triggered </b>event of this <b>OcaObserver </b>object. The rules for hysteresis handling depend upon the configured <b>Operator </b>and <b>TwoWay </b>properties. The <b>Hysteresis </b>property is ignored if the <b>Operator </b>property is ‘Inequality’.

OcaNumericObserver.OnObservation

type: Event

Event emitted to signal an asynchronous, periodic, or conditional-periodic observation.

OcaNumericObserver.OnObservedPropertyChanged

type: PropertyEvent.<OcaProperty>

This event is emitted when the property ObservedProperty changes in the remote object. The property ObservedProperty is described in the AES70 standard as follows. Identification of the property being observed.

OcaNumericObserver.OnOperatorChanged

type: PropertyEvent.<OcaRelationalOperator>

This event is emitted when the property Operator changes in the remote object. The property Operator is described in the AES70 standard as follows. Relational operator used when comparing the value of the observed property to the threshold value.

OcaNumericObserver.OnPeriodChanged

type: PropertyEvent.<number>

This event is emitted when the property Period changes in the remote object. The property Period is described in the AES70 standard as follows. Repetition period or zero. If nonzero, the observer will retrieve the value and emit

OcaNumericObserver.OnStateChanged

type: PropertyEvent.<OcaObserverState>

This event is emitted when the property State changes in the remote object. The property State is described in the AES70 standard as follows. State: triggered, not triggered

OcaNumericObserver.OnThresholdChanged

type: PropertyEvent.<number>

This event is emitted when the property Threshold changes in the remote object. The property Threshold is described in the AES70 standard as follows. Comparison value for raising the <b>Triggered </b>event.

OcaNumericObserver.OnTwoWayChanged

type: PropertyEvent.<boolean>

This event is emitted when the property TwoWay changes in the remote object. The property TwoWay is described in the AES70 standard as follows. True to emit a <b>Triggered </b>event upon crossing the threshold in either direction; false to emit only upon crossing in the primary direction (i.e. rising when <b>Operator </b>is set to <u>GreaterThan</u> or <u>GreaterThanOrEqual</u>; falling when <b>Operator </b>is set to <u>LessThan</u><b> </b>or <u>LessThanOrEqual</u>; equality when <b>Operator </b>is set to <u>Equality</u>; inequality when <b>Operator </b>is set to <u>Inequality</u>).

OcaNumericObserver.GetHysteresis()

Gets the value of the Hysteresis property. The return value indicates whether the property was successfully retrieved.

Returns

Promise.<number> – A promise which resolves to a single value of type number.

OcaNumericObserver.GetLastObservation()

Gets the value of the observed property that was reported by the most recently emitted Observation event. If the numeric observer has never emitted an Observation event, returns the IEEE not-a-number value. The return status indicates whether the value has been successfully returned.

Returns

Promise.<number> – A promise which resolves to a single value of type number.

OcaNumericObserver.GetObservedProperty()

Gets the identification of the property that the observer observes. The return value indicates whether the identification was successfully retrieved.

Returns

Promise.<OcaProperty> – A promise which resolves to a single value of type OcaProperty().

OcaNumericObserver.GetOperator()

Gets the value of the Operator property. The return value indicates whether the property was successfully retrieved.

Returns

Promise.<OcaRelationalOperator> – A promise which resolves to a single value of type OcaRelationalOperator().

OcaNumericObserver.GetPeriod()

Gets the value of the Period property. The return value indicates whether the property was successfully retrieved.

Returns

Promise.<number> – A promise which resolves to a single value of type number.

OcaNumericObserver.GetState()

Gets the observer’s state. The return value indicates whether the state was successfully retrieved.

Returns

Promise.<OcaObserverState> – A promise which resolves to a single value of type OcaObserverState().

OcaNumericObserver.GetThreshold()

Gets the value of the Threshold property. The return value indicates whether the threshold value was successfully retrieved.

Returns

Promise.<number> – A promise which resolves to a single value of type number.

OcaNumericObserver.GetTwoWay()

Gets the value of the TwoWay property. The return value indicates whether the property was successfully retrieved.

Returns

Promise.<boolean> – A promise which resolves to a single value of type boolean.

OcaNumericObserver.SetHysteresis(hysteresis)

Sets the value of the Hysteresis property. The return value indicates whether the property was successfully set.

Arguments
  • hysteresis (number) –

Returns

Promise.<void>

OcaNumericObserver.SetObservedProperty(property)

Sets the identification of the property that the observer observes. The return value indicates whether the identification was successfully set.

Arguments
Returns

Promise.<void>

OcaNumericObserver.SetOperator(_operator)

Sets the value of the Operator property. The return value indicates whether the operator was successfully set.

Arguments
Returns

Promise.<void>

OcaNumericObserver.SetPeriod(period)

Sets the value of the Period property. The return value indicates whether the property was successfully set.

Arguments
  • period (number) –

Returns

Promise.<void>

OcaNumericObserver.SetThreshold(Threshold)

Sets the value of the Threshold property. The return value indicates whether the threshold value was successfully set.

Arguments
  • Threshold (number) –

Returns

Promise.<void>

OcaNumericObserver.SetTwoWay(twoWay)

Sets the value of the TwoWay property. The return value indicates whether the property was successfully set.

Arguments
  • twoWay (boolean) –

Returns

Promise.<void>