发送值pyiec61850

2024-06-28 19:53:38 发布

您现在位置:Python中文网/ 问答频道 /正文

首先我很抱歉,因为我对这个标准还很陌生。我想发送传感器值附加到树莓皮到另一个树莓皮使用iec61850标准。我在这里找到了代码:https://github.com/mz-automation/libiec61850和他们的网站:https://libiec61850.com/libiec61850/

这是我想做的。你知道吗

服务器端:

self.__model = iec61850.IedModel_create("testmodel")
lDevice1 = iec61850.LogicalDevice_create("SENSORS", self.__model);
ttmp1 = iec61850.LogicalNode_create("TTMP1", lDevice1);
iec61850.CDC_VSS_create("TmpStr", iec61850.toModelNode(ttmp1), 1)
value = self.measure_temp()
self.__iedServer = iec61850.IedServer_create(self.__model)
iec61850.IedServer_start(self.__iedServer, tcpPort);
print("Waiting for Connection...")

客户方:

con = iec61850.IedConnection_create()
error = iec61850.IedConnection_connect(con, "localhost", tcpPort)
if (error == iec61850.IED_ERROR_OK):
print("Connected to Server")
# Accessing to VSS values
theVal = "testmodelSENSORS/TTMP1.TmpStr.stVal.f"
theValType = iec61850.IEC61850_FC_ST
temperatureSetpoint = iec61850.IedConnection_readStringValue(con, theVal, theValType)
print(temperatureSetpoint)

我想把value = self.measure_temp()发送到客户端。你能帮帮我吗?客户端(print(temperatureSetpoint))的输出总是22。我非常感谢你的帮助。我已经通过电子邮件和他们的github联系了他们,但是还没有回复。你知道吗

非常感谢


Tags: httpsselfgithubcom标准modelcreatecon