Commit 2b15fb71 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 08c4d7e5
Rimuovere attributi FixedX
Leggere pressione, corrente e tensione di un canale solo quanto questo e' ON
......@@ -289,38 +289,55 @@ void Agilent4uhv::init_device()
strncpy(attr_SerialNumber_read[0], serial.c_str(), MAX_DEVSTRING_LENGTH);
/* Read all the device data */
static const int nw[] = { 8, /*, 108, 205, 320, 319, 323, 503, 504, 600 */
601, 602, 603, 800, 801, 802, 803, 804, 808, 809, 810, 811};
vector<int> normal_windows(nw, nw + sizeof(nw) / sizeof(nw[0]));
static const int lpw[] = { 8, /*, 108, 205, 320, 319, 323, 503, 504, 600 */
601, 602, 603, 800, 801, 802, 803, 804, 808, 809 };
vector<int> lowprio_windows(lpw, lpw + sizeof(lpw) / sizeof(lpw[0]));
for (size_t i=0; i<channels.size(); ++i) {
int chan;
convert(channels[i], chan);
normal_windows.push_back(10 + chan);
normal_windows.push_back(2060 + chan);
normal_windows.push_back(600 + chan * 10);
normal_windows.push_back(602 + chan * 10);
normal_windows.push_back(603 + chan * 10);
normal_windows.push_back(604 + chan * 10);
normal_windows.push_back(605 + chan * 10);
normal_windows.push_back(800 + chan * 10);
normal_windows.push_back(801 + chan * 10);
lowprio_windows.push_back(10 + chan);
lowprio_windows.push_back(2060 + chan);
lowprio_windows.push_back(600 + chan * 10);
lowprio_windows.push_back(602 + chan * 10);
lowprio_windows.push_back(603 + chan * 10);
lowprio_windows.push_back(604 + chan * 10);
lowprio_windows.push_back(605 + chan * 10);
}
for (size_t i=0; i<normal_windows.size(); ++i) {
read_window_into_cache(normal_windows[i]);
for (size_t i=0; i<lowprio_windows.size(); ++i) {
read_window_into_cache(lowprio_windows[i]);
}
static const int iw[] = { 812, 822, 832, 842 };
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]);
vector<int> medprio_windows;
for (size_t i=0; i<channels.size(); ++i) {
int chan;
convert(channels[i], chan);
medprio_windows.push_back(800 + chan * 10);
medprio_windows.push_back(801 + chan * 10);
}
for (size_t i=0; i<medprio_windows.size(); ++i) {
read_window_into_cache(medprio_windows[i]);
}
static const int hpw[] = { 812, 822, 832, 842 };
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 % 5) {
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 */);
......@@ -731,12 +748,31 @@ void Agilent4uhv::write_VTargetX(Tango::WAttribute &attr)
/*----- PROTECTED REGION ID(Agilent4uhv::write_VTargetX) ENABLED START -----*/
check_init();
int value = w_val;
if (value > 0 && value < 3000)
Tango::Except::throw_exception( "",
"Out of range [3000-7000]",
"Agilent4uhv::write_VTargetX()");
string channel_str = attr.get_name().substr(attr.get_name().size()-1);
int channel;
convert(channel_str, channel);
string fs;
read_window_from_cache(603, fs);
fs[fs.size()-channel] = '0';
write_window(603, fs);
int win;
convert("6" + attr.get_name().substr(attr.get_name().size()-1) + "3", win);
convert("6" + channel_str + "3", win);
if (value != 0) {
write_window(win, value);
read_window_into_cache(win);
int value = w_val;
write_window(win, value);
read_window_into_cache(win);
fs[fs.size()-channel] = '1';
write_window(603, fs);
}
read_window_into_cache(603);
/*----- PROTECTED REGION END -----*/ // Agilent4uhv::write_VTargetX
}
......
......@@ -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>
......
......@@ -271,7 +271,7 @@ void Agilent4uhv::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
......
Markdown is supported
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