18 #include "primarydriver.h"
19 #include "xitemnode.h"
20 #include "xnodeconnector.h"
27 class Ui_FrmPulserMore;
35 XPulser(
const char *name,
bool runtime,
36 Transaction &tr_meas,
const shared_ptr<XMeasure> &meas);
45 enum {N_MODE_NMR_PULSER = 0, N_MODE_PULSE_ANALYZER = 1};
47 enum {N_COMB_MODE_OFF = 0, N_COMB_MODE_ON = 1, N_COMB_MODE_P1_ALT = 2, N_COMB_MODE_COMB_ALT = 3};
49 enum {N_RT_MODE_FIXREP = 0, N_RT_MODE_FIXREST = 1};
51 enum {MAX_NUM_PHASE_CYCLE = 16};
53 enum {NUM_DO_PORTS= 16};
55 enum {PAT_DO_MASK = (1 << NUM_DO_PORTS) - 1,
56 PAT_QAM_PHASE = (1 << NUM_DO_PORTS),
57 PAT_QAM_PHASE_MASK = PAT_QAM_PHASE * 3,
58 PAT_QAM_PULSE_IDX = PAT_QAM_PHASE * 4,
59 PAT_QAM_PULSE_IDX_P1 = PAT_QAM_PULSE_IDX * 1,
60 PAT_QAM_PULSE_IDX_P2 = PAT_QAM_PULSE_IDX * 2,
61 PAT_QAM_PULSE_IDX_PCOMB = PAT_QAM_PULSE_IDX * 3,
62 PAT_QAM_PULSE_IDX_INDUCE_EMISSION = PAT_QAM_PULSE_IDX * 4,
63 PAT_QAM_PULSE_IDX_MASK = PAT_QAM_PULSE_IDX * 15,
64 PAT_QAM_MASK = PAT_QAM_PHASE_MASK | PAT_QAM_PULSE_IDX_MASK,
70 double rtime()
const {
return m_rtime;}
71 double tau()
const {
return m_tau;}
72 double pw1()
const {
return m_pw1;}
73 double pw2()
const {
return m_pw2;}
74 double combP1()
const {
return m_combP1;}
75 double altSep()
const {
return m_altSep;}
76 double combP1Alt()
const {
return m_combP1Alt;}
77 double aswSetup()
const {
return m_aswSetup;}
78 double aswHold()
const {
return m_aswHold;}
80 double difFreq()
const {
return m_difFreq;}
81 double combPW()
const {
return m_combPW;}
82 double combPT()
const {
return m_combPT;}
83 uint16_t echoNum()
const {
return m_echoNum;}
84 uint16_t combNum()
const {
return m_combNum;}
85 int16_t rtMode()
const {
return m_rtMode;}
86 uint16_t numPhaseCycle()
const {
return m_numPhaseCycle;}
90 int16_t
p1Func()
const {
return m_p1Func;}
91 int16_t p2Func()
const {
return m_p2Func;}
92 int16_t combFunc()
const {
return m_combFunc;}
93 double p1Level()
const {
return m_p1Level;}
94 double p2Level()
const {
return m_p2Level;}
95 double combLevel()
const {
return m_combLevel;}
96 double masterLevel()
const {
return m_masterLevel;}
97 double combOffRes()
const {
return m_combOffRes;}
98 bool conserveStEPhase()
const {
return m_conserveStEPhase;}
100 bool isPulseAnalyzerMode()
const {
return m_paPulseBW > 0;}
101 double paPulseRept()
const {
return m_rtime;}
102 double paPulseBW()
const {
return m_paPulseBW;}
103 double paPulseOrigin()
const {
return m_paPulseOrigin;}
106 double periodicTerm()
const;
109 RelPat(uint32_t pat, uint64_t t, uint64_t toapp) :
110 pattern(pat), time(t), toappear(toapp) {}
116 typedef std::deque<RelPat> RelPatList;
117 RelPatList &relPatList() {
return m_relPatList;}
118 const RelPatList &relPatList()
const {
return m_relPatList;}
120 const std::vector<std::complex<double> > &qamWaveForm(
unsigned int idx)
const {
121 return m_qamWaveForm[idx];
128 int16_t m_pulserMode;
152 bool m_conserveStEPhase;
160 std::vector<std::complex<double> >
161 m_qamWaveForm[XPulser::PAT_QAM_PULSE_IDX_MASK / XPulser::PAT_QAM_PULSE_IDX];
164 const shared_ptr<XBoolNode> &output()
const {
return m_output;}
170 const shared_ptr<XDoubleNode> &
rtime()
const {
return m_rt;}
171 const shared_ptr<XDoubleNode> &
tau()
const {
return m_tau;}
172 const shared_ptr<XDoubleNode> &
combPW()
const {
return m_combPW;}
173 const shared_ptr<XDoubleNode> &
pw1()
const {
return m_pw1;}
174 const shared_ptr<XDoubleNode> &
pw2()
const {
return m_pw2;}
176 const shared_ptr<XDoubleNode> &
combP1()
const {
return m_combP1;}
187 const shared_ptr<XComboNode> &
p1Func()
const {
return m_p1Func;}
188 const shared_ptr<XComboNode> &
p2Func()
const {
return m_p2Func;}
190 const shared_ptr<XDoubleNode> &
p1Level()
const {
return m_p1Level;}
191 const shared_ptr<XDoubleNode> &
p2Level()
const {
return m_p2Level;}
193 const shared_ptr<XBoolNode> &induceEmission()
const {
return m_induceEmission;}
194 const shared_ptr<XDoubleNode> &induceEmissionPhase()
const {
return m_induceEmissionPhase;}
195 const shared_ptr<XDoubleNode> &qamOffset1()
const {
return m_qamOffset1;}
197 const shared_ptr<XDoubleNode> &qamLevel1()
const {
return m_qamLevel1;}
198 const shared_ptr<XDoubleNode> &
qamLevel2()
const {
return m_qamLevel2;}
199 const shared_ptr<XDoubleNode> &qamDelay1()
const {
return m_qamDelay1;}
202 const shared_ptr<XDoubleNode> &
qswDelay()
const {
return m_qswDelay;}
203 const shared_ptr<XDoubleNode> &
qswWidth()
const {
return m_qswWidth;}
204 const shared_ptr<XDoubleNode> &
qswSoftSWOff()
const {
return m_qswSoftSWOff;}
206 const shared_ptr<XBoolNode> &invertPhase()
const {
return m_invertPhase;}
207 const shared_ptr<XBoolNode> &conserveStEPhase()
const {
return m_conserveStEPhase;}
208 const shared_ptr<XComboNode> &portSel(
unsigned int port)
const {
209 assert(port < NUM_DO_PORTS);
210 return m_portSel[port];
212 const shared_ptr<XBoolNode> &pulseAnalyzerMode()
const {
return m_pulseAnalyzerMode;}
213 const shared_ptr<XDoubleNode> &paPulseRept()
const {
return m_paPulseRept;}
214 const shared_ptr<XDoubleNode> &paPulseBW()
const {
return m_paPulseBW;}
221 enum {PORTSEL_UNSEL = -1,
222 PORTSEL_GATE = 0, PORTSEL_PREGATE = 1, PORTSEL_GATE3 = 2,
223 PORTSEL_TRIG1 = 3, PORTSEL_TRIG2 = 4, PORTSEL_ASW = 5, PORTSEL_QSW = 6,
224 PORTSEL_PULSE1 = 7, PORTSEL_PULSE2 = 8,
225 PORTSEL_COMB = 9, PORTSEL_COMB_FM = 10,
226 PORTSEL_QPSK_A = 11, PORTSEL_QPSK_B = 12,
227 PORTSEL_QPSK_OLD_NONINV = 13, PORTSEL_QPSK_OLD_INV = 14,
228 PORTSEL_QPSK_OLD_PSGATE = 15,
229 PORTSEL_PULSE_ANALYZER_GATE = 16,
236 virtual void start();
249 typedef FFT::twindowfunc tpulsefunc;
250 tpulsefunc pulseFunc(
int func_no)
const;
251 int pulseFuncNo(
const XString &str)
const;
257 virtual double resolutionQAM()
const = 0;
263 const shared_ptr<XBoolNode> m_output;
268 const shared_ptr<XDoubleNode>
m_rt;
269 const shared_ptr<XDoubleNode>
m_tau;
270 const shared_ptr<XDoubleNode> m_combPW, m_pw1,
m_pw2;
285 const shared_ptr<XDoubleNode> m_qamOffset1;
287 const shared_ptr<XDoubleNode> m_qamLevel1;
288 const shared_ptr<XDoubleNode> m_qamLevel2;
289 const shared_ptr<XDoubleNode> m_qamDelay1;
292 const shared_ptr<XBoolNode> m_induceEmission;
293 const shared_ptr<XDoubleNode> m_induceEmissionPhase;
294 const shared_ptr<XDoubleNode> m_qswDelay;
295 const shared_ptr<XDoubleNode> m_qswWidth;
296 const shared_ptr<XDoubleNode> m_qswSoftSWOff;
297 const shared_ptr<XBoolNode> m_invertPhase;
298 const shared_ptr<XBoolNode> m_conserveStEPhase;
299 const shared_ptr<XBoolNode> m_qswPiPulseOnly;
300 shared_ptr<XComboNode> m_portSel[NUM_DO_PORTS];
301 const shared_ptr<XBoolNode> m_pulseAnalyzerMode;
306 const shared_ptr<XTouchableNode> m_moreConfigShow;
307 std::deque<xqcon_ptr> m_conUIs;
308 shared_ptr<XListener> m_lsnOnPulseChanged;
309 shared_ptr<XListener> m_lsnOnMoreConfigShow;
327 double pw,
unsigned int to_center,
328 tpulsefunc func,
double dB,
double freq = 0.0,
double phase = 0.0);
332 inline double rintTermMicroSec(
double usec)
const;
333 inline uint64_t ceilSampsMicroSec(
double us)
const;
334 inline uint64_t rintSampsMicroSec(
double us)
const;
335 inline uint64_t rintSampsMilliSec(
double ms)
const;
337 void changeUIStatus(
bool nmrmode,
bool state);
343 return rint(msec / res) * res;
346 XPulser::rintTermMicroSec(
double usec)
const {
348 return rint(usec / res) * res;
351 XPulser::ceilSampsMicroSec(
double usec)
const {
353 return llrint(usec / res + 0.499);
356 XPulser::rintSampsMicroSec(
double usec)
const {
358 return llrint(usec / res);
361 XPulser::rintSampsMilliSec(
double msec)
const {
363 return llrint(msec / res);