from ....Internal.Core import Core
from ....Internal.CommandsGroup import CommandsGroup
from ....Internal import Conversions
from .... import enums
from .... import repcap
# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class AlgorithmCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("algorithm", core, parent)
[docs]
def set(self, algorithm: enums.SwAlgorithm, software=repcap.Software.Default) -> None:
"""
``CDR:SOFTware<*>:ALGorithm`` \n
Snippet: ``driver.cdr.software.algorithm.set(algorithm = enums.SwAlgorithm.CFRequency, software = repcap.Software.Default)`` \n
Sets the software algorithm that is used for clock data recovery.
:param algorithm: CFRequency | PLL | FF | PLLStart | FFSTart \n
- CFRequency: Constant frequency. CDR uses the nominal bit rate to generate the clock signal. The method assumes that the frequency of the signal is constant during the complete acquisition.
- PLL: Phase-locked loop control system. It can follow slow deviations in the frequency of the data stream.
- FF: Feed forward algorithm, a mathematical optimization method. Feed forward is available if none of the listed serial standards is used ( SIGNalconfig:SETup:SETTingm:SERStandard is set to CUSTOM) . It is faster than PLL, i.e., the settling time is shorter. Feed forward is also more precise than PLL. To set up the algorithm, set the bandwidth and the relative bandwith.
- PLLStart: PLL is the phase-locked loop control system which is locked at the acquisition start.
- FFSTart: Feed forward algorithm locked at the acquisition start.
:param software: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Software')
"""
param = Conversions.enum_scalar_to_str(algorithm, enums.SwAlgorithm)
software_cmd_val = self._cmd_group.get_repcap_cmd_value(software, repcap.Software)
self._core.io.write_with_opc(f'CDR:SOFTware{software_cmd_val}:ALGorithm {param}')
# noinspection PyTypeChecker
[docs]
def get(self, software=repcap.Software.Default) -> enums.SwAlgorithm:
"""
``CDR:SOFTware<*>:ALGorithm`` \n
Snippet: ``value: enums.SwAlgorithm = driver.cdr.software.algorithm.get(software = repcap.Software.Default)`` \n
Sets the software algorithm that is used for clock data recovery.
:param software: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Software')
:return: algorithm: CFRequency | PLL | FF | PLLStart | FFSTart \n
- CFRequency: Constant frequency. CDR uses the nominal bit rate to generate the clock signal. The method assumes that the frequency of the signal is constant during the complete acquisition.
- PLL: Phase-locked loop control system. It can follow slow deviations in the frequency of the data stream.
- FF: Feed forward algorithm, a mathematical optimization method. Feed forward is available if none of the listed serial standards is used ( SIGNalconfig:SETup:SETTingm:SERStandard is set to CUSTOM) . It is faster than PLL, i.e., the settling time is shorter. Feed forward is also more precise than PLL. To set up the algorithm, set the bandwidth and the relative bandwith.
- PLLStart: PLL is the phase-locked loop control system which is locked at the acquisition start.
- FFSTart: Feed forward algorithm locked at the acquisition start.
"""
software_cmd_val = self._cmd_group.get_repcap_cmd_value(software, repcap.Software)
response = self._core.io.query_str_with_opc(f'CDR:SOFTware{software_cmd_val}:ALGorithm?')
return Conversions.str_to_scalar_enum(response, enums.SwAlgorithm)