mirror of
				https://github.com/galera951/experiment-automation.git
				synced 2025-10-31 07:27:54 +03:00 
			
		
		
		
	rework 3.5.1
This commit is contained in:
		
							parent
							
								
									49730eee05
								
							
						
					
					
						commit
						59cc284466
					
				
							
								
								
									
										
											BIN
										
									
								
								3.5.1-ne-plasma/latex.zip
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								3.5.1-ne-plasma/latex.zip
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -13,10 +13,10 @@ public: | |||||||
| 		return name; | 		return name; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| protected: |  | ||||||
| 	void command(std::string comm); | 	void command(std::string comm); | ||||||
| 	std::string query(std::string comm); | 	std::string query(std::string comm); | ||||||
| 
 | 
 | ||||||
|  | protected: | ||||||
| 	std::string name; | 	std::string name; | ||||||
| 	std::string root_path; | 	std::string root_path; | ||||||
| }; | }; | ||||||
|  | |||||||
							
								
								
									
										28
									
								
								project/hardware/Measurement.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								project/hardware/Measurement.hpp
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,28 @@ | |||||||
|  | #pragma once | ||||||
|  | #include <iostream> | ||||||
|  | #include <string> | ||||||
|  | #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; | ||||||
|  | }; | ||||||
| @ -1,8 +1,61 @@ | |||||||
| #pragma once | #pragma once | ||||||
| #include "Device.hpp" | #include "Device.hpp" | ||||||
|  | #include "Measurement.hpp" | ||||||
|  | #include <string> | ||||||
|  | #include <unistd.h> | ||||||
| 
 | 
 | ||||||
| class Oscilloscope : public Device | class Oscilloscope : public Device | ||||||
| { | { | ||||||
| public: | 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; | ||||||
| }; | }; | ||||||
| @ -30,13 +30,7 @@ int main() { | |||||||
| 
 | 
 | ||||||
| 	// work with devices
 | 	// work with devices
 | ||||||
| 	 | 	 | ||||||
| 	//generator.buzz();
 | 	std::cout << oscilloscope.query("C1:WF? DAT2").substr(1, 3) << std::endl; | ||||||
| 
 |  | ||||||
| 	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); |  | ||||||
| 	 | 	 | ||||||
| 	return EXIT_SUCCESS; | 	return EXIT_SUCCESS; | ||||||
| } | } | ||||||
|  | |||||||
							
								
								
									
										13
									
								
								project/hardware/osc.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								project/hardware/osc.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | |||||||
|  | ## Channel commands | ||||||
|  | 
 | ||||||
|  | TRA -- trace | ||||||
|  | VDIV -- vertical sensitivity | ||||||
|  | 
 | ||||||
|  | ## MEASURE commands | ||||||
|  | 
 | ||||||
|  | PACU -- parameter custom | ||||||
|  | PAVA? -- parameter value | ||||||
|  | 
 | ||||||
|  | ## WAVEFORM commands | ||||||
|  | 
 | ||||||
|  | #todo | ||||||
							
								
								
									
										
											BIN
										
									
								
								project/materials/SDG_Programming-Guide_PG02-E04A.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								project/materials/SDG_Programming-Guide_PG02-E04A.pdf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user