Derivative (DERV)
This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers.
The DERV instruction calculates the amount of change of a signal over time in per-second units.
Available Languages
Ladder Diagram
This instruction is not available for ladder diagram.
Function Block
Structured Text
DERV(DERV_tag);
Operands
Function Block
Operand | Type | Format | Description |
---|---|---|---|
DERV tag | DERIVATIVE | structure | DERV structure |
DERIVATIVE Structure
Input Parameter | Data Type | Description |
---|---|---|
EnableIn | BOOL | Enable input. If false, the instruction does not execute and outputs are not updated.
Default is true. |
In | REAL | The analog signal input to the instruction.
Valid = any float
Default = 0.0 |
Gain | REAL | Derivative multiplier
Valid = any float
Default = 1.0 |
ByPass | BOOL | Request to bypass the algorithm. When ByPass is true, the instruction sets Out = In.
Default is false. |
TimingMode | DINT | Selects timing execution mode. 0 = periodic mode 1 = oversampling mode 2 = Real time sampling mode For more information about timing modes, see Function Block Attributes
Valid = 0 to 2
Default = 0 |
OversampleDT | REAL | Execution time for oversample mode.
Valid = 0 to 4194.303 seconds
Default = 0 |
RTSTime | DINT | Module update period for real time sampling mode
Valid = 1 to 32,767ms
Default = 1 |
RTSTimeStamp | DINT | Module time stamp value for real time sampling mode.
Valid = 0 to 32,767ms
Default = 0 |
Output Parameter | Data Type | Description |
---|---|---|
EnableOut | BOOL | Indicates if instruction is enabled. Cleared to false if Out overflows. |
Out | REAL | The calculated output of the algorithm. |
DeltaT | REAL | Elapsed time between updates. This is the elapsed time in seconds used by the control algorithm to calculate the process output. |
Status | DINT | Status of the function block. |
InstructFault (Status.0) | BOOL | The instruction detected one of the following execution errors. This is not a minor or major controller error. Check the remaining status bits to determine what occurred. |
TimingModeInv (Status.27) | BOOL | Invalid TimingMode value.
For more information about timing modes, see Function Block Attributes. |
RTSMissed (Status.28) | BOOL | Only used in real time sampling mode. Set to true when
ABS (DeltaT - RTSTime) > 1 millisecond. |
RTSTimeInv (Status.29) | BOOL | Invalid RTSTime value. |
RTSTimeStampInv (Status.30) | BOOL | Invalid RTSTimeStamp value. |
DeltaTInv (Status.31) | BOOL | Invalid DeltaT value. |
Structured Text
Operand | Type | Format | Description |
---|---|---|---|
DERV tag | DERIVATIVE | structure | DERV structure |
See Structured Text Syntax for more information on the syntax of expressions within structured text.
Description
The DERV instruction supports a bypass input that lets you stop calculating the derivative and pass the signal directly to the output.
When Bypass is | The instruction uses this equation |
---|---|
Cleared and DeltaT > 0 | where DeltaT is in seconds |
Set |
Affects Math Status Flags
No
Major/Minor Faults
None specific to this instruction. See Common Attributes for operand-related faults.
Execution
Function Block
Condition/State | Action Taken |
---|---|
Prescan | EnableIn and EnableOut bits are cleared to false. |
Tag.EnableIn is false | EnableIn and EnableOut bits are cleared to false. Structured Text: NA |
Tag.EnableIn is true | EnableIn and EnableOut bits are set to true. The instruction executes. |
Instruction first run | N/A |
Instruction first scan | Recalculate coefficients. |
Postscan | EnableIn and EnableOut bits are cleared to false. |
Structured Text
Condition/State | Action Taken |
---|---|
Prescan | See Prescan in the Function Block table. |
Normal Execution | See Tag.EnableIn is true in the Function Block table. |
Postscan | See Postscan in the Function Block table. |
Examples
This example is the minimal legal programming of the DERV function block and is only used to show the neutral text and generated code for this instruction. This is for internal purposes only and is not a testable case.
Function Block
Structured Text
DERV_01.In := Speed_Reference;
DERV_01.Gain := Feedforward_Gain;
DERV(DERV_01);
PI_01.In := Speed_Reference - Speed_feedback;
PI_01.Kp := Proportional_Gain;
PI_01.Wld := Integral_Gain;
PI(PI_01);
regulator_out := DERV_01.Out + PI_01.Out;
Provide Feedback