8 #include <QScriptEngine> 9 #include <QScriptContext> 10 #include <QScriptValue> 15 class PLL :
public QObject,
public QScriptable
18 Q_PROPERTY(
double corrVoltage READ corrVoltage)
19 Q_PROPERTY(
double lockVoltage READ lockVoltage)
20 Q_PROPERTY(
double referencePower READ refTotalPower)
21 Q_PROPERTY(
double ifPower READ ifTotalPower)
22 Q_PROPERTY(
double assemblyTemperature READ assemblyTemperature)
23 Q_PROPERTY(
bool locked READ locked);
26 explicit PLL(Channel *parent = 0);
27 void setCartridge(
Cartridge *band) { m_cart = band; }
28 Cartridge *cartridge()
const {
return m_cart; }
29 Q_INVOKABLE
double corrVoltage();
30 Q_INVOKABLE
double lockVoltage();
31 Q_INVOKABLE
double refTotalPower();
32 Q_INVOKABLE
double ifTotalPower();
33 Q_INVOKABLE
double assemblyTemperature();
34 Q_INVOKABLE
bool locked()
const;
37 void setPllLoopBandwidth(
bool flag);
38 void setNullPllIntegrator(
bool flag);
39 void setPllSideband(
bool lower);
48 class Multiplier :
public QObject,
public QScriptable
53 explicit Multiplier(Channel *parent = 0);
54 void setCartridge(
Cartridge *band) { m_cart = band; }
55 Cartridge *cartridge()
const {
return m_cart; }
56 Q_INVOKABLE
double drainVoltage(
int amc);
57 Q_INVOKABLE
double drainCurrent(
int amc);
58 Q_INVOKABLE
double gateVoltage(
int amc);
59 Q_INVOKABLE
double monitor5V();
60 Q_INVOKABLE
double multiDVoltage();
63 void setDrainVoltage(
int amc,
double mV);
71 class Amplifier :
public QObject,
public QScriptable
74 Q_PROPERTY(
double drainVoltage READ drainVoltage WRITE setDrainVoltage)
75 Q_PROPERTY(
double drainCurrent READ drainCurrent WRITE setDrainCurrent)
76 Q_PROPERTY(
double gateVoltage READ gateVoltage WRITE setGateVoltage)
79 explicit Amplifier(
int pol, Channel *parent = 0);
80 explicit Amplifier(
int pol,
int sis,
int stage, Channel *parent = 0);
81 void setCartridge(
Cartridge *band) { m_cart = band; }
82 Cartridge *cartridge()
const {
return m_cart; }
83 Q_INVOKABLE
double drainVoltage();
84 Q_INVOKABLE
double drainCurrent();
85 Q_INVOKABLE
double gateVoltage();
88 void setDrainVoltage(
double mV);
89 void setDrainCurrent(
double mA);
90 void setGateVoltage(
double mV);
99 class Element :
public QObject,
public QScriptable
102 Q_PROPERTY(
double bias READ bias WRITE setBias)
103 Q_PROPERTY(
bool mode READ sisOpenLoop WRITE setSisOpenLoop)
104 Q_PROPERTY(
double current READ current)
105 Q_PROPERTY(
double coilCurrent READ coilCurrent WRITE setCoilCurrent)
106 Q_PROPERTY(
double coilVoltage READ coilVoltage)
109 Q_PROPERTY(
double heaterCurrent READ heaterCurrent)
110 Q_PROPERTY(
double mixerTemperature READ mixerTemperature)
116 Element(
int pol,
int sis, Channel *parent = 0);
117 void setCartridge(
Cartridge *band) { m_cart = band; }
118 Cartridge *cartridge()
const {
return m_cart; }
119 Q_INVOKABLE
double bias();
120 Q_INVOKABLE
double current();
121 Q_INVOKABLE
double coilCurrent();
122 Q_INVOKABLE
double coilVoltage();
125 Q_INVOKABLE
double heaterCurrent()
const;
126 Q_INVOKABLE
double mixerTemperature()
const;
130 Q_INVOKABLE QVector<double> biasTrace()
const;
131 Q_INVOKABLE QVector<double> currentTrace()
const;
132 Q_INVOKABLE QVector<double> powerTrace()
const;
133 Q_INVOKABLE
bool sisOpenLoop()
const;
136 void setBias(
double mV);
137 void setCoilCurrent(
double mA);
140 void setSisOpenLoop(
bool flag);
141 void setLNAenable(
bool flag);
145 void setHeaterState(
bool flag);
146 void tune(
double bias1,
double bias2,
double Igoal,
double maxPower);
149 void scan(
double from,
double to,
int steps,
bool withPower=
false);
151 void plotTrace(QVector<double> x, QVector<double> y,
152 const QString &xlab,
const QString &ylab);
160 class Oscillator :
public QObject,
public QScriptable
163 Q_PROPERTY(
int YIG READ getYIG WRITE updateYIG);
164 Q_PROPERTY(
double synthGHz READ synthFreq WRITE setSynthFreq);
165 Q_PROPERTY(
double synthdBm READ synthLevel WRITE setSynthLevel);
166 Q_PROPERTY(
bool lockLatch READ lockLatch);
169 explicit Oscillator(Channel *parent = 0);
170 void setCartridge(
Cartridge *band) { m_cart = band; }
171 Cartridge *cartridge()
const {
return m_cart; }
172 Q_INVOKABLE
int getYIG()
const;
173 Q_INVOKABLE
double synthFreq()
const;
174 Q_INVOKABLE
double synthLevel()
const;
175 Q_INVOKABLE
bool lockLatch()
const;
178 void updateYIG(
int value);
179 void tune(
double ghz,
int harmonic);
180 void setSynthFreq(
double ghz);
181 void setSynthLevel(
double dBm);
182 void setSynthPower(
bool on);
189 class Channel :
public QObject,
public QScriptable
200 enum Amc { AMCA = 1, AMCB = 2, AMCE = 3 };
204 Cartridge *band()
const {
return m_cart; }
206 static bool validPolarization(
int p);
207 static bool validElement(
int s);
208 static bool validStage(
int s);
209 static bool validAmc(
int a);
210 Q_INVOKABLE
double getValue(
const QString &keyword);
213 static QScriptValue multiplier(QScriptContext *context, QScriptEngine *engine);
214 static QScriptValue amplifier(QScriptContext *context, QScriptEngine *engine);
215 static QScriptValue element(QScriptContext *context, QScriptEngine *engine);
217 static QScriptValue oscillator(QScriptContext *context, QScriptEngine *engine);
218 static QScriptValue phaselock(QScriptContext *context, QScriptEngine *engine);
221 void resetCoilCurrents();
222 void cryoControl(
bool flag);
228 class ScriptRunner :
public QObject
232 explicit ScriptRunner(
const QString &scriptname,
Cartridge *cartridge, QObject *parent = 0);
240 void report(
const QString &txt);
243 void console(
const QString &txt);
246 QScriptEngine engine;
250 #endif // SCRIPTRUNNER_H LNA stage 3.
Definition: constants.h:38
polarization POL1
Definition: constants.h:11
LNA stage 1.
Definition: constants.h:36
Element
An enumeration for the two mixer elements in each polarization.
Definition: constants.h:17
element SIS1
Definition: constants.h:18
A virtual class representing a cartridge.
Definition: cartridge.h:267
element SIS2
Definition: constants.h:19
polarization POL0
Definition: constants.h:10
LNA stage 2.
Definition: constants.h:37
Channel
An enumeration for the three SEPIA channels (cartridges).
Definition: constants.h:66