Open keyvdir opened 5 years ago
Hello You want the server to periodically update the value and the client to periodically read the value on the server? Bests
Hello You want the server to periodically update the value and the client to periodically read the value on the server? Bests
Yess, that's what i want to do. I already make a data object and data attribute. Then with update attribute value, i tried to input the value manually (later on i want the value from some sensor attached in raspberry pi gpio). And in the client side i already use the read object, but still the value cannot be seen. Can you please help me out? All the examples only available in C language, but i'm trying to make with python language.
Update's Code. Server:
#Create Model
self.__model = iec61850.IedModel_create("testmodel");
#Create Device
lDevice1 = iec61850.LogicalDevice_create("SENSORS", self.__model);
#Create Node
ttmp1 = iec61850.LogicalNode_create("TTMP1", lDevice1);
#Create Common Data Classes
iec61850.CDC_SAV_create("TmpSv", iec61850.toModelNode(ttmp1), 0, False);
iec61850.CDC_ASG_create("TmpSp", iec61850.toModelNode(ttmp1), 0, False);
#Create Data Object
do1 = iec61850.DataObject_create("Temp1", iec61850.toModelNode(ttmp1), 0);
#Create Data Attribute
iec61850.DataAttribute_create("float", iec61850.toModelNode(do1), iec61850.IEC61850_FLOAT64, iec61850.IEC61850_FC_MX, 0, 0, 0);
#Create Server Connection
self.__iedServer = iec61850.IedServer_create(self.__model);
iec61850.IedServer_start(self.__iedServer, tcpPort);
#Update Data Attribute Value
nil = 33; #Example Value
nilai = iec61850.MmsValue_newFloat(nil);
iec61850.IedServer_lockDataModel(self.__iedServer);
val1 = iec61850.IedServer_updateAttributeValue(self.__iedServer, iec61850.toDataAttribute(do1), nilai);
iec61850.IedServer_unlockDataModel(self.__iedServer);
iec61850.MmsValue_setFloat(nilai, nil);
Client:
con = iec61850.IedConnection_create()
error = iec61850.IedConnection_connect(con, "localhost", tcpPort)
if (error == iec61850.IED_ERROR_OK):
print("Connected to Server")
# Accessing values
theVal = "testmodelSENSORS/TTMP1.TmpSv.Mag.f"
theValType = iec61850.IEC61850_FC_MX
value = iec61850.IedConnection_readObject(con, theVal, theValType)
if (value != 0):
fval = iec61850.MmsValue_toFloat(value); #Error
print("Result:" % value);
iec61850.MmsValue_delete(value);#Error
iec61850.IedConnection_close(con);
But i got an error saying that: TypeError: in method 'MmsValue_toFloat', argument 1 of type 'MmsValue const *'
Hello You want the server to periodically update the value and the client to periodically read the value on the server? Bests
Yess, that's what i want to do. I already make a data object and data attribute. Then with update attribute value, i tried to input the value manually (later on i want the value from some sensor attached in raspberry pi gpio). And in the client side i already use the read object, but still the value cannot be seen. Can you please help me out? All the examples only available in C language, but i'm trying to make with python language.
Update's Code. Server:
#Create Model self.__model = iec61850.IedModel_create("testmodel"); #Create Device lDevice1 = iec61850.LogicalDevice_create("SENSORS", self.__model); #Create Node ttmp1 = iec61850.LogicalNode_create("TTMP1", lDevice1); #Create Common Data Classes iec61850.CDC_SAV_create("TmpSv", iec61850.toModelNode(ttmp1), 0, False); iec61850.CDC_ASG_create("TmpSp", iec61850.toModelNode(ttmp1), 0, False); #Create Data Object do1 = iec61850.DataObject_create("Temp1", iec61850.toModelNode(ttmp1), 0); #Create Data Attribute iec61850.DataAttribute_create("float", iec61850.toModelNode(do1), iec61850.IEC61850_FLOAT64, iec61850.IEC61850_FC_MX, 0, 0, 0); #Create Server Connection self.__iedServer = iec61850.IedServer_create(self.__model); iec61850.IedServer_start(self.__iedServer, tcpPort); #Update Data Attribute Value nil = 33; #Example Value nilai = iec61850.MmsValue_newFloat(nil); iec61850.IedServer_lockDataModel(self.__iedServer); val1 = iec61850.IedServer_updateAttributeValue(self.__iedServer, iec61850.toDataAttribute(do1), nilai); iec61850.IedServer_unlockDataModel(self.__iedServer); iec61850.MmsValue_setFloat(nilai, nil);
Client:
con = iec61850.IedConnection_create() error = iec61850.IedConnection_connect(con, "localhost", tcpPort) if (error == iec61850.IED_ERROR_OK): print("Connected to Server") # Accessing values theVal = "testmodelSENSORS/TTMP1.TmpSv.Mag.f" theValType = iec61850.IEC61850_FC_MX value = iec61850.IedConnection_readObject(con, theVal, theValType) if (value != 0): fval = iec61850.MmsValue_toFloat(value); #Error print("Result:" % value); iec61850.MmsValue_delete(value);#Error iec61850.IedConnection_close(con);
But i got an error saying that: TypeError: in method 'MmsValue_toFloat', argument 1 of type 'MmsValue const *'
I have the same problem. You solve it?
Hello You want the server to periodically update the value and the client to periodically read the value on the server? Bests
Yess, that's what i want to do. I already make a data object and data attribute. Then with update attribute value, i tried to input the value manually (later on i want the value from some sensor attached in raspberry pi gpio). And in the client side i already use the read object, but still the value cannot be seen. Can you please help me out? All the examples only available in C language, but i'm trying to make with python language. Update's Code. Server:
#Create Model self.__model = iec61850.IedModel_create("testmodel"); #Create Device lDevice1 = iec61850.LogicalDevice_create("SENSORS", self.__model); #Create Node ttmp1 = iec61850.LogicalNode_create("TTMP1", lDevice1); #Create Common Data Classes iec61850.CDC_SAV_create("TmpSv", iec61850.toModelNode(ttmp1), 0, False); iec61850.CDC_ASG_create("TmpSp", iec61850.toModelNode(ttmp1), 0, False); #Create Data Object do1 = iec61850.DataObject_create("Temp1", iec61850.toModelNode(ttmp1), 0); #Create Data Attribute iec61850.DataAttribute_create("float", iec61850.toModelNode(do1), iec61850.IEC61850_FLOAT64, iec61850.IEC61850_FC_MX, 0, 0, 0); #Create Server Connection self.__iedServer = iec61850.IedServer_create(self.__model); iec61850.IedServer_start(self.__iedServer, tcpPort); #Update Data Attribute Value nil = 33; #Example Value nilai = iec61850.MmsValue_newFloat(nil); iec61850.IedServer_lockDataModel(self.__iedServer); val1 = iec61850.IedServer_updateAttributeValue(self.__iedServer, iec61850.toDataAttribute(do1), nilai); iec61850.IedServer_unlockDataModel(self.__iedServer); iec61850.MmsValue_setFloat(nilai, nil);
Client:
con = iec61850.IedConnection_create() error = iec61850.IedConnection_connect(con, "localhost", tcpPort) if (error == iec61850.IED_ERROR_OK): print("Connected to Server") # Accessing values theVal = "testmodelSENSORS/TTMP1.TmpSv.Mag.f" theValType = iec61850.IEC61850_FC_MX value = iec61850.IedConnection_readObject(con, theVal, theValType) if (value != 0): fval = iec61850.MmsValue_toFloat(value); #Error print("Result:" % value); iec61850.MmsValue_delete(value);#Error iec61850.IedConnection_close(con);
But i got an error saying that: TypeError: in method 'MmsValue_toFloat', argument 1 of type 'MmsValue const *'
I have the same problem. You solve it?
You can check my repo here: https://github.com/keyvdir/pyiec61850 Hope it solved your problem
Hi, first of all i'm sorry because i'm really new with this standard. I want to send sensors value attached to raspberry pi to another raspberry pi using iec 61850 standard. Here's what i'm trying to make.
Server's Side:
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...")
Client's Side:
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)
I want to send the
value = self.measure_temp()
to be seen in the client's side. Can you please help me? The output in clien's side is always 22. I'll really appreciate your help. Thank you very much