[mcstas-users] switchable components (WHEN) problem

Jean-Francois.Moulin at hzg.de Jean-Francois.Moulin at hzg.de
Wed Jun 22 20:43:33 CEST 2011


Hi dear McStas Team!

first of all I wanted to send you a big thanks for the NIDS school in Lund 
!
You got me started!

Now... I of course come with some questions...
First one is related to the use of facultative components built using a 
WHEN.

I 'd like to be able to activate them via an INSTRUMENT parameter (which I 
understand is out of scope in the WHEN).

This is what I did: 

DEFINE INSTRUMENT REFSANS(... foo, bar.....
                                                  int NOK9_Type = 0 )      
        /* My switch*/

DECLARE 
%{

        int NOK9_type = NOK9_Type; */ copied here to put it in WHEN scope 
*/
...
%}

.... long list of components...

/*  In order to keep a reference to a switchable device I use an arm */
COMPONENT NOK9 = Arm()
    AT (0, 0, l_NOK8 + space_NOK89) RELATIVE NOK8 

/* first switchable */
COMPONENT NOK9_guide = Guide_gravity(w1 = .112, ...., ) WHEN (NOK9_type == 
0)
 
    AT (0, 0, 0) RELATIVE NOK9
....

This code fails miserably with: 
/home/jfmoulin/McStas/refsans_chopper_all_noks_switchable.instr:50: error: 
initializer element is not constant
(line 50 is the declare where I copy the instrument par...)
I understand that the compiler expects the declare to be constants but I 
thought this followed the tip given in the manual ....

As an additional remark, the manual references Neutron 
site/ILL/ILL_TOF_Env as an example... but this file does not exist on my 
install.

Thanks a lot for any input
Cheers Jean-Francois
-
Helmoltz Zentrum Geesthacht
Institut für Werkstoffforschung
Abteilung WPN, Instrument REFSANS
Lichtenbergstr. 1
85747 Garching FRM II
Tel.: +49 (0)89 289 10762
Internet: http://www.frm2.tum.de



Helmholtz-Zentrum Geesthacht
Zentrum für Material- und Küstenforschung GmbH
Max-Planck-Straße 1
21502 Geesthacht
Deutschland/Germany

Geschäftsführer/Board of Management: Prof. Dr. Wolfgang Kaysser, Dipl.-Ing. Michael Ganß 
Vorsitzender des Aufsichtsrates/Chairman of the Supervisory Board: Ministerialrat Wilfried Kraus

Amtsgericht Lübeck  HRB 285 GE (Register Court)
Internet: http://www.hzg.de


ACHTUNG - ATTENTION

Die Helmholtz-Zentrum Geesthacht Zentrum für Material- und Küstenforschung GmbH
hieß bis zum 1. November 2010 GKSS-Forschungszentrum Geesthacht GmbH.

Until 1st November 2010 the Helmholtz-Zentrum Geesthacht Zentrum für Material- und Küstenforschung GmbH was officially called GKSS-Forschungszentrum Geesthacht GmbH.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20110622/531e30b4/attachment.html>


More information about the mcstas-users mailing list