Commit 523ad82b authored by Pavel Vainerman's avatar Pavel Vainerman

add processingThresholds function

parent dd3b30d8
......@@ -24,6 +24,5 @@
SensorInfo ObjectId.
----------
RTUExchabge: vtype="Byte"
smonit: processing "precision"
admin: processing "precision"
\ No newline at end of file
......@@ -492,6 +492,9 @@ void IOControl::iopoll()
unideb[Debug::LEVEL3] << myname << "(iopoll): catch ..." << endl;
}
}
for( IOMap::iterator it=iomap.begin(); it!=iomap.end(); ++it )
IOBase::processingThreshold(&(*it),shm,force);
}
// --------------------------------------------------------------------------------
void IOControl::readConfiguration()
......
......@@ -298,6 +298,9 @@ void MBMaster::poll()
dlog[Debug::LEVEL3] << myname << "(poll): catch ..." << endl;
}
}
for( MBMap::iterator it=mbmap.begin(); it!=mbmap.end(); ++it )
IOBase::processingThreshold(&(*it),shm,force);
}
// -----------------------------------------------------------------------------
long MBMaster::readReg( MBMap::iterator& p )
......
......@@ -307,6 +307,9 @@ void MBSlave::execute_rtu()
<< "(execute_rtu): (hb) " << ex << std::endl;
}
}
for( IOMap::iterator it=iomap.begin(); it!=iomap.end(); ++it )
IOBase::processingThreshold(&it->second,shm,force);
}
catch(...){}
}
......@@ -355,6 +358,9 @@ void MBSlave::execute_tcp()
<< "(execute_tcp): (hb) " << ex << std::endl;
}
}
for( IOMap::iterator it=iomap.begin(); it!=iomap.end(); ++it )
IOBase::processingThreshold(&it->second,shm,force);
}
catch(...){}
}
......
......@@ -317,6 +317,18 @@ void RTUExchange::poll()
// update SharedMemory...
updateSM();
// check thresholds
for( RTUExchange::RTUDeviceMap::iterator it1=rmap.begin(); it1!=rmap.end(); ++it1 )
{
RTUDevice* d(it1->second);
for( RTUExchange::RegMap::iterator it=d->regmap.begin(); it!=d->regmap.end(); ++it )
{
RegInfo* r(it->second);
for( PList::iterator i=r->slst.begin(); i!=r->slst.end(); ++i )
IOBase::processingThreshold( &(*i),shm,force);
}
}
// printMap(rmap);
}
// -----------------------------------------------------------------------------
......
......@@ -34,8 +34,7 @@ static const int NoSafety = -1;
jar_state(false),
ondelay_state(false),
offdelay_state(false),
t_ai(UniSetTypes::DefaultObjectId),
initOK(false)
t_ai(UniSetTypes::DefaultObjectId)
{}
......
......@@ -370,17 +370,10 @@ void IOBase::processingThreshold( IOBase* it, SMInterface* shm, bool force )
if( it->t_ai == DefaultObjectId )
return;
if( !it->initOK )
{
shm->initAIterator(it->ait);
shm->initDIterator(it->dit);
it->initOK = true;
}
long val = shm->localGetValue(it->ait,it->t_ai);
bool set = it->value ? true : false;
cout << "val=" << val << " set=" << set << endl;
// cout << "val=" << val << " set=" << set << endl;
//
// lowLimit-
if( val <= (it->ti.lowlimit-it->ti.sensibility) )
......@@ -388,8 +381,8 @@ void IOBase::processingThreshold( IOBase* it, SMInterface* shm, bool force )
else if( val >= (it->ti.hilimit+it->ti.sensibility) )
set = true;
cout << "thresh: set=" << set << endl;
processingDI(it,set,shm,force);
// cout << "thresh: set=" << set << endl;
processingAsDI(it,set,shm,force);
}
// -----------------------------------------------------------------------------
......
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