Loading...
Searching...
No Matches
benchmark_steady_state_detection

Definition

Provides methods for detecting steady-state conditions based on t-test.

Examples

The following example demonstrates some of the methods found in the benchmark_steady_state_detection module.

use benchmark_steady_state_detection, only: ssd
use benchmark_workflow, only: workflow
use benchmark_options
use benchmark_method
use benchmark_timer, only: clock
use benchmark_statistics, only: stats
use benchmark_warning, only: display_maxcall_warning
use benchmark_string
use benchmark_kinds
use benchmark_output_unit
class(benchmark_run), intent(inout) :: step
!private
integer :: k
real(r8) :: start, finish
type(stats) :: s
real(r8), allocatable :: times(:)
real(r8) :: treshold
maxcall_reached = .false.
treshold = step%options%ssd_threshold
if (first_call) write (output_unit, '(A)') new_line('A'), step%header, new_line('A')
step%options%count = step%options%count + 1
allocate(times(step%options%sampling_window), source=0.0_r8)
block
integer :: icount, jcount, count
real(r8) :: crit, t
crit = 0.0_r8; icount = 0; jcount = 0; count = 0
call clock(start)
do while (crit <= (1.0_r8 - treshold))
call step%method%invoke(); call clock(finish)
t = finish - start
icount = icount + 1
if (t > step%options%mintime) then
times(1 + modulo(jcount, step%options%sampling_window)) = &
t / real(icount, r8)
jcount = jcount + 1
if (jcount >= step%options%sampling_window) crit = &
ssd(times, modulo(jcount, step%options%sampling_window), &
treshold)
icount = 0
call clock(start)
end if
count = count + 1
if (count >= step%options%maxcalls) then
maxcall_reached = .true.
exit
end if
end do
end block
call s%compute(times)
if (step%options%csv_unit /= 0) then
call summary(step, s, step%options%csv_unit)
else
call summary(step, s)
end if
deallocate(times)
nullify(step%method)
nullify(step%options)

Remarks

The steady-state detection algorithm is based on the work by J. D. Kelly and J. D. Hedengren, “A steady-state detection (SSD) algorithm to detect non-stationary drifts in processes,” J. Process Control, vol. 23, no. 3, pp. 326–331, 2013. The original algorithm has been altered to be used with dynamic real-time data.

Methods

◆ ssd()

real(r8) function, public ssd ( real(r8), dimension(:), intent(in) x,
integer, intent(in) offset,
real(r8), intent(in) alpha )

Compute the probability that a sample x reached steady-state. The SSD algorithm presented in this work is also window-based and utilizes the Student-t test to determine if the difference between the process signal value minus its mean is above or below the standard-deviation times its statistical critical value. If less than, then that time instant or point is steady and if greater than, then it is unsteady where the aggregation is computed over the window approximating a probability or frequency of being at steady-state.

Parameters
[in]xSample of real(r8) values
[in]offsetIndex of the first values inside the periodic array x
[in]alphaSignificance level for the student test.

The mean is defined as:

\[ \mu = \frac{1}{n}\left(\sum x-m\sum i\right) \]

where \(m\) is the slope of a linear drift. In the present case, \(m=0\) It comes that the standard deviation is given by

\[ \sigma = \sqrt{\frac{1}{n-2}\sum (x-\mu)^2} \]

At this point along with a specified Student-t critical or threshold value at a particu100 lar significance level α and degrees-of-freedom n, all of the necessary information is available to test the null-hypothesis that the process signal is steady or is stationary about \(\mu\)

\[ if\ x - \mu < t_{crit}-\sigma\ , then\ 1,\ else\ 0 \]

\(t_{crit}\) is evaluated for a given significance level and a given degree of freedom using the t-distribution.

Remarks

Definition at line 59 of file SteadyStateDetection.f90.