QXRD  0.11.16
Public Types | Public Slots | Signals | Public Member Functions | Properties | Private Attributes | List of all members
QxrdAcquisitionExtraInputsChannel Class Reference

#include <qxrdacquisitionextrainputschannel.h>

Inheritance diagram for QxrdAcquisitionExtraInputsChannel:
Inheritance graph
[legend]
Collaboration diagram for QxrdAcquisitionExtraInputsChannel:
Collaboration graph
[legend]

Public Types

enum  { ModeSummed, ModeAveraged, ModeMaximum, ModeMinimum }
 
enum  {
  TriggerModeNone, TriggerModeEdgePos, TriggerModeEdgeNeg, TriggerModeLevelPos,
  TriggerModeLevelNeg
}
 

Public Slots

QVector< double > readChannel ()
 
double evaluateChannel ()
 
double sumChannel ()
 
double averageChannel ()
 
double maximumChannel ()
 
double minimumChannel ()
 
int startIndex ()
 
int endIndex ()
 
bool evaluateTrigger ()
 
bool evalTrig (int polarity, bool edgeTrig)
 
- Public Slots inherited from QcepObject
virtual void printLine (QString line)
 
virtual void printMessage (QString msg, QDateTime dt=QDateTime::currentDateTime()) const
 
virtual void criticalMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
virtual void statusMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
virtual QString settingsScript ()
 
QString scriptValueLiteral (QVariant v)
 

Signals

void reinitiateNeeded ()
 

Public Member Functions

 QxrdAcquisitionExtraInputsChannel (int chnum, QcepSettingsSaverWPtr saver, QxrdExperimentWPtr doc, QxrdAcquisitionExtraInputsWPtr xtra)
 
void readSettings (QSettings *settings, QString section)
 
void writeSettings (QSettings *settings, QString section)
 
- Public Member Functions inherited from QcepObject
 QcepObject (QString name, QcepObject *parent)
 
virtual ~QcepObject ()
 
QString get_Name () const
 
void set_Name (QString name)
 

Properties

int channelNumber
 
bool enabled
 
bool plotted
 
QString channelName
 
int mode
 
bool saveWave
 
double min
 
double max
 
double start
 
double end
 
int triggerMode
 
double triggerLevel
 
double triggerHysteresis
 
int physicalChannel
 
double value
 
bool triggered
 
int nLow
 
int nHigh
 
QcepDoubleVector waveform
 
- Properties inherited from QcepObject
QString name
 

Private Attributes

QMutex m_Mutex
 
QxrdExperimentWPtr m_Experiment
 
QxrdAcquisitionExtraInputsWPtr m_ExtraInputs
 

Additional Inherited Members

- Static Public Member Functions inherited from QcepObject
static int allocatedObjects ()
 
static int deletedObjects ()
 
static QSet< QcepObject * > allocatedObjectsSet ()
 
static QString addSlashes (QString str)
 

Detailed Description

Definition at line 11 of file qxrdacquisitionextrainputschannel.h.

Member Enumeration Documentation

anonymous enum
anonymous enum

Constructor & Destructor Documentation

QxrdAcquisitionExtraInputsChannel::QxrdAcquisitionExtraInputsChannel ( int  chnum,
QcepSettingsSaverWPtr  saver,
QxrdExperimentWPtr  doc,
QxrdAcquisitionExtraInputsWPtr  xtra 
)
explicit

Definition at line 7 of file qxrdacquisitionextrainputschannel.cpp.

References reinitiateNeeded(), QcepDoubleProperty::valueChanged(), QcepBoolProperty::valueChanged(), and QcepStringProperty::valueChanged().

8  :
9  QcepObject(tr("extraChannel(%1)").arg(chnum), NULL),
10  m_ChannelNumber(QcepSettingsSaverPtr(), this, "channelNumber", chnum, "Extra Input Channel Number"),
11  m_Enabled(saver, this, "enabled", 1, "Enabled?"),
12  m_Plotted(saver, this, "plotted", 1, "Plotted?"),
13  m_ChannelName(saver, this, "channelName", "", "NIDAQ name of channel"),
14 // m_Kind(saver, this, "kind", 0, "Channel Kind (0 = none, 1 = Analog In, 2 = Counter In)"),
15  m_Mode(saver, this, "mode", 0, "Channel Mode (0 = summed, 1 = averaged, 2 = maximum, 3 = minimum)"),
16  m_SaveWave(saver, this, "saveWave", 0, "Save entire waveform (0 = no, 1 = yes)"),
17  m_Min(saver, this, "min", -10.0, "Minimum Input value for Analog Channel (in Volts)"),
18  m_Max(saver, this, "max", 10.0, "Maximum Input Value for Analog Channel (in Volts)"),
19  m_Start(saver, this, "start", 0.0, "Start Offset for Channel (in sec after notional exposure start)\n"
20  "i.e. Negative values mean times before start of exposure"),
21  m_End(saver, this, "end", 0.0, "End Offset for Channel (in sec before notional exposure end)\n"
22  "i.e. Negative values mean times after end of exposure"),
23  m_TriggerMode(saver, this, "triggerMode", 0, "Trigger Mode (0 = None, 1 = +Edge, 2 = -Edge, 3 = +Level, 4 = -Level)"),
24  m_TriggerLevel(saver, this, "triggerLevel", 0.0, "Trigger Level (in Volts)"),
25  m_TriggerHysteresis(saver, this, "triggerHysteresis", 0.0, "Trigger Hysteresis (in Volts)"),
26  m_PhysicalChannel(QcepSettingsSaverPtr(), this, "physicalChannel", 0, "Physical Channel Number"),
27  m_Value(QcepSettingsSaverWPtr(), this, "value", 0.0, "Current Value of Channel"),
28  m_Triggered(QcepSettingsSaverWPtr(), this, "triggered", 0, "Was channel triggered?"),
29  m_NLow(QcepSettingsSaverWPtr(), this, "nLow", 0, "Number of untriggered data points"),
30  m_NHigh(QcepSettingsSaverWPtr(), this, "nHigh", 0, "Number of triggered data points"),
31  m_Waveform(QcepSettingsSaverWPtr(), this, "waveform", QcepDoubleVector(), "Waveform on Channel"),
32  m_Experiment(doc),
33  m_ExtraInputs(xtra)
34 {
35  connect(prop_ChannelName(), &QcepStringProperty::valueChanged,
37 
38  connect(prop_Min(), &QcepDoubleProperty::valueChanged,
40 
41  connect(prop_Max(), &QcepDoubleProperty::valueChanged,
43 
44  connect(prop_Enabled(), &QcepBoolProperty::valueChanged,
46 }
void valueChanged(QString val, int index)
QVector< double > QcepDoubleVector
Definition: qcepmacros.h:19
QSharedPointer< QcepSettingsSaver > QcepSettingsSaverPtr
QcepObject(QString name, QcepObject *parent)
Definition: qcepobject.cpp:16
void valueChanged(double val, int index)
void valueChanged(bool val, int index)
QWeakPointer< QcepSettingsSaver > QcepSettingsSaverWPtr

Member Function Documentation

double QxrdAcquisitionExtraInputsChannel::averageChannel ( )
slot

Definition at line 163 of file qxrdacquisitionextrainputschannel.cpp.

References endIndex(), readChannel(), and startIndex().

Referenced by evaluateChannel().

164 {
165  QVector<double> res = readChannel();
166 
167  double n=0;
168  double sum=0;
169 
170  int i0 = startIndex();
171  int i1 = endIndex();
172 
173  for(int i=i0; i<i1; i++) {
174  sum += res[i];
175  n += 1;
176  }
177 
178  return (n>0 ? sum/n : 0);
179 }

Here is the call graph for this function:

Here is the caller graph for this function:

int QxrdAcquisitionExtraInputsChannel::endIndex ( )
slot

Definition at line 101 of file qxrdacquisitionextrainputschannel.cpp.

References m_ExtraInputs.

Referenced by averageChannel(), evalTrig(), maximumChannel(), minimumChannel(), and sumChannel().

102 {
103  int res = 0;
104 
106 
107  if (xtra) {
108  QxrdNIDAQPluginInterfacePtr nidaq = xtra->nidaqPlugin();
109 
110  if (nidaq) {
111  int nSamples = nidaq->countContinuousInput();
112  int endOffset = xtra->get_SampleRate()*(0.1 + xtra->get_ExposureTime() - get_End());
113 
114  if (endOffset > nSamples) {
115  res = nSamples;
116  } else if (endOffset > 0) {
117  res = endOffset;
118  }
119  }
120  }
121 
122  return res;
123 }
QSharedPointer< QxrdAcquisitionExtraInputs > QxrdAcquisitionExtraInputsPtr
QSharedPointer< QxrdNIDAQPluginInterface > QxrdNIDAQPluginInterfacePtr

Here is the caller graph for this function:

bool QxrdAcquisitionExtraInputsChannel::evalTrig ( int  polarity,
bool  edgeTrig 
)
slot

Definition at line 262 of file qxrdacquisitionextrainputschannel.cpp.

References endIndex(), readChannel(), and startIndex().

Referenced by evaluateTrigger().

263 {
264  double level = get_TriggerLevel();
265  double hyst = get_TriggerHysteresis();
266  bool tres;
267 
268  QVector<double> res = readChannel();
269 
270  int nlow=0, nhigh=0;
271  double tlevel = level*polarity;
272  double lowlevel = tlevel-fabs(hyst);
273  double highlevel = tlevel+fabs(hyst);
274 
275  int i0 = startIndex();
276  int i1 = endIndex();
277 
278  for(int i=i0; i<i1; i++) {
279  double v=res[i]*polarity;
280 
281  if (v < lowlevel) nlow += 1;
282 
283  if (edgeTrig) {
284  if (nlow && (v > highlevel)) nhigh += 1;
285  } else {
286  if (v > highlevel) nhigh += 1;
287  }
288  }
289 
290  set_NLow(nlow);
291  set_NHigh(nhigh);
292 
293  if (edgeTrig) {
294  tres = ((nlow > 0) && (nhigh > 0));
295  } else {
296  tres = (nhigh > 0);
297  }
298 
299  return tres;
300 }

Here is the call graph for this function:

Here is the caller graph for this function:

double QxrdAcquisitionExtraInputsChannel::evaluateChannel ( )
slot

Definition at line 125 of file qxrdacquisitionextrainputschannel.cpp.

References averageChannel(), evaluateTrigger(), maximumChannel(), minimumChannel(), mode, ModeAveraged, ModeMaximum, ModeMinimum, ModeSummed, and sumChannel().

Here is the call graph for this function:

bool QxrdAcquisitionExtraInputsChannel::evaluateTrigger ( )
slot

Definition at line 229 of file qxrdacquisitionextrainputschannel.cpp.

References evalTrig(), TriggerModeEdgeNeg, TriggerModeEdgePos, TriggerModeLevelNeg, TriggerModeLevelPos, and TriggerModeNone.

Referenced by evaluateChannel().

230 {
231  int trigMode = get_TriggerMode();
232  bool res;
233 
234  switch (trigMode) {
235  case TriggerModeNone:
236  default:
237  res = false;
238  break;
239 
240  case TriggerModeEdgePos:
241  res = evalTrig(+1, true);
242  break;
243 
244  case TriggerModeEdgeNeg:
245  res = evalTrig(-1, true);
246  break;
247 
248  case TriggerModeLevelPos:
249  res = evalTrig(+1, false);
250  break;
251 
252  case TriggerModeLevelNeg:
253  res = evalTrig(-1, false);
254  break;
255  }
256 
257  set_Triggered(res);
258 
259  return res;
260 }

Here is the call graph for this function:

Here is the caller graph for this function:

double QxrdAcquisitionExtraInputsChannel::maximumChannel ( )
slot

Definition at line 181 of file qxrdacquisitionextrainputschannel.cpp.

References endIndex(), max, readChannel(), and startIndex().

Referenced by evaluateChannel().

182 {
183  QVector<double> res = readChannel();
184 
185  double max=0;
186 
187  int i0 = startIndex();
188  int i1 = endIndex();
189 
190  for(int i=i0; i<i1; i++) {
191  double v=res[i];
192 
193  if (i == i0) {
194  max = v;
195  } else {
196  if (v > max) {
197  max = v;
198  }
199  }
200  }
201 
202  return max;
203 }

Here is the call graph for this function:

Here is the caller graph for this function:

double QxrdAcquisitionExtraInputsChannel::minimumChannel ( )
slot

Definition at line 205 of file qxrdacquisitionextrainputschannel.cpp.

References endIndex(), min, readChannel(), and startIndex().

Referenced by evaluateChannel().

206 {
207  QVector<double> res = readChannel();
208 
209  double min=0;
210 
211  int i0 = startIndex();
212  int i1 = endIndex();
213 
214  for(int i=i0; i<i1; i++) {
215  double v=res[i];
216 
217  if (i == i0) {
218  min = v;
219  } else {
220  if (v < min) {
221  min = v;
222  }
223  }
224  }
225 
226  return min;
227 }

Here is the call graph for this function:

Here is the caller graph for this function:

QVector< double > QxrdAcquisitionExtraInputsChannel::readChannel ( )
slot

Definition at line 62 of file qxrdacquisitionextrainputschannel.cpp.

References m_ExtraInputs.

Referenced by averageChannel(), evalTrig(), maximumChannel(), minimumChannel(), and sumChannel().

63 {
65 
66  if (xtra) {
67  QxrdNIDAQPluginInterfacePtr nidaq = xtra->nidaqPlugin();
68 
69  if (nidaq) {
70  return nidaq->readContinuousInputChannel(get_PhysicalChannel());
71  }
72  }
73 
74  return QVector<double>();
75 }
QSharedPointer< QxrdAcquisitionExtraInputs > QxrdAcquisitionExtraInputsPtr
QSharedPointer< QxrdNIDAQPluginInterface > QxrdNIDAQPluginInterfacePtr

Here is the caller graph for this function:

void QxrdAcquisitionExtraInputsChannel::readSettings ( QSettings *  settings,
QString  section 
)
virtual

Reimplemented from QcepObject.

Definition at line 48 of file qxrdacquisitionextrainputschannel.cpp.

References m_Mutex, and QcepObject::readSettings().

49 {
50  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
51 
52  QcepObject::readSettings(settings, section);
53 }
virtual void readSettings(QSettings *set, QString section)
Definition: qcepobject.cpp:119

Here is the call graph for this function:

void QxrdAcquisitionExtraInputsChannel::reinitiateNeeded ( )
signal

Referenced by QxrdAcquisitionExtraInputs::appendChannel(), and QxrdAcquisitionExtraInputsChannel().

Here is the caller graph for this function:

int QxrdAcquisitionExtraInputsChannel::startIndex ( )
slot

Definition at line 77 of file qxrdacquisitionextrainputschannel.cpp.

References m_ExtraInputs.

Referenced by averageChannel(), evalTrig(), maximumChannel(), minimumChannel(), and sumChannel().

78 {
79  int res = 0;
80 
82 
83  if (xtra) {
84  QxrdNIDAQPluginInterfacePtr nidaq = xtra->nidaqPlugin();
85 
86  if (nidaq) {
87  int nSamples = nidaq->countContinuousInput();
88  int startOffset = xtra->get_SampleRate()*(0.1 + get_Start());
89 
90  if (startOffset > nSamples) {
91  res = nSamples;
92  } else if (startOffset > 0) {
93  res = startOffset;
94  }
95  }
96  }
97 
98  return res;
99 }
QSharedPointer< QxrdAcquisitionExtraInputs > QxrdAcquisitionExtraInputsPtr
QSharedPointer< QxrdNIDAQPluginInterface > QxrdNIDAQPluginInterfacePtr

Here is the caller graph for this function:

double QxrdAcquisitionExtraInputsChannel::sumChannel ( )
slot

Definition at line 147 of file qxrdacquisitionextrainputschannel.cpp.

References endIndex(), readChannel(), and startIndex().

Referenced by evaluateChannel().

148 {
149  QVector<double> res = readChannel();
150 
151  double sum=0;
152 
153  int i0 = startIndex();
154  int i1 = endIndex();
155 
156  for(int i=i0; i<i1; i++) {
157  sum += res[i];
158  }
159 
160  return sum;
161 }

Here is the call graph for this function:

Here is the caller graph for this function:

void QxrdAcquisitionExtraInputsChannel::writeSettings ( QSettings *  settings,
QString  section 
)
virtual

Reimplemented from QcepObject.

Definition at line 55 of file qxrdacquisitionextrainputschannel.cpp.

References m_Mutex, and QcepObject::writeSettings().

56 {
57  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
58 
59  QcepObject::writeSettings(settings, section);
60 }
virtual void writeSettings(QSettings *set, QString section)
Definition: qcepobject.cpp:114

Here is the call graph for this function:

Member Data Documentation

QxrdExperimentWPtr QxrdAcquisitionExtraInputsChannel::m_Experiment
private

Definition at line 113 of file qxrdacquisitionextrainputschannel.h.

QxrdAcquisitionExtraInputsWPtr QxrdAcquisitionExtraInputsChannel::m_ExtraInputs
private

Definition at line 114 of file qxrdacquisitionextrainputschannel.h.

Referenced by endIndex(), readChannel(), and startIndex().

QMutex QxrdAcquisitionExtraInputsChannel::m_Mutex
mutableprivate

Definition at line 112 of file qxrdacquisitionextrainputschannel.h.

Referenced by readSettings(), and writeSettings().

Property Documentation

QString QxrdAcquisitionExtraInputsChannel::channelName
readwrite

Definition at line 60 of file qxrdacquisitionextrainputschannel.h.

int QxrdAcquisitionExtraInputsChannel::channelNumber
readwrite

Definition at line 51 of file qxrdacquisitionextrainputschannel.h.

bool QxrdAcquisitionExtraInputsChannel::enabled
readwrite

Definition at line 54 of file qxrdacquisitionextrainputschannel.h.

double QxrdAcquisitionExtraInputsChannel::end
readwrite

Definition at line 81 of file qxrdacquisitionextrainputschannel.h.

double QxrdAcquisitionExtraInputsChannel::max
readwrite

Definition at line 75 of file qxrdacquisitionextrainputschannel.h.

Referenced by maximumChannel().

double QxrdAcquisitionExtraInputsChannel::min
readwrite

Definition at line 72 of file qxrdacquisitionextrainputschannel.h.

Referenced by minimumChannel().

int QxrdAcquisitionExtraInputsChannel::mode
readwrite

Definition at line 66 of file qxrdacquisitionextrainputschannel.h.

Referenced by evaluateChannel().

int QxrdAcquisitionExtraInputsChannel::nHigh
readwrite

Definition at line 105 of file qxrdacquisitionextrainputschannel.h.

int QxrdAcquisitionExtraInputsChannel::nLow
readwrite

Definition at line 102 of file qxrdacquisitionextrainputschannel.h.

int QxrdAcquisitionExtraInputsChannel::physicalChannel
readwrite

Definition at line 93 of file qxrdacquisitionextrainputschannel.h.

bool QxrdAcquisitionExtraInputsChannel::plotted
readwrite

Definition at line 57 of file qxrdacquisitionextrainputschannel.h.

bool QxrdAcquisitionExtraInputsChannel::saveWave
readwrite

Definition at line 69 of file qxrdacquisitionextrainputschannel.h.

double QxrdAcquisitionExtraInputsChannel::start
readwrite

Definition at line 78 of file qxrdacquisitionextrainputschannel.h.

bool QxrdAcquisitionExtraInputsChannel::triggered
readwrite

Definition at line 99 of file qxrdacquisitionextrainputschannel.h.

double QxrdAcquisitionExtraInputsChannel::triggerHysteresis
readwrite

Definition at line 90 of file qxrdacquisitionextrainputschannel.h.

double QxrdAcquisitionExtraInputsChannel::triggerLevel
readwrite

Definition at line 87 of file qxrdacquisitionextrainputschannel.h.

int QxrdAcquisitionExtraInputsChannel::triggerMode
readwrite

Definition at line 84 of file qxrdacquisitionextrainputschannel.h.

double QxrdAcquisitionExtraInputsChannel::value
readwrite

Definition at line 96 of file qxrdacquisitionextrainputschannel.h.

QcepDoubleVector QxrdAcquisitionExtraInputsChannel::waveform
readwrite

Definition at line 108 of file qxrdacquisitionextrainputschannel.h.


The documentation for this class was generated from the following files: