Skip to content

Control Elements

ChristopherMayes edited this page Sep 6, 2017 · 10 revisions

Overview

Control elements are elements that control the parameters of other elements. These elements are called groups and overlays. Overlays and groups are convenient to do such things as simulate control room "knobs". For example a power supply that powers a chain of magnets can be simulated with a control element.


Setup

Example:

beginning[beta_a] = 10
beginning[beta_b] = 10

parameter[particle] = muon
parameter[p0c] = 1e9
parameter[geometry] = open

q: quadrupole, l = 1
b: sbend, l = 1
ll: line = (q, b)
use, ll

ov1: overlay = {q[k1]: a+b^2, b[g]: 0.1*a+tan(b)}, var = {a, b}
ov2: overlay = {q[k1]: 0.7, q[x_offset]: 0.1*kt}, var={kt}
gr1: group = {b[e1]: 0.4*sqrt(k)}, var = {k}
  • Here overlay ov1 controls two parameters: The k1 attribute of element q and the g attribute of element b.

  • Overlay ov1 has two variables called a and b that are used to control the two attributes.

  • The formulas for overlay ov1 that are used to calculate the the values of the two controlled attributes are a+b^2 for q[k1] and ** 0.1*a+tan(b)** for b[g].

  • Since overlay ov2 also controls q[k1], the value of **q[k1] is the sum of the contributions of ov1 and ov2.

  • The given "formula" for the control of q[k1] by ov2 is just a constant: 0.7. This is a shorthand notation and the actual formula used is 0.7 * kt. Note: When this shorthand notation is used, only one variable (in this case kt) may be used by the overlay.

  • The difference between group and **overlay elements is explained below.


Control Element Organization in the Lattice

Save the above lattice to a file "control.bmad" and run Tao:

> tao -lat control.bmad 

Tao> show lat
      Values at End of Element:
 Index  name      key                       s       l    beta     phi    eta  orbit     beta     phi    eta  orbit    Track_State
                                                            a       a      a  x [mm]       b       b      b  y [mm]
     0  BEGINNING Beginning_Ele         0.000     ---   10.00   0.000   0.00   0.000   10.00   0.000   0.00   0.000   Alive
     1  Q         Quadrupole            1.000   1.000   10.10   0.100   0.00   0.000   10.10   0.100   0.00   0.000   Alive
     2  B         Sbend                 2.000   1.000   10.40   0.197   0.00   0.000   10.40   0.197   0.00   0.000   Alive
     3  END       Marker                2.000   0.000   10.40   0.197   0.00   0.000   10.40   0.197   0.00   0.000   Alive
Lord Elements:
     4  OV1       Overlay               2.000     ---   10.40   0.197   0.00     ---   10.40   0.197   0.00     ---   Not_Set
     5  OV2       Overlay               1.000     ---   10.10   0.100   0.00     ---   10.10   0.100   0.00     ---   Not_Set
     6  GR1       Group                 2.000     ---   10.40   0.197   0.00     ---   10.40   0.197   0.00     ---   Not_Set
 Index  name      key                       s       l    beta     phi    eta  orbit     beta     phi    eta  orbit    Track_State
                                                            a       a      a  x [mm]       b       b      b  y [mm]
      Values at End of Element:

The list of lattice elements is divided up into two sections

  • The "tracking" part of the lattice are the elements to be tracked through. Here the tracking part of the lattice is elements 0 through 3 .
  • The "lord" section of the lattice are where the overlay and group elements (and other "lord" elements as described elsewhere). Here the lord section is elements 4 through 6.

Examining Controls

Tao> show ele 4
 Element #                4
 Element Name: OV1
 Key: Overlay
... ... ... etc...
Slave_status: Free
Lord_status:  Overlay_Lord
Control Variables:
    1   A                                         =  0.0000000E+00
    2   B                                         =  0.0000000E+00
Slaves: [Attrib_Val = Expression_Val summed over all overlays controlling the attribute.]
   Index   Ele_Name    Attribute         Attrib_Value  Expression_Val    Expression
       1   Q           K1                  0.0000E+00      0.0000E+00    a+b^2
       2   B           G                   0.0000E+00      0.0000E+00    0.1*a+tan(b)
... ... ... etc...

And

Tao> show ele q
 Element #                1
 Element Name: Q

        ... etc...

Slave_status: Minor_Slave
Controller Lord(s):
   Index   Name                            Attribute           Lord_Type           Expression
       4   OV1                             K1                  Overlay             a+b^2
       5   OV2                             K1                  Overlay             0.7*KT
       5   OV2                             X_OFFSET            Overlay             0.1*kT

Lord_status:  Not_a_Lord

        ... etc...

Overlay Control

When a element parameter is controlled by one or more overlays, the value of the element parameter is the sum of the values for each overlay.

Tao> set ele ov1 a = 0.02
Tao> set ele ov2 kt = 0.01

Tao> show ele q
 Element #                1
 Element Name: Q
... etc...

 Attribute values [Only non-zero/non-default values shown]:
    1   L                            =  1.0000000E+00 m
    4   K1                           =  2.7000000E-02 1/m^2
... etc...

The value of a parameter that is controlled by overlays may not be directly changed:

Tao> set ele q k1 = 0.02
[ERROR | 2017-AUG-26 13:29:26] attribute_free:
    THE ATTRIBUTE: K1
    OF THE ELEMENT: Q
    IS NOT FREE TO VARY SINCE:
    IT IS CONTROLLED BY THE OVERLAY: OV1

Group Control

  • Unlike overlay control, a parameter that is controlled by one or more group elements is free to vary.
  • When a group element is varied, a change in the value for parameters it controls is computed.

Example:

Tao> set ele gr1 k = 0.01

Tao> show ele gr1
 Element #                6
 Element Name: GR1
 Key: Group

... etc...    

Slave_status: Free
Lord_status:  Group_Lord
Control Variables:
    1   K  =  1.0000000E-02           OLD_K  =  1.0000000E-02
Slaves: [Attrib_Val = Value of the controlled attribute, Expression_Val = Value calculated by the Group element.]
   Index   Ele_Name    Attribute         Attrib_Value  Expression_Val    Expression
       2   B           K1                  4.0000E-02      4.0000E-02    0.4*sqrt(k)

Tao> set ele b k1 = 0.02
Tao> set ele gr1 k = 0.04

Tao> show ele gr1
... etc...
Control Variables:
    1   K  =  4.0000000E-02           OLD_K  =  4.0000000E-02
Slaves: [Attrib_Val = Value of the controlled attribute, Expression_Val = Value calculated by the Group element.]
   Index   Ele_Name    Attribute         Attrib_Value  Expression_Val    Expression
       2   B           K1                  6.0000E-02      8.0000E-02    0.4*sqrt(k)

What is a group element useful for? Example: Consider the situation where you want to control the chromaticity (change in tune with particle energy) of a ring by varying sextupole strengths. To change the chromaticity by 1 unit you want to change the sextupole strengths by some amount that you compute. Here you don't care about the value of the sextupole strengths, you only want to vary the sextupole strengths by a delta.

raw_xqune_1 : group ={SEX_08W:-.6415E-03*k2, SEX_08E:-.6847E-03*k2,...}, var = {k2}

Notes:

  • Group and overlay elements can control other group and overlay elements.
  • A given element parameter may only be controlled by a set of group elements or a set of overlay elements but may not be controlled by both group and overlay elements.

Girder Controller

A third type of controller is the girder element which can be used to simulate support structures. See the Bmad manual for more details.