SEPIA
Software documentation for the APEX SEPIA receivers
localoscillator.h
Go to the documentation of this file.
1 /* Copyright 2017 Michael Olberg <michael.olberg@chalmers.se> */
2 #ifndef LOCALOSCILLATOR_H
3 #define LOCALOSCILLATOR_H
4 
5 #include <QWidget>
6 #include <QDoubleSpinBox>
7 #include <QComboBox>
8 #include <QPushButton>
9 #include <QLabel>
10 #include <QString>
11 #include <QVariant>
12 
13 #include "led.h"
14 #include "propertycontrol.h"
15 #include "mixer.h"
16 #include "../property.h"
17 
26 class LocalOscillator : public QWidget
27 {
28  Q_OBJECT
29  Q_PROPERTY(double frequency READ frequency WRITE setFrequency)
30  Q_PROPERTY(double IFrequency READ IFrequency WRITE setIFrequency)
31  Q_PROPERTY(QString sideband READ sideband WRITE setSideband)
32  Q_PROPERTY(bool tuned READ isTuned WRITE setTuned)
33  Q_PROPERTY(bool modified READ isModified WRITE setModified)
34  Q_PROPERTY(bool expertMode READ expertMode WRITE setExpertMode)
35 
36  public:
42  enum Sideband {
43  DSB = 0,
44  LSB = 1,
45  USB = 2
46  };
47  Q_ENUM(Sideband)
48 
49 
52  enum Polarity {
53  NEGATIVE = 400,
54  POSITIVE = 401
55  };
56 
57  explicit LocalOscillator(QWidget *parent = 0);
58 
63  double frequency() const;
64  double IFrequency() const { return m_ifreq; }
65 
71  double skyFrequency(bool cmd = true) const;
72 
78  Sideband SB(bool cmd = true) const;
79 
85  double refFrequency(bool cmd = true) const;
86 
91  QString sideband() const;
92 
97  bool isTuned() const { return m_tuned; }
98 
103  bool isModified() const { return m_modified; }
104 
109  double lowerLimit() const { return m_range[0]; }
110 
115  double upperLimit() const { return m_range[1]; }
116 
117  bool expertMode() const { return m_expert; }
118  bool isTuning() const { return m_tuning; }
119 
120  public slots:
125  void reset();
126 
136  void setFrequency(double ghz);
137  void setIFrequency(double ghz) { m_ifreq = ghz; }
138 
148  void setSkyFrequency(double GHz);
149 
157 
158  void setHarmonic(int n);
159 
164  void setSideband(const QString &sb);
165 
170  void setSynthGHz(double GHz);
171 
176  void setSynthdBm(double dbm);
177 
178  // void switchToSideband(Sideband sb);
179 
180  void synthConnected(bool state) { synthLED->setState(state); }
181 
182  void switchSynth(bool on);
183 
189  void setRange(double lower, double upper);
190 
195  void setModified(bool flag) { m_modified = flag; }
196 
197  // void changeProperty(const QString &name, const QVariant &value);
198 
205  void tune();
206 
217  void setTuned(bool flag);
218  void setExpertMode(bool flag);
219 
220  void setPaDrainVoltage(Mixer::Polarization pol, float mV);
221  void updatePaDrainVoltage(Mixer::Polarization pol, float mV);
222 
223  signals:
224  void LOtuning(double GHz);
225  void newCmdLOfrequency(double GHz);
226 
227  private slots:
228  void changeLO(double ghz);
229  void changeSynthGHz(double ghz);
230  void changeSynthdBm(double dbm);
231  void updateSidebands();
232  void changeSideband(int index);
233  void showProperties();
234 
235  private:
236  Property<double> fSky;
238  Property<double> fSynth;
239  Property<float> att;
240 
241  QLabel *usbFreq;
242  QLabel *lsbFreq;
243 
244  PropertyControl *LOFreqCtrl;
245  QComboBox *cmdSideband;
246  QLabel *harmonic;
247  QLabel *synthFreq;
248  QLabel *synthLevel;
249  LED *synthLED;
250 
251  QLabel *paAcmd;
252  QLabel *paBcmd;
253 
254  Property<float> m_paa;
255  Property<float> m_pab;
256  int m_harmonic;
257  double m_range[2];
258  double m_ifreq;
259  bool m_tuning;
260  bool m_tuned;
261  bool m_modified;
262  bool m_expert;
263 };
264 
265 #endif // LOCALOSCILLATOR_H
Sideband SB(bool cmd=true) const
Query the sideband.
Definition: localoscillator.cpp:217
void setFrequency(double ghz)
Setter function for commanded LO frequency.
Definition: localoscillator.cpp:172
void setSideband(const QString &sb)
Set a new commanded sideband given as string.
Definition: localoscillator.cpp:251
void setSkyFrequency(double GHz)
Set a new commanded sky frequency.
Definition: localoscillator.cpp:192
A class to represent the local oscillator in the GUI.
Definition: localoscillator.h:26
void setSB(LocalOscillator::Sideband sb)
Set a new commanded sideband.
Definition: localoscillator.cpp:232
double frequency() const
Getter function for commanded LO frequency.
Polarization
An enumeration for the two polarizations.
Definition: constants.h:9
void tune()
Trigger LO tuning.
Definition: localoscillator.cpp:328
double refFrequency(bool cmd=true) const
Query the reference (i.e. synthesizer) frequency.
Definition: localoscillator.cpp:211
QString sideband() const
Get sideband information as a string.
positive polarity
Definition: localoscillator.h:54
void setTuned(bool flag)
Update actual values based on success of tuning.
Definition: localoscillator.cpp:336
double lowerLimit() const
Query the lower limit of the LO tuning range.
Definition: localoscillator.h:109
double skyFrequency(bool cmd=true) const
Query the sky frequency.
Definition: localoscillator.cpp:166
Polarity
This enum specifies possible polarities.
Definition: localoscillator.h:52
bool isTuned() const
Query if LO is tuned.
Definition: localoscillator.h:97
void setModified(bool flag)
Setter function for the modified flag.
Definition: localoscillator.h:195
negative polarity
Definition: localoscillator.h:53
double upperLimit() const
Query the upper limit of the LO tuning range.
Definition: localoscillator.h:115
lower side band
Definition: localoscillator.h:44
Sideband
This enum specifies the various sideband configurations.
Definition: localoscillator.h:42
void setRange(double lower, double upper)
Specify tuning range of LO.
Definition: localoscillator.cpp:354
bool isModified() const
Query if commanded frequency requires re-tuning.
Definition: localoscillator.h:103
void setSynthdBm(double dbm)
Set the commanded synthesizer signal strength.
Definition: localoscillator.cpp:262
upper side band
Definition: localoscillator.h:45
void reset()
reset the widget after a band de-selection
Definition: localoscillator.cpp:400
void setSynthGHz(double GHz)
Set the commanded synthesizer frequency.
Definition: localoscillator.cpp:257
double side band
Definition: localoscillator.h:43