Created
December 12, 2018 14:11
-
-
Save MiquelIR/2ddde365ec7947af77dbd2ec16140e03 to your computer and use it in GitHub Desktop.
Seleccionar bits de control para configurar excepción de contadores TG
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import product, combinations | |
array = dict.fromkeys([0,1,2,3,4,5,6,7], 0) | |
stuff = [1,3,7] | |
for L in range(0, len(stuff)+1): | |
for subset in combinations(stuff, L): | |
subarray = array.copy() | |
value = '' | |
for x in subset: | |
subarray[x] = 1 | |
for y in sorted(subarray.keys(), reverse=True): | |
value += str(subarray[y]) | |
if len(value) != 8: | |
print 'ERROR!!!' | |
v = int(str(value), 2) | |
hex_value = hex(v).split('x')[-1] | |
if len(hex_value) < 2: | |
hex_value = hex_value.zfill(2) | |
print hex_value | |
print subset |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Los bits de control són códigos validadores, si un bit falla se indica con un 1 en la posición del bit erróneo.
Actualmente para perfiles de telegestión se comprueba lo siguiente:
Bit 7: Invalid measure
Bit 6: Synchronized meter during period
Bit 5: Overflow
Bit 4: Time verification during period
Bit 3: Modified parameters during period
Bit 2: Intrusion detected
Bit 1: Incomplete period due to power failure
Bit 0: No checks