PID Feedback Control
Use settings defined in hardware to perform feedback on a monitored quantity.
This plug-in relies on
simple-pid
(v2+) library, install it (don’t forgetconda activate scopefoundry
if necessary.)pip install simple-pid
Add
PIDFeedbackControl
to your app.# fancy_app.py from ScopeFoundry import BaseMicroscopeApp class FancyApp(BaseMicroscopeApp): name = "fancy_app" def setup(self): from ScopeFoundry.controlling import PIDFeedbackControl self.add_measurement(PIDFeedbackControl)
Refer to the following figure to define the control.
a) The system used in this example: a laser beam from the OPO is controlled by a motorized ND filter wheel (“Plant”). The power of the laser beam is monitored at a pickoff location using a power meter (“Sensor”). (Ignore the rest of figure a).)
b) Control loop diagram. Note it is a standard feedback with a PID controller - however, the inputs that the plant receives are constraint with min/max for safety.
c) The GUI of
PIDFeedbackControl
: Defining- The setpoint.
plant_input
(position of the motor of the ND filter wheel,side_beam_power_wheel
).sensor
is the power readout of a power meter (thorlabs_powermeter
as a sensor) by moving an ND density filter wheel (as the plant).- The PID controller with the usual 3 parameters.
- Note that the input to the plant can be constrained by (
min_plant_input
,max_plant_input
). - Lastly, you can define when the measurement terminates.