OpenHantek
ppresult.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 
3 #pragma once
4 
5 #include <QReadWriteLock>
6 #include <QVector3D>
7 
8 #include "hantekprotocol/types.h"
9 #include "utils/printutils.h"
10 #include <vector>
11 
13 struct SampleValues {
14  std::vector< double > samples;
15  double interval = 0.0;
16 };
17 
19 struct DataChannel {
22  bool valid = true;
23  double vmin = 0.0;
24  double vmax = 0.0;
25  double rms = 0.0;
26  double dBmin = 0.0;
27  double dBmax = 0.0;
28  double dc = 0.0;
29  double ac = 0.0;
30  double dB = 0.0;
31  double frequency = 0.0;
32  QString note = "";
33  double thd = 0.0;
34  double pulseWidth1 = 0.0;
35  double pulseWidth2 = 0.0;
37 };
38 
39 typedef std::vector< QVector3D > ChannelGraph;
40 typedef std::vector< ChannelGraph > ChannelsGraphs;
41 
43 class PPresult {
44  public:
45  explicit PPresult( unsigned int channelCount );
46 
49  const DataChannel *data( ChannelID channel ) const;
54  unsigned int sampleCount() const;
55  unsigned int channelCount() const;
56 
61  double pulseWidth1 = 0.0;
62  double pulseWidth2 = 0.0;
63  unsigned tag;
64 
68 
69  private:
70  std::vector< DataChannel > analyzedData;
71 };
std::vector< DataChannel > analyzedData
The analyzed data for each channel.
Definition: ppresult.h:70
double pulseWidth2
The width of the following pulse.
Definition: ppresult.h:35
double interval
The interval between two sample values.
Definition: ppresult.h:15
std::vector< double > samples
Vector holding the sampling data.
Definition: ppresult.h:14
bool valid
Not clipped, distorted, dropouts etc.
Definition: ppresult.h:22
double pulseWidth1
The width of the triggered pulse.
Definition: ppresult.h:34
double vmax
The maximum sample value of displayed part of trace.
Definition: ppresult.h:24
double pulseWidth1
The width of the triggered pulse.
Definition: ppresult.h:61
unsigned int channelCount() const
Definition: ppresult.cpp:18
double pulseWidth2
The width of the following pulse.
Definition: ppresult.h:62
SampleValues spectrum
The frequency-domain power levels (dB)
Definition: ppresult.h:21
DataChannel * modifiableData(ChannelID channel)
Returns the analyzed data (RW). The data structure can be modified.
Definition: ppresult.cpp:14
ChannelsGraphs vaChannelVoltage
Definition: ppresult.h:66
double dc
The DC bias of the signal.
Definition: ppresult.h:28
double dB
The AC rms value as dB (dBV or other depending on config)
Definition: ppresult.h:30
double vmin
The minimum sample value of displayed part of trace.
Definition: ppresult.h:23
double dBmin
The minimum magnitude value.
Definition: ppresult.h:26
SampleValues voltage
The time-domain voltage levels (V)
Definition: ppresult.h:20
unsigned tag
track individual sample blocks (debug support)
Definition: ppresult.h:63
double ac
The AC rms value of the signal.
Definition: ppresult.h:29
std::vector< QVector3D > ChannelGraph
Definition: ppresult.h:39
double thd
The THD value.
Definition: ppresult.h:33
PPresult(unsigned int channelCount)
Definition: ppresult.cpp:6
Struct for a array of sample values.
Definition: ppresult.h:13
double rms
The DC + AC rms value of the signal = sqrt( dc * dc + acc * ac )
Definition: ppresult.h:25
std::vector< ChannelGraph > ChannelsGraphs
Definition: ppresult.h:40
Definition: printutils.h:12
Unit
The various units supported by valueToString.
Definition: printutils.h:12
ChannelsGraphs vaChannelHistogram
Definition: ppresult.h:67
unsigned ChannelID
Definition: types.h:6
bool softwareTriggerTriggered
sw trigger status
Definition: ppresult.h:58
QString note
The note value of the frequency.
Definition: ppresult.h:32
Struct for the analyzed data.
Definition: ppresult.h:19
double dBmax
The maximum magnitude value.
Definition: ppresult.h:27
unsigned int sampleCount() const
Definition: ppresult.cpp:16
const DataChannel * data(ChannelID channel) const
Returns the analyzed data (RO).
Definition: ppresult.cpp:8
double frequency
The frequency of the signal.
Definition: ppresult.h:31
ChannelsGraphs vaChannelSpectrum
Definition: ppresult.h:65
Post processing results.
Definition: ppresult.h:43
Unit voltageUnit
unless UNIT_VOLTSQUARE for some math functions
Definition: ppresult.h:36
int triggeredPosition
skip samples at start of channel to get triggered trace on screen
Definition: ppresult.h:60