1/*******************************************************************************
2* Instrument: PSI_Focus
3*
4* %Identification
5* Written by: <a href="mailto:Uwe.Filges@psi.ch">Uwe Filges</a>
6* Date: Jan 2004
7* Origin: <a href="http://www.psi.ch">PSI</a>
8* %INSTRUMENT_SITE: PSI
9*
10* The FOCUS Spectrometer at PSI (Paul Scherrer Institute,Switzerland)
11*
12* %Description
13* This instrument is a model of the FOCUS Spectrometer at PSI, Villigen, CH.
14*
15* %Example: lambda=3.4 Detector: PSD_Fermi1_I=1.44416e+07
16* Example: lambda=3.4 Detector: PSD_SAMPLE_I=1.58754E+05
17*
18* %Parameters
19* lambda: [Angs]    source energy
20* chopp_ratio: [1]  Chopper radio Fermi Chopper to Disk Chopper
21* DET: [deg ]       Detector angle
22*
23* %Link
24* Written by U.Filges <uwe.filges@psi.ch> PSI, Jan 2004
25* %End
26*******************************************************************************/
27DEFINE INSTRUMENT PSI_Focus(lambda=3.4, chopp_ratio=1, DET=-69.9)
28
29DECLARE
30%{
31 double lambda;
32 double chopp_ratio;
33 double DET;
34 double PHM, TTM;
35 double RV_2, RH_2;
36 double FO_PHA;
37 double DISC_SPEED, FERMI_SPEED;
38 /* mono d-spacing */
39 double monodd = 3.355;
40 /* time constant [mus/A/m] */
41 double c = 252.78;
42 /* distance sample - detector */
43 double dsd = 2.5;
44 /* distance guide - monochromator */
45 double dgm = 2.996;
46 /* distance fermi-chopper - sample */
47 double dfcs = 0.4997;
48 /* distance disk chopper - monochromator */
49 double ddcm = 2.944;
50 /* distance  monochromator - fermi-chopper */
51 double mfc = 1.002;
52 /* distance  monochromator - sample */
53 double dms = 1.4997;
54 /* setting range of sources */
55 double dL = 0.7;
56 double LMIN, LMAX;
57 double EMIN, EMAX;
58
59%}
60
61INITIALIZE
62%{
63
64 /* setting theta and 2Theta */
65 PHM = asin(lambda/2/monodd)*180/PI;
66 TTM = 2*PHM;
67
68 /* setting speed of Fermi chopper, Disk chopper */
69 FERMI_SPEED=1.0e6/(PI*lambda*c*(1./tan(PHM*PI/180))*(dsd*pow((1),1.5)+dfcs)*(1.0-(dms/dgm)));
70 DISC_SPEED = FERMI_SPEED/chopp_ratio;
71
72 /* calculate the phase between Fermi and Disk chopper */
73 FO_PHA = (c*lambda*(ddcm+mfc))/1e6;
74
75 /* setting monochromator curvature */
76 RV_2 = 2*dms*(sin(DEG2RAD*PHM));
77 RH_2 = 2*dms/(sin(DEG2RAD*PHM));
78
79 /* setting E and L monitors */
80 LMIN = lambda - dL;
81 LMAX = lambda + dL;
82 EMIN = 81.81/(LMAX*LMAX);
83 EMAX = 81.81/(LMIN*LMIN);
84
85%}
86
87TRACE
88
89COMPONENT a1 = Progress_bar()
90  AT (0,0,0) ABSOLUTE
91
92/* values for guide side window RNR11 */
93COMPONENT csource = Source_gen(
94   yheight = 0.135, xwidth = 0.08, dist=1.77, focus_xw = 0.05, focus_yh = 0.12,
95   lambda0 = 3.4, dlambda = dL, T1= 296.16, I1=8.5E11,
96   T2=40.68, I2=5.2E11)
97AT (0,0,0) RELATIVE a1  ROTATED (0,0,0) RELATIVE a1
98
99/* guide segment 1, m=2, 4.66 m */
100COMPONENT guide1 = Guide(w1=0.05, h1=0.12, w2=0.05, h2=0.12,
101                         l=4.66, R0=0.995, Qc=0.0217, alpha = 5.76,
102                         m = 2.0, W = 0.0033)
103    AT (0,0,1.5) RELATIVE a1 ROTATED (0,0,0) RELATIVE a1
104
105/* guide segment 2, curved, m=2, 24.5 m */
106COMPONENT guide2 = Bender(
107    w = 0.05, h = 0.12, r = 1445, R0a = 0.995, Qca = 0.0217,
108    alphaa = 5.76, ma = 2, Wa = 0.0033, R0i = 0.995, Qci = 0.0217,
109    alphai = 5.76, mi = 2, Wi = 0.0033, R0s = 0.995, Qcs = 0.0217,
110    alphas = 5.76, ms = 2, Ws = 0.0033, l = 24.5)
111   AT (0,0,6.16) RELATIVE a1 ROTATED (0,0,0) RELATIVE a1
112
113/* bunker wall, m=2, 3.0 m */
114 COMPONENT bunker = Guide(w1=0.05, h1=.12, w2=0.05, h2=.12,
115        l=3.0, R0=0.995, Qc=0.0217, alpha = 5.76, m = 2.0, W = 0.0033)
116    AT (0,0,30.66) RELATIVE a1 ROTATED (0,0,0) RELATIVE a1
117
118/* guide segment 3, m=2, 32.95 m */
119 COMPONENT guide3 = Guide(w1=0.05, h1=.12, w2=0.05, h2=.12,
120        l=32.95, R0=0.995,Qc=0.0217, alpha = 5.76, m = 2.0, W = 0.0033)
121    AT (0,0,33.66) RELATIVE a1 ROTATED (0,0,0) RELATIVE a1
122
123/* guide exit at 66.61 m - measured flux 2.53 10e8 cm-2 s-1 mA-1 */
124
125COMPONENT lambdaGuideExit = L_monitor(
126	xwidth = 0.05, yheight = 0.12,
127	Lmin = LMIN, Lmax = LMAX, nL = 60,
128	filename = "lambdaguide.dat")
129  AT(0, 0, 66.611) RELATIVE a1 ROTATED (0,0,0) RELATIVE a1
130
131COMPONENT DivMonGuideExit = Divergence_monitor(
132          nh=60, nv=60, filename="divguide.dat",
133          xwidth = 0.05, yheight = 0.12,
134          maxdiv_h=2, maxdiv_v=2)
135  AT (0, 0, 66.612) RELATIVE a1  ROTATED (0, 0, 0) RELATIVE a1
136
137COMPONENT PSDGuideExit = PSD_monitor(
138    xwidth = 0.05, yheight = 0.12,
139    nx=60, ny=60, filename="psdguide.dat")
140  AT (0, 0, 66.613) RELATIVE a1  ROTATED (0, 0, 0) RELATIVE a1
141
142/* Shutter position - distance neutron guide to FOCUS trumpet 0.06 m */
143
144COMPONENT FOCUSguide = Guide_channeled(
145     w1 = 0.05, h1 = 0.12,
146     w2 = 0.05, h2 = 0.095,
147     l = 2.95, R0 = 0.995, Qcx = 0.0217, Qcy = 0.0217,
148     alphax = 5.76, alphay = 5.64, W = 0.0033,
149     nslit = 1, d = 0.002, mx = 2.4, my = 3)
150  AT (0, 0, 66.67) RELATIVE a1 ROTATED (0, 0, 0) RELATIVE a1
151
152/* distance guide exit to chopper center 0.054 m */
153
154COMPONENT FirstChopper = DiskChopper(theta_0=0, abs_out=0, verbose=1,
155				     radius = 0.70, yheight=0.70, xwidth = 0.07, nu = DISC_SPEED/2/PI, nslit = 2, delay = FO_PHA, isfirst = 1)
156  AT (0, 0, 69.674) RELATIVE a1
157
158COMPONENT  DISCTOF = Monitor_nD(
159    bins = 30, filename = "DISC_TOF.dat", xmin = -0.05,
160    xmax = 0.05, ymin = -0.1, ymax = 0.1, options="auto, time")
161  AT (0, 0, 69.718) RELATIVE a1
162
163COMPONENT PSDmon1Chopper = PSD_monitor(
164    xwidth = 0.1, yheight = 0.2,
165    nx=60, ny=60, filename="psdchopper.dat")
166  AT (0, 0, 69.719) RELATIVE a1  ROTATED (0, 0, 0) RELATIVE a1
167
168/* Be-filter optinal; distance chopper center to Be-Filter entry 0.06 m,
169   Filter length 0.17 m */
170
171/*
172COMPONENT BeFilter = Filter(
173    xmin = -0.035, xmax = 0.035, ymin = -0.06, ymax = 0.06,
174    len = 0.17, T0 = 0.9, T1 = 0.1, Emin = 0.5, Emax = 20.0)
175  AT (0, 0, 69.717) RELATIVE a1
176*/
177
178/* distance chopper center to vacuum tube entry 0.398 m */
179
180/* vacuum tube part 1,  0.535 m */
181
182COMPONENT VacuumTube1entry = Slit(radius = 0.085)
183  AT (0, 0, 70.072) RELATIVE a1
184
185COMPONENT VacuumTube1exit = Slit(radius = 0.085)
186  AT (0, 0, 70.607) RELATIVE a1
187
188/* vacuum tube part 2,  0.795 m */
189
190COMPONENT VacuumTube2entry = Slit(radius = 0.1)
191  AT (0, 0, 70.607) RELATIVE a1
192
193COMPONENT VacuumTube2exit = Slit(radius = 0.1)
194  AT (0, 0, 71.402) RELATIVE a1
195
196/* vacuum tube part 3,  0.605 m */
197
198COMPONENT VacuumTube3entry = Slit(radius = 0.1335)
199  AT (0, 0, 71.402) RELATIVE a1
200
201COMPONENT VacuumTube3exit = Slit(radius = 0.1335)
202  AT (0, 0, 72.007) RELATIVE a1
203
204/* distance vakuum tube exit to monochromator center 0.610 m */
205
206COMPONENT PSDmonMono = PSD_monitor(
207    xwidth = 0.1, yheight = 0.2,
208    nx=60, ny=60, filename="psdmono.dat")
209  AT (0, 0, 72.4) RELATIVE a1  ROTATED (0, 0, 0) RELATIVE a1
210
211COMPONENT  MONOTOF = Monitor_nD(
212    bins = 30, filename = "MONO_TOF.dat", xmin = -0.05,
213    xmax = 0.05, ymin = -0.1, ymax = 0.1, options="auto, time")
214  AT (0, 0, 72.41) RELATIVE a1
215
216COMPONENT DivMonMono = Divergence_monitor(
217          nh=60, nv=60, filename="divmono.dat",
218          xwidth = 0.1, yheight = 0.2,
219          maxdiv_h=3, maxdiv_v=3)
220  AT (0, 0, 72.42) RELATIVE a1  ROTATED (0, 0, 0) RELATIVE a1
221
222
223COMPONENT focus_mono = Arm()
224   AT (0, 0, 72.617) RELATIVE a1 ROTATED (0, PHM, 0) RELATIVE a1
225
226/* PG002=3.355 AA */
227
228SPLIT COMPONENT mono = Monochromator_2foc(
229          zwidth = 0.019, yheight = 0.025, gap = 0.001,
230          NH = 9, NV =  7,
231          mosaich = 48, mosaicv = 48,
232          r0 = 0.99,
233          Q = 1.873,
234          RV = RV_2, RH = RH_2)
235  AT (0, 0, 0) RELATIVE focus_mono
236
237COMPONENT a2 = Arm()
238  AT (0,0,0) RELATIVE focus_mono ROTATED (0, TTM, 0) RELATIVE a1
239
240COMPONENT  FERMITOF_before = Monitor_nD(
241    bins = 30, filename = "FERMI_TOF_before.dat", xmin = -0.05,
242    xmax = 0.05, ymin = -0.1, ymax = 0.1, options="auto, time")
243  AT (0, 0, 0.9) RELATIVE a2
244
245COMPONENT lambdaFermi = L_monitor(
246	xwidth=0.1, yheight=0.2,
247	Lmin = LMIN, Lmax = LMAX, nL = 60,
248	filename = "lambdafermi.dat")
249  AT(0, 0, 0.901) RELATIVE a2
250
251COMPONENT EMON_Fermi = E_monitor(
252	xwidth=0.06, yheight=0.1,
253	Emin = EMIN, Emax = EMAX, nE = 60,
254	filename = "emon_fermi.dat")
255  AT(0, 0, 0.9397) RELATIVE a2 ROTATED (0,0,0) RELATIVE a2
256
257COMPONENT DivMonfermi1 = Divergence_monitor(
258          nh=30, nv=30, filename="divfermi1.dat",
259          xwidth=0.06, yheight=0.1,
260          maxdiv_h=2, maxdiv_v=2)
261  AT (0, 0, 0.9398) RELATIVE a2
262
263COMPONENT PSD_Fermi1 = PSD_monitor(
264    xwidth=0.06, yheight=0.11,
265    nx=30, ny=30, filename="psdfermi1.dat")
266  AT (0, 0, 0.9399) RELATIVE a2  ROTATED (0, 0, 0) RELATIVE a2
267
268COMPONENT FoChopper = FermiChopper(
269    radius = 0.06, nu = -FERMI_SPEED, yheight = 0.11,
270    w = 0.0005, nslit = 120, alpha = 0,
271    Qc = 0 , m = 0, W = 0.0001, R0 = 0, length = 0.012)
272  AT (0, 0, 1.002) RELATIVE a2
273
274COMPONENT PSD_Fermi2 = PSD_monitor(
275    xwidth=0.06, yheight=0.11,
276    nx=30, ny=30, filename="psdfermi2.dat")
277  AT (0, 0, 1.063) RELATIVE a2  ROTATED (0, 0, 0) RELATIVE a2
278
279COMPONENT DivMonfermi2 = Divergence_monitor(
280          nh=30, nv=30, filename="divfermi2.dat",
281          xwidth=0.06, yheight=0.1,
282          maxdiv_h=2, maxdiv_v=2)
283  AT (0, 0, 1.064) RELATIVE a2
284
285COMPONENT  FERMITOF1 = Monitor_nD(
286    bins = 30, filename = "FERMI_TOF1.dat.dat", xmin = -0.05,
287    xmax = 0.05, ymin = -0.1, ymax = 0.1, options="auto, time")
288  AT (0, 0, 1.154) RELATIVE a2
289
290COMPONENT SAMPLE_SLIT = Slit(
291    xwidth=0.02, yheight=0.06)
292  AT (0, 0, 1.155) RELATIVE a2
293
294COMPONENT  FERMITOF2 = Monitor_nD(
295    bins = 30, filename = "FERMI_TOF2.dat.dat", xmin = -0.05,
296    xmax = 0.05, ymin = -0.1, ymax = 0.1, options="auto, time")
297  AT (0, 0, 1.2) RELATIVE a2
298
299COMPONENT PSD_SAMPLE = PSD_monitor(
300    xwidth=0.02, yheight=0.1,
301    nx=30, ny=30, filename="psdsample.dat")
302  AT (0, 0, 1.45) RELATIVE a2  ROTATED (0, 0, 0) RELATIVE a2
303
304COMPONENT DivMon_Sample = Divergence_monitor(
305          nh=30, nv=30, filename="div2.dat",
306          xwidth=0.01, yheight=0.06,
307          maxdiv_h=3, maxdiv_v=3)
308  AT (0, 0, 1.451) RELATIVE a2  ROTATED (0, 0, 0) RELATIVE a2
309
310COMPONENT EMON_SAMPLE = E_monitor(
311	xwidth=0.01, yheight=0.06,
312	Emin = EMIN, Emax = EMAX, nE = 60,
313	filename = "emon_sample.dat")
314  AT(0, 0, 1.452) RELATIVE a2 ROTATED (0,0,0) RELATIVE a2
315
316/* sample position */
317
318COMPONENT a3 = Arm()
319  AT (0, 0, 1.5) RELATIVE a2
320
321SPLIT COMPONENT Sample = V_sample(
322    radius = 0.008, yheight = 0.055, focus_xw=0.336, focus_yh=0.4, pack=1,
323    target_index=+3)
324  AT (0, 0, 0) RELATIVE PREVIOUS
325
326COMPONENT TOF_Det = Monitor_nD(
327 xwidth=1.5, yheight=0.2,
328 options="auto time, abs angle limits=[10 180], banana, parallel",
329 bins=100)
330AT(0, 0, 0) RELATIVE PREVIOUS
331
332COMPONENT FoDet = Monitor_nD(
333  xwidth = 0.336, yheight = 0.4,
334  options="t auto file=TofDet.dat")
335AT (0, 0, 2.5) RELATIVE a3 ROTATED (0,DET,0) RELATIVE a3
336
337COMPONENT EMON_DET = E_monitor(
338	xwidth=0.4, yheight=0.4,
339	Emin = EMIN, Emax = EMAX, nE = 80, filename = "emon_det.dat")
340  AT(0, 0, 2.501) RELATIVE a3 ROTATED (0,DET,0) RELATIVE a3
341
342END
343