rohdeschwarz  0.2.0
TCPIP socket library for Rohde & Schwarz instrument control
main.cpp
Go to the documentation of this file.
1 
10 // RsVisa
11 #include "RsVisa/znx.hpp"
12 
13 
14 // std lib
15 #include <cassert>
16 #include <iostream>
17 
18 
19 void main()
20 {
21  // create a Znx object
22  // constructor loads VISA shared library
23  auto znx = RsVisa::Znx();
24 
25  // is VISA loaded?
26  assert(znx.isVisa());
27 
28  // connect to znx
29  znx.open("TCPIP::localhost::znx");
30 
31  // is znx connected?
32  assert(znx.isOpen());
33 
34  // start from instrument preset:
35  // - Channels: 1
36  // - Traces: Trc1
37  // - Diagrams: 1
38  znx.reset();
39 
40  // configure channel 1:
41  // sweep from 1 GHz to 2 GHz with 201 points
42  auto ch1 = znx.channel(1);
43  ch1.setStartFrequency(1e9);
44  ch1.setStopFrequency(2e9);
45  ch1.setPoints(201);
46 
47  // create trace Trc2
48  znx.createTrace("Trc2");
49 
50  // configure trace for |S11| in dB
51  auto trc2 = znx.trace("Trc2");
52  trc2.setParameter("S11");
53  trc2.setFormat("MLOG");
54 
55  // display Trc2 in diagram
56  trc2.setDiagram(1);
57 }
void main()
Definition: main.cpp:19