Instrument Control Lib
Framework to control Oscilloscopes, SMUs, Function Generators and DC Powersupplies via Ethernet.
KST3000.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include "types/Oscilloscope.h"
9 
10 namespace PIL {
11  class Logging;
12 }
13 
14 //#define DEVICE_NAME "Mixed Single Oscilloscope" TODO
15 
16 #define MEASURE_RET_BUFF_SIZE 1024
17 
18 
25 class KST3000 : public Oscilloscope
26 {
27 public:
28  explicit KST3000(const char *ip, int timeoutInMS);
29  KST3000(const char *ip, int timeoutInMs, PIL::Logging *logger);
30 
31  PIL_ERROR_CODE run() override;
32  PIL_ERROR_CODE stop() override;
33  PIL_ERROR_CODE single() override;
34  PIL_ERROR_CODE autoScale() override;
35 
36  PIL_ERROR_CODE setTimeRange(double value) override;
37  PIL_ERROR_CODE setChannelOffset(OSC_CHANNEL channel, double offset) override;
38  PIL_ERROR_CODE setChannelScale(OSC_CHANNEL channel, double value) override;
39  PIL_ERROR_CODE setChannelRange(OSC_CHANNEL channel, double value, VOLTAGE_UNIT voltageUnit) override; // TODO what is is_v?
40 
41  PIL_ERROR_CODE setTriggerEdge(TRIGGER_EDGE edge) override;
42  PIL_ERROR_CODE setTriggerSource(OSC_CHANNEL channel) override;
43 
44  PIL_ERROR_CODE setTimeDelay(double delay);
45 
46  PIL_ERROR_CODE setWaveformSource(OSC_CHANNEL channel);
47  PIL_ERROR_CODE getWaveformPreamble(std::string *result);
48  PIL_ERROR_CODE getWaveformPoints(int* nrWaveFormPoints);
49  PIL_ERROR_CODE setWaveformPoints(int num_points);
50  PIL_ERROR_CODE setWaveformPointsMode(std::string &mode);
51  PIL_ERROR_CODE setWaveformFormat(FILE_FORMAT format);
52  PIL_ERROR_CODE saveWaveformData(std::string &file_path); // TODO remove unnecessary default argument
53 
54  PIL_ERROR_CODE getWaveformData(std::string *data);
55  PIL_ERROR_CODE getRealData(double **result);
56  std::vector<std::vector<double>> getRealDataPy();
57  PIL_ERROR_CODE digitize(OSC_CHANNEL channel);
58 
59  PIL_ERROR_CODE getSystemSetup(std::string *result);
60  PIL_ERROR_CODE setDisplayMode(DISPLAY_MODES displayMode);
61  PIL_ERROR_CODE displayConnection();
62  PIL_ERROR_CODE setChannelDisplay(OSC_CHANNEL channel, int on);
63 
64  PIL_ERROR_CODE Exec2(const std::string &command, ExecArgs *args, std::string *result, bool br);
65 
66 private:
67  // Helper-functions
68  static std::string getTriggerEdgeStr(TRIGGER_EDGE edge) ;
69  std::string getChannelFromEnum(OSC_CHANNEL channel) ;
70  static std::string getDisplayModeFromEnum(DISPLAY_MODES displayMode);
71  static std::string getFileFormatStrFromEnum(FILE_FORMAT format);
72  PIL_ERROR_CODE writeToFile(const char *data, const std::string &file_path);
73 
74 };
PIL_ERROR_CODE delay(double delayTime)
Stops the execution for the specified amount of time in seconds. If buffering is enabled,...
Definition: Device.cpp:265
ExecArgs class is used to create execution arguments based on a parameter seperator value scheme....
Definition: ExecArgs.h:15
Mixed Single Oscilloscope(Oscillator) Commend operations of a single generator are defined....
Definition: KST3000.h:26
PIL_ERROR_CODE getSystemSetup(std::string *result)
get system setup
Definition: KST3000.cpp:573
PIL_ERROR_CODE setChannelOffset(OSC_CHANNEL channel, double offset) override
Set vertical offset. Equivalent to adjust the knob below channel number button.
Definition: KST3000.cpp:215
PIL_ERROR_CODE getWaveformPoints(int *nrWaveFormPoints)
Query the number of waveform points to be transferred.
Definition: KST3000.cpp:282
PIL_ERROR_CODE setChannelDisplay(OSC_CHANNEL channel, int on)
Show or hide channel display. Equivalent to press channel number button.
Definition: KST3000.cpp:232
PIL_ERROR_CODE setWaveformPointsMode(std::string &mode)
set waveform points mode
Definition: KST3000.cpp:311
PIL_ERROR_CODE setTriggerEdge(TRIGGER_EDGE edge) override
Set trigger slope.
Definition: KST3000.cpp:115
KST3000(const char *ip, int timeoutInMS)
Constructor.
Definition: KST3000.cpp:20
PIL_ERROR_CODE Exec2(const std::string &command, ExecArgs *args, std::string *result, bool br)
Definition: KST3000.cpp:32
PIL_ERROR_CODE getRealData(double **result)
convert a measurement data array to a 2d array: time array & voltage array
Definition: KST3000.cpp:406
PIL_ERROR_CODE stop() override
Stop to run. Equivalent to press the Run/Stop button when the device is not stopping.
Definition: KST3000.cpp:90
PIL_ERROR_CODE single() override
Equivalent to press the Single button.
Definition: KST3000.cpp:98
PIL_ERROR_CODE getWaveformPreamble(std::string *result)
Query the preamble of waveform data, e.g. WAVeform:PREamble?
Definition: KST3000.cpp:268
PIL_ERROR_CODE run() override
Start to run. Equivalent to press the Run/Stop button when the device is not running.
Definition: KST3000.cpp:82
PIL_ERROR_CODE setWaveformFormat(FILE_FORMAT format)
set format of waveform data(default "BYTE")
Definition: KST3000.cpp:335
PIL_ERROR_CODE setChannelRange(OSC_CHANNEL channel, double value, VOLTAGE_UNIT voltageUnit) override
Similar to setChannelScale, but set the whole voltage range.
Definition: KST3000.cpp:196
PIL_ERROR_CODE digitize(OSC_CHANNEL channel)
capture data
Definition: KST3000.cpp:565
PIL_ERROR_CODE displayConnection()
Display a line of text: Connected Successfully. Returning... The message will disappear after 2 secon...
Definition: KST3000.cpp:49
PIL_ERROR_CODE saveWaveformData(std::string &file_path)
save waveform data to the target file
Definition: KST3000.cpp:523
std::vector< std::vector< double > > getRealDataPy()
convert a measurement data array to a 2d array: time array & voltage array
Definition: KST3000.cpp:458
PIL_ERROR_CODE autoScale() override
Equivalent to press the "Auto Scale" button.
Definition: KST3000.cpp:106
PIL_ERROR_CODE getWaveformData(std::string *data)
get the sampled data points
Definition: KST3000.cpp:375
PIL_ERROR_CODE setTriggerSource(OSC_CHANNEL channel) override
Set trigger channel.
Definition: KST3000.cpp:130
PIL_ERROR_CODE setTimeDelay(double delay)
Set timebase(horizontal) delay; Equivalent to adjust the delay knob in Horizontal controls....
Definition: KST3000.cpp:160
PIL_ERROR_CODE setWaveformPoints(int num_points)
set number of waveform points
Definition: KST3000.cpp:323
PIL_ERROR_CODE setWaveformSource(OSC_CHANNEL channel)
set waveform source
Definition: KST3000.cpp:586
PIL_ERROR_CODE setDisplayMode(DISPLAY_MODES displayMode)
set timebase mode
Definition: KST3000.cpp:556
PIL_ERROR_CODE setTimeRange(double value) override
Set timebase(horizontal) range; Equivalent to adjust the "Horizontal" knob.
Definition: KST3000.cpp:145
PIL_ERROR_CODE setChannelScale(OSC_CHANNEL channel, double value) override
Equivalent to adjust the knob above channel numbers. e.g. CHANnel3:SCALe 5.
Definition: KST3000.cpp:176
Definition: Oscilloscope.h:11
OSC_CHANNEL
Definition: Oscilloscope.h:14
VOLTAGE_UNIT
Definition: Oscilloscope.h:39
TRIGGER_EDGE
Definition: Oscilloscope.h:19
FILE_FORMAT
Definition: Oscilloscope.h:33
DISPLAY_MODES
Definition: Oscilloscope.h:26
This class contains a implementation of a command line interface. It supports various functions like ...
Definition: CommandLineInterface.h:16