AverageTime (FB)¶
FUNCTION_BLOCK AverageTime
Short Description¶
Averaging of an analog value over four different time periodsAveraging: Arithmetic mean valueTypical application: Averaging over time of the outside temperature
Portrayal¶
Interfaces¶
Inputs¶
Name Datatype
Range
Init-Value
Function
rIn REAL Analog value input
Outputs¶
Name Datatype
Range
Init-Value
Function
rOutCH0 REAL Average value for time period 1
rOutCH1 REAL Average value for time period 2
rOutCH2 REAL Average value for time period 3
rOutCH3 REAL Average value for time period 4
rOutMin REAL Minimum value of all measured values
rOutMax REAL Maximum value of all measured values
dtLastNewValue DATE_AND_TIME Save time of the last measured value
sErr STRING Current error text
Setpoints / Parameters¶
Name Datatype
Range
Init-Value
Function
xCalculation BOOL TRUE Enable / disable data recording
xResetOnInput BOOL FALSE Initialization of the measured value memory and the average value outputs with rIn.
rInitValue REAL 10 Initialization value for the measured value memory and the average value outputs with eInitial = eInit2. InitValue.
tInitDelay TIME 10s Delay time for saving measured values with eInitial = eInit2. InputValueDelayed.
eInitial eInit2 eInit2.LastValue Definition of the type of initialization
wCH3Time WORD 72 Definition of the time period 4
wCH2Time WORD 48 Definition of the time period 3
wCH1Time WORD 1 36 Definition of the time period 2
wCH0Time WORD 12 Definition of the time period 1
rTimeBaseCh0to3 eTime eTime.Hour Determination of the time unit for the periods
wInterval WORD 30 Setting the recording interval
rTimeBaseInterval eTime eTime.Minute Defining the time unit for the recording interval
Functional description¶
General¶
rOutCHX Average value outputs ( X = 0 ... 3 )¶
rOutMin minimum value output¶
rOutMax maximum value output¶
dtLastNewValue time stamp¶
sErr error text¶
eInitial type of initialisation¶
Type
Initialization value
Notes
eInit2.InitValue rInitValue Configurable initial value
eInit2.InputValue rIn Input value
eInit2.InputValueDelayed rIn Delayed input value
eInit2.LastValue Average - measured value memory (measured value memory filled)
Last Value
eInit2.LastValue rIn (measured value memory empty)
Last Value
Enable / disable data recording xCalculation¶
Visualization¶
Information¶
Element Authors
Date
Version Note
Function
Adam Bartod 06.2016 1.0 Initial version
Programming
Adam Bartod 06.2016 1.0 Initial version
Test 12.2016 1.0 Initial version
Documentation
Jochen Reu 10.2017 1.0 Initial version
Codesys¶
- InOut:
Scope Name Type Initial Comment Input rIn REAL Analog value input
xCalculation BOOL TRUE Enable / disable data recording
xResetOnInput BOOL FALSE Initialization of the measured value memory and the average value outputs with rIn.
rInitValue REAL 10 Initialization value for the measured value memory and the average value outputs with eInit2 = eInit2. InitValue.
tInitDelay TIME TIME#10s0ms Delay time for saving measured values with eInit2 = eInit2. InputValueDelayed.
eInitial eInit2 eInit2.LastValue wCH3Time WORD 72 Definition of the time period 4 in hours
wCH2Time WORD 48 Definition of the time period 3 in hours
wCH1Time WORD 36 Definition of the time period 2 in hours
wCH0Time WORD 24 Definition of the time period 1 in hours
eTimeBaseCh0to3 eTime eTime.Hour Time unit for CH 0 to 3
wInterval WORD 30 memory interval
eTimeBaseInterval eTime eTime.Minute Time unit for memory interval
Output rOutCH0 REAL Average value for time period 1
rOutCH1 REAL Average value for time period 2
rOutCH2 REAL Average value for time period 3
rOutCH3 REAL Average value for time period 4
rOutMin REAL Minimum value of all measured values
rOutMax REAL Maximum value of all measured values
dtLastNewValue DT Save time of the last measured value
sErr STRING Current error text