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
887 stars 474 forks source link

Client Report Handler in Python #500

Open plipK opened 8 months ago

plipK commented 8 months ago

Hi,

I am trying to set up some python test code based on the client reporting example. I can connect to my IED and read dataset and RCB. But when I try to install a Report handler I get a TypeError Exeption for the reportHandler argument in the IedConnection_installReportHandler call. Does anyone know what the reason is?

Here is my code:

import iec61850

def reportHandler(params, report):
    print("Report Callback")

connection = iec61850.IedConnection_create()
iec61850.IedConnection_connect(connection, "192.168.178.10", 102)
[dataSetDirectory, rdErr] = iec61850.IedConnection_getDataSetDirectory(connection, "Server_CP2TestDevice/LLN0.RCB_DataSet", None)
[clientDataSet, rdErr] = iec61850.IedConnection_readDataSetValues(connection, "Server_CP2TestDevice/LLN0.RCB_DataSet", None)
[rcb, rdErr]  = iec61850.IedConnection_getRCBValues(connection, "Server_CP2TestDevice/LLN0.RP.UnbufferedRCB01", None)
iec61850.IedConnection_installReportHandler(connection, "Server_CP2TestDevice/LLN0.RP.UnbufferedRCB", 
                                            iec61850.ClientReportControlBlock_getRptId(rcb), reportHandler, dataSetDirectory)
nikunj1222 commented 5 months ago

Hi @plipK ,

Please check the example for Python report subcription https://github.com/mz-automation/libiec61850/blob/v1.5/pyiec61850/examples/rcbSubscriptionExample.py