AnalogInputReal
- Namespace
- ZEquipment
- Extends
- Inherited Properties
- Inherited Methods
- Implements
FUNCTION_BLOCK AnalogInputReal EXTENDS ZEquipment.Analog IMPLEMENTS ZEquipment.IAnalog, ZEquipment.IDigital, ZCore.ITrigger
Implementation of an analog input with the underlying datatype REAL. 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
bInitRetainsBOOLif TRUE, the retain variables are initialized (warm start / cold start)
bInCopyCodeBOOLif TRUE, the instance afterwards gets moved into the copy code (online change)
Returns
- BOOL
Properties
Link
PROPERTY Link : REAL
Returns the raw value of the actuator as it is written/read from the bus
Property Value
- REAL
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
ReadRaw
METHOD ReadRaw () : REAL
This method returns the raw value that is given by the terminal. No linear conversion is applied.
This method behaves the same for physical and simulated terminals (Simulation)
Returns
- REAL
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
WriteRaw
METHOD WriteRaw (
[input] value : REAL)
This method writes a raw value to the terminal. No linear conversion is applied.
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.