Class Adelay
Version 1.0
Modified 08-MAR-2026 11:05:32.00
Code rt_plc_arithm.c
 Time delay of an analog signal.

 The time delay Tim can vary within the interval:

      { 0 - 100 * MaxCount * ScanTime }

 The delay is implemented in a 100-step shift register.
 The time resolution per step is MaxCount * ScanTime and
 maximum time delay is 100 * MaxCount * ScanTime.

 Several Adelay objects can be connected in series when
 a higher resolution is needed.
 If the time resolution per step is worse than the
 program cycle time (i.e. MaxCount > 1) a mean value is
 formed and stored in shift register 1.

 The very first sample is stored in every shift
 register. At sample number 2 a mean value is calculated
 from the value in shift register ( position) 1 and the
 input signal, thereafter the mean value is restored in
 shift register 1. This is repeated up to sample
 MaxCount - 1. At sample number MaxCount a shift of the
 register contents takes place and the input signal is
 stored direct into the shift register 1. During the
 time up to the next shift the mean value of the input
 signal is stored in shift register position 1.
 The output signal is fetched from the register
 representing the actual delay.

Example

 1. With MaxCount = 1 and ScanTime = 20 ms the maximum delay time
    is 100 * 1 * 1 / 50 seconds.
    if the delay Tim = 1, ActVal(t) will be = In(t-50), i.e. the input
    signal is delayed by 50 execution cycles.

 2. If MaxCount = 1 and ScanTime = 1 second represent each register the
    delay of one second. Tim specifies from which register to get ActVal.


RtBody attributes pwr_sClass_adelay
Float32 In IN Value of the input signal.
Float32 Tim TIM Actual time delay ( in seconds ) in the interval
{ 0, 100 * MaxCount * ScanTime }.
Float32 ActVal VAL Delayed signal according to Tim.
Pointer to Float32 ScanTime ScanTime Program cycle period in seconds.
Array of Float32 TimVect TimVect A cyclic register.
Int32 StoInd StoInd Storage index, which points to the next store location.
Int32 MaxCount MaxCount Number of cycles per shift register step; i.e. register
shift is done at every MaxCount:e program cycle
execution.
Int32 StoredNumbers StoredNumbers Counter; used at the initial phase.
Int32 Count Count Loop counter for shift.
Int32 AccTim AccTim The operator's authorities regarding to Tim.
0 -- Changes not allowed.
!=0 -- Changes allowed.
Float32 MinTim MinTim The minimum allowed value of Tim at changes made by an operator.
Float32 MaxTim MaxTim The maximum allowed value of Tim at changes made by an operator.

DevBody attributes 
PlcNode PlcNode  


GraphPlcNode
object_type 131
parameters[0] 2
parameters[1] 0
parameters[2] 1
parameters[3] 0
subwindows 0
graphmethod 0 (standard, individual attributes)
graphindex 0
default_mask[0] 1
default_mask[1] 1
segname_annotation 1
compmethod 4
compindex 0
tracemethod 0
traceindex 0
executeordermethod 2
objname Adelay
graphname Adelay
debugpar


Template Object
MaxCount 1


Attributes detail


In Input
Class Input
Type Float32
Flags STATE | NOEDIT | REDUTRANSFER
GraphName IN
Body RtBody
 Value of the input signal.

Tim Input
Class Input
Type Float32
Flags REDUTRANSFER
GraphName TIM
Body RtBody
 Actual time delay ( in seconds ) in the interval
 { 0, 100 * MaxCount * ScanTime }.

ActVal Output
Class Output
Type Float32
Flags STATE | NOEDIT | REDUTRANSFER
GraphName VAL
Body RtBody
 Delayed signal according to Tim.

ScanTime Intern
Class Intern
Type Pointer to Float32
Flags INVISIBLE | POINTER | PRIVATE
GraphName ScanTime
Body RtBody
 Program cycle period in seconds.

TimVect Intern
Class Intern
Type Array of Float32
Flags ARRAY | STATE | INVISIBLE | REDUTRANSFER
Elements 100
GraphName TimVect
Body RtBody
 A cyclic register.

StoInd Intern
Class Intern
Type Int32
Flags STATE | NOEDIT | INVISIBLE | REDUTRANSFER
GraphName StoInd
Body RtBody
 Storage index, which points to the next store location.

MaxCount Intern
Class Intern
Type Int32
Flags REDUTRANSFER
GraphName MaxCount
Body RtBody
 Number of cycles per shift register step; i.e. register
 shift is done at every MaxCount:e program cycle
 execution.

StoredNumbers Intern
Class Intern
Type Int32
Flags STATE | NOEDIT | INVISIBLE
GraphName StoredNumbers
Body RtBody
 Counter; used at the initial phase.

Count Intern
Class Intern
Type Int32
Flags STATE | NOEDIT | INVISIBLE | REDUTRANSFER
GraphName Count
Body RtBody
 Loop counter for shift.

AccTim Intern
Class Intern
Type Int32
Flags REDUTRANSFER
GraphName AccTim
Body RtBody
 The operator's authorities regarding to Tim.
    0   -- Changes not allowed.
    !=0 -- Changes allowed.

MinTim Intern
Class Intern
Type Float32
Flags REDUTRANSFER
GraphName MinTim
Body RtBody
 The minimum and maximum allowed value of Tim at changes
 made by an operator.

 Example

 1  With MaxCount = 1 and ScanTime = 20 milliseconds the
    maximum time delay is 100 * 1 * 1 / 50 = 2 seconds.
    If the delay Tim = 1, ActValt will be = In     ,
    t-50, i.e. the input signal is delayed by 50 execution
    cycles.
 2  If MaxCount = 1 and ScanTime = 1 second represent
    each register the delay of one second. Tim specifies
   from which register to get ActVal.

MaxTim Intern
Class Intern
Type Float32
Flags REDUTRANSFER
GraphName MaxTim
Body RtBody
 The maximum allowed value of Tim at changes made by an operator.

PlcNode Buffer
Class Buffer
Type PlcNode
Flags INVISIBLE
Body DevBody