/******************************************************************************* * %I * Written by: Philipp Bernhardt * Date: Januar 22 1999 * Version: $Revision: 1.1.1.1 $ * Origin: McStas release * * Disk chopper. * * %D * Models a disc chopper with n identical slits, which are symmetrically disposed on the disc. * * %P * INPUT PARAMETERS: * * w: (m) Width of the slits at the bottom side * R: (m) Radius of the disc * f: (rad/s) angular frequency of the Chopper (algebraic sign defines the direction * of rotation * n: (1) Number of slits * pha: (s) Phase * * %D * Example values: w=0.05 R=0.5 f=2500 n=3 pha=0 * * %E *******************************************************************************/ DEFINE COMPONENT Chopper DEFINITION PARAMETERS () SETTING PARAMETERS (w, R, f, n, pha) OUTPUT PARAMETERS (Tg, To) STATE PARAMETERS (x, y, z, vx, vy, vz, t, s1, s2, p) DECLARE %{ double Tg,To; %} INITIALIZE %{ /* time between two pulses */ Tg=2*PI/fabs(f)/n; /* how long can neutrons pass the Chopper at a single point */ To=2*atan(w/R/2.0)/fabs(f); %} TRACE %{ double toff; PROP_Z0; toff=fabs(t-atan2(x,y+R)/f-pha)+To/2.0; /* does neutron hit the slit? */ if (fmod(toff,Tg)>To) ABSORB; %} END