#-----------------------------------------------------------------------
# An Advanced Virgo Plus input file for Finesse 3

# Detectors
# Beam
readout_dc B1 OMC_1_2.p3.o       output_detectors=true
readout_dc B2 B2_attenuator.p3.o output_detectors=true
readout_dc B4 B4_attenuator.p3.o output_detectors=true
readout_dc B7 NE_AR.p2.o         output_detectors=true
readout_dc B8 WE_AR.p2.o         output_detectors=true

power_detector_demod_1 B4_12  B4_attenuator.p3.o f=2*f6
power_detector_demod_1 B4_112 B4_attenuator.p3.o f=2*f56

math_detector B4_12_mag  abs(B4_12)
math_detector B4_112_mag abs(B4_112)

# Controls readouts
# 1f
readout_rf B1p_56 SR_AR.p2.o f=EOM56.f phase=0 output_detectors=True
readout_rf B2_6 B2.p1.i f=EOM6.f phase=0 output_detectors=True
readout_rf B2_56 B2.p1.i f=EOM56.f phase=0 output_detectors=True
readout_rf B2_8 B2.p1.i f=EOM8.f phase=0 output_detectors=True
# 3f
readout_rf B2_56_3f B2.p1.i f=3*EOM56.f phase=0 output_detectors=True
readout_rf B2_6_3f B2.p1.i f=3*EOM6.f phase=0 output_detectors=True

# Degree of freedom detectors
amplitude_detector CAR_AMP_PRin PR_AR.p1.i f=0
amplitude_detector CAR_AMP_N    NE.p1.o    f=0
amplitude_detector CAR_AMP_W    WE.p1.o    f=0
amplitude_detector CAR_AMP_BS   BS.p1.i    f=0
amplitude_detector CAR_AMP_AS   B1.p1.i    f=0

# normalising by powers from the design case:
# find fractional difference from pre-defined operating point, i.e., we
# define an optimal operating point as when these detectors are these
# values.
math_detector opt_pr abs(B4_12_mag/0.0017327341567091679-1)
math_detector opt_sr abs(B4_112_mag/0.000605331698252113-1)
math_detector opt_tl opt_pr**2+opt_sr**2