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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Ele: "qf" (b1>>2) Quadrupole
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
FloorPositionGroup:
OrientationGroup:
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
Expand Down
2 changes: 1 addition & 1 deletion manual/attic/Notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 FloorPositionGroup if the lattice contains a flexible patch.
the OrientationGroup 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 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{FloorPositionGroup parameters} (\sref{s:floor.position.g}) in the \vn{BeginningEle} element.
\vn{OrientationGroup 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
8 changes: 4 additions & 4 deletions manual/ele-anatomy.tex
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ \section{Element Parameter Groups}
• ApertureGroup -> Vacuum chamber aperture.
• BMultipoleGroup -> Magnetic multipoles.
• EMultipoleGroup -> Electric multipoles.
FloorPositionGroup -> Floor position and orientation.
OrientationGroup -> Floor position and orientation.
• LengthGroup -> Length and s-position parameters.
• LordSlaveGroup -> Element lord and slave status.
• MasterGroup -> Contains field_master parameter.
Expand Down Expand Up @@ -135,7 +135,7 @@ \section{Element Parameters}
\begin{example}
julia> info(:theta)
User name: theta_floor
Stored in: FloorPositionGroup.theta
Stored in: OrientationGroup.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{FloorPositionGroup} is \vn{theta} so
But the component in the \vn{OrientationGroup} is \vn{theta} so
\begin{example}
bg.FloorPositionGroup.theta = 2.7 # Equivalent to the set above.
bg.OrientationGroup.theta = 2.7 # Equivalent to the set above.
\end{example}

%---------------------------------------------------------------------------------------------------
Expand Down
44 changes: 22 additions & 22 deletions manual/ele-param-groups.tex
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ \chapter{Element Parameter Groups}
\begin{tabular}{llll} \toprule
{\it Group} & {\it Section} & {\it Group} & {\it Section} \\
\midrule
ACKickerGroup & \sref{s:ackicker.g} & InitParticleGroup & \sref{s:init.particle.g} \\
AlignmentGroup & \sref{s:alignment.g} & LengthGroup & \sref{s:length.g} \\
ApertureGroup & \sref{s:aperture.g} & LordSlaveStatusGroup & \sref{s:lord.slave.g} \\
BMultipoleGroup & \sref{s:bmultipole.g} & MasterGroup & \sref{s:master.g} \\
ACKickerGroup & \sref{s:ackicker.g} & LengthGroup & \sref{s:length.g} \\
AlignmentGroup & \sref{s:alignment.g} & LordSlaveStatusGroup & \sref{s:lord.slave.g} \\
ApertureGroup & \sref{s:aperture.g} & MasterGroup & \sref{s:master.g} \\
BMultipoleGroup & \sref{s:bmultipole.g} & OrientationGroup & \sref{s:orientation.g} \\
BeamBeamGroup & \sref{s:beam.beam.g} & OriginEleGroup & \sref{s:origin.ele.g} \\
BendGroup & \sref{s:bend.g} & PatchGroup & \sref{s:patch.g} \\
DescriptionGroup & \sref{s:descrip.g} & RFGroup & \sref{s:rf.g} \\
DownstreamReferenceGroup & \sref{s:dreference.g} & RFAutoGroup & \sref{s:rfauto.g} \\
EMultipoleGroup & \sref{s:emultipole.g} & ReferenceGroup & \sref{s:reference.g} \\
FloorPositionGroup & \sref{s:floor.pos.g} & SolenoidGroup & \sref{s:solenoid.g} \\
ForkGroup & \sref{s:fork.g} & TrackingGroup & \sref{s:tracking.g} \\
GirderGroup & \sref{s:girder.g} & TwissGroup & \sref{s:twiss.g} \\
ForkGroup & \sref{s:fork.g} & SolenoidGroup & \sref{s:solenoid.g} \\
GirderGroup & \sref{s:girder.g} & TrackingGroup & \sref{s:tracking.g} \\
InitParticleGroup & \sref{s:init.particle.g} & TwissGroup & \sref{s:twiss.g} \\
\bottomrule
\end{tabular}
}
Expand Down Expand Up @@ -771,21 +771,6 @@ \section{EMultipoleGroup}
Similarly, the setting of the \vn{field_master} parmeter (\sref{s:master.g}) will determine
whether normalized or unnormalized quantities will stay constant if the reference energy is varied.

%---------------------------------------------------------------------------------------------------
\section{FloorPositionGroup}
\label{s:floor.pos.g}

The \vn{FloorPositionGroup} stores the nominal (calculated without alignment shifts)
position and orientation in the floor coordinates of the upstream end of the element.
system. The components of this group are:
\begin{example}
r::Vector - [x,y,z] position. Accessed using \vn{r_floor}
q::Quaternion - Quaternion orientation. Accessed using \vn{q_floor}.
\end{example}




%---------------------------------------------------------------------------------------------------
\section{ForkGroup}
\label{s:fork.g}
Expand Down Expand Up @@ -883,6 +868,21 @@ \section{MasterGroup}
field_master::Bool = false # Does field or normalized field stay constant with energy changes?
\end{example}

%---------------------------------------------------------------------------------------------------
\section{OrientationGroup}
\label{s:orientation.g}

The \vn{OrientationGroup} stores the nominal (calculated without alignment shifts)
position and angular orientation in the floor coordinates of the upstream end of the element.
system. The components of this group are:
\begin{example}
r::Vector - [x,y,z] position. Accessed using \vn{r_floor}
q::Quaternion - Quaternion orientation. Accessed using \vn{q_floor}.
\end{example}




%---------------------------------------------------------------------------------------------------
\section{OriginEleGroup}
\label{s:origin.ele.g}
Expand Down
24 changes: 12 additions & 12 deletions manual/ele-types.tex
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ \section{ACKicker}
AlignmentGroup -> Element position/orientation shift. \sref{s:align.g}
ApertureGroup -> Vacuum chamber aperture. \sref{s:aperture.g}
BMultipoleGroup -> Magnetic multipoles. \sref{s:bmultipole.g}
FloorPositionGroup -> Floor floor position and orientation. \sref{s:floor.pos.g}
OrientationGroup -> Floor floor position and orientation. \sref{s:orientation.g}
LengthGroup -> Length and s-position parameters. \sref{s:length.g}
LordSlaveGroup -> Element lord and slave status. \sref{s:lord.slave.g}
MasterGroup -> Contains field_master parameter. \sref{s:master.g}
Expand Down Expand Up @@ -88,7 +88,7 @@ \section{BeamBeam}
Element parameter groups associated with this element type are:
\TOPrule
\begin{example}
FloorPositionGroup -> Floor floor position and orientation. \sref{s:floor.pos.g}
OrientationGroup -> Floor floor position and orientation. \sref{s:orientation.g}
LengthGroup -> Length and s-position parameters. \sref{s:length.g}
LordSlaveGroup -> Element lord and slave status. \sref{s:lord.slave.g}
DescriptionGroup -> Element descriptive strings. \sref{s:descrip.g}
Expand All @@ -111,7 +111,7 @@ \section{BeginningEle}
Element parameter groups associated with this element type are:
\TOPrule
\begin{example}
FloorPositionGroup -> Floor floor position and orientation. \sref{s:floor.pos.g}
OrientationGroup -> Floor floor position and orientation. \sref{s:orientation.g}
InitParticleGroup -> Initial particle position and spin. \sref{s:init.particle.g}
LengthGroup -> Length and s-position parameters. \sref{s:length.g}
LordSlaveGroup -> Element lord and slave status. \sref{s:lord.slave.g}
Expand Down Expand Up @@ -148,7 +148,7 @@ \section{Bend}
BMultipoleGroup -> Magnetic multipoles. \sref{s:bmultipole.g}
BendGroup -> Bend element parameters. \sref{s:bend.g}
EMultipoleGroup -> Electric multipoles. \sref{s:emultipole.g}
FloorPositionGroup -> Floor floor position and orientation. \sref{s:floor.pos.g}
OrientationGroup -> Floor floor position and orientation. \sref{s:orientation.g}
LengthGroup -> Length and s-position parameters. \sref{s:length.g}
LordSlaveGroup -> Element lord and slave status. \sref{s:lord.slave.g}
MasterGroup -> Contains field_master parameter. \sref{s:master.g}
Expand Down Expand Up @@ -195,7 +195,7 @@ \section{Collimator}
Element parameter groups associated with this element type are:
\TOPrule
\begin{example}
FloorPositionGroup -> Floor floor position and orientation. \sref{s:floor.pos.g}
OrientationGroup -> Floor floor position and orientation. \sref{s:orientation.g}
LengthGroup -> Length and s-position parameters. \sref{s:length.g}
LordSlaveGroup -> Element lord and slave status. \sref{s:lord.slave.g}
DescriptionGroup -> Element descriptive strings. \sref{s:descrip.g}
Expand All @@ -217,7 +217,7 @@ \section{Converter}
Element parameter groups associated with this element type are:
\TOPrule
\begin{example}
FloorPositionGroup -> Floor floor position and orientation. \sref{s:floor.pos.g}
OrientationGroup -> Floor floor position and orientation. \sref{s:orientation.g}
LengthGroup -> Length and s-position parameters. \sref{s:length.g}
LordSlaveGroup -> Element lord and slave status. \sref{s:lord.slave.g}
DescriptionGroup -> Element descriptive strings. \sref{s:descrip.g}
Expand All @@ -240,7 +240,7 @@ \section{CrabCavity}
Element parameter groups associated with this element type are:
\TOPrule
\begin{example}
FloorPositionGroup -> Floor floor position and orientation. \sref{s:floor.pos.g}
OrientationGroup -> Floor floor position and orientation. \sref{s:orientation.g}
LengthGroup -> Length and s-position parameters. \sref{s:length.g}
LordSlaveGroup -> Element lord and slave status. \sref{s:lord.slave.g}
DescriptionGroup -> Element descriptive strings. \sref{s:descrip.g}
Expand All @@ -260,7 +260,7 @@ \section{Drift}
Element parameter groups associated with this element type are:
\TOPrule
\begin{example}
FloorPositionGroup -> Floor floor position and orientation. \sref{s:floor.pos.g}
OrientationGroup -> Floor floor position and orientation. \sref{s:orientation.g}
LengthGroup -> Length and s-position parameters. \sref{s:length.g}
LordSlaveGroup -> Element lord and slave status. \sref{s:lord.slave.g}
DescriptionGroup -> Element descriptive strings. \sref{s:descrip.g}
Expand All @@ -282,7 +282,7 @@ \section{EGun}
Element parameter groups associated with this element type are:
\TOPrule
\begin{example}
FloorPositionGroup -> Floor floor position and orientation. \sref{s:floor.pos.g}
OrientationGroup -> Floor floor position and orientation. \sref{s:orientation.g}
LengthGroup -> Length and s-position parameters. \sref{s:length.g}
LordSlaveGroup -> Element lord and slave status. \sref{s:lord.slave.g}
DescriptionGroup -> Element descriptive strings. \sref{s:descrip.g}
Expand All @@ -306,7 +306,7 @@ \section{Fiducial}
Element parameter groups associated with this element type are:
\TOPrule
\begin{example}
FloorPositionGroup -> Floor floor position and orientation. \sref{s:floor.pos.g}
OrientationGroup -> Floor floor position and orientation. \sref{s:orientation.g}
LengthGroup -> Length and s-position parameters. \sref{s:length.g}
LordSlaveGroup -> Element lord and slave status. \sref{s:lord.slave.g}
DescriptionGroup -> Element descriptive strings. \sref{s:descrip.g}
Expand Down Expand Up @@ -361,7 +361,7 @@ \section{Fork}
Element parameter groups associated with this element type are:
\TOPrule
\begin{example}
FloorPositionGroup -> Floor floor position and orientation. \sref{s:floor.pos.g}
OrientationGroup -> Floor floor position and orientation. \sref{s:orientation.g}
LengthGroup -> Length and s-position parameters. \sref{s:length.g}
DescriptionGroup -> Element descriptive strings. \sref{s:descrip.g}
TrackingGroup -> Default tracking settings. \sref{s:tracking.g}
Expand Down Expand Up @@ -559,7 +559,7 @@ \section{Girder}
Element parameter groups associated with this element type are:
\TOPrule
\begin{example}
FloorPositionGroup -> Floor floor position and orientation. \sref{s:floor.pos.g}
OrientationGroup -> Floor floor position and orientation. \sref{s:orientation.g}
LengthGroup -> Length and s-position parameters. \sref{s:length.g}
DescriptionGroup -> Element descriptive strings. \sref{s:descrip.g}
AlignmentGroup -> Alignment with respect to the reference. \sref{s:alignment.g}
Expand Down
9 changes: 5 additions & 4 deletions manual/introduction.tex
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,9 @@ \section{Lattice Branches}
All tracking branches have a name \vn{Branch.name} inherited from the \vn{BeamLine} that defines
the branch in the lattice file and branches contains an array of elements \vn{Branch.ele[]}.
If the \vn{BeamLine} used to instantiate a tracking branch does not have a name, The default name
is used. The default name is \vn{"bN"} where \vn{N} is the index of the
branch in the \vn{Lattice.branch} array.
is used. The default name is \vn{"Bn"} where \vn{n} is the index of the
branch in the \vn{Lattice.branch} array. For example, \vn{"B2"} would be the default name of
\vn{lat.branch[2]} (assuming that this is a tracking branch).

%---------------------------------------------------------------------------
\section{Lattices}
Expand Down Expand Up @@ -182,11 +183,11 @@ \section{Lattices}

Similarly, lattice elements can be accessed by name or by index.
For example, if \vn{lat} is a lattice instance, and \vn{"q1"} is the name of an element or
elements that are in a branch named "b2", the following are equivalent:
elements that are in a branch named "B2", the following are equivalent:
\begin{example}
elist = lat["q1"]
elist = find(lat, "q1")
b2 = lat.branch["b2"]; elist = b2["q1"]
b2 = lat.branch["B2"]; elist = b2["q1"]
\end{example}
\vn{elist} will be a vector of elements since a name may match to multiple elements.

Expand Down
4 changes: 2 additions & 2 deletions manual/new-ele.tex
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ \section{Defining a New Element}
* If the element has a new type of geometry, extend the \vn{propagate_ele_geometry()} function
to handle the new type of geometry. Example:
\begin{example}
function propagate_ele_geometry(::Type{CORKSCREW}, fstart::FloorPositionGroup, ele::Ele)
function propagate_ele_geometry(::Type{CORKSCREW}, fstart::OrientationGroup, ele::Ele)
...
return floor_end # FloorPositionGroup at the downstream end of the element.
return floor_end # OrientationGroup at the downstream end of the element.
end
\end{example}

Expand Down
2 changes: 1 addition & 1 deletion src/AcceleratorLattice.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export split!, construct_ele_type, ele_at_s, toggle_integrated!
export eles_search, eles_substitute_lords!, eles_sort!
export next_ele, ele_at_offset, ele_param_value_str, strip_AL, ele_param_group_symbols
export branch, matches_branch, create_ele_vars, eval_str, Vertex1, LatticeGlobal
export EleParameterGroup, AlignmentGroup, FloorPositionGroup, BMultipole, BMultipoleGroup, BeamBeamGroup
export EleParameterGroup, AlignmentGroup, OrientationGroup, BMultipole, BMultipoleGroup, BeamBeamGroup
export EMultipole, EMultipoleGroup, BendGroup, ApertureGroup, DescriptionGroup, RFGroup, SolenoidGroup
export TrackingGroup, LengthGroup, ReferenceGroup, DownstreamReferenceGroup, ForkGroup
export MasterGroup, LordSlaveStatusGroup, ACKickerGroup
Expand Down
20 changes: 10 additions & 10 deletions src/accessor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -454,40 +454,40 @@ function output_parameter(sym::Symbol, ele::Ele, output_group::Type{T}) where T
if :AlignmentGroup ∉ keys(ele.pdict); return NaN; end
if isnothing(girder(ele)); return ele.offset; end
ag = ele.pdict[:AlignmentGroup]
orient_girder = FloorPositionGroup(girder(ele).offset_tot, girder(ele).q_align_tot)
orient_ele = FloorPositionGroup(ele.offset, ele.q_align)
orient_girder = OrientationGroup(girder(ele).offset_tot, girder(ele).q_align_tot)
orient_ele = OrientationGroup(ele.offset, ele.q_align)
return floor_transform(orient_ele, orient_girder).r

elseif sym == :x_rot_tot
if :AlignmentGroup ∉ keys(ele.pdict); return NaN; end
if isnothing(girder(ele)); return ele.x_rot; end
ag = ele.pdict[:AlignmentGroup]
orient_girder = FloorPositionGroup(girder(ele).offset_tot, girder(ele).q_align_tot)
orient_ele = FloorPositionGroup(ele.offset, ele.q_align)
orient_girder = OrientationGroup(girder(ele).offset_tot, girder(ele).q_align_tot)
orient_ele = OrientationGroup(ele.offset, ele.q_align)
return rot_angles(floor_transform(orient_ele, orient_girder).q)[1]

elseif sym == :y_rot_tot
if :AlignmentGroup ∉ keys(ele.pdict); return NaN; end
if isnothing(girder(ele)); return ele.y_rot; end
ag = ele.pdict[:AlignmentGroup]
orient_girder = FloorPositionGroup(girder(ele).offset_tot, girder(ele).q_align_tot)
orient_ele = FloorPositionGroup(ele.offset, ele.q_align)
orient_girder = OrientationGroup(girder(ele).offset_tot, girder(ele).q_align_tot)
orient_ele = OrientationGroup(ele.offset, ele.q_align)
return rot_angles(floor_transform(orient_ele, orient_girder).q)[2]

elseif sym == :z_rot_tot
if :AlignmentGroup ∉ keys(ele.pdict); return NaN; end
if isnothing(girder(ele)); return ele.z_rot; end
ag = ele.pdict[:AlignmentGroup]
orient_girder = FloorPositionGroup(girder(ele).offset_tot, girder(ele).q_align_tot)
orient_ele = FloorPositionGroup(ele.offset, ele.q_align)
orient_girder = OrientationGroup(girder(ele).offset_tot, girder(ele).q_align_tot)
orient_ele = OrientationGroup(ele.offset, ele.q_align)
return rot_angles(floor_transform(orient_ele, orient_girder).q)[3]

elseif sym == :q_align_tot
if :AlignmentGroup ∉ keys(ele.pdict); return NaN; end
if isnothing(girder(ele)); return ele.q_align; end
ag = ele.pdict[:AlignmentGroup]
orient_girder = FloorPositionGroup(girder(ele).offset_tot, girder(ele).q_align_tot)
orient_ele = FloorPositionGroup(ele.offset, ele.q_align)
orient_girder = OrientationGroup(girder(ele).offset_tot, girder(ele).q_align_tot)
orient_ele = OrientationGroup(ele.offset, ele.q_align)
return floor_transform(orient_ele, orient_girder).q
end

Expand Down
Loading
Loading