Set_by_frequency() API interface

What is the correct way to indicate in a call to set_by_frequency that I would like to deactivate one or more of the components of the controller? In other words, how can I replicate the behavior provided by the GUI when I “grey out” the differentiator, for example?

I have tried using ‘None,’ like so:

llb.set_pid_by_frequency(channel=1,
int_crossover = intCrossover,
int_saturation = intSaturation,
prop_gain = propGain,
diff_crossover = None,
diff_saturation =None,
double_int_crossover = None,
invert=True)

but the response from the Moku looks like:

{‘diff_crossover’: 160000.0,
‘diff_saturation’: 15.0,
‘double_int_crossover’: 310.0,
‘int_crossover’: 18000.0,
‘int_saturation’: 40.0,
‘invert’: True,
‘prop_gain’: 0.0}

which seems to indicate that the differentiator and the double integrator are active. As far as I can tell they are not active, rather it seems the echo provided by the set_by_frequency call provides a misleading representation of the current controller state.

How does set_by_frequency() treat missing keyword arguments? does it grey them out, or does it leave them how they were before? How can I grey them out? What is the most reliable way to set a controller and be sure that I know exactly what controller is being used?

Hi @jephwack

Apologies for the misleading behavior, the function works as you’d expect; missing values are set to None and disabled. But the dictionary returned is confusing. I was able to reproduce this on my end and reported this behavior to the team here.

You can confirm that the settings are correct by calling llb.summary() for example:

from moku.instruments import LaserLockBox
llb = LaserLockBox(IP_ADDRESS)
llb.set_pid_by_frequency(1, prop_gain=0, int_saturation=40, int_crossover=18000, invert=True)
print(llb.summary())
>>> ...
>>> Fast controller: PI controller: proportional gain +0.0 dB, integrator crossover 18.00 kHz, integrator saturation +40.0 dB, invert on
>>> ...
1 Like