Timing Modes
These process control and drives instructions support different timing modes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
There are three different timing modes.
Timing Mode | Description | |
Periodic | Periodic mode is the default mode and is suitable for most control applications. We recommend that you place the instructions that use this mode in a routine that executes in a periodic task. The delta time (DeltaT) for the instruction is determined as follows: | |
If the instruction executes in a | Then DeltaT equals | |
Periodic task | Period of the task | |
Event or continuous task | Elapsed time since the previous execution The controller truncates the elapsed time to whole milliseconds (ms). For example, if the elapsed time = 10.5 ms, the controller sets DeltaT = 10 ms. | |
The update of the process input needs to be synchronized with the execution of the task or sampled 5-10 times faster than the task executes in order to minimize the sampling error between the input and the instruction. | ||
Oversample | In oversample mode, the delta time (DeltaT) used by the instruction is the value written into the OversampleDT parameter of the instruction. If the process input has a time stamp value, use the real time sampling mode instead. Add logic to your program to control when the instruction executes. For example, you can use a timer set to the OversampleDeltaT value to control the execution by using the EnableIn input of the instruction. The process input needs to be sampled 5-10 times faster than the instruction is executed in order to minimize the sampling error between the input and the instruction. | |
Real time sampling | In the real time sampling mode, the delta time (DeltaT) used by the instruction is the difference between two time stamp values that correspond to the updates of the process input. Use this mode when the process input has a time stamp associated with its updates and you need precise coordination. The time stamp value is read from the tag name entered for the RTSTimeStamp parameter of the instruction. Normally this tag name is a parameter on the input module associated with the process input. The instruction compares the configured RTSTime value (expected update period) against the calculated DeltaT to determine if every update of the process input is being read by the instruction. If DeltaT is not within 1 millisecond of the configuration time, the instruction sets the RTSMissed status bit to indicate that a problem exists reading updates for the input on the module. |
Time-based instructions require a constant value for DeltaT in order for the control algorithm to properly calculate the process output. If DeltaT varies, a discontinuity occurs in the process output. The severity of the discontinuity depends on the instruction and range over which DeltaT varies.
A discontinuity occurs if the following happens:
- Instruction is not executed during a scan.
- Instruction is executed multiple times during a task.
- Task is running and the task scan rate or the sample time of the process input changes.
- User changes the time-base mode while the task is running.
- Order parameter is changed on a filter block while the task is running.
- Changing the Order parameter selects a different control algorithm within the instruction.
Common Instruction Parameters for Timing Modes
The instructions that support time-base modes have these input and output parameters.
Input Parameters
Input Parameter | Data Type | Description |
TimingMode | DINT | Selects timing execution mode. Value: Description: 0 Periodic mode 1 Oversample mode 2 Real time sampling mode Valid = 0 to 2 Default = 0 When TimingMode = 0 and task is periodic, periodic timing is enabled and DeltaT is set to the task scan rate. When TimingMode = 0 and task is event or continuous, periodic timing is enabled and DeltaT is set equal to the elapsed time span since the last time the instruction was executed. When TimingMode = 1, oversample timing is enabled and DeltaT is set to the value of the OversampleDT parameter. When TimingMode = 2, real time sampling timing is enabled and DeltaT is the difference between the current and previous time stamp values read from the module associated with the input. If TimingMode invalid, the instruction sets the appropriate bit in Status. |
OversampleDT | REAL | Execution time for oversample timing. The value used for DeltaT is in seconds. If TimingMode = 1, then OversampleDT = 0.0 disables the execution of the control algorithm. If invalid, the instruction sets DeltaT = 0.0 and sets the appropriate bit in Status. Valid = 0 to 4194.303 seconds Default = 0.0 |
RTSTime | DINT | Module update period for real time sampling timing. The expected DeltaT update period is in milliseconds. The update period is normally the value that was used to configure the module’s update time. If invalid, the instruction sets the appropriate bit in Status and disables RTSMissed checking. Valid = 1…32,767ms Default = 1 |
RTSTimeStamp | DINT | Module time stamp value for real time sampling timing. The time stamp value that corresponds to the last update of the input signal. This value is used to calculate DeltaT. If invalid, the instruction sets the appropriate bit in Status, disables execution of the control algorithm, and disables RTSMissed checking. Valid =0…32,767ms (wraps from 32767 to 0) 1 count = 1 millisecond Default = 0 |
Output Parameters
Output Parameter | Data Type | Description |
DeltaT | REAL | Elapsed time between updates. This is the elapsed time in seconds used by the control algorithm to calculate the process output. Periodic: DeltaT = task scan rate if task is Periodic task, DeltaT = elapsed time since previous instruction execution if task is Event or Continuous task Oversample: DeltaT = OversampleDT Real Time Sampling: DeltaT = (RTSTimeStampn - RTSTimeStampn-1) |
Status | DINT | Status of the function block. |
TimingModeInv (Status.27) | BOOL | Invalid TimingMode value. |
RTSMissed (Status.28) | BOOL | Only used in real time sampling mode. Set when ABS | DeltaT - RTSTime | > 1 (.001 second). |
RTSTimeInv (Status.29) | BOOL | Invalid RTSTime value. |
RTSTimeStampInv (Status.30) | BOOL | Invalid RTSTimeStamp value. |
DeltaTInv (Status.31) | BOOL | Invalid DeltaT value. |
Overview of Timing Modes
The following diagram shows how an instruction determines the appropriate timing mode.
Provide Feedback