<font size=2 face="sans-serif">Hi dear McStas Team!</font>
<br>
<br><font size=2 face="sans-serif">first of all I wanted to send you a
big thanks for the NIDS school in Lund !</font>
<br><font size=2 face="sans-serif">You got me started!</font>
<br>
<br><font size=2 face="sans-serif">Now... I of course come with some questions...</font>
<br><font size=2 face="sans-serif">First one is related to the use of facultative
components built using a WHEN.</font>
<br>
<br><font size=2 face="sans-serif">I 'd like to be able to activate them
via an INSTRUMENT parameter (which I understand is out of scope in the
WHEN).</font>
<br>
<br><font size=2 face="sans-serif">This is what I did: </font>
<br>
<br><font size=2 face="sans-serif">DEFINE INSTRUMENT REFSANS(... foo, bar.....</font>
<br><font size=2 face="sans-serif">
int NOK9_Type =
0 )
/* My switch*/</font>
<br>
<br><font size=2 face="sans-serif">DECLARE </font>
<br><font size=2 face="sans-serif">%{</font>
<br>
<br><font size=2 face="sans-serif"> int
NOK9_type = NOK9_Type; */ copied here to put it in WHEN scope */</font>
<br><font size=2 face="sans-serif">...</font>
<br><font size=2 face="sans-serif">%}</font>
<br>
<br><font size=2 face="sans-serif">.... long list of components...</font>
<br>
<br><font size=2 face="sans-serif">/* In order to keep a reference
to a switchable device I use an arm */</font>
<br><font size=2 face="sans-serif">COMPONENT NOK9 = Arm()</font>
<br><font size=2 face="sans-serif"> AT (0, 0, l_NOK8 + space_NOK89)
RELATIVE NOK8 </font>
<br>
<br><font size=2 face="sans-serif">/* first switchable */</font>
<br><font size=2 face="sans-serif">COMPONENT NOK9_guide = Guide_gravity(w1
= .112, ...., ) WHEN (NOK9_type == 0)</font>
<br><font size=2 face="sans-serif">
</font>
<br><font size=2 face="sans-serif"> AT (0, 0, 0) RELATIVE
NOK9</font>
<br><font size=2 face="sans-serif">....</font>
<br>
<br><font size=2 face="sans-serif">This code fails miserably with: /home/jfmoulin/McStas/refsans_chopper_all_noks_switchable.instr:50:
error: initializer element is not constant</font>
<br><font size=2 face="sans-serif">(line 50 is the declare where I copy
the instrument par...)</font>
<br><font size=2 face="sans-serif">I understand that the compiler expects
the declare to be constants but I thought this followed the tip given in
the manual ....</font>
<br>
<br><font size=2 face="sans-serif">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.</font>
<br>
<br><font size=2 face="sans-serif">Thanks a lot for any input</font>
<br><font size=2 face="sans-serif">Cheers Jean-Francois</font>
<br><font size=2 face="sans-serif">-<br>
Helmoltz Zentrum Geesthacht<br>
Institut für Werkstoffforschung<br>
Abteilung WPN, Instrument REFSANS<br>
Lichtenbergstr. 1<br>
85747 Garching FRM II<br>
Tel.: +49 (0)89 289 10762<br>
Internet: </font><a href=http://www.frm2.tum.de/><font size=2 face="sans-serif">http://www.frm2.tum.de</font></a><font size=2 face="sans-serif"><br>
</font>
<br>
<font face="Arial">Helmholtz-Zentrum Geesthacht<br>
Zentrum für Material- und Küstenforschung GmbH</font><br>
<font face="Arial">Max-Planck-Straße 1<br>
21502 Geesthacht<br>
Deutschland/Germany<br>
<br>
Geschäftsführer/Board of Management: Prof. Dr. Wolfgang Kaysser, Dipl.-Ing. Michael Ganß <br>
Vorsitzender des Aufsichtsrates/Chairman of the Supervisory Board: Ministerialrat Wilfried Kraus<br>
<br>
Amtsgericht Lübeck HRB 285 GE (Register Court)<br>
Internet: </font><a href="http://www.hzg.de"><u><font color="#0000FF" face="Arial">http://www.hzg.de</font></u></a><font face="Arial"><br>
<br>
</font><br>
<font face="Arial">ACHTUNG - ATTENTION<br>
</font><br>
<font face="Arial">Die Helmholtz-Zentrum Geesthacht Zentrum für Material- und Küstenforschung GmbH<br>
hieß bis zum 1. November 2010 GKSS-Forschungszentrum Geesthacht GmbH.</font><br>
<br>
<font face="Arial">Until 1st November 2010 the Helmholtz-Zentrum Geesthacht Zentrum für Material- und Küstenforschung GmbH was officially called GKSS-Forschungszentrum Geesthacht GmbH.<br>
</font>