mz-automation / libiec61850

Official repository for libIEC61850, the open-source library for the IEC 61850 protocols
http://libiec61850.com/libiec61850
GNU General Public License v3.0
883 stars 470 forks source link

MMS string for data read #446

Open picardst opened 1 year ago

picardst commented 1 year ago

I have been trying to implement this library with Python wrapper in order to run some tests. I have not been successfull in reading data. In order to troubleshoot, I used Wireshark to monitor the traffic when this library sends requests vs when some other application (that are actually working). In the case of the working app, I see Wireshark request as (in my example): METVMMXU10$MX$PPV$phsAB$instCVal$mag$f

but when observing the string sent by this lib, I see the following: METVMMXU10$MX$PPV$phsAB$instCVal$mag$f$MX

Why is the FC added at the end? Is this part of the standard (I know, I could search myself, I was hoping someone would know). Thanks, Stéphan

Drelique commented 1 year ago

Hi,

I managed to read data using the python wrapper after looking at the code provided by Saleem334 here: https://github.com/mz-automation/libiec61850/issues/258#issue-690097424

I had to edit it so I paste here the modifications I made:

import os,sys
import iec61850

def read(chemin,host,tcpPort):
    con = iec61850.IedConnection_create()
    conn = iec61850.IedConnection_connect(con,host,tcpPort)
    if(conn==iec61850.IED_ERROR_OK):
        var = chemin
        vartype = iec61850.IEC61850_FC_CO
        #varvalue = iec61850.IedConnection_readObject(con,var,vartype)
        varvalue = iec61850.IedConnection_readBooleanValue(con, var, vartype)
        if(varvalue!= None):
              print('valeur de {}: {}'.format(chemin,str(varvalue)))
    else:
        print("connecion error")

host = "127.0.0.1"
tcpPort = 102
chemin = "IEDIS/XSWI1.Pos.Oper.ctlVal"
read(chemin,host,tcpPort)

Note: The path to your data should not have the FC in it (ie: IEDIS/XSWI1.CO.Pos.Oper.ctlVal" will be sent as "XSWI1$CO$CO$Pos$Oper$ctlVal").

In wireshark, the idemId sent by the script is in this format (note the FC missing at the end): itemId: XSWI1$CO$Pos$Oper$ctlVal

An exemple of a data I read: valeur de IEDIS/XSWI1.Pos.Oper.ctlVal: [False, 0]

carminerodio86 commented 1 year ago

It works. Thank you for your help.