17 #include "primarydriverwiththread.h"
18 #include "xnodeconnector.h"
24 class Ui_FrmMagnetPSConfig;
30 Transaction &tr_meas,
const shared_ptr<XMeasure> &meas);
37 double magnetField()
const {
return m_magnetField;}
38 double outputCurrent()
const {
return m_outputCurrent;}
42 double m_outputCurrent;
54 const shared_ptr<XScalarEntry> &
field()
const {
return m_field;}
55 const shared_ptr<XScalarEntry> ¤t()
const {
return m_current;}
57 const shared_ptr<XDoubleNode> &targetField()
const {
return m_targetField;}
58 const shared_ptr<XDoubleNode> &sweepRate()
const {
return m_sweepRate;}
59 const shared_ptr<XBoolNode> &allowPersistent()
const {
return m_allowPersistent;}
60 const shared_ptr<XComboNode> &approach()
const {
return m_approach;}
65 const shared_ptr<XDoubleNode> &magnetField()
const {
return m_magnetField;}
66 const shared_ptr<XDoubleNode> &outputField()
const {
return m_outputField;}
67 const shared_ptr<XDoubleNode> &outputCurrent()
const {
return m_outputCurrent;}
68 const shared_ptr<XDoubleNode> &outputVolt()
const {
return m_outputVolt;}
69 const shared_ptr<XBoolNode> &pcsHeater()
const {
return m_pcsHeater;}
70 const shared_ptr<XBoolNode> &persistent()
const {
return m_persistent;}
72 virtual double fieldResolution() = 0;
73 virtual void toNonPersistent() = 0;
74 virtual void toPersistent() = 0;
75 virtual void toZero() = 0;
76 virtual void toSetPoint() = 0;
77 virtual void setPoint(
double field) = 0;
78 virtual void setRate(
double hpm) = 0;
79 virtual double getPersistentField() = 0;
80 virtual double getOutputField() = 0;
81 virtual double getTargetField() = 0;
82 virtual double getSweepRate() = 0;
83 virtual double getOutputVolt() = 0;
84 virtual double getOutputCurrent() = 0;
89 virtual bool canChangePolarityDuringSweep() {
return true;}
94 const shared_ptr<XScalarEntry> m_field, m_current;
95 const shared_ptr<XScalarEntryList> m_entries;
97 const shared_ptr<XDoubleNode> m_targetField;
98 const shared_ptr<XDoubleNode> m_sweepRate;
99 const shared_ptr<XBoolNode> m_allowPersistent;
100 enum {APPROACH_LINEAR = 0, APPROACH_OSC = 1};
101 const shared_ptr<XComboNode> m_approach;
104 const shared_ptr<XDoubleNode> m_magnetField, m_outputField, m_outputCurrent, m_outputVolt;
105 const shared_ptr<XBoolNode> m_pcsHeater, m_persistent, m_aborting;
107 const shared_ptr<XTouchableNode> m_configShow;
110 const shared_ptr<XDoubleNode> m_rateLimit2, m_rateLimit2UBound;
111 const shared_ptr<XDoubleNode> m_rateLimit3, m_rateLimit3UBound;
112 const shared_ptr<XDoubleNode> m_rateLimit4, m_rateLimit4UBound;
113 const shared_ptr<XDoubleNode> m_rateLimit5, m_rateLimit5UBound;
120 const shared_ptr<XDoubleNode> m_safeCond1Min, m_safeCond1Max;
121 const shared_ptr<XItemNode<XScalarEntryList, XScalarEntry> > m_safeCond2Entry;
122 const shared_ptr<XDoubleNode> m_safeCond2Min, m_safeCond2Max;
123 const shared_ptr<XItemNode<XScalarEntryList, XScalarEntry> > m_safeCond3Entry;
124 const shared_ptr<XDoubleNode> m_safeCond3Min, m_safeCond3Max;
126 const shared_ptr<XItemNode<XScalarEntryList, XScalarEntry> > m_persistentCondEntry;
127 const shared_ptr<XDoubleNode> m_persistentCondMax;
128 const shared_ptr<XItemNode<XScalarEntryList, XScalarEntry> > m_nonPersistentCondEntry;
129 const shared_ptr<XDoubleNode> m_nonPersistentCondMin;
133 shared_ptr<XListener> m_lsnRate, m_lsnConfigShow;
136 xqcon_ptr m_conTargetField, m_conSweepRate;
137 xqcon_ptr m_conMagnetField, m_conOutputField, m_conOutputCurrent, m_conOutputVolt;
138 xqcon_ptr m_conPCSH, m_conPersist, m_conAborting, m_conApproach;
140 xqcon_ptr m_conRateLimit1, m_conRateLimit1UBound;
141 xqcon_ptr m_conRateLimit2, m_conRateLimit2UBound;
142 xqcon_ptr m_conRateLimit3, m_conRateLimit3UBound;
143 xqcon_ptr m_conRateLimit4, m_conRateLimit4UBound;
144 xqcon_ptr m_conRateLimit5, m_conRateLimit5UBound;
145 xqcon_ptr m_conSecondaryPS, m_conSecondaryPSMultiplier;
146 xqcon_ptr m_conSafeCond1Entry, m_conSafeCond1Min, m_conSafeCond1Max;
147 xqcon_ptr m_conSafeCond2Entry, m_conSafeCond2Min, m_conSafeCond2Max;
148 xqcon_ptr m_conSafeCond3Entry, m_conSafeCond3Min, m_conSafeCond3Max;
149 xqcon_ptr m_conPersistentCondEntry, m_conPersistentCondMax;
150 xqcon_ptr m_conNonPersistentCondEntry, m_conNonPersistentCondMin;
155 const shared_ptr<XStatusPrinter> m_statusPrinter;
159 bool isSafeConditionSatisfied(
const Snapshot &shot,
const Snapshot &shot_entries);
160 bool isPersistentStabilized(
const Snapshot &shot,
const Snapshot &shot_entries,
const XTime &pcsh_off_time);
161 bool isNonPersistentStabilized(
const Snapshot &shot,
const Snapshot &shot_entries,
const XTime &pcsh_on_time);
162 double limitSweepRate(
double field,
double rate,
const Snapshot &shot);