import pregunta as P import processaA11 as E if(len(sys.argv)<2): print 'Ús: python %s dd-mm-yy' % sys.argv[0] sys.exit() else: data=sys.argv[1] data=data.split("-") dia=int(data[0]) mes=int(data[1]) yea=int(data[2]) '''Login ASDU 183''' P.pregunta(C.creaTramaVar(0b01110011,C.creaASDU183())) #request data & send password P.pregunta(C.creaTramaFix(0b01011011)) #request data '''ASDU 123, registre 11, objecte 1 (inicial i final)''' P.pregunta( C.creaTramaVar(0b01110011, C.creaASDU123(11,1,1, C.creaTemps(dia ,mes,yea,0,0), C.creaTemps(dia+1,mes,yea,0,0)))) P.pregunta(C.creaTramaFix(0b01011011)) #request data respostes=[] #array per contenir les respostes a processar (trames amb asdus 11) while True: #vés consultant fins que doni senyal de fi try: respostes.append(P.pregunta(C.creaTramaFix(0b01111011))) #flip FCB bit respostes.append(P.pregunta(C.creaTramaFix(0b01011011))) #request data except: #quan s'acabi donarà runtime error
ASDU 123 amb registre 21 dóna resums diaris ASDU 122 amb registre 21 dóna els resums diaris (respon ASDU 8) ===NO FUNCIONA ASDU 122 amb registre 11 no funciona ASDU 115: no disponible (esborrat del codi) ASDU 118: no disponible (idem) ''' import sys sys.path.insert(0, "../bin") #add bin folder to path import crea as C import pregunta as P #login P.pregunta(C.creaTramaVar(0b01110011, C.creaASDU183())) #request user data & send password P.pregunta(C.creaTramaFix(0b01011011)) #request class 2 data '''TEST: ASDU 123 amb registre 21''' P.pregunta( C.creaTramaVar( 0b01110011, C.creaASDU123(21, 1, 1, C.creaTemps(16, 10, 20, 0, 0, 0), C.creaTemps(16, 10, 22, 0, 0, 0)))) while (1): P.pregunta(C.creaTramaFix(0b01011011)) #request data P.pregunta(C.creaTramaFix(0b01111011)) #request data (flip FCB) quit('STOP') #TEST: prova asdu 190 amb registre 11 (Curva de carga) i direccio 9,10,11 '''La dirección de objeto selecciona la obtención de bloques de puntos de medida genéricos con reservas (9),
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' asdu 103 pregunta la hora al comptador ''' import sys sys.path.insert(0, "../bin") #add bin folder to path import crea as C import pregunta as P #login P.pregunta(C.creaTramaVar(0b01110011, C.creaASDU183())) #request user data & send password P.pregunta(C.creaTramaFix(0b01011011)) #request data #envia asdu 103 P.pregunta(C.creaTramaVar(0x73, C.creaASDU103())) P.pregunta(C.creaTramaFix(0b01011011)) #request data