Getting objetcs of DLMS/COSEM by OBIS code.

5 posts / 0 new
Last post
pradson
Getting objetcs of DLMS/COSEM by OBIS code.

Hi,

I am new for DLMS/COSEM. I want just try to make DLMS/COSEM Client. I want read a single register's data.
I have tried below mentioned code but it goes

"TRACE("Err! Failed to read register: Access Error : Device reports a undefined object" here.

Kindly suggest me.

if ((ret = comm.Connect("localhost", 4061)) != 0)
{
TRACE("Connect failed %s.\r\n", CGXDLMSConverter::GetErrorMessage(ret));
return 1;
}
if ((ret = comm.InitializeConnection()) != 0)
{
TRACE("InitializeConnection failed %s.\r\n", CGXDLMSConverter::GetErrorMessage(ret));
return 1;
}

std::string value;
CGXDLMSObject *obj = new CGXDLMSObject(DLMS_OBJECT_TYPE_ALL, "0.0.1.0.0.255");
if ((ret = comm.Read(obj, 3, value)) != 0)
{
TRACE("Err! Failed to read register: %s", CGXDLMSConverter::GetErrorMessage(ret));
}
else
{
TRACE("Test: %s", value.c_str());
}

Thanks & Regards,
Pradson

pradson
Help needed in reading only wanted objects

Could anybody help me???

Thanks...

kurumi
kurumi's picture
Getting objetcs of DLMS/COSEM by OBIS code.

Hi,

You try to read the object that doesn't exist. Check your logical name. Read your meter with GXLMDSDirector first to check what kind of objects you have.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
Hermiankatu 6-8 H 33720 TAMPERE, FINLAND
Phone: +358 3 265 1244
Home page: http://www.gurux.org

pradson
Getting objetcs of DLMS/COSEM by OBIS code.

Hi,

Thanks for your prompt response.
Actually I am using "GuruxDLMSServerExample" application as a meter and this ("0.0.1.0.0.255") OBIS code is for clock object.

The below mentioned code is working. kindly refer.

CGXDLMSClock *clock = new CGXDLMSClock("0.0.1.0.0.255");
if ((ret = comm.Read(clock, 2, value)) != 0)
{
TRACE("err! failed to read register: %s", CGXDLMSConverter::GetErrorMessage(ret));
}
else
{
TRACE("3 result isssss: %s", value.c_str());
}

Actually I have to skip the association view and want to read only single object with the help of OBIS code.
Is any function available which take OBIS code as a argument and return an object of the device to read???

or

any common object suppose "CGXDLMSxyz" which take any device's objects and passes it to read device data????

Kindly refer the mentioned code.

CGXDLMSxyz *obj = new CGXDLMSxyz("0.0.1.0.0.255");
if ((ret = comm.Read(obj , 2, value)) != 0)
{
TRACE("err! failed to read register: %s", CGXDLMSConverter::GetErrorMessage(ret));
}
else
{
TRACE("3 result isssss: %s", value.c_str());
}

Kindly suggest me. What should I do?

Thanks & Regards,
Pradson

kurumi
kurumi's picture
Getting objetcs of DLMS/COSEM by OBIS code.

Hi,
When you are reading the object from the meter, you must know object type and it must be correct.
If the object type is wrong "undefined object" exception is returned.
Check your object type.

Save Logical name and object type so you don't need to read association view.

BR,

Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
Hermiankatu 6-8 H 33720 TAMPERE, FINLAND
Phone: +358 3 265 1244
Home page: http://www.gurux.org