Fraunhofer-FIT-DIEN / iec104-python

A Python module to simulate SCADA and RTU communication over protocol 60870-5-104 to research ICT behavior in power grids.

Home Page:https://iec104-python.readthedocs.io/python/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setting the quality value at the default Point

ArtTron22 opened this issue · comments

Hello. I had the following question: imagine that at some point my daughter's quality parameter changed to point.quality = c 104.Quality.Invalid. But then, after several polls, the quality of this point should become normal again, those QUALITY = Quality set: {}, is_good: True. How could I do that?
I tried to change this somehow in the before_transmit function in point.on_before_read(callable=before_transmit), where point.set(value=32, quality=point.quality, timestamp_ms=int(time.time() * 1000)), but I failed. How can I set the default value to quality again?

Hello, you should be able to use the empty constructor to reset the quality to Good.

Reset all bits of the quality:

point.quality = c104.Quality()

Quality is a bitset, if no bit is set, then the quality is good. The other option would be to unset just the Invalid bit, but assigning a fresh quality is easier.

Disable only the Invalid bit and keep other bits as is:

point.quality ^= c104.Quality.Invalid

Enable only the Invalid bit and keep other bits as is:

point.quality |= c104.Quality.Invalid

Thank you very much!
point.quality = c104.Quality() works great)