sdm120c problema setup "Problem locking serial device"

Discussioni relative all'uso di contatori SDM120 SDM220 modbus
alexf
Messaggi: 35
Iscritto il: 19/05/2016, 12:57

Re: sdm120c problema setup "Problem locking serial device"

Messaggioda alexf » 02/06/2016, 9:31

ok...non c'è problema
tanto ho riscritto l'immagine , non hi ancora configurato metern

ritorniamo sul contatore come faccio a resettarlo o a riportarlo su indirizzo 1 ?

ho provato a

Codice: Seleziona tutto

sudo sdm120c -a 2 -s 1 /dev/ttyUSB0
20160602-09:28:08.258136: sdm120c(8267) error: (110) Connection timed out, -1, 0
NOK


Avatar utente
Flane
Messaggi: 2084
Iscritto il: 16/01/2016, 15:02

Re: sdm120c problema setup "Problem locking serial device"

Messaggioda Flane » 02/06/2016, 9:48

Cavolo ma dovresti imparare a forza di prove .... se non specifici la velocità visto che non è quella di default ..... :shock:
usate la testa ogni tanto ..... ;)

prima metti in SET il contatore
poi

Codice: Seleziona tutto

sdm120c -a 2 -s 1 -b9600 -PN /dev/ttyUSB0

QUANDO CAMBI QUALCHE PARAMETRO POI DEVI SEMPRE SPECIFICARLO, ALTRIMENTI IL SOFTWARE UTILIZZA QUELLI DI DEFAULT (indirizzo 1, velocità 2400, parità None) e non trovando corrispondenza da errore !!!

alexf
Messaggi: 35
Iscritto il: 19/05/2016, 12:57

Re: sdm120c problema setup "Problem locking serial device"

Messaggioda alexf » 02/06/2016, 9:54

grazie!!
Flane scusa per le distrazioni ,non volevo approfittare della tua pazienza

ok son riuscito
ma con la vecchia versione

Codice: Seleziona tutto

pi@raspberrypi:~/sdm120c_v114 $ sudo ./sdm120c -a 2 -s 1 -b9600 -PN /dev/ttyUSB0
New value 1 for address 0x14
You have to restart the meter for apply chang


alexf
Messaggi: 35
Iscritto il: 19/05/2016, 12:57

Re: sdm120c problema setup "Problem locking serial device"

Messaggioda alexf » 02/06/2016, 10:15

no

pi@raspberrypi:~ $ sudo sdm120c -a 2 -s 1 -b9600 -PN /dev/ttyUSB0
20160602-09:50:47.080269: sdm120c(1144) error: (110) Connection timed out, -1, 0
NOK
e allora ho provato subito con
pi@raspberrypi:~/sdm120c_v114 $ sudo ./sdm120c -a 2 -s 1 -b9600 -PN /dev/ttyUSB0
New value 1 for address 0x14
You have to restart the meter for apply changes

Avatar utente
Flane
Messaggi: 2084
Iscritto il: 16/01/2016, 15:02

Re: sdm120c problema setup "Problem locking serial device"

Messaggioda Flane » 02/06/2016, 10:21

Presumo che ora hai il contatore con indirizzo 1.

Puoi provare a fare il seguente tentativo di riportare a 2 l'indirizzo con il software nuovo e con l'opzione -d1?

Codice: Seleziona tutto

sudo sdm120c -a 1 -s 2 -b9600 -PN -d1 /dev/ttyUSB0

alexf
Messaggi: 35
Iscritto il: 19/05/2016, 12:57

Re: sdm120c problema setup "Problem locking serial device"

Messaggioda alexf » 02/06/2016, 14:08

si confermo ora sono ad ID 1 verificato display

Codice: Seleziona tutto

pi@raspberrypi:~ $ sdm120c -a 1 -P N -b 9600 /dev/ttyUSB0
Voltage: 229.70 V
Current: 0.00 A
Power: 0.00 W
Active Apparent Power: 0.00 VA
Reactive Apparent Power: 0.00 VAR
Power Factor: 1.00
Phase Angle: 0.00 Degree
Frequency: 49.95 Hz
Import Active Energy: 256 Wh
Export Active Energy: 0 Wh
Total Active Energy: 256 Wh
Import Reactive Energy: 204 VARh
Export Reactive Energy: 0 VARh
Total Reactive Energy: 204 VARh
OK


poi tento di riportare a 2 come suggerito

Codice: Seleziona tutto

[size=85]pi@raspberrypi:~ $ sudo sdm120c -a 1 -s 2 -b9600 -PN -d1 /dev/ttyUSB0
20160602-14:02:58.944569: sdm120c(2683) cmdline="sdm120c -a 1 -s 2 -b9600 -PN -d1 /dev/ttyUSB0"
20160602-14:02:58.947603: sdm120c(2683) szttyDevice: /dev/ttyUSB0
20160602-14:02:58.949893: sdm120c(2683) devLCKfile: </var/lock/LCK..ttyUSB0>
20160602-14:02:58.951229: sdm120c(2683) devLCKfileNew: </var/lock/LCK..ttyUSB0.2683>
20160602-14:02:58.951562: sdm120c(2683) PID: 2683
20160602-14:02:58.951960: sdm120c(2683) Attempting to get lock on Serial Port /dev/ttyUSB0...
20160602-14:02:58.952450: sdm120c(2683) Acquiring shared lock on /var/lock/LCK..ttyUSB0...
20160602-14:02:58.953848: sdm120c(2683) Shared lock on /var/lock/LCK..ttyUSB0 acquired...
20160602-14:02:58.954424: sdm120c(2683) Checking for lock
20160602-14:02:58.956535: sdm120c(2683) errno=0, bRead=2 PID=2683 LckPID=2683
20160602-14:02:58.956897: sdm120c(2683) Checking process 2683 (sdm120c) for lock
20160602-14:02:58.958463: sdm120c(2683) PID: 2683 COMMAND: "sdm120c" LckPID: 2683 LckCOMMAND: "sdm120c" LckPIDcommand "sdm120c" = me
20160602-14:02:58.959091: sdm120c(2683) Appears we got the lock.
20160602-14:02:58.960329: sdm120c(2683) resp_timeout=200000us
20160602-14:02:58.960716: sdm120c(2683) Libmodbus context open (9600N2)
20160602-14:02:58.960994: sdm120c(2683) Byte timeout disabled.
20160602-14:02:58.961271: sdm120c(2683) New response timeout: 0s, 200000us
New value 2 for address 0x14
20160602-14:02:59.044828: sdm120c(2683) devLCKfile: </var/lock/LCK..ttyUSB0>
20160602-14:02:59.046158: sdm120c(2683) devLCKfileNew: </var/lock/LCK..ttyUSB0.2683>
20160602-14:02:59.047301: sdm120c(2683) Clearing Serial Port Lock (2683)...
20160602-14:02:59.047654: sdm120c(2683) Acquiring exclusive lock on /var/lock/LCK..ttyUSB0...
20160602-14:02:59.048273: sdm120c(2683) Exclusive lock on /var/lock/LCK..ttyUSB0 acquired (0) Success...
20160602-14:02:59.049871: sdm120c(2683) cmdLen=7
20160602-14:02:59.050186: sdm120c(2683) cmdLen=7 COMMAND is not null
20160602-14:02:59.051491: sdm120c(2683) errno=0, bRead=2 LckPID=2683 PID=2683 COMMAND='sdm120c'
20160602-14:02:59.051924: sdm120c(2683) errno=0, bRead=-1 LckPID=2683 PID=0 COMMAND=''
20160602-14:02:59.052819: sdm120c(2683) Clearing Serial Port Lock done[/size]


dopo aver risposto con questo log
]verifico a dispaly ok id2

e anche interrogando il contatore

Codice: Seleziona tutto

[size=85
pi@raspberrypi:~ $ sdm120c -a 2 -P N -b 9600 /dev/ttyUSB0
Voltage: 230.00 V
Current: 0.00 A
Power: 0.00 W
Active Apparent Power: 0.00 VA
Reactive Apparent Power: 0.00 VAR
Power Factor: 1.00
Phase Angle: 0.00 Degree
Frequency: 49.95 Hz
Import Active Energy: 256 Wh
Export Active Energy: 0 Wh
Total Active Energy: 256 Wh
Import Reactive Energy: 204 VARh
Export Reactive Energy: 0 VARh
Total Reactive Energy: 204 VARh
OK
[/size]

Avatar utente
Flane
Messaggi: 2084
Iscritto il: 16/01/2016, 15:02

Re: sdm120c problema setup "Problem locking serial device"

Messaggioda Flane » 02/06/2016, 14:31

OK, come vedi il cambio indirizzo funziona anche con il software nuovo.
Probabilmente è meglio usare l'opzione -z3 anche durante queste operazioni, così in caso di errori il software prova 3 volte prima di demordere.
Il bug comunque sembra essere solo sul cambio velocità.

Visto che stai diventando esperto :P , ti chiedo nuovamente un'ultima prova.
Prova ancora a cambiare la velocità con il software nuovo sempre con il debug attivo (opzione -d1)

Codice: Seleziona tutto

sudo sdm120c -a 2 -b9600 -r2400 -PN -d1 /dev/ttyUSB0

scusa ma le prove sono utili per cercare di individuare il problema.
Attenzione che per il cambio di velocità devi successivamente anche riavviare il contatore togliendo tensione.

In caso negativo, se possibile fai più di una prova come sopra, eventualmente aggiungendo anche l'opzione -z3.

Codice: Seleziona tutto

sudo sdm120c -a 2 -b9600 -r2400 -PN -d1 -z3 /dev/ttyUSB0

alexf
Messaggi: 35
Iscritto il: 19/05/2016, 12:57

Re: sdm120c problema setup "Problem locking serial device"

Messaggioda alexf » 02/06/2016, 14:54

a disposizione , :)
ecco la prova
premetto che io ora sono a ID 1 e lancio i comandi su quel valore

Codice: Seleziona tutto

[size=85]pi@raspberrypi:~/sdm120c_v114 $ sudo sdm120c -a 1 -b9600 -r2400 -PN -d1 /dev/ttyUSB0   20160602-14:47:25.700966: sdm120c(4034) cmdline="sdm120c -a 1 -b9600 -r2400 -PN -d1 /dev/ttyUSB0"
20160602-14:47:25.704106: sdm120c(4034) szttyDevice: /dev/ttyUSB0
20160602-14:47:25.706439: sdm120c(4034) devLCKfile: </var/lock/LCK..ttyUSB0>
20160602-14:47:25.706727: sdm120c(4034) devLCKfileNew: </var/lock/LCK..ttyUSB0.4034>
20160602-14:47:25.708175: sdm120c(4034) PID: 4034
20160602-14:47:25.708590: sdm120c(4034) Attempting to get lock on Serial Port /dev/ttyUSB0...
20160602-14:47:25.710039: sdm120c(4034) Acquiring shared lock on /var/lock/LCK..ttyUSB0...
20160602-14:47:25.710391: sdm120c(4034) Shared lock on /var/lock/LCK..ttyUSB0 acquired...
20160602-14:47:25.711215: sdm120c(4034) Checking for lock
20160602-14:47:25.713125: sdm120c(4034) errno=0, bRead=2 PID=4034 LckPID=4034
20160602-14:47:25.714406: sdm120c(4034) Checking process 4034 (sdm120c) for lock
20160602-14:47:25.716113: sdm120c(4034) PID: 4034 COMMAND: "sdm120c" LckPID: 4034 LckCOMMAND: "sdm120c" LckPIDcommand "sdm120c" = me
20160602-14:47:25.716446: sdm120c(4034) Appears we got the lock.
20160602-14:47:25.717707: sdm120c(4034) resp_timeout=200000us
20160602-14:47:25.718095: sdm120c(4034) Libmodbus context open (9600N2)
20160602-14:47:25.718371: sdm120c(4034) Byte timeout disabled.
20160602-14:47:25.718649: sdm120c(4034) New response timeout: 0s, 200000us
20160602-14:47:25.726634: sdm120c(4034) 1/1. Register Address 30001 [0000]
20160602-14:47:25.784429: sdm120c(4034) Read time: 55483us
20160602-14:47:25.784753: sdm120c(4034) reg[0/1]=17253 (0x4365)
20160602-14:47:25.785214: sdm120c(4034) reg[1/1]=32768 (0x8000)
Voltage: 229.50 V
20160602-14:47:25.787259: sdm120c(4034) 1/1. Register Address 30007 [0006]
20160602-14:47:25.844502: sdm120c(4034) Read time: 56888us
20160602-14:47:25.844877: sdm120c(4034) reg[0/1]=15841 (0x3DE1)
20160602-14:47:25.845157: sdm120c(4034) reg[1/1]=18350 (0x47AE)
Current: 0.11 A
20160602-14:47:25.845861: sdm120c(4034) 1/1. Register Address 30013 [000C]
20160602-14:47:25.904639: sdm120c(4034) Read time: 58433us
20160602-14:47:25.905081: sdm120c(4034) reg[0/1]=16840 (0x41C8)
20160602-14:47:25.905422: sdm120c(4034) reg[1/1]=52429 (0xCCCD)
Power: 25.10 W
20160602-14:47:25.906069: sdm120c(4034) 1/1. Register Address 30019 [0012]
20160602-14:47:25.968514: sdm120c(4034) Read time: 60842us
20160602-14:47:25.968896: sdm120c(4034) reg[0/1]=16842 (0x41CA)
20160602-14:47:25.969274: sdm120c(4034) reg[1/1]=36160 (0x8D40)
Active Apparent Power: 25.32 VA
20160602-14:47:25.969791: sdm120c(4034) 1/1. Register Address 30025 [0018]
20160602-14:47:26.026161: sdm120c(4034) Read time: 55993us
20160602-14:47:26.026543: sdm120c(4034) reg[0/1]=0 (0x0)
20160602-14:47:26.026807: sdm120c(4034) reg[1/1]=0 (0x0)
Reactive Apparent Power: 0.00 VAR
20160602-14:47:26.027400: sdm120c(4034) 1/1. Register Address 30031 [001E]
20160602-14:47:26.090116: sdm120c(4034) Read time: 62401us
20160602-14:47:26.090502: sdm120c(4034) reg[0/1]=16254 (0x3F7E)
20160602-14:47:26.096036: sdm120c(4034) reg[1/1]=25062 (0x61E6)
Power Factor: 0.99
20160602-14:47:26.096528: sdm120c(4034) 1/1. Register Address 30037 [0024]
20160602-14:47:26.151446: sdm120c(4034) Read time: 54603us
20160602-14:47:26.151630: sdm120c(4034) reg[0/1]=0 (0x0)
20160602-14:47:26.151741: sdm120c(4034) reg[1/1]=0 (0x0)
Phase Angle: 0.00 Degree
20160602-14:47:26.151968: sdm120c(4034) 1/1. Register Address 30071 [0046]
20160602-14:47:26.215327: sdm120c(4034) Read time: 63146us
20160602-14:47:26.215595: sdm120c(4034) reg[0/1]=16968 (0x4248)
20160602-14:47:26.215726: sdm120c(4034) reg[1/1]=0 (0x0)
Frequency: 50.00 Hz
20160602-14:47:26.215987: sdm120c(4034) 1/1. Register Address 30073 [0048]
20160602-14:47:26.276665: sdm120c(4034) Read time: 60494us
20160602-14:47:26.278067: sdm120c(4034) reg[0/1]=16009 (0x3E89)
20160602-14:47:26.278415: sdm120c(4034) reg[1/1]=47710 (0xBA5E)
Import Active Energy: 269 Wh
20160602-14:47:26.278915: sdm120c(4034) 1/1. Register Address 30075 [004A]
20160602-14:47:26.336786: sdm120c(4034) Read time: 56345us
20160602-14:47:26.337262: sdm120c(4034) reg[0/1]=0 (0x0)
20160602-14:47:26.337558: sdm120c(4034) reg[1/1]=0 (0x0)
Export Active Energy: 0 Wh
20160602-14:47:26.339277: sdm120c(4034) 1/1. Register Address 30343 [0156]
20160602-14:47:26.398191: sdm120c(4034) Read time: 58554us
20160602-14:47:26.398565: sdm120c(4034) reg[0/1]=16009 (0x3E89)
20160602-14:47:26.398824: sdm120c(4034) reg[1/1]=47710 (0xBA5E)
Total Active Energy: 269 Wh
20160602-14:47:26.399384: sdm120c(4034) 1/1. Register Address 30077 [004C]
20160602-14:47:26.457131: sdm120c(4034) Read time: 57427us
20160602-14:47:26.457513: sdm120c(4034) reg[0/1]=15954 (0x3E52)
20160602-14:47:26.457802: sdm120c(4034) reg[1/1]=61866 (0xF1AA)
Import Reactive Energy: 206 VARh
20160602-14:47:26.458321: sdm120c(4034) 1/1. Register Address 30079 [004E]
20160602-14:47:26.515982: sdm120c(4034) Read time: 57297us
20160602-14:47:26.516372: sdm120c(4034) reg[0/1]=0 (0x0)
20160602-14:47:26.516660: sdm120c(4034) reg[1/1]=0 (0x0)
Export Reactive Energy: 0 VARh
20160602-14:47:26.517159: sdm120c(4034) 1/1. Register Address 30345 [0158]
20160602-14:47:26.578566: sdm120c(4034) Read time: 61038us
20160602-14:47:26.578938: sdm120c(4034) reg[0/1]=15954 (0x3E52)
20160602-14:47:26.579221: sdm120c(4034) reg[1/1]=61866 (0xF1AA)
Total Reactive Energy: 206 VARh
20160602-14:47:26.582784: sdm120c(4034) devLCKfile: </var/lock/LCK..ttyUSB0>
20160602-14:47:26.583155: sdm120c(4034) devLCKfileNew: </var/lock/LCK..ttyUSB0.4034>
20160602-14:47:26.583418: sdm120c(4034) Clearing Serial Port Lock (4034)...
20160602-14:47:26.583747: sdm120c(4034) Acquiring exclusive lock on /var/lock/LCK..ttyUSB0...
20160602-14:47:26.584080: sdm120c(4034) Exclusive lock on /var/lock/LCK..ttyUSB0 acquired (0) Success...
20160602-14:47:26.584604: sdm120c(4034) cmdLen=7
20160602-14:47:26.586318: sdm120c(4034) cmdLen=7 COMMAND is not null
20160602-14:47:26.586674: sdm120c(4034) errno=0, bRead=2 LckPID=4034 PID=4034 COMMAND='sdm120c'
20160602-14:47:26.586968: sdm120c(4034) errno=0, bRead=-1 LckPID=4034 PID=0 COMMAND=''
20160602-14:47:26.587582: sdm120c(4034) Clearing Serial Port Lock done
OK
[/size]


ma la velocita non cambia

Codice: Seleziona tutto

pi@raspberrypi:~/sdm120c_v114 $ sdm120c -a 1 -P N -b 9600 /dev/ttyUSB0
Voltage: 228.30 V
Current: 0.11 A
Power: 24.80 W
Active Apparent Power: 25.01 VA
Reactive Apparent Power: 0.00 VAR
Power Factor: 0.99
Phase Angle: 0.00 Degree
Frequency: 50.00 Hz
Import Active Energy: 269 Wh
Export Active Energy: 0 Wh
Total Active Energy: 269 Wh
Import Reactive Energy: 206 VARh
Export Reactive Energy: 0 VARh
Total Reactive Energy: 206 VARh
OK


neanche a display RIMANE 9600

Avatar utente
Flane
Messaggi: 2084
Iscritto il: 16/01/2016, 15:02

Re: sdm120c problema setup "Problem locking serial device"

Messaggioda Flane » 02/06/2016, 15:01

Infatti.... come puoi vedere dal log, il parametro -r2400 viene completamente ignorato ed esegue una normale lettura di tutti i valori.

Praticamente per il nuovo software il comando:

Codice: Seleziona tutto

sudo sdm120c -a 1 -b9600 -r2400 -PN -d1 /dev/ttyUSB0

e

Codice: Seleziona tutto

sudo sdm120c -a 1 -b9600 -PN -d1 /dev/ttyUSB0

sono la stessa cosa. Puoi anche provare e vedere che la risposta nei due casi è identica.

Vedo se Thedrake mi dà ascolto e riesce a sistemare.


Torna a “Contatori Modbus”

Chi c’è in linea

Visitano il forum: Nessuno e 11 ospiti