Following is the flow of our system
Meter<->Controller<->Gateway<->Cloud
We have implemented dlms client in Controller to read the data from Real Meter. we have successfully implemented client and reading data from real meter. meter is providing data and controller is parsing the dlms data to fetch the correct values.
Reading Values from meter are Voltage, Current, PF, Frequency, kWh, kVAh, power in kW, kVA, kVAr.
So, to generate the DLMS frame for the values(received from real meter) we require DLMS Sever in controller. we have implemented the server but we don't know how to generate the DLMS frame for the values we have received from meter and parsed in controller. We need to transmit DLMS frame to the cloud.
can DLMS server generate frame with obis code from values only?
can you please provide steps to generate the frame? is there a common API in server for all the values to generate the frame?
You need to implement the server and the client. You need to listen svr_preRead and then client reads value from the meter. Value is updated to e->value. You also need to set e->handled = 1;.
I've checked svr_preRead API by clicking shared link. I've doubt how client should pass the value to the server for generate the DLMS frame? link does not have those details or might I'm not understanding it correctly. can you please help me to understand in detail?
For instance, client has value of voltage=230. now how to pass that value to the server to generate the voltage dlms frame?
You don't need to care from DLMS frame. You just give the value for the server what it needs to return. It might be that meter and HES are using different settings (ex. frame size or PDU size or interface type). All those settings cause you to need to implement the server for the HES and client for the meter.
Because this seems to be a hot topic, a VERY simple example is done in the next week for Windows where are a client and a server implemented.
will above source encodes the obis code for the value? Our HES is only understands the obis code. it parse the data on the basis of the obis code. so, we need to encode obis code with the value from controller.
so, let's say if we want to provide voltage obis code "1.0.12.7.0.255" and voltage value=230 to the dlms server to perform the encode operation than which API we should use to pass the value to sever?
You need to create a register object with OBIS code "1.0.12.7.0.255". If you want to use hard-coded value it can be set on initializing. If you want to update the value in reading, you can set it in svr_preRead method.
understood. we have use voltage=10 to call svr_preRead API and it generates this value 200023a0, doesn't look like a correct encoding. can you verify and confirm are we on correct path or not?
Hi,
Hi,
You need to implement the server and the client. You need to listen svr_preRead and then client reads value from the meter. Value is updated to e->value. You also need to set e->handled = 1;.
Check how clock is read and implement it in the same way.
https://github.com/Gurux/GuruxDLMS.c/blob/cf7c1bdd47287ac0a95fb439b1207…
BR,
Mikko
Thanks for the reply,
Thanks for the reply,
I've checked svr_preRead API by clicking shared link. I've doubt how client should pass the value to the server for generate the DLMS frame? link does not have those details or might I'm not understanding it correctly. can you please help me to understand in detail?
For instance, client has value of voltage=230. now how to pass that value to the server to generate the voltage dlms frame?
Hi,
Hi,
You don't need to care from DLMS frame. You just give the value for the server what it needs to return. It might be that meter and HES are using different settings (ex. frame size or PDU size or interface type). All those settings cause you to need to implement the server for the HES and client for the meter.
Because this seems to be a hot topic, a VERY simple example is done in the next week for Windows where are a client and a server implemented.
BR,
Mikko
Following is the source from
Following is the source from the shared link
if (e->target == BASE(clock1) && e->index == 2)
{
gxtime dt;
time_now(&dt, 1);
if (e->value.byteArr == NULL)
{
e->value.byteArr = (gxByteBuffer*)gxmalloc(sizeof(gxByteBuffer));
bb_init(e->value.byteArr);
}
e->error = cosem_setDateTimeAsOctetString(e->value.byteArr, &dt);
e->value.vt = DLMS_DATA_TYPE_OCTET_STRING;
e->handled = 1;
}
will above source encodes the obis code for the value? Our HES is only understands the obis code. it parse the data on the basis of the obis code. so, we need to encode obis code with the value from controller.
Hi,
Hi,
OBIS code is not sent back on the reply message in the DLMS protocol if that is not part of the content.
BR,
Mikko
understood. if client provide
understood. if client provide obis code to the server than can server encode it in dlms format(just like value)?
Hi,
Hi,
Obis code is sent in part of write, read or action methods. Obis code can also be part of the content of the data and the server can handle it.
BR,
Mikko
so, let's say if we want to
so, let's say if we want to provide voltage obis code "1.0.12.7.0.255" and voltage value=230 to the dlms server to perform the encode operation than which API we should use to pass the value to sever?
Hi,
Hi,
You need to create a register object with OBIS code "1.0.12.7.0.255". If you want to use hard-coded value it can be set on initializing. If you want to update the value in reading, you can set it in svr_preRead method.
BR,
Mikko
understood. we have use
understood. we have use voltage=10 to call svr_preRead API and it generates this value 200023a0, doesn't look like a correct encoding. can you verify and confirm are we on correct path or not?
Hi,
Hi,
Just to make sure: You don't call the svr_preRead.
You can update value like this in the svr_preRead
GX_UINT16(activePowerL1.value, 230);
OR if you use reference you can update the value like this:
activePowerL1Value = 230;
BR,
Mikko