def _modbusRead(self, key):
if self.PM_cacheEnabled is False:
# W/O cache
val = self.mb.readRegistersAndDecode(self.modbusmap[key][0],self.modbusmap[key][1],self.modbusmap[key][2])
else:
# with cache
val = self.mb.cachedRead(self.modbusmap[key][0], self.modbusmap[key][1], self.modbusmap[key][2])
log.debug('"%s" Modbus: (%s,%s,%s) = %s' % (key, self.modbusmap[key][0],
self.modbusmap[key][1], self.modbusmap[key][2], val))
if self.modbusmap[key][2].startswith("float"):
try:
if math.isnan(val):
log.debug("NaN regs %s => 0" % self.modbusmap[key][0])
val = 0
except TypeError:
val = 0
return val
SchneiderElectric_iEM3255.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录