Skip to content

Control Elements

David Sagan edited this page Aug 26, 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*k1}, k1
gr1: group = {b[e1]: 0.4*sqrt(k)}, var = {k}

Start Tao with the command

  > tao -lat lat.bmad 

Control Element Organization in the Lattice

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.

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.

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*K1
       5   OV2                             X_OFFSET            Overlay             0.1*k1

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 k1 = 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.

    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}

**

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.