From eeae393ad4b1c0546922eab3c4decb39e5e69f4b Mon Sep 17 00:00:00 2001 From: Lars Amsel Date: Sat, 23 May 2020 14:16:34 +0200 Subject: cal: Add automated port switch Current implementation needed manual interaction to calibrate each antenna. More sophisticated setups are able to switch between channels and antennas programmatically. This commit introduces a base class that handle the switch behaviour. The previous implementation moved to a ManualSwitch class which is the default switch. Without any options the previous flow remains unchanged. A new class is able to handle NI switch models. The switch port can be given via options parameter (comA is default). The channels are connected in ascending order. The user has to ensure that the cable setup matches the order given for channels and antennas. Co-authored-by: Martin Braun --- host/utils/uhd_power_cal.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'host/utils') diff --git a/host/utils/uhd_power_cal.py b/host/utils/uhd_power_cal.py index b71e8f3ab..c598c1058 100644 --- a/host/utils/uhd_power_cal.py +++ b/host/utils/uhd_power_cal.py @@ -83,6 +83,12 @@ def parse_args(): parser.add_argument( '-o', '--meas-option', default=[], action='append', help='Options that are passed to the measurement device') + parser.add_argument( + '--switch', default='manual', + help='Type of switch to be used to connect antennas') + parser.add_argument( + '--switch-option', default=[], action='append', + help='Options that are passed to the switch') parser.add_argument( '-r', '--rate', type=float, help='Sampling rate at which the calibration is performed') @@ -194,6 +200,8 @@ def main(): # not transmitting at full scale if args.dir == 'tx': meas_dev.power_offset -= 20 * math.log10(args.amplitude) + print("=== Initializing port connector...") + switch = uhd.usrp.cal.get_switch(args.dir, args.switch, args.switch_option) print("=== Initializing USRP calibration object...") usrp_cal = uhd.usrp.cal.get_usrp_calibrator( usrp, meas_dev, args.dir, @@ -220,7 +228,7 @@ def main(): .format(chan, ant)) # Set up all the objects getattr(usrp, 'set_{}_antenna'.format(args.dir))(ant, chan) - meas_dev.update_port(chan, ant) + switch.connect(chan, ant) usrp_cal.update_port(chan, ant) freqs = usrp_cal.init_frequencies(args.start, args.stop, args.step) usrp_cal.start() # This will activate siggen -- cgit v1.2.3