Skip to Content.
Sympa Menu

opal - Re: [Opal] String variable for aperture

opal AT

Subject: The OPAL Discussion Forum

List archive

Re: [Opal] String variable for aperture

Chronological Thread 
  • From: "Snuverink Jochem (PSI)" <jochem.snuverink AT>
  • To: "opal AT" <opal AT>, Simon Friederich <s.friederich AT>
  • Subject: Re: [Opal] String variable for aperture
  • Date: Wed, 1 Apr 2020 13:33:16 +0000
  • Accept-language: en-US, de-CH

Dear Simon,

I think there is unfortunately no better way to do it.

As you noticed, 'apert1' is still interpreted as a string (without quotes it is converted to uppercase), and not as a variable.

See also and

Cheers, Jochem

From: opal-request AT <opal-request AT> on behalf of Simon Friederich <s.friederich AT>
Sent: Wednesday, April 1, 2020 1:26:27 PM
To: opal AT
Subject: [Opal] String variable for aperture

Dear all,

As we have changing apertures throughout our beamline I'd really like to use string variables but I don't get the correct syntax. I want something like:

STRING apert1 = "circle(0.015)"
STRING apert2 = "circle(0.030)"

drift1: DRIFT, ELEMEDGE=0.5, APERTURE=apert1, L=0.5;
drift2: DRIFT, ELEMEDGE=1, APERTURE=apert2, L=0.5;

But the error appears
Error> *** User error detected by function "OpalElement::getApert()"
Error>     Unknown aperture type 'APERT1'.
Error>     Unknown aperture type 'APERT1'.

Do I miss something?

Best regards

P.S.: I know this workaround does it
REAL napert1 = 0.015;

REAL napert2 = 0.030;

drift1: DRIFT, ELEMEDGE=0.5, APERTURE="circle(" & STRING(napert1) & ")", L=0.5;
drift1: DRIFT, ELEMEDGE=1, APERTURE="circle(" & STRING(napert2) & ")", L=0.5;

But maybe there is a better way to do it.

Dr. Simon Friederich
Helmholtz-Institut Mainz
Kollaboration B / ACID
Johannes Gutenberg-Universit├Ąt Mainz
Staudingerweg 18
55128 Mainz, Deutschland

Tel.: +49 (0)6131 39-23160
E-Mail: s.friederich AT

Archive powered by MHonArc 2.6.19.

Top of Page