Table of Contents

AnalogInput2Byte

Namespace
ZEquipment
Extends
Inherited Properties
Inherited Methods
Implements
FUNCTION_BLOCK AnalogInput2Byte EXTENDS ZEquipment.Analog IMPLEMENTS ZEquipment.IAnalog, ZEquipment.IDigital, ZCore.ITrigger

Implementation of an analog input with 2 bytes as the underlying datatype (hi byte and lo byte). The function block implements convenient methods to interact with a physical input or (by default) allows to simulate an analog input. for details refer to Analog

Constructor

FB_init

METHOD FB_init (
 [input] bInitRetains : BOOL,
 [input] bInCopyCode : BOOL) : BOOL

Inputs

bInitRetains BOOL

if TRUE, the retain variables are initialized (warm start / cold start)

bInCopyCode BOOL

if TRUE, the instance afterwards gets moved into the copy code (online change)

Returns

BOOL

Properties

Simulation

PROPERTY Simulation : BOOL

This property is used to enable or disable the simulation mode for the analog terminal. Internally the pointer to the variable that is written to or read from, respectively, is swapped by toggling this property. Simulated inputs behave different with respect to actual terminals with regard to the Write method. Phyisical terminals can not be written to, for simulated terminal this is totally fine though (and even needed most of the times).

Property Value

BOOL

Methods

ReadImpl

METHOD PROTECTED ReadImpl () : LREAL

This method reads a physical value from the terminal. The raw value that is read from the terminal is converted by applying a linear conversion that can be set by using the SetConversionLinear method. If no conversion is specified, the method returns a number between 0 and 1 (default linear conversion).

This method behaves the same for physical and simulated terminals (Simulation)

Returns

LREAL

WriteImpl

METHOD PROTECTED WriteImpl (
 [input] value : LREAL)

This method writes a physical value from the terminal. The value that is passed as a parameter is converted to a value that is actually usable for the terminal. This is achieved by applying a linear conversion that has been set using the SetConversionLinear method. By default the conversion assumes that values are scaled between 0-1.

This method behaves differently for physical and simulated terminals (Simulation). Only simulated terminals can be written to. No action is taken when attempting to write to a physical analog terminal.

Inputs

value LREAL