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

# Source: current finesse-virgo's model
# Modified with: https://git.ligo.org/virgo/isc/parameters/-/blob/377982cc0fd35a561a2f0d9356ca847072d39c57/mechanics.m
# Modified with: https://git.ligo.org/virgo/isc/parameters/-/blob/c7e2cf038a096fbb5a20cc58ff01650cec5a96fa/advanced_virgo.m
# Modified with: https://git.ligo.org/virgo/isc/parameters/-/blob/7de842d4f3ebe3744a608e2f19d6d0a15a437cdf/advanced_virgo_current.m
# Modified with: https://git.ligo.org/virgo/isc/parameters/-/blob/a89dfb3b8556c9796b64531da93343f56e773e6b/detection_current.m
# Modified with: https://git.ligo.org/virgo/isc/optickle/-/blob/f577e6f073c0dda2ef9db3d2fbab27021f406182/models/DRITFscatter.m
# Modified with: https://git.ligo.org/virgo/virgoapp/simulinkNoiseBudget/-/blob/6e7e1b95b7817cdb6cc67d5748281ed1d7ffc805/DRITF/scatterRadiationPressureTune.m
# Modified with: https://git.ligo.org/virgo/virgoapp/simulinkNoiseBudget/-/blob/6e7e1b95b7817cdb6cc67d5748281ed1d7ffc805/DRITF/scatterRadiationPressure.m

# Defines general variables needed for the model creation here

# Constant
variable	speed_of_light	299792458

# Material
variable	silica	1.44963

# Injection
variable	wavelength	1.064e-6	units='m'
variable	frequency	speed_of_light/wavelength	units='Hz'

# Schnupp asymmetry
variable	schnupp_asymetry	0.23	units='m'

# Cavity length
variable	length_PRCL	11.952	units='m'
variable	length_SRCL	11.952	units='m'

# Laser
laser	laser	P=25

# Modulator

modulator	eom1	f=6270777	midx=0.22	order=1
space	space_laser_eom1	laser.p1	eom1.p1	L=0.1

modulator	eom2	f=4/3*eom1.f	midx=0.15	order=1
space	space_eom1_eom2	eom1.p2	eom2.p1	L=0.1

modulator	eom3	f=9*eom1.f	midx=0.204	order=1
space	space_eom2_eom3	eom2.p2	eom3.p1	L=0.1

modulator	eom4	f=21*eom1.f	midx=0.128	order=1
space	space_eom3_eom4	eom3.p2	eom4.p1	L=0.1

# Power Recycling
mirror	PR_AR	T=9.9984e-1	L=1.6e-4	Rc=-3.62	phi=PR.phi
mirror	PR	T=0.04835	L=37.5e-6	Rc=-1430
space	inside_PR	PR_AR.p2	PR.p1	L=0.1003	nr=silica

space	space_eom4_PR	eom4.p2	PR_AR.p1	L=11.67

# Beamsplitter

beamsplitter	BS	T=0.5012	L=37.5e-6	alpha=-45.0

space	space_PR_BS	PR.p2	BS.p1	L=5.925

# North arm

mirror	NI_AR	T=9.9968e-1	L=0.0	Rc=-1420	phi=NI.phi
mirror	NI	T=0.01377	L=37.5e-6	Rc=-1420
space	inside_NI	NI_AR.p2	NI.p1	L=0.2	nr=silica

mirror	NE	T=4.4e-6	L=37.5e-6	Rc=1683
mirror	NE_AR	R=100e-6	L=1.33e-4	phi=NE.phi	Rc=1683
space	inside_NE	NE.p2	NE_AR.p1	L=0.2	nr=silica

space	space_NI_NE	NI.p2	NE.p1	L=2999.8

space	space_BS_NI	BS.p3	NI_AR.p1	L=length_PRCL-space_PR_BS.L+schnupp_asymetry/2-inside_NI.L*inside_NI.nr

# West arm

mirror	WI_AR	T=9.99942e-1	L=0.0	Rc=-1424	phi=WI.phi
mirror	WI	T=0.01377	L=37.5e-6	Rc=-1420
space	inside_WI	WI_AR.p2	WI.p1	L=0.2	nr=silica

mirror	WE	T=4.3e-6	L=37.5e-6	Rc=1683
mirror	WE_AR	T=9.99845e-1	L=1.55e-4	phi=WE.phi	Rc=1683
space	inside_WE	WE.p2	WE_AR.p1	L=0.2	nr=silica

space	space_WI_WE	WI.p2	WE.p1	L=2999.8

# schnupp asymetry correction
space	space_BS_WI	BS.p2	WI_AR.p1	L=length_PRCL-space_PR_BS.L-schnupp_asymetry/2-inside_WI.L*inside_NI.nr

# SR

mirror	SR	T=0.40	L=37.5e-6	Rc=1430
mirror	SR_AR	T=9.99859e-1	L=1.41e-4	Rc=1430	phi=SR.phi
space	inside_SR	SR.p2	SR_AR.p1	L=0.1004

space	space_BS_SR	BS.p4	SR.p1	L=length_SRCL-(space_BS_WI.L+space_BS_NI.L)/2

# power detectors

power_detector_dc	NE_p1	NE.p1.o
power_detector_dc	NI_p1	NI.p1.o
power_detector_dc	NE_p2	NE.p2.o
power_detector_dc	NI_p2	NI.p2.o

power_detector_dc	WE_p1	WE.p1.o
power_detector_dc	WI_p1	WI.p1.o
power_detector_dc	WE_p2	WE.p2.o
power_detector_dc	WI_p2	WI.p2.o

power_detector_dc	PR_p1	PR.p1.o
power_detector_dc	PR_p2	PR.p2.o

power_detector_dc	SR_p1	SR.p1.o
power_detector_dc	SR_p2	SR.p2.o

# degree of freedom

degree_of_freedom	NORTH_ARM	NE.dofs.z	+1
degree_of_freedom	WEST_ARM	WE.dofs.z	+1
degree_of_freedom	PRCL	PR.dofs.z	+1
degree_of_freedom	SRCL	SR.dofs.z	+1

degree_of_freedom MICH	NI.dofs.z	-0.5	WI.dofs.z	+0.5	NE.dofs.z	-0.5	WE.dofs.z	+0.5
degree_of_freedom DARM	NE.dofs.z	-0.5	WE.dofs.z	+0.5
degree_of_freedom CARM	NE.dofs.z	+1	WE.dofs.z	+1
degree_of_freedom	DARM_Fz	NE.dofs.F_z	-0.5	WE.dofs.F_z	+0.5

# cavities

cavity	north_arm	NI.p2.o	priority=3
cavity	west_arm	WI.p2.o	priority=3

cavity	PRCL_north	PR.p2.o	via=WE.p1.i	priority=2
cavity	PRCL_west	PR.p2.o	via=NE.p1.i	priority=2

cavity	SRCL_north	SR.p1.o	via=WE.p1.i	priority=1
cavity	SRCL_west	SR.p1.o	via=WE.p1.i	priority=1

readout_rf	B1	SDB1.p2.o	output_detectors=True	f=0
readout_dc	B1_DDC	SDB1.p2.o	output_detectors=False

# benches

mirror	SNEB	R=1e-6	L=0.0	Rc=1683+7
mirror	SWEB	R=1e-6	L=0.0	Rc=1683+7
mirror	SDB1	R=1e-6	L=0.0	Rc=1430

space	space_NE_AR_SNEB	NE_AR.p2	SNEB.p1	L=7
space	space_WE_AR_SWEB	WE_AR.p2	SWEB.p1	L=7
space	space_SR_SDB1	SR_AR.p2	SDB1.p1	L=0

power_detector_dc	SNEB_DC	SNEB.p1.i
power_detector_dc	SWEB_DC	SWEB.p1.i
power_detector_dc	SDB1_DC	SDB1.p1.i

degree_of_freedom	SNEB_z	SNEB.dofs.z	-1
degree_of_freedom	SWEB_z	SWEB.dofs.z	-1
degree_of_freedom	SDB1_z	SDB1.dofs.z	-1

# Suspensions

pendulum	NI_suspension	NI.mech	mass=42	fz=0.76	Qz=40
pendulum	NI_AR_suspension	NI_AR.mech	mass=NI_suspension.mass	fz=NI_suspension.fz	Qz=NI_suspension.Qz

pendulum	NE_suspension	NE.mech	mass=42	fz=0.76	Qz=40
pendulum	NE_AR_suspension	NE_AR.mech	mass=NE_suspension.mass	fz=NE_suspension.fz	Qz=NE_suspension.Qz

pendulum	WI_suspension	WI.mech	mass=42	fz=0.76	Qz=40
pendulum	WI_AR_suspension	WI_AR.mech	mass=WI_suspension.mass	fz=WI_suspension.fz	Qz=WI_suspension.Qz

pendulum	WE_suspension	WE.mech	mass=42	fz=0.76	Qz=40
pendulum	WE_AR_suspension	WE_AR.mech	mass=WE_suspension.mass	fz=WE_suspension.fz	Qz=WE_suspension.Qz

pendulum	PR_suspension	PR.mech	mass=42	fz=0.76	Qz=40
pendulum	PR_AR_suspension	PR_AR.mech	mass=PR_suspension.mass	fz=PR_suspension.fz	Qz=PR_suspension.Qz

pendulum	SR_suspension	SR.mech	mass=42	fz=0.76	Qz=40
pendulum	SR_AR_suspension	SR_AR.mech	mass=SR_suspension.mass	fz=SR_suspension.fz	Qz=SR_suspension.Qz

pendulum	SNEB_suspension	SNEB.mech	mass=42	fz=0.76	Qz=40
pendulum	SWEB_suspension	SWEB.mech	mass=42	fz=0.76	Qz=40
pendulum	SDB1_suspension	SDB1.mech	mass=42	fz=0.76	Qz=40

free_mass	BS_suspension	BS.mech	mass=34
