38 "The \"TRIMCOIL\" statement defines a trim coil."),
41 (
"TYPE",
"Specifies the type of trim coil: PSI-BFIELD, PSI-PHASE, PSI-BFIELD-MIRRORED");
44 (
"COEFNUM",
"Radial profile: list of polynomial coefficients for the numerator (not for PSI-BFIELD-MIRRORED)");
47 (
"COEFDENOM",
"Radial profile: list of polynomial coefficients for the denominator (not for PSI-BFIELD-MIRRORED)");
50 (
"COEFNUMPHI",
"Angular profile: list of polynomial coefficients for the numerator (not for PSI-BFIELD-MIRRORED)");
53 (
"COEFDENOMPHI",
"Angular profile: list of polynomial coefficients for the denominator (not for PSI-BFIELD-MIRRORED)");
56 (
"BMAX",
"Maximum magnetic field in Tesla.");
59 (
"PHIMIN",
"Minimal azimuth [deg] (default 0)");
62 (
"PHIMAX",
"Maximal azimuth [deg] (default 360)");
65 (
"RMIN",
"Minimum radius [mm].");
68 (
"RMAX",
"Maximum radius [mm].");
71 (
"SLPTC",
"Slopes of the rising edge [1/mm] (for PSI-BFIELD-MIRRORED)");
117 if (trimcoil ==
nullptr) {
118 throw OpalException(
"OpalTrimCoil::find()",
"OpalTrimCoil \"" + name +
"\" not found.");
141 if (type ==
"PSI-BFIELD" || type ==
"PSI-PHASE") {
146 if (type ==
"PSI-BFIELD")
147 trimcoil_m = std::unique_ptr<TrimCoilBFit> (
new TrimCoilBFit (bmax, rmin, rmax, coefnum, coefdenom, coefnumphi, coefdenomphi));
149 trimcoil_m = std::unique_ptr<TrimCoilPhaseFit> (
new TrimCoilPhaseFit(bmax, rmin, rmax, coefnum, coefdenom, coefnumphi, coefdenomphi));
151 }
else if (type ==
"PSI-BFIELD-MIRRORED") {
156 type +
" is not a valid trim coil type");
165 os <<
"* ******************************** T R I M C O I L ********************************\n"
170 if (type ==
"PSI-BFIELD" || type ==
"PSI-PHASE") {
184 os <<
"* *********************************************************************************" <<
endl;
189 std::stringstream ss;
191 for (std::size_t i = 0; i < coef.size(); ++i) {
192 ss << ((i > 0) ?
"+ " :
"") << coef[i]
193 << ((i > 0) ? (
" * x^" + std::to_string(i)) :
"") <<
' ';
195 os <<
"* POLYNOM " << attr.
getName() <<
" " << ss.str() <<
'\n';
void define(Object *newObject)
Define a new object.
The base class for all OPAL definitions.
void printPolynom(Inform &os, const Attribute &attr) const
Helper method for printing.
The base class for all OPAL exceptions.
std::string toUpper(const std::string &str)
Inform & print(Inform &os) const
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
virtual bool canReplaceBy(Object *object)
Test if replacement is allowed.
virtual void update()
Update the OpalTrimCoil data.
static OpalData * getInstance()
const std::string & getOpalName() const
Return object name.
A representation of an Object attribute.
virtual void execute()
Check the OpalTrimCoil data.
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
std::vector< double > getRealArray(const Attribute &attr)
Get array value.
std::unique_ptr< TrimCoil > trimcoil_m
Actual implementation.
OpalTrimCoil()
Exemplar constructor.
virtual OpalTrimCoil * clone(const std::string &name)
Make clone.
Object * find(const std::string &name)
Find entry.
The base class for all OPAL objects.
void setOpalName(const std::string &name)
Set object name.
void initOpalTrimCoil()
Initialise implementation.
Attribute makeRealArray(const std::string &name, const std::string &help)
Create real array attribute.
bool builtin
Built-in flag.
Inform & level3(Inform &inf)
double getReal(const Attribute &attr)
Return real value.
static OpalTrimCoil * find(const std::string &name)
Find named trim coil.
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
const std::string & getName() const
Return the attribute name.
Inform & endl(Inform &inf)
std::string getString(const Attribute &attr)
Get string value.