# PLC Archive:Derivative Calculation

### From ControlWiki

# Derivative Calculation

### contributed by: Simone Stefani

## Link to File

Click here to view program file.

## Abstract

This function calculates the 1st derivative of [Input_value]. The derivative is calculated on 20 samples of [Input_value] - the samples are taken each time [CLK] is TRUE. The output value is the sum of the 1st 10 samples with 2nd 10 samples.

Parameters:

- [Input_value]: Value to derive
- [Reset]: This command resets the act derive value. The calculation restarts when all the items of samples array are refreshed.
- [Derive_spl_CMD]: Timing step. The samples are taken when [Derive_spl_CMD] = TRUE
- [Derive_value]: Derivated output value
- [Enable]: This output is energized when the calculation of act value is finished
- [Samples]: Samples container.
- [Nr_samples]: # of samples to take for calculation
- [Derive_calc_ON]: System variable
- [Nr_of_shf]: System variable
- [Loop]: System variable
- [Index]: System variable
- [Prev_sum]: System variable
- [Next_sum]: System variable
- [Dummy_bit_1]: System variable
- [Calc_ON]: System variable
- [Init_end]: System variable

## Disclaimer

For all material in the PLC Archive, our site disclaimer applies. You take full responsibility for the application of any code appearing on this site, as we have made no engineering evaluation of the code nor are we, or the author, familiar with the details and risks inherent in your application.