FACT++  1.0
StateMachineFeedback::StateMachineFeedback ( ostream &  out = cout)
inline

Definition at line 1184 of file feedback.cc.

References Calibrate(), HandleBiasCurrent(), HandleBiasDac(), HandleBiasNom(), HandleBiasStateChange(), HandleBiasVoltage(), HandleCameraTemp(), Feedback::State::kCalibrated, Feedback::State::kCalibrating, Feedback::State::kConnected, Feedback::State::kConnecting, Feedback::State::kCritical, Feedback::State::kDimNetworkNA, Feedback::State::kDisconnected, Feedback::State::kInProgress, Feedback::State::kOnStandby, Feedback::State::kWaitingForData, Feedback::State::kWarning, LoadCalibration(), LoadOffset(), Print(), PrintCalibration(), ResetOffset(), SaveCalibration(), DimState::SetCallback(), SetMoonMode(), SetVerbosity(), Start(), StopFeedback(), DimState::Subscribe(), and DimDescribedState::Subscribe().

1184  : StateMachineDim(out, "FEEDBACK"),
1185  fIsVerbose(false),
1186  //---
1187  fDimFSC("FSC_CONTROL"),
1188  fDimBias("BIAS_CONTROL"),
1189  //---
1190  fDimCalibration("FEEDBACK/CALIBRATION", "F:416;F:416;F:416;F:416",
1191  "Current offsets"
1192  "|Avg[uA]:Average offset at dac=256+5*512"
1193  "|Rms[uA]:Rms of Avg"
1194  "|R[Ohm]:Measured calibration resistor"
1195  "|U[V]:Corresponding voltage reported by biasctrl"),
1196  fDimCalibration2("FEEDBACK/CALIBRATION_STEPS", "I:1;F:416;F:416;F:416",
1197  "Calibration of the R8 resistor"
1198  "|DAC[dac]:DAC setting"
1199  "|U[V]:Corresponding voltages reported by biasctrl"
1200  "|Iavg[uA]:Averaged measured current"
1201  "|Irms[uA]:Rms measured current"),
1202  fDimCalibrationR8("FEEDBACK/CALIBRATION_R8", "F:416;F:416",
1203  "Calibration of R8"
1204  "|DeltaI[uA]:Average offset"
1205  "|R8[Ohm]:Measured effective resistor R8"),
1206  fDimCurrents("FEEDBACK/CALIBRATED_CURRENTS", "F:416;F:1;F:1;F:1;F:1;I:1;F:1;F:416;F:1;F:1",
1207  "Calibrated currents"
1208  "|I[uA]:Calibrated currents per pixel"
1209  "|I_avg[uA]:Average calibrated current (N channels)"
1210  "|I_rms[uA]:Rms of calibrated current (N channels)"
1211  "|I_med[uA]:Median calibrated current (N channels)"
1212  "|I_dev[uA]:Deviation of calibrated current (N channels)"
1213  "|N[uint16]:Number of valid values"
1214  "|T_diff[s]:Time difference to calibration"
1215  "|U_ov[V]:Calculated overvoltage w.r.t. operation voltage"
1216  "|U_nom[V]:Nominal overvoltage w.r.t. operation voltage"
1217  "|dU_temp[V]:Correction calculated from temperature"
1218  ),
1219  fDimOffsets("FEEDBACK/OFFSETS", "F:416",
1220  "Offsets operation voltages"
1221  "|U[V]:Offset per bias channels"),
1223  fMoonMode(0),
1225  fNumCalibIgnore(30),
1226  fNumCalibRequests(300)
1227  {
1228  fDim.Subscribe(*this);
1229  fDimFSC.Subscribe(*this);
1230  fDimBias.Subscribe(*this);
1231 
1233 
1234  Subscribe("BIAS_CONTROL/CURRENT")
1235  (bind(&StateMachineFeedback::HandleBiasCurrent, this, placeholders::_1));
1236  Subscribe("BIAS_CONTROL/VOLTAGE")
1237  (bind(&StateMachineFeedback::HandleBiasVoltage, this, placeholders::_1));
1238  Subscribe("BIAS_CONTROL/DAC")
1239  (bind(&StateMachineFeedback::HandleBiasDac, this, placeholders::_1));
1240  Subscribe("BIAS_CONTROL/NOMINAL")
1241  (bind(&StateMachineFeedback::HandleBiasNom, this, placeholders::_1));
1242  Subscribe("FSC_CONTROL/BIAS_TEMP")
1243  (bind(&StateMachineFeedback::HandleCameraTemp, this, placeholders::_1));
1244 
1245  // State names
1246  AddStateName(Feedback::State::kDimNetworkNA, "DimNetworkNotAvailable",
1247  "The Dim DNS is not reachable.");
1248 
1250  "The Dim DNS is reachable, but the required subsystems are not available.");
1252  "Either biasctrl or fscctrl not connected.");
1254  "biasctrl and fscctrl are available and connected with their hardware.");
1255 
1257  "Bias crate calibrating in progress.");
1259  "Bias crate calibrated.");
1260 
1262  "Current control started, waiting for valid temperature and current data.");
1263 
1265  "Current control in progress but with limited voltage.");
1267  "Current control in progress.");
1269  "Current control in progress but current warning level exceeded.");
1271  "Current control in progress but critical current limit exceeded.");
1272 
1273 
1274  /*
1275  AddEvent("SET_CURRENT_REQUEST_INTERVAL")
1276  (bind(&StateMachineFeedback::SetCurrentRequestInterval, this, placeholders::_1))
1277  ("|interval[ms]:Interval between two current requests in modes which need that.");
1278  */
1279 
1281  (bind(&StateMachineFeedback::Calibrate, this))
1282  ("");
1283 
1284  AddEvent("START", "F:1", Feedback::State::kCalibrated)
1285  (bind(&StateMachineFeedback::Start, this, placeholders::_1))
1286  ("Start the current/temperature control loop"
1287  "|Uov[V]:Overvoltage to be applied (standard value is 1.1V)");
1288 
1289  AddEvent("STOP")
1290  (bind(&StateMachineFeedback::StopFeedback, this))
1291  ("Stop any control loop");
1292 
1294  (bind(&StateMachineFeedback::LoadOffset, this, placeholders::_1))
1295  ("");
1297  (bind(&StateMachineFeedback::ResetOffset, this))
1298  ("");
1299 
1300 
1301  AddEvent("SAVE_CALIBRATION", Feedback::State::kCalibrated)
1303  ("");
1304  AddEvent("LOAD_CALIBRATION", Feedback::State::kConnected)
1306  ("");
1307 
1309  (bind(&StateMachineFeedback::SetMoonMode, this, placeholders::_1))
1310  ("Operate central pixels at 5V below nominal voltage. 0:off, 1:minimal, 2:medium, 3:maximum size.");
1311 
1312 
1313  AddEvent("PRINT")
1314  (bind(&StateMachineFeedback::Print, this))
1315  ("");
1316  AddEvent("PRINT_CALIBRATION")
1318  ("");
1319 
1320  // Verbosity commands
1321  AddEvent("SET_VERBOSE", "B:1")
1322  (bind(&StateMachineFeedback::SetVerbosity, this, placeholders::_1))
1323  ("set verbosity state"
1324  "|verbosity[bool]:disable or enable verbosity when calculating overvoltage");
1325  }
DimDescribedService fDimOffsets
Definition: feedback.cc:44
DimDescribedState fDimBias
Definition: feedback.cc:38
EventImp & AddEvent(const std::string &name, const std::string &states, const std::string &fmt)
virtual void Subscribe(StateMachineImp &imp)
Definition: DimState.h:134
DimDescribedState fDimFSC
Definition: feedback.cc:37
DimVersion fDim
Definition: feedback.cc:35
int Print() const
Definition: feedback.cc:907
DimDescribedService fDimCalibration2
Definition: feedback.cc:41
DimDescribedService fDimCalibration
Definition: feedback.cc:40
StateMachineDim(std::ostream &out=std::cout, const std::string &name="DEFAULT")
int HandleBiasDac(const EventImp &evt)
Definition: feedback.cc:141
uint16_t fNumCalibIgnore
Definition: feedback.cc:80
uint16_t fCurrentRequestInterval
Definition: feedback.cc:79
uint16_t fNumCalibRequests
Definition: feedback.cc:81
int HandleBiasStateChange()
Definition: feedback.cc:88
int HandleCameraTemp(const EventImp &evt)
Definition: feedback.cc:148
int HandleBiasVoltage(const EventImp &evt)
Definition: feedback.cc:134
DimDescribedService fDimCurrents
Definition: feedback.cc:43
int Start(const EventImp &evt)
Definition: feedback.cc:1022
vector< double > fVoltOffset
Definition: feedback.cc:75
int LoadOffset(const EventImp &evt)
Definition: feedback.cc:1088
virtual void Subscribe(StateMachineImp &imp)
Definition: DimState.h:68
EventImp & Subscribe(const std::string &name)
int SetMoonMode(const EventImp &evt)
Definition: feedback.cc:978
int HandleBiasCurrent(const EventImp &evt)
Definition: feedback.cc:457
uint16_t fMoonMode
Definition: feedback.cc:77
int HandleBiasNom(const EventImp &evt)
Definition: feedback.cc:118
bool AddStateName(const int state, const std::string &name, const std::string &doc="")
DimDescribedService fDimCalibrationR8
Definition: feedback.cc:42
int SetVerbosity(const EventImp &evt)
Definition: feedback.cc:956
void SetCallback(const callback &cb)
Definition: DimState.h:74

+ Here is the call graph for this function: