Skip to content

Commit

Permalink
Merge pull request #6352 from mgunyho/ZNB-ref-osc
Browse files Browse the repository at this point in the history
Add parameters related to reference oscillator to R&S ZNB driver
  • Loading branch information
jenshnielsen authored Sep 5, 2024
2 parents c5eedf9 + ff7e086 commit 0b43223
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions src/qcodes/instrument_drivers/rohde_schwarz/ZNB.py
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,54 @@ def __init__(
val_mapping={True: "1\n", False: "0\n"},
)
"""Parameter rf_power"""

self.ref_osc_source: Parameter = self.add_parameter(
name="ref_osc_source",
label="Reference oscillator source",
get_cmd="ROSC:SOUR?",
set_cmd="ROSC:SOUR {}",
# strip newline
get_parser=lambda s: s.rstrip(),
vals=vals.Enum("INT", "EXT", "int", "ext", "internal", "external"),
)
"""Reference oscillator source"""

self.ref_osc_external_freq: Parameter = self.add_parameter(
name="ref_osc_external_freq",
label="Reference oscillator frequency",
docstring="Frequency of the external reference clock signal at REF IN",
get_cmd="ROSC:EXT:FREQ?",
set_cmd="ROSC:EXT:FREQ {}Hz",
# The response contains the unit (Hz), so we have to strip it
get_parser=lambda f: float(f.strip("Hz")),
unit="Hz",
# Data sheet: 1 MHz to 20 MHz, in steps of 1 MHz
vals=vals.Enum(*np.linspace(1e6, 20e6, 20)),
)
"""Frequency of the external reference clock signal at REF IN"""

self.ref_osc_PLL_locked: Parameter = self.add_parameter(
name="ref_osc_PLL_locked",
label="Reference frequency PLL lock",
get_cmd=self._get_PLL_locked,
docstring="If an external reference signal or an internal high "
"precision clock (option B4) is used, the local oscillator is "
"phase locked to a reference signal. This parameter will be "
"False if the phase locked loop (PLL) fails. "
"\n"
"For external reference: check frequency and level of the "
"supplied reference signal.",
)
"""
If an external reference signal or an internal high precision clock
(option B4) is used, the local oscillator is phase locked to a
reference signal. This parameter will be False if the phase locked loop
(PLL) fails.
For external reference: check frequency and level of the supplied
reference signal.
"""

self.add_function("reset", call_cmd="*RST")
self.add_function("tooltip_on", call_cmd="SYST:ERR:DISP ON")
self.add_function("tooltip_off", call_cmd="SYST:ERR:DISP OFF")
Expand Down Expand Up @@ -1115,6 +1163,13 @@ def __init__(
self.rf_off()
self.connect_message()

def _get_PLL_locked(self) -> bool:
# query the bits of the "questionable hardware integrity" register
hw_integrity_bits = int(self.ask("STATus:QUEStionable:INTegrity:HARDware?"))
# if bit number 1 is set, the PLL locking has failed
pll_lock_failed = bool(hw_integrity_bits & 0b10)
return not pll_lock_failed

def display_grid(self, rows: int, cols: int) -> None:
"""
Display a grid of channels rows by columns.
Expand Down

0 comments on commit 0b43223

Please sign in to comment.