/*******************************************************************************
* Instrument: Test_FZP_simple
*
* %I
* Written by: Peter Willendrup (pkwi@fysik.dtu.dkl)
* Date: March 2023
* Origin: DTU
* %INSTRUMENT_SITE: DTU
*
* Simple test instrument for the FZP_simple component
*
* %D
* Simple test instrument for the FZP_simple component
*
* %Example: Test_FZP_simple.instr lambda0=10 dlambda=1e-1 l1=40 Detector: psd_monitor_9_I=1.53e-05
*
* %P
* lambda0: [AA] Centre of wavelength distribution
* dlambda: [AA] Width of wavelength distribution
* l1: [m] Distance source to FZP
*
* %L
* <reference/HTML link>
*
* %E
*******************************************************************************/
DEFINE INSTRUMENT Test_FZP_simple(lambda0=10, dlambda=1e-1, l1=40)

DECLARE
%{
%}

USERVARS
%{
%}

INITIALIZE
%{
%}

TRACE

COMPONENT origin = Progress_bar()
AT (0, 0, 0) RELATIVE ABSOLUTE

// insert components here (e.g. Insert -> Source -> ...)

COMPONENT source_simple = Source_simple(
    yheight=0.1, 
    xwidth=0.1, 
    dist=l1,
    focus_xw=0.1, 
    focus_yh=0.1, 
    lambda0=lambda0, 
    dlambda=dlambda)
AT (0, 0, 0) RELATIVE ABSOLUTE


COMPONENT FZP = FZP_simple(
  rad = 0.05,
  dr = 5e-8,
  bs0rad = 0.005) 
 AT (0, 0, l1) RELATIVE  source_simple

COMPONENT psd_monitor = PSD_monitor(
    nx=128, 
    ny=128, 
    filename="1m", 
    xwidth=0.1, 
    yheight=0.1)
AT (0, 0, 1) RELATIVE FZP

COMPONENT COPY(psd_monitor) = COPY(psd_monitor)(filename="2m")
AT (0, 0, 1) RELATIVE PREVIOUS

COMPONENT COPY(psd_monitor) = COPY(psd_monitor)(filename="3m")
AT (0, 0, 1) RELATIVE PREVIOUS

COMPONENT COPY(psd_monitor) = COPY(psd_monitor)(filename="4m")
AT (0, 0, 1) RELATIVE PREVIOUS

COMPONENT COPY(psd_monitor) = COPY(psd_monitor)(filename="5m")
AT (0, 0, 1) RELATIVE PREVIOUS

COMPONENT COPY(psd_monitor) = COPY(psd_monitor)(filename="6m")
AT (0, 0, 1) RELATIVE PREVIOUS

COMPONENT COPY(psd_monitor) = COPY(psd_monitor)(filename="7m")
AT (0, 0, 1) RELATIVE PREVIOUS

COMPONENT COPY(psd_monitor) = COPY(psd_monitor)(filename="8m")
AT (0, 0, 1) RELATIVE PREVIOUS

COMPONENT COPY(psd_monitor) = COPY(psd_monitor)(filename="9m")
AT (0, 0, 1) RELATIVE PREVIOUS

COMPONENT COPY(psd_monitor) = COPY(psd_monitor)(filename="10m")
AT (0, 0, 1) RELATIVE PREVIOUS

FINALLY
%{
%}

END
