C++Instrument Catalog MFC 1.2
Metrolab C++InstrumentCatalog for MFC
Loading...
Searching...
No Matches
PT2026Types.h
Go to the documentation of this file.
1#pragma once
2
3// Standard includes
4#include <string>
5#include <vector>
6
7// Personnal includes
8#include "SCPIParsing.h"
9#include "OSDefines.h"
10
11namespace MTL {
12 namespace Instrument {
13 namespace PT2026Types {
14
15 //----------------------------------------------------------------------//
16 // Status //
17 //----------------------------------------------------------------------//
45 U16 RawSTB = 0;
46 struct sStatusByte {
47 // Contains a 1-byte status summary. The PT2026 uses the following bits:
48 U8 NA0_1 : 2; // Not Available
49 U8 EAV : 1; // Error Available in Error / Event Queue
50 U8 QSB : 1; // QUEStionable status summary bit
51 U8 MAV : 1; // Message Available
52 U8 ESB : 1; // Standard Event Status Register summary bit
53 U8 RQS : 1; // ReQuest for Service
54 U8 OSB : 1; // OPERation status summary bit
56 };
57
59 U8 RawSE = 0;
61 // Latches certain standardized events. The PT2026 uses the following bits:
62 U8 OperationComplete : 1; // *OPC has flagged operation complete
63 U8 NA1 : 1; // Not Available
64 U8 QueryError : 1; // Error in preceding query
65 U8 DeviceDependentError : 1; // Errors specific to the PT2026, including internal errors
66 U8 ExecutionError : 1; // Error detected during command execution
67 U8 CommandError : 1; // Error in preceding command
68 U8 UserRequest : 1; // A parameter has been changed
69 U8 PowerOn : 1; // PT2026 has been powered up
71 };
72
74 U16 RawQUES = 0;
76 // Indicates conditions that may reduce the quality of the measurement. The PT2026 sets the following bits:
77 U16 NA0_8 : 9; // Not Available
78 U16 UnableToMeasure : 1; // Unable to acquire and measure an NMR signal
79 U16 IgnoredSetting : 1; // A setting was set, but is not taken into account because of other settings
80 U16 Measurement : 1; // The quality of the measurement is questionable (e.g. Due to unknown IF in manual search mode)
81 U16 BIT12 : 1; // Summary Bit: DSP Status
82 U16 NA13_15 : 3; // Not Available
84 };
85
87 U16 RawQUES12 = 0;
89 // This is a fan-out for bit 12 of the QUEStionable register, a device-specific summary bit.
90 U16 ExternalRefDetected : 1; // External reference clock is detected
91 U16 ExternalRefLocked : 1; // Locked onto external reference clock
92 U16 BeatingDetected : 1; // Measurement was rejected as spurious signal (cf. :CONFigure:MEASure:REJect command)
93 U16 NA3_15 : 13; // Not Available
95 };
96
97 union uOPERation {
98 U16 RawOPER = 0;
99 struct sOPERation {
100 // Captures conditions which are part of the instrument s normal operation. The PT2026 uses the following bits:
101 U16 NA0_1 : 2; // Not Available
102 U16 RANGing : 1; // Scanning for available probes
103 U16 SWEeping : 1; // Searching for NMR signal
104 U16 MEASuring : 1; // Measuring magnetic field strength
105 U16 WaitingForTRIGger : 1; // Waiting for trigger
106 U16 NA6_7 : 2; // Not Available
107 U16 NewAcqAvail : 1; // New Acquisition Data is Available
108 U16 NewMeasAvail : 1; // New Measurement Available
109 U16 INITiated : 1; // Currently in the INITiated state
110 U16 BIT11 : 1; // BIT11 Summary Bit: A parameter has changed
111 U16 BIT12 : 1; // BIT12 Summary Bit: Acquisition status
112 U16 NA13_15 : 3; // Not Available
114 };
115
117 U16 RawOPER11 = 0;
119 // This is a fan-out for bit 11 of the OPERation register, a device-specific summary bit. It indicates subsystems whose configuration has changed.
120 U16 SYSTem : 1; // System: system ID, communications, lock
121 U16 STATus : 1; // Status: enable bits
122 U16 MEMory : 1; // Memory: parameter file loaded
123 U16 MMEMory : 1; // Mass memory: parameters saved, created, deleted
124 U16 CONFigure : 1; // Measurement: matching/tuning, search, tracking
125 U16 ROUTe : 1; // Route: channel selection
126 U16 INPut : 1; // Input: reference clock
127 U16 OUTput : 1; // Output: trigger output signal
128 U16 SENse : 1; // Sense: digitization
129 U16 SOURce : 1; // Source: pulse
130 U16 TRIGger : 1; // Trigger: measurement trigger, output trigger
131 U16 CALCulate : 1; // Calculate: signal & measurement averaging
132 U16 FORMat : 1; // Format: output format
133 U16 UNIT : 1; // Units: output units
134 U16 NAS14_15 : 2; // Not Available
136 };
137
139 U16 RawOPER12 = 0;
141 // This is a fan-out for bit 12 of the OPERation register, a device-specific summary bit.
142 U16 DSP_CPLDFatalError : 1; // Unable to use DSP and/or CPLD
143 U16 NA1_2 : 2; // Not Available
144 U16 AcquisitionOverrun : 1; // DSP s acquisition buffer is full
145 U16 TriggerOverrun : 1; // Trigger arrived before previous acquisition complete
146 U16 NMRPathBroken : 1; // Active probe was unplugged
147 U16 PeripheralPlugged : 1; // A peripheral was plugged into the PT2026
148 U16 RemoteBoxStart : 1; // Start button of the remote box has been pressed
149 U16 NA8_15 : 8; // Not Available
151 };
152
153 //----------------------------------------------------------------------//
154 // Units //
155 //----------------------------------------------------------------------//
156 enum class eUnits {
158 };
159
160 //----------------------------------------------------------------------//
161 // Errors //
162 //----------------------------------------------------------------------//
163 struct sError {
164 I32 Code;
165 std::string Description;
166 std::string Context;
167
168 explicit operator bool() const
169 { return Code != 0; }
170 };
171
172 //----------------------------------------------------------------------//
173 // Parameters //
174 //----------------------------------------------------------------------//
175 //------------------------------------------//
176 // Generic
177 template <class DataType>
179 {
180 DataType Val; // Current value
181 DataType Min; // Low bound
182 DataType Max; // High bound
183 DataType Def; // Default value
184 };
185 template <class DataType>
186 using uParm = DataType;
187
188 template <template<class> class ParmType>
189 struct sExample
190 {
192 ParmType<F64> ExampleF64;
193 ParmType<F32> ExampleF32;
194 };
195 // Declare as: sExample<uParm> or sExample<sBoundedParm>
196
197 //------------------------------------------//
198 // Averaging
204 template <template<class> class ParmType>
209
216 template <template<class> class ParmType>
221
222 //------------------------------------------//
223 // Digitization
228 template <template<class> class ParmType>
231 ParmType<F64> DeadTime_s;
232 ParmType<F64> SweepTime_s;
233 ParmType<F64> Rate_Hz;
236 };
237
238 //------------------------------------------//
239 // Input Trigger
251 template <template<class> class ParmType>
254 ParmType<F64> Period_s; // If source is Timer
255 eInputTriggerEdge Edge; // If source is External
256 ParmType<U8> Count;
257 };
258
259 //------------------------------------------//
260 // Output Trigger
269 template <template<class> class ParmType>
279
280 //------------------------------------------//
281 // Measure
282 enum class eMeasureMode {
285 };
286 template <template<class> class ParmType>
287 struct sTracking {
288 ParmType<F64> MinIF_Hz;
289 ParmType<F64> MaxIF_Hz;
290 ParmType<U32> AllowedMissMeas;
291 };
292 template <template<class> class ParmType>
304
305 //------------------------------------------//
306 // Matching-Tuning
311 template <template<class> class ParmType>
319
320 //------------------------------------------//
321 // Pulse
322 enum class ePulseMode {
325 };
326 template <template<class> class ParmType>
327 struct sPulse {
329 ParmType<F64> Period_s;
330 ParmType<F64> Width_s;
333 };
334
335 //------------------------------------------//
336 // Search
337 enum class eSearchMode {
340 };
341 template <template<class> class ParmType>
342 struct sSearch {
343 bool Enable;
344 ParmType<F64> ManualValue_UNITS;
346 ParmType<F64> FrequencyStep_Hz;
347 ParmType<F64> LowLimit_UNITS;
348 ParmType<F64> HighLimit_UNITS;
350 : Enable(true), Mode(eSearchMode::kAuto) {}
351 };
352
353 //------------------------------------------//
354 // Reference
356
357 //------------------------------------------//
358 // Clock
363
364 //------------------------------------------//
365 // Format
370
371 //------------------------------------------//
372 // Ethernet
374 U8 Address[4];
375 struct {
376 U8 A;
377 U8 B;
378 U8 C;
379 U8 D;
381 };
393 //------------------------------------------//
394 // Modbus
395 struct sModbus {
397 std::vector<std::string> Hosts;
400 };
401 //------------------------------------------//
402 // Channels
403 typedef U32 tModel;
404 typedef U32 tSerialNumber;
405 enum class ePeriphObjectType // Type as presented by PT2026 through SCPI
406 {
407 kPwProbe = 0, // Pulsed probe
408 kPwCamera = 1, // Pulsed camera
409 kPwCameraHead = 2, // Pulsed camera head
410 kPwMultiplexer = 3, // Pulsed probe multiplexer
411 kPwFCA = 4, // Pulsed camera adapter
413 };
414 static const char* PeriphObjectTypeStr[] =
415 {
416 "kPwProbe",
417 "kPwCamera",
418 "kPwCameraHead",
419 "kPwMultiplexer",
420 "kPwFCA"
421 };
429
433
434 inline bool operator==(const sExtendedChannel & other)
435 {
436 return ( Channel == other.Channel &&
437 Type == other.Type &&
438 Model == other.Model &&
439 SerialNumber == other.SerialNumber &&
440 NoPorts == other.NoPorts &&
441 CanMeasure == other.CanMeasure);
442 }
443 inline bool operator!=(const sExtendedChannel & other)
444 {
445 return !(*this == other);
446 }
447 void clear(void)
448 {
449 Channel.clear();
451 Model = 0;
452 SerialNumber = 0;
453 NoPorts = 0;
454 CanMeasure = false;
455 }
456 };
457 class CExtendedChannelList : public std::vector<sExtendedChannel>
458 {
459 public:
460 inline bool operator==(CExtendedChannelList & other)
461 {
462 if (size() != other.size())
463 return false;
464 for (CExtendedChannelList::iterator it = begin(), otherit = other.begin(); it != end(); it++, otherit++)
465 {
466 if (*it != *otherit)
467 return false;
468 }
469 return true;
470 }
471 inline bool operator!=(CExtendedChannelList & other)
472 {
473 return !(*this == other);
474 }
475 };
476 //------------------------------------------//
477 // Channel Information
478 typedef F64 tProbeLimit_UNITS;
479 typedef U16 tFirmwareVersion;
488 //------------------------------------------//
489 // Hall
490 struct sProbeHall {
491 F64 B;
492 F64 Bx;
493 F64 By;
494 F64 Bz;
495 void clear()
496 {
497 B = 0;
498 Bx = 0;
499 By = 0;
500 Bz = 0;
501 }
502 };
504 U16 Bx;
505 U16 By;
506 U16 Bz;
507 U16 T;
508 void clear()
509 {
510 Bx = 0;
511 By = 0;
512 Bz = 0;
513 T = 0;
514 }
515 };
516 //------------------------------------------//
517 // Remote Busy LED modes
519 kOff = 0, // Busy LED is always Off
520 kOnWhenMeasuring = 1, // Busy LED is On when measuring, Off otherwise
521 kClearsAfterMeasurement = 2, // Busy LED in immediately On, and clears after measurement
522 kOn = 3, // Busy LED is always On
523 kBlinkSlow = 4, // Busy LED blinks at a slow rate
524 kBlinkFast = 5 // Busy LED blinks at a fast rate
525 };
526 const U8 MAX_BUSY_LED_MODE = static_cast<std::underlying_type<eRemoteBusyLEDmode>::type>(eRemoteBusyLEDmode::kBlinkFast);
527
528 //------------------------------------------//
529 // Files
530 struct sFile {
531 std::string Path;
532 std::string Type;
533 size_t Size;
534 };
535 typedef std::vector<sFile> tFileList;
544
545 //------------------------------------------//
546 // Search (Legacy FW <= 1.22)
552 template <template<class> class ParmType>
555 ParmType<F64> DetectionLevel_V;
556 ParmType<F64> FrequencyStep_Hz;
557 ParmType<F64> ManualValue_UNITS;
558 ParmType<F64> LowLimit_UNITS;
559 ParmType<F64> HighLimit_UNITS;
560 };
561
562 //----------------------------------------------------------------------//
563 // Measurements //
564 //----------------------------------------------------------------------//
565 //------------------------------------------//
566 // NMR
567 typedef F64 tFlux;
570 struct sMeasStatus {
571 U8 Questionable : 1; // Measurement is questionable
572 U8 NA1_7 : 7; // Not Available
574 };
583 void clear()
584 {
585 Flux_UNITS = DPqNaN;
586 Deviation_ppm = SPqNaN;
587 Uniformity = SPqNaN;
588 Channel.clear();
589 Timestamp = 0;
590 Status = { 0 };
591 NbValidMeas = 0;
592 }
593 };
595 std::vector<sBasicMeasurement> Basic;
599 void clear()
600 {
601 Basic.clear();
603 RelaxationTime_s = SPqNaN;
604 RadioFrequency_Hz = DPqNaN;
605 }
606 };
607 struct sNMRSignal {
609 std::vector<F32> Samples_V;
610 void clear()
611 {
612 SamplePeriod_s = SPqNaN;
613 Samples_V.clear();
614 }
615 };
616 struct sFFTBuffer {
618 std::vector<F32> Samples_V;
619 void clear()
620 {
621 FrequencyResolution_Hz = SPqNaN;
622 Samples_V.clear();
623 }
624 };
625 struct sSpectrum {
628 std::vector<F32> Samples_V;
629 void clear()
630 {
631 CenterFrequency_Hz = SPqNaN;
632 FrequencyResolution_Hz = SPqNaN;
633 Samples_V.clear();
634 }
635 };
636 struct sFitPolynom {
638 std::vector<F32> Coeffs;
639 void clear()
640 {
641 Residue = SPqNaN;
642 Coeffs.clear();
643 }
644 };
646 bool Flux = false;
647 bool Deviation = false;
648 bool Uniformity = false;
649 bool Channel = false;
650 bool Timestamp = false;
651 bool Status = false;
652 bool NbValidMeas = false;
653 bool IF = false;
654 bool RelaxationTime = false;
655 bool RadioFrequency = false;
660 };
682
683 //------------------------------------------//
684 // Hall
686 F64 B;
687 F64 Bx;
688 F64 By;
689 F64 Bz;
690 };
691
692 //------------------------------------------//
693 // Normalization
694 typedef F32 tNormalizationFactor_Hz; // [Hz]
695 typedef std::vector<tNormalizationFactor_Hz> tNormalizationTable;
696
697
698 } // namespace PT2026Types
699 } // namespace Instrument
700} // namespace MTL
Utilities to aid in sending SCPI commands and parsing of SCPI reponses.
Platform Dependent Definitions.
std::vector< tNormalizationFactor_Hz > tNormalizationTable
std::vector< sFile > tFileList
std::vector< unsigned char > tChannel
SCPI channel
Definition SCPIParsing.h:25
sStatusRegister(eStatusRegisterSet S, eStatusRegisterType T)
Definition PT2026Types.h:37
struct MTL::Instrument::PT2026Types::uStatusByte::sStatusByte StatusByte
struct MTL::Instrument::PT2026Types::uStandardEvent::sStandardEvent StandardEvent
struct MTL::Instrument::PT2026Types::uQUEStionable::sQUEStionable QUEStionable
struct MTL::Instrument::PT2026Types::uQUEStionableBIT12::sQUEStionableBIT12 QUEStionableBIT12
struct MTL::Instrument::PT2026Types::uOPERation::sOPERation OPERation
struct MTL::Instrument::PT2026Types::uOPERationBIT11::sOPERationBIT11 OPERationBIT11
struct MTL::Instrument::PT2026Types::uOPERationBIT12::sOPERationBIT12 OPERationBIT12
struct MTL::Instrument::PT2026Types::uIPAddress::@225307205161251105272037335060220031277103233250 Member
std::vector< std::string > Hosts
bool operator==(const sExtendedChannel &other)
bool operator!=(const sExtendedChannel &other)
bool operator==(CExtendedChannelList &other)
bool operator!=(CExtendedChannelList &other)
sChannelIformation(tModel Mod, tSerialNumber Ser, std::string Des, tFirmwareVersion FWV)
struct MTL::Instrument::PT2026Types::uMeasStatus::sMeasStatus StatusBits