[docs]classUsrpSystem(Serializable,PhysicalScenario[UsrpDevice]):"""Scenario of USRPs running the UHD server application."""yaml_tag="UsrpSystem""""YAML serialization tag"""def__init__(self,*args,**kwargs)->None:PhysicalScenario.__init__(self,*args,**kwargs)# Hacked USRP system (hidden)self.__system=_UsrpSystem()
[docs]defnew_device(self,ip:str,port:int=5555,*args,**kwargs)->UsrpDevice:"""Create a new UHD device managed by the system. Args: Device initialization parameters. Refer to :class:.UsrpDevice for further details. Returns: A handle to the initialized device. """device=UsrpDevice(ip,port,*args,**kwargs)self.add_device(device)returndevice
[docs]defadd_device(self,device:UsrpDevice)->None:"""Register an existing UHD device to be managed by the system. Args: device (UsrpDevice): The device to be added. """self.__system.addUsrp(usrpName=str(self.num_devices),client=device._client)PhysicalScenario.add_device(self,device)
def_trigger(self)->None:self.__system.execute()def_trigger_direct(self,transmissions:list[Signal],devices:list[PDT],calibrate:bool=True)->list[Signal]:# Upload transmissions to devicesfortransmission,deviceinzip(transmissions,devices):device._upload(transmission)# Trigger devicesself._trigger()# Download receptions from devicesreceptions=[device._download()fordeviceindevices]returnreceptions