Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
XNIDAQmxPulser Class Referenceabstract
Inheritance diagram for XNIDAQmxPulser:
Inheritance graph
[legend]

Classes

struct  GenPattern
 
struct  Payload
 
struct  RingBuffer
 Ring buffer storing AO/DO patterns being transfered to DAQmx lib. More...
 
struct  tRawAOSet
 

Public Member Functions

 XNIDAQmxPulser (const char *name, bool runtime, Transaction &tr_meas, const shared_ptr< XMeasure > &meas)
 
virtual double resolution () const
 time resolution [ms]
 
- Public Member Functions inherited from XNIDAQmxDriver< XPulser >
 XNIDAQmxDriver (const char *name, bool runtime, Transaction &tr_meas, const shared_ptr< XMeasure > &meas)
 
- Public Member Functions inherited from XPulser
 XPulser (const char *name, bool runtime, Transaction &tr_meas, const shared_ptr< XMeasure > &meas)
 
virtual void showForms ()
 shows all forms belonging to driver
 
const shared_ptr< XBoolNode > & output () const
 
const shared_ptr< XComboNode > & combMode () const
 
const shared_ptr< XComboNode > & rtMode () const
 
const shared_ptr< XComboNode > & numPhaseCycle () const
 How many cycles in phase cycling.
 
const shared_ptr< XDoubleNode > & rtime () const
 Repetition/Rest Time [ms].
 
const shared_ptr< XDoubleNode > & tau () const
 [us]
 
const shared_ptr< XDoubleNode > & combPW () const
 PulseWidths [us].
 
const shared_ptr< XDoubleNode > & pw1 () const
 PulseWidths [us].
 
const shared_ptr< XDoubleNode > & pw2 () const
 PulseWidths [us].
 
const shared_ptr< XDoubleNode > & combPT () const
 Comb pulse periodic term [us].
 
const shared_ptr< XDoubleNode > & combP1 () const
 P1 and P1 alternative.
 
const shared_ptr< XDoubleNode > & combP1Alt () const
 P1 and P1 alternative.
 
const shared_ptr< XDoubleNode > & aswSetup () const
 Analog switch setting, setup(proceeding) time before the first spin echo.
 
const shared_ptr< XDoubleNode > & aswHold () const
 Analog switch setting, hold time after the last spin echo.
 
const shared_ptr< XDoubleNode > & altSep () const
 Separation time in DSO record, cause a shift of trigger of DSO in alternatively mode.
 
const shared_ptr< XDoubleNode > & g2Setup () const
 Setup time of pre-gating port and QPSK.
 
const shared_ptr< XUIntNode > & combNum () const
 

of comb pulses


 
const shared_ptr< XUIntNode > & echoNum () const
 

of Spin echoes (i.e. pi pulses)


 
const shared_ptr< XBoolNode > & drivenEquilibrium () const
 polarize spins after pulse sequence or not
 
const shared_ptr< XDoubleNode > & combOffRes () const
 off-resonance comb pulses
 
const shared_ptr< XComboNode > & combFunc () const
 Pulse Modulation.
 
const shared_ptr< XComboNode > & p1Func () const
 Pulse Modulation.
 
const shared_ptr< XComboNode > & p2Func () const
 Pulse Modulation.
 
const shared_ptr< XDoubleNode > & combLevel () const
 [dB], Pulse Modulation
 
const shared_ptr< XDoubleNode > & p1Level () const
 [dB], Pulse Modulation
 
const shared_ptr< XDoubleNode > & p2Level () const
 [dB], Pulse Modulation
 
const shared_ptr< XDoubleNode > & masterLevel () const
 [dB]
 
const shared_ptr< XBoolNode > & induceEmission () const
 
const shared_ptr< XDoubleNode > & induceEmissionPhase () const
 
const shared_ptr< XDoubleNode > & qamOffset1 () const
 
const shared_ptr< XDoubleNode > & qamOffset2 () const
 [F.S.]
 
const shared_ptr< XDoubleNode > & qamLevel1 () const
 
const shared_ptr< XDoubleNode > & qamLevel2 () const
 < Quadrature Amplitude Modulation. Amplitude compensation factor.
 
const shared_ptr< XDoubleNode > & qamDelay1 () const
 
const shared_ptr< XDoubleNode > & qamDelay2 () const
 < Delaying compensation [us].
 
const shared_ptr< XDoubleNode > & difFreq () const
 [MHz]
 
const shared_ptr< XDoubleNode > & qswDelay () const
 Q-switch setting, period after the end-edge of pulses [us].
 
const shared_ptr< XDoubleNode > & qswWidth () const
 Q-switch setting, width of suppression [us].
 
const shared_ptr< XDoubleNode > & qswSoftSWOff () const
 Q-switch setting, second pulse [us].
 
const shared_ptr< XBoolNode > & qswPiPulseOnly () const
 Q-switch setting, use QSW only for pi pulses.
 
const shared_ptr< XBoolNode > & invertPhase () const
 
const shared_ptr< XBoolNode > & conserveStEPhase () const
 
const shared_ptr< XComboNode > & portSel (unsigned int port) const
 
const shared_ptr< XBoolNode > & pulseAnalyzerMode () const
 
const shared_ptr< XDoubleNode > & paPulseRept () const
 
const shared_ptr< XDoubleNode > & paPulseBW () const
 
const shared_ptr< XUIntNode > & firstPhase () const
 0-3, selects the first phase of QPSK.
 
- Public Member Functions inherited from XPrimaryDriver
 XPrimaryDriver (const char *name, bool runtime, Transaction &tr_meas, const shared_ptr< XMeasure > &meas)
 
- Public Member Functions inherited from XDriver
 XDriver (const char *name, bool runtime, Transaction &tr_meas, const shared_ptr< XMeasure > &meas)
 
- Public Member Functions inherited from XNode
 XNode (const char *name, bool runtime=false)
 
template<class T >
shared_ptr< T > create (const char *name)
 
template<class T , typename... Args>
shared_ptr< T > create (const char *name, bool runtime, Args &&...args)
 
template<class T >
shared_ptr< T > create (Transaction &tr, const char *name)
 
template<class T , typename... Args>
shared_ptr< T > create (Transaction &tr, const char *name, bool runtime, Args &&...args)
 
XString getName () const
 
virtual XString getLabel () const
 
XString getTypename () const
 
shared_ptr< XNodegetChild (const XString &var) const
 
shared_ptr< XNodegetParent () const
 
void setUIEnabled (bool v)
 Enables/disables controls over scripting/GUI.
 
void disable ()
 Disables all scripting/GUI operations on this node hereafter.
 
- Public Member Functions inherited from Transactional::Node< XNode >
bool insert (Transaction< XNode > &tr, const shared_ptr< XNode > &var, bool online_after_insertion=false)
 
void insert (const shared_ptr< XNode > &var)
 
bool release (Transaction< XNode > &tr, const shared_ptr< XNode > &var)
 
void release (const shared_ptr< XNode > &var)
 
void releaseAll ()
 
bool swap (Transaction< XNode > &tr, const shared_ptr< XNode > &x, const shared_ptr< XNode > &y)
 
void swap (const shared_ptr< XNode > &x, const shared_ptr< XNode > &y)
 
XNodeupperNode (Snapshot< XNode > &shot)
 Finds the parent node in shot.
 
Snapshot< XNodeiterate_commit (Closure)
 
Snapshot< XNodeiterate_commit_if (Closure)
 
void iterate_commit_while (Closure)
 
void print_ () const
 
 Node (const Node &)=delete
 
Nodeoperator= (const Node &)=delete
 

Protected Member Functions

virtual void open ()=0 throw (XKameError &)
 Be called just after opening interface. Call start() inside this routine appropriately.
 
virtual void close () throw (XKameError &)
 Be called during stopping driver. Call interface()->stop() inside this routine.
 
double resolutionQAM () const
 
virtual bool hasQAMPorts () const =0
 
virtual const shared_ptr
< XNIDAQmxInterface > & 
intfDO () const
 
virtual const shared_ptr
< XNIDAQmxInterface > & 
intfAO () const
 
virtual const shared_ptr
< XNIDAQmxInterface > & 
intfCtr () const
 
virtual void changeOutput (const Snapshot &shot, bool output, unsigned int blankpattern)
 Sends patterns to pulser or turns off.
 
virtual void createNativePatterns (Transaction &tr)
 Converts RelPatList to native patterns.
 
virtual double minPulseWidth () const
 
void openDO (bool use_ao_clock=false) throw (XKameError &)
 
void openAODO () throw (XKameError &)
 
- Protected Member Functions inherited from XNIDAQmxDriver< XPulser >
const shared_ptr
< XNIDAQmxInterface > & 
interface () const
 
void onOpen (const Snapshot &shot, XInterface *)
 
void onClose (const Snapshot &shot, XInterface *)
 
virtual void closeInterface ()
 This should not cause an exception.
 
- Protected Member Functions inherited from XPulser
unsigned int selectedPorts (const Snapshot &shot, int func) const
 
virtual void start ()
 Starts up your threads, connects GUI, and activates signals.
 
virtual void stop ()
 
virtual void analyzeRaw (RawDataReader &reader, Transaction &tr) throw (XRecordError&)
 
virtual void visualize (const Snapshot &shot)
 
tpulsefunc pulseFunc (int func_no) const
 
int pulseFuncNo (const XString &str) const
 
- Protected Member Functions inherited from XPrimaryDriver
void finishWritingRaw (const shared_ptr< const RawData > &rawdata, const XTime &time_awared, const XTime &time_recorded)
 
- Protected Member Functions inherited from XDriver
void record (Transaction &tr, const XTime &time_awared, const XTime &time_recorded)
 

Protected Attributes

double m_resolutionDO
 
double m_resolutionAO
 
TaskHandle m_taskAO
 
TaskHandle m_taskDO
 
TaskHandle m_taskDOCtr
 
TaskHandle m_taskGateCtr
 

Private Types

enum  { NUM_AO_CH = 2 }
 
enum  { CAL_POLY_ORDER = 4 }
 
enum  { PORTSEL_PAUSING = 17 }
 
typedef int16 tRawAO
 
typedef uInt16 tRawDO
 
typedef std::vector
< GenPattern >::iterator 
GenPatternIterator
 
typedef std::deque< std::pair
< uint64_t, uint64_t > > 
QueueTimeGenCnt
 

Private Member Functions

void startPulseGen (const Snapshot &shot) throw (XKameError &)
 
void stopPulseGen ()
 
void abortPulseGen ()
 
void stopPulseGenFreeRunning (unsigned int blankpattern)
 
void startPulseGenFromFreeRun (const Snapshot &shot)
 
void clearTasks ()
 
void setupTasksDO (bool use_ao_clock)
 
void setupTasksAODO ()
 
void onTaskDone (TaskHandle task, int32 status)
 
tRawAOSet aoVoltToRaw (const double poly_coeff[NUM_AO_CH][CAL_POLY_ORDER], const std::complex< double > &volt)
 Converts voltage to an internal value for DAC and compensates it.
 
template<bool UseAO>
bool fillBuffer ()
 
void rewindBufPos (double ms_from_gen_pos)
 
ssize_t writeToDAQmxDO (const tRawDO *pDO, ssize_t samps)
 
ssize_t writeToDAQmxAO (const tRawAOSet *pAO, ssize_t samps)
 
void startBufWriter ()
 
void stopBufWriter ()
 
void * executeWriter (const atomic< bool > &)
 
void * executeFillBuffer (const atomic< bool > &)
 
void preparePatternGen (const Snapshot &shot, bool use_dummypattern, unsigned int blankpattern)
 
int makeWaveForm (int num, double pw, tpulsefunc func, double dB, double freq=0.0, double phase=0.0)
 

Static Private Member Functions

static int32 onTaskDone_ (TaskHandle task, int32 status, void *)
 

Private Attributes

shared_ptr< std::vector
< GenPattern > > 
m_genPatternList
 
GenPatternIterator m_genLastPatIt
 
unsigned int m_genAOIndex
 Preserved index for m_genPulseWaveAO[],.
 
shared_ptr
< XNIDAQmxInterface::SoftwareTrigger
m_softwareTrigger
 
unsigned int m_pausingBit
 Pausing bit triggers counter that stops DO/AO for a certain period.
 
unsigned int m_aswBit
 
unsigned int m_pausingCount
 
XString m_pausingCh
 
XString m_pausingSrcTerm
 
XString m_pausingGateTerm
 
unsigned int m_preFillSizeDO
 Determines stating condition,.
 
unsigned int m_preFillSizeAO
 
unsigned int m_transferSizeHintDO
 Max size of data transfer to DAQmx lib.
 
unsigned int m_transferSizeHintAO
 
uint64_t m_genTotalCount
 During the pattern generation, indicates total # of clocks at the next pattern change that has elapsed from the origin.
 
uint64_t m_genRestCount
 
uint64_t m_genTotalSamps
 m_genTotalSamps is different from m_genTotalCount when pausing clocks are active.
 
uint64_t m_totalWrittenSampsDO
 
uint64_t m_totalWrittenSampsAO
 

of samps written to DAQmx lib.


 
bool m_running
 
RingBuffer< tRawDO > m_patBufDO
 Buffer containing generated patterns for DO.
 
RingBuffer< tRawAOSetm_patBufAO
 Buffer containing generated patterns for AO.
 
shared_ptr< std::vector
< tRawAOSet > > 
m_genPulseWaveAO [PAT_QAM_MASK/PAT_QAM_PHASE]
 
tRawAOSet m_genAOZeroLevel
 
double m_coeffAODev [NUM_AO_CH][CAL_POLY_ORDER]
 
double m_upperLimAO [NUM_AO_CH]
 
double m_lowerLimAO [NUM_AO_CH]
 
shared_ptr< XThread
< XNIDAQmxPulser > > 
m_threadWriter
 
bool m_isThreadWriterReady
 
XRecursiveMutex m_stateLock
 
QueueTimeGenCnt m_queueTimeGenCnt
 pairs of real time and # of DO samps, which are identical if pausing feature is off.
 

Additional Inherited Members

- Public Types inherited from XPulser
enum  { N_MODE_NMR_PULSER = 0, N_MODE_PULSE_ANALYZER = 1 }
 driver specific part below More...
 
enum  { N_COMB_MODE_OFF = 0, N_COMB_MODE_ON = 1, N_COMB_MODE_P1_ALT = 2, N_COMB_MODE_COMB_ALT = 3 }
 
enum  { N_RT_MODE_FIXREP = 0, N_RT_MODE_FIXREST = 1 }
 
enum  { MAX_NUM_PHASE_CYCLE = 16 }
 
enum  { NUM_DO_PORTS = 16 }
 

of digital-pulse ports.


 
enum  {
  PAT_DO_MASK = (1 << NUM_DO_PORTS) - 1, PAT_QAM_PHASE = (1 << NUM_DO_PORTS), PAT_QAM_PHASE_MASK = PAT_QAM_PHASE * 3, PAT_QAM_PULSE_IDX = PAT_QAM_PHASE * 4,
  PAT_QAM_PULSE_IDX_P1 = PAT_QAM_PULSE_IDX * 1, PAT_QAM_PULSE_IDX_P2 = PAT_QAM_PULSE_IDX * 2, PAT_QAM_PULSE_IDX_PCOMB = PAT_QAM_PULSE_IDX * 3, PAT_QAM_PULSE_IDX_INDUCE_EMISSION = PAT_QAM_PULSE_IDX * 4,
  PAT_QAM_PULSE_IDX_MASK = PAT_QAM_PULSE_IDX * 15, PAT_QAM_MASK = PAT_QAM_PHASE_MASK | PAT_QAM_PULSE_IDX_MASK
}
 for RelPatList patterns. More...
 
- Static Public Member Functions inherited from XNode
template<class T__ >
static shared_ptr< T__ > createOrphan (const char *name)
 
template<class T__ , typename... Args_>
static shared_ptr< T__ > createOrphan (const char *name, bool runtime, Args_ &&...args)
 
- Protected Types inherited from XPulser
enum  {
  PORTSEL_UNSEL = -1, PORTSEL_GATE = 0, PORTSEL_PREGATE = 1, PORTSEL_GATE3 = 2,
  PORTSEL_TRIG1 = 3, PORTSEL_TRIG2 = 4, PORTSEL_ASW = 5, PORTSEL_QSW = 6,
  PORTSEL_PULSE1 = 7, PORTSEL_PULSE2 = 8, PORTSEL_COMB = 9, PORTSEL_COMB_FM = 10,
  PORTSEL_QPSK_A = 11, PORTSEL_QPSK_B = 12, PORTSEL_QPSK_OLD_NONINV = 13, PORTSEL_QPSK_OLD_INV = 14,
  PORTSEL_QPSK_OLD_PSGATE = 15, PORTSEL_PULSE_ANALYZER_GATE = 16
}
 indice for return values of portSel().
 
typedef FFT::twindowfunc tpulsefunc
 

Detailed Description

Definition at line 27 of file pulserdrivernidaqmx.h.

Member Function Documentation

template<bool UseAO>
bool XNIDAQmxPulser::fillBuffer ( )
inlineprivate
virtual bool XNIDAQmxPulser::hasQAMPorts ( ) const
protectedpure virtual
Returns
Existence of AO ports.

Implements XPulser.

Implemented in XNIDAQMSeriesWithSSeriesPulser, XNIDAQDOPulser, and XNIDAQAODOPulser.

Referenced by createNativePatterns().

virtual double XNIDAQmxPulser::minPulseWidth ( ) const
inlineprotectedvirtual
Returns
Minimum period of pulses [ms]

Implements XPulser.

Definition at line 76 of file pulserdrivernidaqmx.h.

References resolution().

ssize_t XNIDAQmxPulser::writeToDAQmxDO ( const tRawDO *  pDO,
ssize_t  samps 
)
private
Returns
Counts being sent.

Definition at line 846 of file pulserdrivernidaqmx.cpp.

Member Data Documentation

unsigned int XNIDAQmxPulser::m_genAOIndex
private

Preserved index for m_genPulseWaveAO[],.

See Also
fillBuffer().

Definition at line 100 of file pulserdrivernidaqmx.h.

Referenced by fillBuffer().

uint64_t XNIDAQmxPulser::m_genRestCount
private

indicates the remaining # of clocks to the next pattern change.

Definition at line 114 of file pulserdrivernidaqmx.h.

Referenced by fillBuffer().

uint64_t XNIDAQmxPulser::m_genTotalSamps
private

m_genTotalSamps is different from m_genTotalCount when pausing clocks are active.

During the pattern generation, total # of samplings that has been generated for DO buffered device.

Definition at line 117 of file pulserdrivernidaqmx.h.

Referenced by fillBuffer().

bool XNIDAQmxPulser::m_isThreadWriterReady
private

indicates DAQmx lib. has been (partially) filled with generated patterns.

Definition at line 191 of file pulserdrivernidaqmx.h.

unsigned int XNIDAQmxPulser::m_preFillSizeDO
private

Determines stating condition,.

See Also
m_isThreadWriterReady.

Definition at line 108 of file pulserdrivernidaqmx.h.


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

Generated for KAME4 by  doxygen 1.8.3