58 "The \"TRIMCOIL\" statement defines a trim coil."),
61 (
"TYPE",
"Specifies the type of trim coil.", {
"PSI-BFIELD",
"PSI-PHASE",
"PSI-BFIELD-MIRRORED"});
64 (
"COEFNUM",
"Radial profile: list of polynomial coefficients for the numerator (not for PSI-BFIELD-MIRRORED)");
67 (
"COEFDENOM",
"Radial profile: list of polynomial coefficients for the denominator (not for PSI-BFIELD-MIRRORED)");
70 (
"COEFNUMPHI",
"Angular profile: list of polynomial coefficients for the numerator (not for PSI-BFIELD-MIRRORED)");
73 (
"COEFDENOMPHI",
"Angular profile: list of polynomial coefficients for the denominator (not for PSI-BFIELD-MIRRORED)");
76 (
"BMAX",
"Maximum magnetic field in Tesla.");
79 (
"PHIMIN",
"Minimal azimuth [deg] (default 0)");
82 (
"PHIMAX",
"Maximal azimuth [deg] (default 360)");
85 (
"RMIN",
"Minimum radius [mm].");
88 (
"RMAX",
"Maximum radius [mm].");
91 (
"SLPTC",
"Slopes of the rising edge [1/mm] (for PSI-BFIELD-MIRRORED)");
137 if (trimcoil ==
nullptr) {
138 throw OpalException(
"OpalTrimCoil::find()",
"OpalTrimCoil \"" +
name +
"\" not found.");
161 if (
type ==
"PSI-BFIELD" ||
type ==
"PSI-PHASE") {
166 if (
type ==
"PSI-BFIELD")
167 trimcoil_m = std::unique_ptr<TrimCoilBFit> (
new TrimCoilBFit (bmax, rmin, rmax, coefnum, coefdenom, coefnumphi, coefdenomphi));
169 trimcoil_m = std::unique_ptr<TrimCoilPhaseFit> (
new TrimCoilPhaseFit(bmax, rmin, rmax, coefnum, coefdenom, coefnumphi, coefdenomphi));
171 }
else if (
type ==
"PSI-BFIELD-MIRRORED") {
182 os <<
"* ******************************** T R I M C O I L ********************************\n"
187 if (
type ==
"PSI-BFIELD" ||
type ==
"PSI-PHASE") {
201 os <<
"* *********************************************************************************" <<
endl;
206 std::stringstream ss;
208 for (std::size_t i = 0; i < coef.size(); ++i) {
209 ss << ((i > 0) ?
"+ " :
"") << coef[i]
210 << ((i > 0) ? (
" * x^" + std::to_string(i)) :
"") <<
' ';
212 os <<
"* POLYNOM " << attr.
getName() <<
" " << ss.str() <<
'\n';
Inform & endl(Inform &inf)
Inform & level3(Inform &inf)
double getReal(const Attribute &attr)
Return real value.
Attribute makePredefinedString(const std::string &name, const std::string &help, const std::initializer_list< std::string > &predefinedStrings)
Make predefined string attribute.
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
Attribute makeRealArray(const std::string &name, const std::string &help)
Create real array attribute.
std::vector< double > getRealArray(const Attribute &attr)
Get array value.
std::string getString(const Attribute &attr)
Get string value.
boost::function< boost::tuple< double, bool >arguments_t)> type
A representation of an Object attribute.
const std::string & getName() const
Return the attribute name.
The base class for all OPAL definitions.
The base class for all OPAL objects.
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
const std::string & getOpalName() const
Return object name.
void setOpalName(const std::string &name)
Set object name.
std::vector< Attribute > itsAttr
The object attributes.
bool builtin
Built-in flag.
Object * find(const std::string &name)
Find entry.
static OpalData * getInstance()
void define(Object *newObject)
Define a new object.
Inform & print(Inform &os) const
OpalTrimCoil()
Exemplar constructor.
static OpalTrimCoil * find(const std::string &name)
Find named trim coil.
std::unique_ptr< TrimCoil > trimcoil_m
Actual implementation.
virtual void update()
Update the OpalTrimCoil data.
void initOpalTrimCoil()
Initialise implementation.
void printPolynom(Inform &os, const Attribute &attr) const
Helper method for printing.
virtual void execute()
Check the OpalTrimCoil data.
virtual OpalTrimCoil * clone(const std::string &name)
Make clone.
virtual bool canReplaceBy(Object *object)
Test if replacement is allowed.
The base class for all OPAL exceptions.