diff --git a/3.5.1-ne-plasma/latex.zip b/3.5.1-ne-plasma/latex.zip new file mode 100644 index 0000000..8c0533a Binary files /dev/null and b/3.5.1-ne-plasma/latex.zip differ diff --git a/3.5.1-ne-plasma/report.pdf b/3.5.1-ne-plasma/report.pdf index 0a00e2c..ca936cd 100644 Binary files a/3.5.1-ne-plasma/report.pdf and b/3.5.1-ne-plasma/report.pdf differ diff --git a/project/hardware/Device.hpp b/project/hardware/Device.hpp index de86b21..0caf7eb 100644 --- a/project/hardware/Device.hpp +++ b/project/hardware/Device.hpp @@ -13,10 +13,10 @@ public: return name; } -protected: void command(std::string comm); std::string query(std::string comm); +protected: std::string name; std::string root_path; }; diff --git a/project/hardware/Measurement.hpp b/project/hardware/Measurement.hpp new file mode 100644 index 0000000..5189d8c --- /dev/null +++ b/project/hardware/Measurement.hpp @@ -0,0 +1,28 @@ +#pragma once +#include +#include +#include "Oscilloscope.hpp" + +class Measurement +{ +public: + + Measurement() = default; + + Measurement(std::string name_) : name(name_) { } + + Measurement(std::string stat_response, bool) + { + size_t name_start = stat_response.find(" C") + 5; + size_t name_end = stat_response.find(":"); + name = stat_response.substr(name_start, name_end - name_start); + } + +// private: + std::string name; + double mean; + double min; + double max; + double std_dev; + double count; +}; \ No newline at end of file diff --git a/project/hardware/Oscilloscope.hpp b/project/hardware/Oscilloscope.hpp index 0ee2404..9c669c6 100644 --- a/project/hardware/Oscilloscope.hpp +++ b/project/hardware/Oscilloscope.hpp @@ -1,8 +1,61 @@ #pragma once #include "Device.hpp" +#include "Measurement.hpp" +#include +#include class Oscilloscope : public Device { public: - Oscilloscope(std::string path_name) : Device(path_name) {} + Oscilloscope(std::string path_name) : Device(path_name), m_channel("C1") {} + + void set_channel(size_t channel) + { + if (channel == 1 || channel == 2) + m_channel = "C" + std::to_string(channel); + else + std::cerr << "Invalid channel" << std::endl; + } + + Measurement get_pkpk() + { + comm_param_custom("PKPK"); + comm_param_stat(1); + + // size_t count = 0; + // while (count <= 20) + // { + // std::string response = quer_param_value("STAT1"); + // size_t count_ind = response.find("count,") + 5; + // std::string count_str = response.substr(count_ind); + // std::cerr << count_str; + // comm_param_stat(0); + + // count = std::stoi(count_str); + // } + std::string response = quer_param_value("STAT1"); + comm_param_stat(0); + + std::cout << response << std::endl; + return Measurement(response, 1); + } + + +private: + void comm_param_custom(std::string param) + { + command("PACU " + param + "," + m_channel); + } + + void comm_param_stat(bool condition) + { + command("PASTAT " + condition ? "ON" : "OFF"); + } + + std::string quer_param_value(std::string custom) + { + return query("PAVA? " + custom); + } + + std::string m_channel; }; \ No newline at end of file diff --git a/project/hardware/main.cpp b/project/hardware/main.cpp index 9a11227..9812c67 100644 --- a/project/hardware/main.cpp +++ b/project/hardware/main.cpp @@ -23,20 +23,14 @@ int main() { return EXIT_FAILURE; } } - + Generator generator(generator_path); Oscilloscope oscilloscope(oscilloscope_path); // work with devices - //generator.buzz(); - - std::string waveform; - std::cout << "Input waveform (SINE, SQUARE, RAMP, PULSE, NOISE, ARB, DC, PRBS, IQ):" << std::endl; - std::cin >> waveform; - - generator.set_waveform(waveform); + std::cout << oscilloscope.query("C1:WF? DAT2").substr(1, 3) << std::endl; return EXIT_SUCCESS; } diff --git a/project/hardware/osc.md b/project/hardware/osc.md new file mode 100644 index 0000000..5009c4b --- /dev/null +++ b/project/hardware/osc.md @@ -0,0 +1,13 @@ +## Channel commands + +TRA -- trace +VDIV -- vertical sensitivity + +## MEASURE commands + +PACU -- parameter custom +PAVA? -- parameter value + +## WAVEFORM commands + +#todo \ No newline at end of file diff --git a/project/materials/SDG_Programming-Guide_PG02-E04A.pdf b/project/materials/SDG_Programming-Guide_PG02-E04A.pdf new file mode 100644 index 0000000..76b246a Binary files /dev/null and b/project/materials/SDG_Programming-Guide_PG02-E04A.pdf differ diff --git a/project/materials/SDS1000-SeriesSDS2000XSDS2000X-E_ProgrammingGuide_PG01-E02D.pdf b/project/materials/SDS1000-SeriesSDS2000XSDS2000X-E_ProgrammingGuide_PG01-E02D.pdf new file mode 100644 index 0000000..86518a4 Binary files /dev/null and b/project/materials/SDS1000-SeriesSDS2000XSDS2000X-E_ProgrammingGuide_PG01-E02D.pdf differ