From 7e8bf3dc9f0162ac1e30d6e57315937ff70506d5 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Sun, 2 Jan 2022 21:12:23 -0500 Subject: added measurements of magnetic control voltage response --- examples/lock_eit.py | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/examples/lock_eit.py b/examples/lock_eit.py index 8742db3..08522c5 100644 --- a/examples/lock_eit.py +++ b/examples/lock_eit.py @@ -233,6 +233,64 @@ async def main(): lockin_slope= await calibratingLockin() + async def responseToChangeOfBfieldControlVoltage(): + apparatus.state = f'Calibrating lockin response to change of Bfield control voltage, {rfPout} dBm' + logger.info(apparatus.state) + update_webpage(apparatus=apparatus) + ai['pid'].setEnable(True) + ai['pid'].reset() + apparatus.gui_log.setTraces( initLog() ) + dV = 0.01 + ai['lockin'].AuxOut1=dV + apparatus.getBCurrent(); # this automatically logs value to TSDB + + # initial lock + ai['pid'].setEnable(True) + ai['pid'].reset() + res = await asyncio.gather( + feedbackLoop(apparatus, nsteps=20) + ) + + # this is for the money lock + res = await asyncio.gather( + feedbackLoop(apparatus, nsteps=30) + ) + + fr0 = ai['rfgen'].getFreqFixed() + apparatus.getBCurrent(); # this automatically logs value to TSDB + + # this is for the money lock + ai['lockin'].AuxOut1=0 + ai['pid'].setEnable(True) + ai['pid'].reset() + res = await asyncio.gather( + feedbackLoop(apparatus, nsteps=30) + ) + fr1 = ai['rfgen'].getFreqFixed() + + log = apparatus.gui_log.traces + trE=log.getTrace('error') + + df = fr0 - fr1 + slope = df/dV + + logger.info(f'df = {df}') + logger.info(f'response to magnetic control voltage = {slope} Hz/V') + + apparatus.getBCurrent(); # this automatically logs value to TSDB + + # relock to default state + ai['lockin'].AuxOut1=0 + ai['pid'].setEnable(True) + ai['pid'].reset() + res = await asyncio.gather( + feedbackLoop(apparatus, nsteps=20) + ) + + return slope + + B_response= await responseToChangeOfBfieldControlVoltage() + logger.info('========= Long term lock ===========') apparatus.gui_log.setTraces( initLog() ) apparatus.gui_log.traces.config['tags']['lockin_slope']=float(lockin_slope) -- cgit v1.2.3