Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,27 @@ An individual element looks like:
Ele: "qf" (b1>>2) Quadrupole
branch Branch 1: "b1"
ix_ele 2
BodyShiftGroup:
BodyShiftParams:
offset [0.0, 0.0, 0.0] m offset_tot [0.0, 0.0, 0.0] m
x_rot 0 rad x_rot_tot 0 rad
y_rot 0 rad y_rot_tot 0 rad
tilt 0 rad tilt_tot 0 rad
ApertureGroup:
ApertureParams:
x_limit [NaN, NaN] m y_limit [NaN, NaN] m
aperture_at BodyLoc.ENTRANCE_END
aperture_type ApertureShape.ELLIPTICAL
misalignment_moves_aperture true
BMultipoleGroup:
BMultipoleParams:
Order Integrated Tilt (rad)
1 false 0.0 0.34 Kn1 0.0 Ks1 (1/m^2)
-0.011341179236737171 Bn1 -0.0 Bs1 (T/m^1)
EMultipoleGroup: No electric multipoles
OrientationGroup:
EMultipoleParams: No electric multipoles
OrientationParams:
r (r_floor) [0.0, 0.0, 0.0] m
q (q_floor) 1.0 + 0.0⋅i + 0.0⋅j + 0.0⋅k
theta (theta_floor) 0.0 rad
phi (phi_floor) 0.0 rad psi (psi_floor) 0.0 rad
LengthGroup:
LengthParams:
L 0.6 m orientation 1
s 0.0 m s_downstream 0.6 m
... etc...
Expand Down
16 changes: 8 additions & 8 deletions manual/attic/Notes.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
* Some element parameter groups may or may not be present. EG: AmpVsTimeGroup for ACKicker.
* Some element parameter groups may or may not be present. EG: AmpVsTimeParams for ACKicker.

* EG AmpVsTimeGroup: There are no "shortcuts" like ele.L -> ele.LengthGroup.L. Can set via:
at = ele.AmpVsTimeGroup # Does this work if AmpVsTimeGroup is not present? If so need function for this.
* EG AmpVsTimeParams: There are no "shortcuts" like ele.L -> ele.LengthParams.L. Can set via:
at = ele.AmpVsTimeParams # Does this work if AmpVsTimeParams is not present? If so need function for this.
at.interpolation = ...
or
at = AmpVsTimeGroup(t_offset = ...)
at = AmpVsTimeParams(t_offset = ...)
at.interpolation = ...
...
ele.AmpVsTimeGroup = at
ele.AmpVsTimeParams = at

* BeamBeam element can have a reference to a Solenoid element

Expand Down Expand Up @@ -52,7 +52,7 @@ The reason for doing a shallow copy, instead of a deep copy, is to save on memor
* "Lattice" bookkeeping triggered by user (or optimizer).
* Drifts are temporarily put in branch.ele_saved for superposition.

* MultipassLord elements do not have orientation, s, nor s_downstream parameters but does have a LengthGroup
* MultipassLord elements do not have orientation, s, nor s_downstream parameters but does have a LengthParams

* Lattice bookkeeping can be bypassed by setting the element group parameter directly.

Expand All @@ -71,7 +71,7 @@ Note: Could also have defined parameters to be Union{Float64,Missing} but this p

* Implementation note: Bookkeeping is element-by-element rather then parameter group by parameter group since
the parameter groups are not necessarily independent. For example, the reference time will depend upon
the OrientationGroup if the lattice contains a flexible patch.
the OrientationParams if the lattice contains a flexible patch.

* Using Strings for the keys of ele.pdict[] would have worked instead of Symbols. Using Symbols gives
a slightly cleaner look to the code.
Expand All @@ -87,7 +87,7 @@ values is redefined).

* Coding tip: Element group structures are not mutable by design to maximize tracking speed. This is a bit inconvenient when a structure needs to be modified. One way to handle this is using the @set macro. Another way is to convert a structure instance to a Dict, change the Dict, and then convert back (note: this is possible since the @kwdef macro was used to define the element group structures). Example: ...

* Some element groups are optional and may not be present in a given element. For example, LengthGroup is required and BMultipoleGroup and EMultipoleGroup are optional.
* Some element groups are optional and may not be present in a given element. For example, LengthParams is required and BMultipoleParams and EMultipoleParams are optional.

* Online documentation: For element groups use REPL "?" and type in the name.

Expand Down
2 changes: 1 addition & 1 deletion manual/bookkeeping.tex
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ \section{Lord/Slave Bookkeeping}
Multipass: Multipass lords Multipass Slaves \sref{c:multipass}
\end{example}

The lord and slave slave status of a lattice element is contained in the \vn{LordSlaveStatusGroup}
The lord and slave slave status of a lattice element is contained in the \vn{LordSlaveStatusParams}
parameter group. The components of this group are (\sref{s:lord.slave.g}):
\begin{example}
lord_status::Lord.T - Lord status.
Expand Down
2 changes: 1 addition & 1 deletion manual/coordinates.tex
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ \section{Branch Coordinates Construction}
branch coordinate system starts at the \vn{BeginningEle} element (\sref{s:begin.ele}) at the start of a
branch. If the branch is a \vn{root} branch (\sref{s:lattice.def}), The orientation of the beginning
element within the floor coordinate system (\sref{s:coords}) can be fixed by setting
\vn{OrientationGroup parameters} (\sref{s:orientationition.g}) in the \vn{BeginningEle} element.
\vn{OrientationParams parameters} (\sref{s:orientationition.g}) in the \vn{BeginningEle} element.
If the branch is not a \vn{root} branch, the position
of the beginning element is determined by the position of the \vn{Fork} element
from which the branch forks from. The default value of $s$ at the \vn{BeginningEle} element is zero
Expand Down
58 changes: 29 additions & 29 deletions manual/ele-anatomy.tex
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@ \section{Instantiating a Lattice Element}
\end{example}

%---------------------------------------------------------------------------------------------------
\section{Element Parameter Groups}
\section{Element Parameter Paramss}
\label{s:ele.groups}

Generally, element parameters are grouped into ``\vn{element} \vn{parameter} \vn{group}''
structs which inherit from the abstract type \vn{EleParameterGroup}.
structs which inherit from the abstract type \vn{EleParameterParams}.
Element parameter documentation is in Chapter~\sref{c:ele.groups}. In the REPL,
To see a list of parameter groups, use the \vn{suptypes} function:
\begin{example}
julia> subtypes(EleParameterGroup)
julia> subtypes(EleParameterParams)
28-element Vector{Any}:
BodyShiftGroup
ApertureGroup
BMultipoleGroup
BodyShiftParams
ApertureParams
BMultipoleParams
...
\end{example}
Chapter~\sref{c:ele.types} documents the parameters groups that are associated with any particular element type.
Expand All @@ -83,44 +83,44 @@ \section{Element Parameter Groups}

Associated parameter groups
===========================
BodyShiftGroup -> Element position/orientation shift.
ApertureGroup -> Vacuum chamber aperture.
BMultipoleGroup -> Magnetic multipoles.
EMultipoleGroup -> Electric multipoles.
OrientationGroup -> Floor position and orientation.
LengthGroup -> Length and s-position parameters.
LordSlaveGroup -> Element lord and slave status.
MasterGroup -> Contains field_master parameter.
ReferenceGroup -> Reference energy and species.
DescriptionGroup -> String labels for element.
TrackingGroup -> Default tracking settings.
BodyShiftParams -> Element position/orientation shift.
ApertureParams -> Vacuum chamber aperture.
BMultipoleParams -> Magnetic multipoles.
EMultipoleParams -> Electric multipoles.
OrientationParams -> Floor position and orientation.
LengthParams -> Length and s-position parameters.
LordSlaveParams -> Element lord and slave status.
MasterParams -> Contains field_master parameter.
ReferenceParams -> Reference energy and species.
DescriptionParams -> String labels for element.
TrackingParams -> Default tracking settings.
\end{example}
Alternatively,

%---------------------------------------------------------------------------------------------------
\section{Element Parameters}
\label{s:ele.params}

For example, the \vn{LengthGroup} holds the length and s-positions of the element and is defined by:
For example, the \vn{LengthParams} holds the length and s-positions of the element and is defined by:
\begin{example}
@kwdef struct LengthGroup <: EleParameterGroup
@kwdef struct LengthParams <: EleParameterParams
L::Number = 0.0 # Length of element
s::Number = 0.0 # Starting s-position
s_downstream::Number = 0.0 # Ending s-position
orientation::Int = 1 # Longitudinal orientation
end
\end{example}
The \vn{@kwdef} macro automatically defines a keyword-based constructor for \vn{LengthGroup}.
The \vn{@kwdef} macro automatically defines a keyword-based constructor for \vn{LengthParams}.
See the Julia manual for more information on \vn{@kwdef}.
To see a list of all element parameter groups use the \vn{subtypes(EleParamterGroup)} command.
To see a list of all element parameter groups use the \vn{subtypes(EleParamterParams)} command.
To see the components of a given group use the \vn{fieldnames} function. For information on
a given element parameter use the \vn{info(::Symbol)} function where the argument is the
symbol corresponding to the component. For example, the information on
the \vn{s_downstream} parameter which is a field of the \vn{LengthGroup} is:
the \vn{s_downstream} parameter which is a field of the \vn{LengthParams} is:
\begin{example}
julia> info(:s_downstream)
User name: s_downstream
Stored in: LengthGroup.s_downstream
Stored in: LengthParams.s_downstream
Parameter type: Number
Units: m
Description: Longitudinal s-position at the downstream end.
Expand All @@ -135,7 +135,7 @@ \section{Element Parameters}
\begin{example}
julia> info(:theta)
User name: theta_floor
Stored in: OrientationGroup.theta
Stored in: OrientationParams.theta
Parameter type: Number
Units: rad
Description: Element floor theta angle orientation
Expand All @@ -145,9 +145,9 @@ \section{Element Parameters}
@ele bg = BeginningEle(theta_floor = 0.3) # Set at element definition time.
bg.theta_floor = 2.7 # Or set after definition.
\end{example}
But the component in the \vn{OrientationGroup} is \vn{theta} so
But the component in the \vn{OrientationParams} is \vn{theta} so
\begin{example}
bg.OrientationGroup.theta = 2.7 # Equivalent to the set above.
bg.OrientationParams.theta = 2.7 # Equivalent to the set above.
\end{example}

%---------------------------------------------------------------------------------------------------
Expand All @@ -157,13 +157,13 @@ \section{How Element Parameters are Stored in an Element}
All lattice element types have a single field of type \vn{Dict\{Symbol,Any\}} named \vn{pdict}.
The values of \vn{pdict} will, with a few exceptions, be an
element parameter group. The corresponding key for a parameter group in \vn{pdict} is the symbol associated
with the type. For example, a \vn{LengthGroup} struct would be stored in \vn{pdict[:LengthGroup]}.
with the type. For example, a \vn{LengthParams} struct would be stored in \vn{pdict[:LengthParams]}.

To (partially) hide the complexity of parameter groups, the dot selection operator is overloaded for elements.
This is achieved by overloading the \vn{Base.setproperty} and \vn{Base.getproperty} functions,
which get called when the dot selection operator is used.
For example, if \vn{q} is an element instance, \vn{q.s} will get mapped to \vn{q.pdict[:LengthGroup].s}.
Additionally, \vn{q.LengthGroup} is mapped to \vn{q.pdict[:LengthGroup]}.
For example, if \vn{q} is an element instance, \vn{q.s} will get mapped to \vn{q.pdict[:LengthParams].s}.
Additionally, \vn{q.LengthParams} is mapped to \vn{q.pdict[:LengthParams]}.

Besides simplifying the syntax, overloading the dot selection operator has a second purpose which
is to allow the \accellat bookkeeping routines to properly do dependent parameter bookkeeping (\sref{param.depend}).
Expand Down
Loading
Loading