Commit 6886264f authored by Pavel Vainerman's avatar Pavel Vainerman

(2.0): Убрал устаревшее поле "sensibility", а также разобрался с начальной…

(2.0): Убрал устаревшее поле "sensibility", а также разобрался с начальной инициализацией порогов (eterbug #9454)
parent 72f3dddf
......@@ -19,8 +19,6 @@
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman
* \date $Date: 2008/11/29 21:24:24 $
* \version $Id: IOController_i.idl,v 1.16 2008/11/29 21:24:24 vpashka Exp $
*/
// --------------------------------------------------------------------------
#ifndef BaseIOController_i_IDL_
......@@ -89,7 +87,6 @@ interface IOController_i : UniSetManager_i
long maxRaw; /*!< максимальное "сырое" значение */
long minCal; /*!< минимальное калиброванное значение */
long maxCal; /*!< максимальное калиброванное значение */
long sensibility; /*!< чуствительность (для первичного фильтрования) */
short precision; /*!< точность */
};
......@@ -193,13 +190,11 @@ interface IONotifyController_i : IOController_i
* \param tid - идентификатор порога
* \param lowLimit - нижний порог срабатыания
* \param hiLimit - верхний порог срабатывания
* \param sensibility - чуствительность
*
* Датчик срабатывает при условии, что значение меньше (lowLimit-sensibility) или
* больше (hiLimit+sensibility)
* Датчик срабатывает при условии, что значение <= lowLimit или >= hiLimit
*/
void askThreshold(in SensorInfo si, in UniSetTypes::ConsumerInfo ci, in UniSetTypes::ThresholdId tid,
in long lowLimit, in long hiLimit, in long sensibility,
in long lowLimit, in long hiLimit,
in UniversalIO::UIOCommand cmd ) raises(NameNotFound, IOBadParam, BadRange);
/*!
......@@ -225,7 +220,6 @@ interface IONotifyController_i : IOController_i
UniSetTypes::ThresholdId id;
long hilimit; /*!< верхняя граница срабатывания */
long lowlimit; /*!< нижняя гранийа срабатывания */
long sensibility; /*!< точность определения границ (?) */
ThresholdState state;
long tv_sec; /*!< время последнего изменения датчика, секунды (gettimeofday) */
long tv_usec; /*!< время последнего изменения датчика, мксек (gettimeofday) */
......
......@@ -19,8 +19,6 @@
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman
* \date $Date: 2007/12/18 20:24:11 $
* \version $Id: UniSetManager_i.idl,v 1.2 2007/12/18 20:24:11 vpashka Exp $
*/
// --------------------------------------------------------------------------
#ifndef UniSetManager_i_IDL_
......
......@@ -19,8 +19,6 @@
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman
* \date $Date: 2007/12/17 22:50:59 $
* \version $Id: UniSetObject_i.idl,v 1.4 2007/12/17 22:50:59 vpashka Exp $
*/
// --------------------------------------------------------------------------
#ifndef UniSetObject_i_IDL_
......
......@@ -19,8 +19,6 @@
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman
* \date $Date: 2009/01/23 23:56:54 $
* \version $Id: UniSetTypes_i.idl,v 1.9 2009/01/23 23:56:54 vpashka Exp $
*/
// --------------------------------------------------------------------------
#ifndef UniSetTypes_i_IDL_
......
......@@ -358,7 +358,7 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
- UniversalInterface --> UInterface
- ObjectsManager --> UniSetManager
- ObjectsActitvator --> UniSetActivator
- remove deprecated property: "sensebility"
* Tue Dec 10 2013 Pavel Vainerman <pv@altlinux.ru> 1.7-alt3
- add RRDServer
......
......@@ -43,6 +43,8 @@
set_d2_check_s="AI11_AS"
undef_c="AI54_S"
check_undef_s="AI54_S"
t_set_c="AI_AS"
t_check_s="Threshold1_S"
/>
<IOControl name="IOControl"/>
......
......@@ -98,7 +98,6 @@
<br>\b rmax - максимальное "сырое" значение
<br>\b cmin - минимальное "калиброванное" значение
<br>\b cmax - максимальное "калиброванное" значение
<br>\b sensibility - чуствительность. (deprecated)
<br>\b precision - Точность. Задаёт количство знаков после запятой.
<br>Т.е. при считывании из канала, значение домножается
<br>на 10^precision и уже таким сохраняется.
......@@ -114,7 +113,6 @@
Используется для DI.
<br>\b lowlimit - нижний порого срабатывания.
<br>\b hilimit - верхний порого срабатывания.
<br>\b sensibility - чувствительность (deprecated)
<br>\b card - номер карты
<br>\b subdev - номер подустройства
......
......@@ -72,9 +72,9 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname )
string t_fvalue = conf->getArgParam("--t-filter-value");
heartbeat_node = conf->getArgParam("--heartbeat-node");
if( heartbeat_node.empty() )
if( heartbeat_node.empty() && dlog.is_warn() )
dlog.warn() << myname << "(init): --heartbeat-node NULL ===> heartbeat NOT USED..." << endl;
else
else if( dlog.is_info() )
dlog.info() << myname << "(init): heartbeat-node: " << heartbeat_node << endl;
heartbeatCheckTime = conf->getArgInt("--heartbeat-check-time","1000");
......@@ -89,7 +89,7 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname )
string wdt_dev = conf->getArgParam("--wdt-device");
if( !wdt_dev.empty() )
wdt = new WDTInterface(wdt_dev);
else
else if( dlog.is_warn() )
dlog.warn() << myname << "(init): watchdog timer NOT USED (--wdt-device NULL)" << endl;
......@@ -112,7 +112,8 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname )
{
ostringstream err;
err << myname << ": ID not found ('pulsar') for " << p;
dlog.crit() << myname << "(init): " << err.str() << endl;
if( dlog.is_crit() )
dlog.crit() << myname << "(init): " << err.str() << endl;
throw SystemError(err.str());
}
siPulsar.node = conf->getLocalNode();
......@@ -169,26 +170,33 @@ void SharedMemory::processingMessage( UniSetTypes::VoidMessage *msg )
}
catch( Exception& ex )
{
dlog.crit() << myname << "(processingMessage): " << ex << endl;
if( dlog.is_crit() )
dlog.crit() << myname << "(processingMessage): " << ex << endl;
}
catch(CORBA::SystemException& ex)
{
dlog.warn() << myname << "(processingMessage): CORBA::SystemException: " << ex.NP_minorString() << endl;
if( dlog.is_warn() )
dlog.warn() << myname << "(processingMessage): CORBA::SystemException: " << ex.NP_minorString() << endl;
}
catch(CORBA::Exception& ex)
{
dlog.warn() << myname << "(processingMessage): CORBA::Exception: " << ex._name() << endl;
if( dlog.is_warn() )
dlog.warn() << myname << "(processingMessage): CORBA::Exception: " << ex._name() << endl;
}
catch( omniORB::fatalException& fe )
{
dlog.crit() << myname << "(processingMessage): Caught omniORB::fatalException:" << endl;
dlog.crit() << myname << "(processingMessage): file: " << fe.file()
<< " line: " << fe.line()
<< " mesg: " << fe.errmsg() << endl;
if( dlog.is_crit() )
{
dlog.crit() << myname << "(processingMessage): Caught omniORB::fatalException:" << endl;
dlog.crit() << myname << "(processingMessage): file: " << fe.file()
<< " line: " << fe.line()
<< " mesg: " << fe.errmsg() << endl;
}
}
catch(...)
{
dlog.crit() << myname << "(processingMessage): catch..." << endl;
if( dlog.is_crit() )
dlog.crit() << myname << "(processingMessage): catch..." << endl;
}
}
......@@ -240,7 +248,7 @@ void SharedMemory::sysCommand( SystemMessage *sm )
msleep(100);
}
if( !isActivated() )
if( !isActivated() && dlog.is_crit() )
dlog.crit() << myname << "(sysCommand): ************* don`t activate?! ************" << endl;
// подождать пока пройдёт инициализация
......@@ -395,11 +403,13 @@ void SharedMemory::checkHeartBeat()
}
catch(Exception& ex)
{
dlog.crit() << myname << "(checkHeartBeat): " << ex << endl;
if( dlog.is_crit() )
dlog.crit() << myname << "(checkHeartBeat): " << ex << endl;
}
catch(...)
{
dlog.crit() << myname << "(checkHeartBeat): ..." << endl;
if( dlog.is_crit() )
dlog.crit() << myname << "(checkHeartBeat): ..." << endl;
}
}
......@@ -439,7 +449,8 @@ bool SharedMemory::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
<< ") указан неверно ("
<< it.getProp("iotype") << ") должен быть 'AI'";
dlog.crit() << msg.str() << endl;
if( dlog.is_crit() )
dlog.crit() << msg.str() << endl;
kill(getpid(),SIGTERM);
// throw NameNotFound(msg.str());
};
......@@ -453,7 +464,8 @@ bool SharedMemory::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
{
ostringstream msg;
msg << "(SharedMemory::readItem): дискретный датчик (heartbeat_ds_name) связанный с " << it.getProp("name");
dlog.warn() << msg.str() << endl;
if( dlog.is_warn() )
dlog.warn() << msg.str() << endl;
}
}
else
......@@ -466,7 +478,8 @@ bool SharedMemory::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
// Если уж задали имя для датчика, то он должен существовать..
// поэтому завершаем процесс, если не нашли..
dlog.crit() << msg.str() << endl;
if( dlog.is_crit() )
dlog.crit() << msg.str() << endl;
kill(getpid(),SIGTERM);
// throw NameNotFound(msg.str());
}
......@@ -481,7 +494,8 @@ bool SharedMemory::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
msg << "(SharedMemory::readItem): НЕ УКАЗАН id для "
<< it.getProp("name") << " секция " << sec;
dlog.crit() << msg.str() << endl;
if( dlog.is_crit() )
dlog.crit() << msg.str() << endl;
kill(getpid(),SIGTERM);
// throw NameNotFound(msg.str());
};
......@@ -499,7 +513,8 @@ SharedMemory* SharedMemory::init_smemory( int argc, const char* const* argv )
if( dfile[0]!='.' && dfile[0]!='/' )
dfile = conf->getConfDir() + dfile;
dlog.info() << "(smemory): datfile = " << dfile << endl;
if( dlog.is_info() )
dlog.info() << "(smemory): datfile = " << dfile << endl;
UniSetTypes::ObjectId ID = conf->getControllerID(conf->getArgParam("--smemory-id","SharedMemory"));
if( ID == UniSetTypes::DefaultObjectId )
......@@ -527,14 +542,16 @@ void SharedMemory::readEventList( std::string oname )
xmlNode* enode = conf->getNode(oname);
if( enode == NULL )
{
dlog.warn() << myname << "(readEventList): " << oname << " не найден..." << endl;
if( dlog.is_warn() )
dlog.warn() << myname << "(readEventList): " << oname << " не найден..." << endl;
return;
}
UniXML_iterator it(enode);
if( !it.goChildren() )
{
dlog.warn() << myname << "(readEventList): <eventlist> пустой..." << endl;
if( dlog.is_warn() )
dlog.warn() << myname << "(readEventList): <eventlist> пустой..." << endl;
return;
}
......@@ -550,7 +567,7 @@ void SharedMemory::readEventList( std::string oname )
dlog.info() << myname << "(readEventList): add " << it.getProp("name") << endl;
elst.push_back(oid);
}
else
else if( dlog.is_crit() )
dlog.crit() << myname << "(readEventList): Не найден ID для "
<< it.getProp("name") << endl;
}
......@@ -574,7 +591,7 @@ void SharedMemory::sendEvent( UniSetTypes::SystemMessage& sm )
catch(...){};
}
if(!ok)
if(!ok && dlog.is_crit() )
dlog.crit() << myname << "(sendEvent): Объект " << (*it) << " НЕДОСТУПЕН" << endl;
}
}
......@@ -598,14 +615,16 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
UniXML* xml = conf->getConfXML();
if( !xml )
{
dlog.warn() << myname << "(buildHistoryList): xml=NULL?!" << endl;
if( dlog.is_warn() )
dlog.warn() << myname << "(buildHistoryList): xml=NULL?!" << endl;
return;
}
xmlNode* n = xml->extFindNode(cnode,1,1,"History","");
if( !n )
{
dlog.warn() << myname << "(buildHistoryList): <History> not found. ignore..." << endl;
if( dlog.is_warn() )
dlog.warn() << myname << "(buildHistoryList): <History> not found. ignore..." << endl;
hist.clear();
return;
}
......@@ -615,7 +634,8 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
bool no_history = conf->getArgInt("--sm-no-history",it.getProp("no_history"));
if( no_history )
{
dlog.warn() << myname << "(buildHistoryList): no_history='1'.. history skipped..." << endl;
if( dlog.is_warn() )
dlog.warn() << myname << "(buildHistoryList): no_history='1'.. history skipped..." << endl;
hist.clear();
return;
}
......@@ -626,7 +646,8 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
if( !it.goChildren() )
{
dlog.warn() << myname << "(buildHistoryList): <History> empty. ignore..." << endl;
if( dlog.is_warn() )
dlog.warn() << myname << "(buildHistoryList): <History> empty. ignore..." << endl;
return;
}
......@@ -645,10 +666,11 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
hi.fuse_id = conf->getSensorID(it.getProp("fuse_id"));
if( hi.fuse_id == DefaultObjectId )
{
dlog.warn() << myname << "(buildHistory): not found sensor ID for "
<< it.getProp("fuse_id")
<< " history item id=" << it.getProp("id")
<< " ..ignore.." << endl;
if( dlog.is_warn() )
dlog.warn() << myname << "(buildHistory): not found sensor ID for "
<< it.getProp("fuse_id")
<< " history item id=" << it.getProp("id")
<< " ..ignore.." << endl;
continue;
}
......@@ -661,7 +683,8 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
hi.fuse_val = it.getIntProp("fuse_value");
}
dlog.info() << myname << "(buildHistory): add fuse_id=" << hi.fuse_id
if( dlog.is_info() )
dlog.info() << myname << "(buildHistory): add fuse_id=" << hi.fuse_id
<< " fuse_val=" << hi.fuse_val
<< " fuse_use_val=" << hi.fuse_use_val
<< " fuse_invert=" << hi.fuse_invert
......@@ -695,7 +718,8 @@ void SharedMemory::checkHistoryFilter( UniXML_iterator& xit )
ai.id = conf->getSensorID(xit.getProp("name"));
if( ai.id == DefaultObjectId )
{
dlog.warn() << myname << "(checkHistoryFilter): not found sensor ID for " << xit.getProp("name") << endl;
if( dlog.is_warn() )
dlog.warn() << myname << "(checkHistoryFilter): not found sensor ID for " << xit.getProp("name") << endl;
continue;
}
......
......@@ -355,16 +355,16 @@ void IOBase::processingThreshold( IOBase* it, SMInterface* shm, bool force )
// значение должно быть меньше lowLimit-чуствительность
if (it->ti.inverse)
{
if( val <= (it->ti.lowlimit-it->ti.sensibility) )
if( val <= it->ti.lowlimit )
set = true;
else if( val >= (it->ti.hilimit+it->ti.sensibility) )
else if( val >= it->ti.hilimit )
set = false;
}
else
{
if( val <= (it->ti.lowlimit-it->ti.sensibility) )
if( val <= it->ti.lowlimit )
set = false;
else if( val >= (it->ti.hilimit+it->ti.sensibility) )
else if( val >= it->ti.hilimit )
set = true;
}
......@@ -457,7 +457,6 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
b->cal.maxRaw = 0;
b->cal.minCal = 0;
b->cal.maxCal = 0;
b->cal.sensibility = 0;
b->cal.precision = 0;
b->cdiagram = 0;
b->f_median = false;
......@@ -472,7 +471,6 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
b->cal.maxRaw = it.getIntProp("rmax");
b->cal.minCal = it.getIntProp("cmin");
b->cal.maxCal = it.getIntProp("cmax");
b->cal.sensibility = it.getIntProp("sensibility");
b->cal.precision = it.getIntProp("precision");
int f_size = def_filtersize;
......@@ -542,7 +540,6 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
b->ti.lowlimit = it.getIntProp("lowlimit");
b->ti.hilimit = it.getIntProp("hilimit");
b->ti.sensibility = it.getIntProp("sensibility");
b->ti.inverse = it.getIntProp("inverse");
}
}
......
......@@ -31,15 +31,18 @@ void TestProc::sysCommand( UniSetTypes::SystemMessage* sm )
TestProc_SK::sysCommand(sm);
if( sm->command == SystemMessage::StartUp || sm->command == SystemMessage::WatchDog )
{
askTimer(tmCheckDepend,checkDependTime);
askTimer(tmCheckUndefState,checkUndefTime);
askTimer(tmCheck,checkTime);
askTimer(tmCheckWorking,checkWorkingTime);
// В начальный момент времени блокирующий датчик =0, поэтому d2_check_s должен быть равен depend_off_value (-50).
dlog.level1() << myname << "(startup): check init depend: " << ( getValue(d2_check_s) == -50 ? "OK" : "FAIL" ) << endl;
}
}
// -----------------------------------------------------------------------------
void TestProc::sensorInfo( SensorMessage *sm )
{
dlog[Debug::LEVEL1] << myname << "(sensorInfo): id=" << sm->id << " val=" << sm->value
<< " " << UInterface::timeToString(sm->sm_tv_sec,":")
dlog.level2() << myname << "(sensorInfo): id=" << sm->id << " val=" << sm->value
<< " " << timeToString(sm->sm_tv_sec,":")
<< "(" << setw(6) << sm->sm_tv_usec << "): "
<< endl;
......@@ -47,18 +50,18 @@ void TestProc::sensorInfo( SensorMessage *sm )
{
if( sm->value )
{
dlog[Debug::LEVEL1] << myname << "(sensorInfo): START WORKING.." << endl;
dlog.level1() << myname << "(sensorInfo): START WORKING.." << endl;
askTimer(tmChange,changeTime);
}
else
{
askTimer(tmChange,0);
dlog[Debug::LEVEL1] << myname << "(sensorInfo): STOP WORKING.." << endl;
dlog.level1() << myname << "(sensorInfo): STOP WORKING.." << endl;
}
}
else if( sm->id == check_undef_s )
{
dlog[Debug::LEVEL1] << myname << "(sensorInfo): CHECK UNDEFINED STATE ==> " << (sm->undefined==undef ? "OK" : "FAIL") << endl;
dlog.level1() << myname << "(sensorInfo): CHECK UNDEFINED STATE ==> " << (sm->undefined==undef ? "OK" : "FAIL") << endl;
}
}
// -----------------------------------------------------------------------------
......@@ -68,38 +71,60 @@ void TestProc::timerInfo( TimerMessage *tm )
{
state^=true;
out_lamp_c = ( state ? lmpBLINK : lmpOFF );
dlog[Debug::LEVEL1] << myname << "(timerInfo): state=" << state << " lmp=" << out_lamp_c << endl;
dlog.level2() << myname << ": state=" << state << " lmp=" << out_lamp_c << endl;
askTimer(tmCheckWorking,checkTime); // reset timer
}
else if( tm->id == tmCheckWorking )
dlog[Debug::LEVEL1] << myname << "(timerInfo): WORKING FAIL!" << endl;
else if( tm->id == tmCheckDepend )
dlog.level1() << myname << ": WORKING FAIL!" << endl;
else if( tm->id == tmCheck )
{
dlog[Debug::LEVEL1] << myname << "(timerInfo): Check depend..." << endl;
dlog.level1() << endl << endl << "--------" << endl;
test_depend();
test_undefined_state();
test_thresholds();
}
}
// -----------------------------------------------------------------------------
void TestProc::test_depend()
{
dlog.level1() << myname << ": Check depend..." << endl;
long test_val = 100;
long test_val = 100;
// set depend 0...
setValue(depend_c,0);
setValue(set_d1_check_s,test_val);
setValue(set_d2_check_s,test_val);
dlog[Debug::LEVEL1] << myname << "(timerInfo): check depend OFF: d1: " << ( getValue(d1_check_s) == 0 ? "OK" : "FAIL" ) << endl;
dlog[Debug::LEVEL1] << myname << "(timerInfo): check depend OFF: d2: " << ( getValue(d2_check_s) == -50 ? "OK" : "FAIL" ) << endl;
// set depend 0...
setValue(depend_c,0);
setValue(set_d1_check_s,test_val);
setValue(set_d2_check_s,test_val);
dlog.level1() << myname << ": check depend OFF: d1: " << ( getValue(d1_check_s) == 0 ? "OK" : "FAIL" ) << endl;
dlog.level1() << myname << ": check depend OFF: d2: " << ( getValue(d2_check_s) == -50 ? "OK" : "FAIL" ) << endl;
// set depend 1
setValue(depend_c,1);
dlog[Debug::LEVEL1] << myname << "(timerInfo): check depend ON: d1: " << ( getValue(d1_check_s) == test_val ? "OK" : "FAIL" ) << endl;
dlog[Debug::LEVEL1] << myname << "(timerInfo): check depend ON: d2: " << ( getValue(d2_check_s) == test_val ? "OK" : "FAIL" ) << endl;
}
else if( tm->id == tmCheckUndefState )
{
dlog[Debug::LEVEL1] << myname << "(timerInfo): Check undef state..." << endl;
undef ^= true;
// set depend 1
setValue(depend_c,1);
dlog.level1() << myname << ": check depend ON: d1: " << ( getValue(d1_check_s) == test_val ? "OK" : "FAIL" ) << endl;
dlog.level1() << myname << ": check depend ON: d2: " << ( getValue(d2_check_s) == test_val ? "OK" : "FAIL" ) << endl;
}
// -----------------------------------------------------------------------------
void TestProc::test_undefined_state()
{
// ---------------- Проверка выставления неопределённого состояния ---------------------
dlog.level1() << myname << ": Check undef state..." << endl;
undef ^= true;
si.id = undef_c;
si.node = conf->getLocalNode();
dlog[Debug::LEVEL1] << myname << "(timerInfo): set undefined=" << undef << endl;
ui.setUndefinedState( si, undef, getId() );
}
si.id = undef_c;
si.node = conf->getLocalNode();
dlog.level1() << myname << ": set undefined=" << undef << endl;
ui.setUndefinedState( si, undef, getId() );
}
// -----------------------------------------------------------------------------
void TestProc::test_thresholds()
{
// ---------------- Проверка работы порогов ---------------------
dlog.level1() << myname << ": Check thresholds..." << endl;
setValue(t_set_c,0);
dlog.level1() << myname << ": check threshold OFF value: " << ( getValue(t_check_s) == 0 ? "OK" : "FAIL" ) << endl;
setValue(t_set_c,378);
dlog.level1() << myname << ": check threshold ON value: " << ( getValue(t_check_s) == 1 ? "OK" : "FAIL" ) << endl;
}
// -----------------------------------------------------------------------------
......@@ -18,8 +18,7 @@ class TestProc:
{
tmChange,
tmCheckWorking,
tmCheckDepend,
tmCheckUndefState
tmCheck
};
virtual void step();
......@@ -27,6 +26,10 @@ class TestProc:
virtual void timerInfo( UniSetTypes::TimerMessage *tm );
virtual void sysCommand( UniSetTypes::SystemMessage* sm );
void test_depend();
void test_undefined_state();
void test_thresholds();
private:
bool state;
bool undef;
......
......@@ -17,9 +17,8 @@
</settings>
<variables>
<item name="changeTime" type="int" default="2000" min="0" comment="change state time" const="1" public="1" />
<item name="checkWorkingTime" type="int" default="3000" min="0" comment="check working time" const="1" public="1" />
<item name="checkTime" type="int" default="3000" min="0" comment="check Working time" const="1" public="1" />
<item name="checkDependTime" type="int" default="5000" min="0" comment="check depend time" const="1" public="1" />
<item name="checkUndefTime" type="int" default="3000" min="0" comment="check undef time" const="1" public="1" />
</variables>
<smap>
<!-- name - название переменной в конф. файле -->
......@@ -36,6 +35,11 @@
<!-- проверка работы undefined state -->
<item name="undef_c" vartype="out" comment="аналоговый датчик (для проверки undef-состояния)"/>
<item name="check_undef_s" vartype="in" comment="датчик для выставления undef-состояния"/>
<!-- проверка работы threshold-ов -->
<item name="t_set_c" vartype="out" comment="аналоговый датчик (для выставления порога)"/>
<item name="t_check_s" vartype="in" comment="датчик для проверки срабатывания"/>
</smap>
<msgmap>
......
......@@ -102,7 +102,6 @@ class IOController:
struct USensorInfo;
typedef std::map<UniSetTypes::KeyType, USensorInfo> IOStateList;
// ================== Достпуные сигналы =================
/*!
// \warning В сигнале напрямую передаётся итератор (т.е. по сути указатель на внутреннюю структуру!)
......@@ -151,10 +150,10 @@ class IOController:
// Дополнительные (вспомогательные поля)
UniSetTypes::uniset_rwmutex val_lock; /*!< флаг блокирующий работу со значением */
IOStateList::iterator it;
void* any; /*!< расширение для возможности хранения своей информации */
void* any; /*!< расширение для возможности хранения своей информации */
// сигнал для реализации механизма зависимостией..
// (все зависимые датчики подключаются к нему (см. NCRestorer::init_depends_signals)
......@@ -193,11 +192,18 @@ class IOController:
virtual bool disactivateObject();
virtual bool activateObject();
/*! Начальная инициализация (выставление значений) */
virtual void activateInit();
/*! регистрация датчиков, за информацию о которых отвечает данный IOController */
virtual void sensorsRegistration(){};
/*! удаление из репозитория датчиков за информацию о которых отвечает данный IOController */
virtual void sensorsUnregistration();
typedef sigc::signal<void, IOStateList::iterator&, IOController*> InitSignal;
// signal по изменению определённого датчика
inline InitSignal signal_init(){ return sigInit; }
/*! регистрация датчика
force=true - не проверять на дублирование (оптимизация)
*/
......@@ -230,7 +236,6 @@ class IOController:
ai.ci.maxRaw = 0;
ai.ci.minCal = 0;
ai.ci.maxCal = 0;
ai.ci.sensibility = 0;
ai.ci.precision = 0;
}
return ai;
......@@ -275,6 +280,7 @@ class IOController:
friend class NCRestorer;
ChangeSignal sigAnyChange;
ChangeSignal sigAnyUndefChange;
InitSignal sigInit;
IOStateList ioList; /*!< список с текущим состоянием аналоговых входов/выходов */
UniSetTypes::uniset_rwmutex ioMutex; /*!< замок для блокирования совместного доступа к ioList */
......
......@@ -63,7 +63,6 @@ class NCRestorer;
и оставлены для совместимости со старыми интерфейсами.
... продолжение следует...
\section sec_NC_Consumers Заказчики
В качестве "заказчиков" могут выступать любые UniSet-объекты (UniSetObject),
обладающие "обратным адресом" (идентификатором), по которому присылается
......@@ -143,8 +142,7 @@ class IONotifyController:
virtual void askThreshold(const IOController_i::SensorInfo& si, const UniSetTypes::ConsumerInfo& ci,
UniSetTypes::ThresholdId tid,
CORBA::Long lowLimit, CORBA::Long hiLimit, CORBA::Long sensibility,
UniversalIO::UIOCommand cmd );
CORBA::Long lowLimit, CORBA::Long hiLimit, UniversalIO::UIOCommand cmd );
virtual UniSetTypes::IDSeq* askSensorsSeq(const UniSetTypes::IDSeq& lst,
const UniSetTypes::ConsumerInfo& ci, UniversalIO::UIOCommand cmd);
......@@ -175,7 +173,7 @@ class IONotifyController:
struct ThresholdInfoExt:
public IONotifyController_i::ThresholdInfo
{
ThresholdInfoExt( UniSetTypes::ThresholdId tid, CORBA::Long low, CORBA::Long hi, CORBA::Long sb,
ThresholdInfoExt( UniSetTypes::ThresholdId tid, CORBA::Long low, CORBA::Long hi,
UniSetTypes::ObjectId _sid=UniSetTypes::DefaultObjectId,
bool inv = false ):
sid(_sid),
......@@ -184,21 +182,16 @@ class IONotifyController:
id = tid;
hilimit = hi;
lowlimit = low;
sensibility = sb;
state = IONotifyController_i::NormalThreshold;
}
ConsumerList clst;
/*! идентификатор дискретного датчика
связанного с данным порогом
*/
/*! идентификатор дискретного датчика связанного с данным порогом */
UniSetTypes::ObjectId sid;
/*! итератор в списке датчиков
(для оптимально-быстрого доступа)
*/
IOController::IOStateList::iterator itSID;
/*! итератор в списке датчиков (для оптимально-быстрого доступа) */
IOController::IOStateList::iterator sit;
/*! инверсная логика */
bool inverse;
......@@ -207,12 +200,10 @@ class IONotifyController:
{
return ((id == r.id) &&
(hilimit == r.hilimit) &&
(lowlimit == r.lowlimit) &&
(sensibility == r.sensibility) );
(lowlimit == r.lowlimit) );
}
};
typedef std::list<ThresholdInfoExt> ThresholdExtList;
/*! массив пар датчик->список потребителей */
......@@ -237,6 +228,7 @@ class IONotifyController:
protected:
IONotifyController();
virtual bool activateObject();
virtual void initItem( IOStateList::iterator& it, IOController* ic );
// ФИЛЬТРЫ
bool myIOFilter(const USensorInfo& ai, CORBA::Long newvalue, UniSetTypes::ObjectId sup_id);
......@@ -251,7 +243,6 @@ class IONotifyController:
//! поиск информации о пороговом датчике
ThresholdExtList::iterator findThreshold( UniSetTypes::KeyType k, UniSetTypes::ThresholdId tid );
//! сохранение информации об изменении состояния датчика в базу
virtual void loggingInfo(UniSetTypes::SensorMessage& sm);
......
......@@ -124,12 +124,12 @@ class UInterface
//! Заказ информации об изменении дискретного датчика
void askThreshold( UniSetTypes::ObjectId sensorId, UniSetTypes::ThresholdId tid,
UniversalIO::UIOCommand cmd,
CORBA::Long lowLimit=0, CORBA::Long hiLimit=0, CORBA::Long sensibility=0,
CORBA::Long lowLimit=0, CORBA::Long hiLimit=0,
UniSetTypes::ObjectId backid = UniSetTypes::DefaultObjectId );
void askRemoteThreshold( UniSetTypes::ObjectId sensorId, UniSetTypes::ObjectId node,
UniSetTypes::ThresholdId thresholdId, UniversalIO::UIOCommand cmd,
CORBA::Long lowLimit=0, CORBA::Long hiLimit=0, CORBA::Long sensibility=0,
CORBA::Long lowLimit=0, CORBA::Long hiLimit=0,
UniSetTypes::ObjectId backid = UniSetTypes::DefaultObjectId );
// ---------------------------------------------------------------
......
......@@ -62,7 +62,6 @@ class UniSetManager:
UniSetManager( const std::string& name, const std::string& section );
virtual ~UniSetManager();
virtual UniSetTypes::ObjectType getType(){ return UniSetTypes::getObjectType("UniSetManager"); }
// ------ функции объявленные в интерфейсе(IDL) ------
......@@ -114,7 +113,6 @@ class UniSetManager:
int objectsCount(); // количество подчиненных объектов
PortableServer::POA_ptr getPOA(){ return PortableServer::POA::_duplicate(poa); }
PortableServer::POAManager_ptr getPOAManager(){ return PortableServer::POAManager::_duplicate(pman); }
......@@ -136,7 +134,6 @@ class UniSetManager:
//! \note Переопределяя не забывайте вызвать базовую
virtual bool disactivateObject();
typedef UniSetManagerList::iterator MListIterator;
int getObjectsInfo( UniSetManager* mngr, UniSetTypes::SimpleInfoSeq* seq,
......
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \brief Базовый класс для реализации шаблона "наблюдатель"
* \author Pavel Vainerman
*/
//---------------------------------------------------------------------------
#ifndef UniSetObserver_H_
#define UniSetObserver_H_
//---------------------------------------------------------------------------
#include <list>
#include "UniSetObject.h"
#include "MessageType.h"
// --------------------------------------------------------------------------
class UniSetSubject
{
public:
UniSetSubject(UniSetTypes::ObjectId id);
~UniSetSubject();
virtual void attach( UniSetObject* o );
virtual void detach( UniSetObject* o );
virtual void attach( UniSetObject* o, int MessageType );
virtual void detach( UniSetObject* o, int MessageType );
protected:
UniSetSubject();
virtual void notify(int notify, int data,
UniSetTypes::Message::Priority priority=UniSetTypes::Message::Low);
virtual void notify( UniSetTypes::TransportMessage& msg );
private:
typedef std::list<UniSetObject*> ObserverList;
ObserverList lst;
UniSetTypes::ObjectId id;
};
//---------------------------------------------------------------------------
#endif
......@@ -60,14 +60,21 @@ namespace UniSetTypes
/*! генератор уникального положительного ключа
* Уникальность гарантируется только для пары значений
* id и node.
* \warning что тут у нас с переполнением..
* \warning Уникальность генерируемого ключа еще не проверялась,
но нареканий по использованию тоже не было :)
* \todo Желательно продумать что-нибудь с использованием хэш.
*/
inline static KeyType key( UniSetTypes::ObjectId id, UniSetTypes::ObjectId node )
inline static KeyType key( const UniSetTypes::ObjectId id, const UniSetTypes::ObjectId node )
{
return KeyType((id*node)+(id+2*node));
}
inline static KeyType key( const IOController_i::SensorInfo& si )
{
return key(si.id,si.node);
}
typedef std::list<std::string> ListObjectName; /*!< Список объектов типа ObjectName */
typedef ObjectId SysId;
......
......@@ -1219,15 +1219,15 @@ string UInterface::set_err(const string& pre, UniSetTypes::ObjectId id, UniSetTy
// --------------------------------------------------------------------------------------------
void UInterface::askThreshold( UniSetTypes::ObjectId sid, UniSetTypes::ThresholdId tid,
UniversalIO::UIOCommand cmd,
CORBA::Long low, CORBA::Long hi, CORBA::Long sb,
CORBA::Long low, CORBA::Long hi,
UniSetTypes::ObjectId backid)
{
askRemoteThreshold(sid, uconf->getLocalNode(), tid, cmd, low,hi,sb, backid);
askRemoteThreshold(sid, uconf->getLocalNode(), tid, cmd, low,hi, backid);
}
// --------------------------------------------------------------------------------------------
void UInterface::askRemoteThreshold( UniSetTypes::ObjectId sid, UniSetTypes::ObjectId node,
UniSetTypes::ThresholdId tid, UniversalIO::UIOCommand cmd,
CORBA::Long lowLimit, CORBA::Long hiLimit, CORBA::Long sensibility,
CORBA::Long lowLimit, CORBA::Long hiLimit,
UniSetTypes::ObjectId backid )
{
if( backid==UniSetTypes::DefaultObjectId )
......@@ -1264,7 +1264,7 @@ void UInterface::askRemoteThreshold( UniSetTypes::ObjectId sid, UniSetTypes::Obj
ci->id = backid;
ci->node = uconf->getLocalNode();
inc->askThreshold(si,ci,tid,lowLimit,hiLimit,sensibility,cmd);
inc->askThreshold(si,ci,tid,lowLimit,hiLimit,cmd);
return;
}
catch(CORBA::TRANSIENT){}
......
......@@ -248,14 +248,15 @@ void UniSetActivator::stop()
if( ulog.is_system() )
ulog.system() << myname << "(stop): discard request ok."<< endl;
/*
try
{
ulog.system() << myname << "(stop):: shutdown orb... "<<endl;
if( ulog.is_system() )
ulog.system() << myname << "(stop):: shutdown orb... "<<endl;
orb->shutdown(false);
}
catch(...){}
*/
if( ulog.is_system() )
ulog.system() << myname << "(stop): shutdown ok."<< endl;
}
......
......@@ -333,8 +333,7 @@ using namespace UniSetTypes;
{
return os << " rmin=" << c.minRaw << " rmax=" << c.maxRaw
<< " cmin=" << c.minCal << " cmax=" << c.maxCal
<< " precision=" << c.precision
<< " sensibility=" << c.sensibility;
<< " precision=" << c.precision;
}
// ------------------------------------------------------------------------------------------
bool UniSetTypes::check_filter( UniXML_iterator& it, const std::string f_prop, const std::string f_val )
......
......@@ -64,6 +64,10 @@ bool IOController::activateObject()
{
bool res = UniSetManager::activateObject();
sensorsRegistration();
// Начальная инициализация
activateInit();
return res;
}
// ------------------------------------------------------------------------------------------
......@@ -85,11 +89,39 @@ void IOController::sensorsUnregistration()
}
catch(Exception& ex)
{
ulog.crit() << myname << "(sensorsUnregistration): "<< ex << endl;
if( ulog.is_crit() )
ulog.crit() << myname << "(sensorsUnregistration): "<< ex << endl;
}
catch(...){}
}
}
// ------------------------------------------------------------------------------------------
void IOController::activateInit()
{
// Разрегистрируем аналоговые датчики
for( IOStateList::iterator li = ioList.begin(); li != ioList.end(); ++li )
{
try
{
USensorInfo& s(li->second);
// Проверка зависимостей
if( s.d_si.id != DefaultObjectId )
{
IOStateList::iterator d_it = myiofind( UniSetTypes::key(s.d_si) );
if( d_it != ioEnd() )
s.checkDepend(d_it, this);
}
sigInit.emit(li,this);
}
catch( Exception& ex )
{
if( ulog.is_crit() )
ulog.crit() << myname << "(activateInit): "<< ex << endl;
}
catch(...){}
}
}
// ------------------------------------------------------------------------------------------
CORBA::Long IOController::getValue( const IOController_i::SensorInfo& si )
......
......@@ -66,6 +66,7 @@ IONotifyController::IONotifyController( ObjectId id, NCRestorer* d ):
maxAttemtps(conf->getPIntField("ConsumerMaxAttempts", 5))
{
signal_change_undefined_state().connect(sigc::mem_fun(*this, &IONotifyController::onChangeUndefinedState));
signal_init().connect(sigc::mem_fun(*this, &IONotifyController::initItem));
// добавляем фильтры
addIOFilter( sigc::mem_fun(this,&IONotifyController::myIOFilter) );
......@@ -309,18 +310,12 @@ void IONotifyController::ask(AskMap& askLst, const IOController_i::SensorInfo& s
}
}
// ------------------------------------------------------------------------------------------
bool IONotifyController::myIOFilter(const USensorInfo& ai,
CORBA::Long newvalue, UniSetTypes::ObjectId sup_id)
bool IONotifyController::myIOFilter( const USensorInfo& ai,
CORBA::Long newvalue, UniSetTypes::ObjectId sup_id )
{
if( ai.value == newvalue )
return false;
if( ai.ci.sensibility <= 0 )
return true;
if( abs(ai.value - newvalue) < ai.ci.sensibility )
return false;
return true;
}
// ------------------------------------------------------------------------------------------
......@@ -453,8 +448,11 @@ void IONotifyController::loggingInfo(UniSetTypes::SensorMessage& sm)
// --------------------------------------------------------------------------------------------------------------
bool IONotifyController::activateObject()
{
IOController::activateObject();
// сперва вычитаем датчиков и заказчиков..
readDump();
// а потом уже собственно активация..
IOController::activateObject();
return true;
}
// --------------------------------------------------------------------------------------------------------------
......@@ -472,6 +470,14 @@ void IONotifyController::readDump()
}
}
// --------------------------------------------------------------------------------------------------------------
void IONotifyController::initItem( IOStateList::iterator& li, IOController* ic )
{
USensorInfo& s(li->second);
if( s.type == UniversalIO::AI || s.type == UniversalIO::AO )
checkThreshold( li, s.si, false );
}
// ------------------------------------------------------------------------------------------
void IONotifyController::dumpOrdersList(const IOController_i::SensorInfo& si,
const IONotifyController::ConsumerList& lst)
{
......@@ -515,8 +521,7 @@ void IONotifyController::dumpThresholdList(const IOController_i::SensorInfo& si,
void IONotifyController::askThreshold(const IOController_i::SensorInfo& si, const UniSetTypes::ConsumerInfo& ci,
UniSetTypes::ThresholdId tid,
CORBA::Long lowLimit, CORBA::Long hiLimit, CORBA::Long sb,
UniversalIO::UIOCommand cmd )
CORBA::Long lowLimit, CORBA::Long hiLimit, UniversalIO::UIOCommand cmd )
{
if( lowLimit > hiLimit )
throw IONotifyController_i::BadRange();
......@@ -531,8 +536,8 @@ void IONotifyController::askThreshold(const IOController_i::SensorInfo& si, cons
// поиск датчика в списке
UniSetTypes::KeyType skey( key(si.id,si.node) );
AskThresholdMap::iterator it = askTMap.find(skey);
ThresholdInfoExt ti(tid,lowLimit, hiLimit,sb);
ti.itSID = myioEnd();
ThresholdInfoExt ti(tid,lowLimit,hiLimit);
ti.sit = myioEnd();
switch( cmd )
{
......@@ -604,17 +609,17 @@ void IONotifyController::askThreshold(const IOController_i::SensorInfo& si, cons
sm.sm_tv_usec = ti.tv_usec;
sm.ci = li->second.ci;
// Проверка нижнего предела
if( val <= (lowLimit-sb) )
// Проверка нижнего предела
if( val <= lowLimit )
{
sm.threshold = false;
CORBA::Object_var op = ui.resolve(ci.id, ci.node);
CORBA::Object_var op = ui.resolve(ci.id, ci.node);
UniSetObject_i_var ref = UniSetObject_i::_narrow(op);
if(!CORBA::is_nil(ref))
ref->push(sm.transport_msg());
}
// Проверка верхнего предела
else if( val >= (hiLimit+sb) )
else if( val >= hiLimit )
{
sm.threshold = true;
CORBA::Object_var op = ui.resolve(ci.id, ci.node);
......@@ -691,7 +696,6 @@ bool IONotifyController::addThreshold(ThresholdExtList& lst, ThresholdInfoExt& t
addConsumer(ti.clst, ci);
// запоминаем начальное время
struct timeval tm;
struct timezone tz;
......@@ -766,9 +770,11 @@ void IONotifyController::checkThreshold( IOStateList::iterator& li,
for( ThresholdExtList::iterator it=lst->second.list.begin(); it!=lst->second.list.end(); ++it)
{
// Используем здесь sm.value чтобы не делать ещё раз lock на li->second.value
// Проверка нижнего предела
// значение должно быть меньше lowLimit-чуствительность
if( li->second.value <= (it->lowlimit-it->sensibility) )
if( sm.value <= it->lowlimit )
{
if( it->state == IONotifyController_i::LowThreshold )
continue;
......@@ -793,7 +799,7 @@ void IONotifyController::checkThreshold( IOStateList::iterator& li,
if( it->inverse )
state^=1;
localSetValue(it->itSID,SensorInfo(it->sid),(state ? 1:0),getId());
localSetValue(it->sit,SensorInfo(it->sid),(state ? 1:0),getId());
}
catch( UniSetTypes::Exception& ex )
{
......@@ -808,7 +814,7 @@ void IONotifyController::checkThreshold( IOStateList::iterator& li,
}
// Проверка верхнего предела
// значение должно быть больше hiLimit+чуствительность
else if( li->second.value >= (it->hilimit+it->sensibility) )
else if( sm.value >= it->hilimit )
{
if( it->state == IONotifyController_i::HiThreshold )
continue;
......@@ -832,7 +838,7 @@ void IONotifyController::checkThreshold( IOStateList::iterator& li,
if( it->inverse )
state^=1;
localSetValue(it->itSID,SensorInfo(it->sid),(state?1:0),getId());
localSetValue(it->sit,SensorInfo(it->sid),(state?1:0),getId());
}
catch( UniSetTypes::Exception& ex )
{
......@@ -849,7 +855,6 @@ void IONotifyController::checkThreshold( IOStateList::iterator& li,
it->state = IONotifyController_i::NormalThreshold;
}
} // unlock
}
// --------------------------------------------------------------------------------------------------------------
IONotifyController::ThresholdExtList::iterator IONotifyController::findThreshold( UniSetTypes::KeyType key, UniSetTypes::ThresholdId tid )
......@@ -910,7 +915,6 @@ IONotifyController_i::ThresholdsListSeq* IONotifyController::getThresholdsList()
(*res)[i].tlist[k].id = it2->id;
(*res)[i].tlist[k].hilimit = it2->hilimit;
(*res)[i].tlist[k].lowlimit = it2->lowlimit;
(*res)[i].tlist[k].sensibility = it2->sensibility;
(*res)[i].tlist[k].state = it2->state;
(*res)[i].tlist[k].tv_sec = it2->tv_sec;
(*res)[i].tlist[k].tv_usec = it2->tv_usec;
......
......@@ -65,7 +65,8 @@ void NCRestorer::addlist( IONotifyController* ic, SInfo& inf, IONotifyController
break;
default:
ulog.crit() << ic->getName() << "(askDumper::addlist): НЕИЗВЕСТНЫЙ ТИП ДАТЧИКА! -> "
if( ulog.is_crit() )
ulog.crit() << ic->getName() << "(askDumper::addlist): НЕИЗВЕСТНЫЙ ТИП ДАТЧИКА! -> "
<< conf->oind->getNameById(inf.si.id,inf.si.node) << endl;
return;
break;
......@@ -84,8 +85,9 @@ void NCRestorer::addlist( IONotifyController* ic, SInfo& inf, IONotifyController
break;
default:
ulog.crit() << ic->getName() << "(askDumper::addlist): НЕИЗВЕСТНЫЙ ТИП ДАТЧИКА!-> "
<< conf->oind->getNameById(inf.si.id,inf.si.node) << endl;
if( ulog.is_crit() )
ulog.crit() << ic->getName() << "(NCRestorer::addlist): НЕИЗВЕСТНЫЙ ТИП ДАТЧИКА!-> "
<< conf->oind->getNameById(inf.si.id,inf.si.node) << endl;
break;
}
}
......@@ -120,7 +122,7 @@ void NCRestorer::addthresholdlist( IONotifyController* ic, SInfo& inf, IONotifyC
// default init iterators
for( IONotifyController::ThresholdExtList::iterator it=lst.begin(); it!=lst.end(); ++it )
it->itSID = ic->myioEnd();
it->sit = ic->myioEnd();
UniSetTypes::KeyType k( key(inf.si.id,inf.si.node) );
ic->askTMap[k].si = inf.si;
......@@ -128,6 +130,8 @@ void NCRestorer::addthresholdlist( IONotifyController* ic, SInfo& inf, IONotifyC
ic->askTMap[k].list = lst;
ic->askTMap[k].ait = ic->myioEnd();
// Начальная инициализация делается в IOController (IONotifyContoller) в момент "активации". см. IOController::activateInit()
#if 0
try
{
switch( inf.type )
......@@ -148,22 +152,25 @@ void NCRestorer::addthresholdlist( IONotifyController* ic, SInfo& inf, IONotifyC
break;
}
}
catch(Exception& ex)
catch( Exception& ex )
{
ulog.warn() << ic->getName() << "(NCRestorer::addthresholdlist): " << ex
if( ulog.is_warn() )
ulog.warn() << ic->getName() << "(NCRestorer::addthresholdlist): " << ex
<< " для " << conf->oind->getNameById(inf.si.id, inf.si.node) << endl;
throw;
}
catch( CORBA::SystemException& ex )
{
ulog.warn() << ic->getName() << "(NCRestorer::addthresholdlist): "
if( ulog.is_warn() )
ulog.warn() << ic->getName() << "(NCRestorer::addthresholdlist): "
<< conf->oind->getNameById(inf.si.id,inf.si.node) << " недоступен!!(CORBA::SystemException): "
<< ex.NP_minorString() << endl;
throw;
}
#endif
}
// ------------------------------------------------------------------------------------------
NCRestorer::SInfo& NCRestorer::SInfo::operator=(IOController_i::SensorIOInfo& inf)
NCRestorer::SInfo& NCRestorer::SInfo::operator=( IOController_i::SensorIOInfo& inf )
{
this->si = inf.si;
this->type = inf.type;
......@@ -199,6 +206,6 @@ void NCRestorer::init_depends_signals( IONotifyController* ic )
IOController::ChangeSignal s = ic->signal_change_value(it->second.d_si);
s.connect( sigc::mem_fun( &it->second, &IOController::USensorInfo::checkDepend) );
}
}
}
// -----------------------------------------------------------------------------
......@@ -115,7 +115,8 @@ void NCRestorer_XML::read_list( UniXML& xml, xmlNode* node, IONotifyController*
if( !getSensorInfo(xml,it,inf) )
{
ulog.warn() << ic->getName() << "(read_list): не смог получить информацию по датчику " << endl;
if( ulog.is_warn() )
ulog.warn() << ic->getName() << "(read_list): не смог получить информацию по датчику " << endl;
continue;
}
......@@ -265,14 +266,7 @@ bool NCRestorer_XML::getSensorInfo( UniXML& xml, xmlNode* it, SInfo& inf )
else if( prior == "Super" )
inf.priority = Message::Super;
else
{
inf.priority = Message::Medium;
if( ulog.is_info() )
{
ulog.info() << "(NCRestorer_XML:getSensorInfo): не указан приоритет для "
<< xml.getProp(it,"name") << endl;
}
}
inf.type = UniSetTypes::getIOType(xml.getProp(it,"iotype"));
if( inf.type == UniversalIO::UnknownIOType )
......@@ -289,7 +283,6 @@ bool NCRestorer_XML::getSensorInfo( UniXML& xml, xmlNode* it, SInfo& inf )
inf.ci.maxRaw = xml.getIntProp(it,"rmax");
inf.ci.minCal = xml.getIntProp(it,"cmin");
inf.ci.maxCal = xml.getIntProp(it,"cmax");
inf.ci.sensibility = xml.getIntProp(it,"sensibility");
inf.ci.precision = xml.getIntProp(it,"precision");
}
else
......@@ -298,13 +291,12 @@ bool NCRestorer_XML::getSensorInfo( UniXML& xml, xmlNode* it, SInfo& inf )
inf.ci.maxRaw = 0;
inf.ci.minCal = 0;
inf.ci.maxCal = 0;
inf.ci.sensibility = 0;
inf.ci.precision = 0;
}
inf.default_val = xml.getIntProp(it,"default");
inf.dbignore = xml.getIntProp(it,"dbignore");
inf.value = inf.default_val;
inf.value = inf.default_val;
inf.undefined = false;
inf.real_value = inf.value;
......@@ -379,7 +371,6 @@ void NCRestorer_XML::read_thresholds(UniXML& xml, xmlNode* node, IONotifyControl
{
ulog.info() << "(read_thresholds): \tthreshold low="
<< ti.lowlimit << " \thi=" << ti.hilimit
<< " \t sb=" << ti.sensibility
<< " \t sid=" << ti.sid
<< " \t inverse=" << ti.inverse
<< endl << flush;
......@@ -482,7 +473,6 @@ bool NCRestorer_XML::getThresholdInfo( UniXML& xml,xmlNode* node,
ti.id = uit.getIntProp("id");
ti.lowlimit = uit.getIntProp("lowlimit");
ti.hilimit = uit.getIntProp("hilimit");
ti.sensibility = uit.getIntProp("sensibility");
ti.inverse = uit.getIntProp("inverse");
ti.state = IONotifyController_i::NormalThreshold;
return true;
......
......@@ -85,7 +85,6 @@ tid(UniSetTypes::DefaultThresholdId)
ci.maxRaw = 0;
ci.minCal = 0;
ci.maxCal = 0;
ci.sensibility = 0;
ci.precision = 0;
}
......
......@@ -286,7 +286,7 @@ void SViewer::updateThresholds( IONotifyController_i::ThresholdsListSeq_var& tls
IONotifyController_i::ThresholdInfo* ti = &tlst[i].tlist[k];
cout << "\t(" << setw(3) << ti->id << ") | " << ti->state << " | hi: " << setw(5) << ti->hilimit;
cout << " | low: " << setw(5) << ti->lowlimit;
cout << " | sb: " << setw(5) << ti->sensibility << endl;
cout << endl;
}
}
}
......
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