SYNOPSIS
loadrt histobinstream [count=N|names=name1[,name2…]] [keys=value[,value…]]
- keys
-
Stream shmem unique key for each instance
DESCRIPTION
Calculates a histogram of an input pin’s value. The histogram data is sent in a HAL stream for maximum transfer speed and to prevent any RT to non-RT data race conditions. This is the streaming counterpart to the histobins component.
Read the availablebins pin for the number of bins available. Set the minvalue, binsize and nbins pins and ensure nbins ≤ availablebins.
For nbins = N, the bins are numbered 0 … N-1. The value range covered is [minvalue … minvalue + N * binsize). Any input below minvalue is counted in the negative overflow (ntail). Any input at or above the upper edge is counted in the positive overflow (ptail).
The input used is selected based on pintype:
| pintype | inputpin |
|---|---|
0 |
input |
1 |
input-s32 |
2 |
input-u32 |
3 |
input-bit |
Stream format and how to obtain the histogram data:
-
Set the stream pin to high.
-
Read the fifo data when it becomes available. The data streamed has the following sequence:
-
ntail bin[0] … bin[N-1] ptail
-
This gives nbins + 2 values streamed (all unsigned counts).
-
-
Read the statistics pins (input-min, input-max, mean, variance, nsamples) that reflect the values at the time when stream was asserted.
-
Set the stream pin to low.
The reset pin may be used to restart. Note that the reset pin is set to high at startup. You must set it to low before data collection begins.
The method input pin selects an alternate variance calculation (0: Welford incremental, 1: sum / sum-of-squares).
Maintainers note: hardcoded for MAXBINNUMBER==200
FUNCTIONS
- histobinstream.N
PINS
- histobinstream.N.pintype u32 in
-
Select the input pin (0:input 1:input-s32 2:input-u32 3:input-bit).
- histobinstream.N.input float in
-
Floating point input value (pintype 0).
- histobinstream.N.input-s32 s32 in
-
Signed input value (pintype 1).
- histobinstream.N.input-u32 u32 in
-
Unsigned input value (pintype 2).
- histobinstream.N.input-bit bit in
-
Bit input value (pintype 3).
- histobinstream.N.nbins u32 in (default: 20)
-
Number of active bins N (0 … N-1).
- histobinstream.N.binsize float in (default: 1)
-
Width of one bin in input units.
- histobinstream.N.minvalue float in (default: 0)
-
Lower edge of bin 0.
- histobinstream.N.reset bit in (default: 1)
-
Reset state and bins.
- histobinstream.N.stream bit in (default: 0)
-
Set to high to stream all bins and tails on rising edge.
- histobinstream.N.method bit in (default: 0)
-
Variance method (0:Welford incremental, 1:sum of squares).
- histobinstream.N.stream-error bit out
-
Set if the data stream did not fit and was never sent.
- histobinstream.N.input-error bit out
-
Set when input rules are violated; updates are invalid until fixed and a reset.
- histobinstream.N.input-min float out
-
Minimum input value seen (latched on stream rising edge).
- histobinstream.N.input-max float out
-
Maximum input value seen (latched on stream rising edge).
- histobinstream.N.nsamples u32 out
-
Number of samples accumulated (latched on stream rising edge).
- histobinstream.N.variance float out
-
Variance of the input (latched on stream rising edge).
- histobinstream.N.mean float out
-
Mean of the input (latched on stream rising edge).
- histobinstream.N.stream-time s64 out
-
The time it took for the stream data to be pushed out in nanoseconds (ns).
- histobinstream.N.availablebins s32 out (default: 200)
AUTHOR
Dewey Garrett, B.Stultiens, LinuxCNC contributors
LICENSE
GPL