Skip to content
Snippets Groups Projects
Commit 06569a1c authored by Alessio Igor Bogani's avatar Alessio Igor Bogani
Browse files

Split windows into three groups (normal, medium, important) to poll them with different rates

parent 74a7721e
No related branches found
No related tags found
No related merge requests found
......@@ -276,26 +276,40 @@ void IPCMini::init_device()
strncpy(attr_SerialNumber_read[0], serial.c_str(), MAX_DEVSTRING_LENGTH);
/* Read all the device data */
static const int nw[] = { 8, 11 /*, 108, 205 */, 206
static const int lpw[] = { 8, 11 /*, 108, 205 */, 206
/*, 319, 323, 503, 504, 600 */, 601, 602, 603, 610,
612, 613, 614, 615, 800, 801, 804, 810, 811 /*, 890 */ };
vector<int> normal_windows(nw, nw + sizeof(nw) / sizeof(nw[0]));
for (size_t i=0; i<normal_windows.size(); ++i) {
read_window_into_cache(normal_windows[i]);
612, 613, 614, 615, 800, 801, 804 /*, 890 */ };
vector<int> lowprio_windows(lpw, lpw + sizeof(lpw) / sizeof(lpw[0]));
for (size_t i=0; i<lowprio_windows.size(); ++i) {
read_window_into_cache(lowprio_windows[i]);
}
static const int iw[] = { 812 };
vector<int> important_windows(iw, iw + sizeof(iw) / sizeof(iw[0]));
for (size_t i=0; i<important_windows.size(); ++i) {
read_window_into_cache(important_windows[i]);
static const int mpw[] = { 810, 811 };
vector<int> medprio_windows(mpw, mpw + sizeof(mpw) / sizeof(mpw[0]));
for (size_t i=0; i<medprio_windows.size(); ++i) {
read_window_into_cache(medprio_windows[i]);
}
static const int hpw[] = { 812 };
vector<int> highprio_windows(hpw, hpw + sizeof(hpw) / sizeof(hpw[0]));
for (size_t i=0; i<highprio_windows.size(); ++i) {
read_window_into_cache(highprio_windows[i]);
}
read_window_into_cache(205);
// Contruct polled windows vector
for (size_t i=0; i<normal_windows.size(); ++i) {
polled_windows.push_back(normal_windows[i]);
unsigned int medidx = 0;
for (size_t i=0; i<lowprio_windows.size(); ++i) {
if (i % 2) {
if (medidx >= medprio_windows.size())
medidx = 0;
polled_windows.push_back(medprio_windows[medidx++]);
} else {
polled_windows.push_back(lowprio_windows[i]);
}
polled_windows.insert(polled_windows.end(),
important_windows.begin(),
important_windows.end());
highprio_windows.begin(),
highprio_windows.end());
}
polled_windows.push_back(205 /* it MUST be latest */);
......@@ -691,8 +705,25 @@ void IPCMini::write_VTargetX(Tango::WAttribute &attr)
check_init();
int value = w_val;
write_window(613, value);
read_window_into_cache(613);
if (value > 0 && value < 3000)
Tango::Except::throw_exception( "",
"Out of range [3000-7000]",
"Agilent4uhv::write_VTargetX()");
string fs;
read_window_from_cache(603, fs);
fs[0] = '0';
write_window(603, fs);
if (value != 0) {
write_window(613, value);
read_window_into_cache(613);
fs[0] = '1';
write_window(603, fs);
}
read_window_into_cache(603);
/*----- PROTECTED REGION END -----*/ // IPCMini::write_VTargetX
}
......@@ -1563,6 +1594,7 @@ void* IPCMiniWorker::run_undetached(void * /*ptr*/)
while(cont) {
DEBUG_STREAM << "Worker::run_undetached() - loop" << endl;
try {
usleep(10);
usleep(device->pollingSleep);
device->read_window_into_cache(*it);
if (++it == device->polled_windows.end()) {
......
......@@ -125,7 +125,7 @@
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="" label="" unit="V" standardUnit="" displayUnit="" format="" maxValue="7000" minValue="3000" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
<properties description="" label="" unit="V" standardUnit="" displayUnit="" format="" maxValue="7000" minValue="0" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
<readExcludedStates>UNKNOWN</readExcludedStates>
<readExcludedStates>INIT</readExcludedStates>
<writeExcludedStates>UNKNOWN</writeExcludedStates>
......
......@@ -270,7 +270,7 @@ void IPCMini::add_VTargetX_dynamic_attribute(string attname)
// display_unit not set for VTargetX
// format not set for VTargetX
vtargetx_prop.set_max_value("7000");
vtargetx_prop.set_min_value("3000");
vtargetx_prop.set_min_value("0");
// max_alarm not set for VTargetX
// min_alarm not set for VTargetX
// max_warning not set for VTargetX
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment