Hi,
I'm currently working with a DLMS/COSEM-compliant meter using your C# library. I’m trying to update the destination IP address of a Push Setup object (class_id 40) using the following code:
GXDLMSPushSetup push = new GXDLMSPushSetup() { LogicalName = "0.2.25.9.0.255" };
push.Destination = "46.105.164.139:7000";
push.Service = Gurux.DLMS.Objects.Enums.ServiceType.Udp;
byte[][] requests = client.Write(push, 3);
foreach (var request in requests)
{
Console.WriteLine($"Sending request: {BitConverter.ToString(request)}");
connection.Send(request, request.Length);
}
However, when I send the Write request, I get an invocation counter error (e.g., “Invalid invocation counter”). These are both the request and answer translated with DLMSTranslator:
TX: 00-01-00-01-00-01-00-44-DB-08-53-41-43-53-41-43-53-41-39-30-00-00-01-2C-8E-BA-4E-32-A6-17-27-6F-E5-E1-BF-86-18-E6-C2-FE-63-2D-F5-55-43-58-44-6C-87-7B-4A-CF-75-B1-DB-ED-85-7C-F1-7D-5D-21-64-93-51-15-B2-48-AF-EF-12-0A-85-90-F6-90
RX: 0001000100010007D8010600000001
(translation)
1: 00 01 00 01 00 01 00 44 DB 08 53 41 43 53 41 43 53 41 39 30 00 00 01 2C 8E BA 4E 32 A6 17 27 6F E5 E1 BF 86 18 E6 C2 FE 63 2D F5 55 43 58 44 6C 87 7B 4A CF 75 B1 DB ED 85 7C F1 7D 5D 21 64 93 51 15 B2 48 AF EF 12 0A 85 90 F6 90
<WRAPPER len="44" >
<SourceAddress Value="1" />
<TargetAddress Value="1" />
<PDU>
<!-- DLMS system title:
Manufacturer Code: SAC
Serial number: 4412225
-->
<!-- Invocation Counter: 300 -->
<!-- Decrypt data: C1 01 C1 00 28 00 02 19 09 00 FF 03 00 02 03 16 01 09 13 34 36 2E 31 30 35 2E 31 36 34 2E 31 33 39 3A 37 30 30 30 16 00
<SetRequest>
<SetRequestNormal>
# Priority: High, ServiceClass: Confirmed, Invoke ID: 1
<InvokeIdAndPriority Value="C1" />
<AttributeDescriptor>
# PushSetup
<ClassId Value="0028" />
# 0.2.25.9.0.255
<InstanceId Value="0002190900FF" />
# Send Destination And Method
<AttributeId Value="03" />
</AttributeDescriptor>
<Value>
<Structure Qty="03" >
<Enum Value="01" />
# 46.105.164.139:7000
<OctetString Value="34362E3130352E3136342E3133393A37303030" />
<Enum Value="00" />
</Structure>
</Value>
</SetRequestNormal>
</SetRequest>
-->
<GeneralGloCiphering>
<SystemTitle Value="5341435341435341" />
<CipheredService Value="300000012C8EBA4E32A617276FE5E1BF8618E6C2FE632DF5554358446C877B4ACF75B1DBED857CF17D5D2164935115B248AFEF120A8590F690" />
</GeneralGloCiphering>
</PDU>
</WRAPPER>
2: 00 01 00 01 00 01 00 07 D8 01 06 00 00 00 01
<WRAPPER len="7" >
<SourceAddress Value="1" />
<TargetAddress Value="1" />
<PDU>
<ExceptionResponse>
<StateError Value="ServiceNotAllowed" />
<ServiceError Value="InvocationCounterError" />
</ExceptionResponse>
</PDU>
</WRAPPER>
My questions are:
- Is there any special requirement when setting the destination address of a Push Setup object using GXDLMSPushSetup?
- Do I need to manually update the invocation counter before sending a write re
quest?
Thanks in advance for your help :)
Cheers,
Carlos.
Hi, You need to read the…
Hi,
You need to read the invocation counter from the meter before you establish the connection to the meter. Check the -v argument from the client example.
Check that you have established the connection by sending AARQ message and parsing AARE message.
BR,
Mikko
Hi Mikko, Thanks for your…
Hi Mikko,
Thanks for your quick reply. :)
The manufacturer said it is a pre-established connection so we don't need to send any AARQ message. Once we receive the push message from the meter (UDP), we are able to communicate with it within the next 10 secs (aprox).
The thing is that I have been able to read clock object, but when I try to write the example I mentioned above, it returns the Invocation Count error.
So, in this case, when I get the first message from the meter, do I need to get the invocation counter? And then, I guess I need to set it in the secure client created for the connection, isn't it?
Do I need to increment it every time I send a message?
Thanks, I'll check out the client example
Thanks,
Carlos.
Hi, Check that your client…
Hi,
Check that your client address is correct and that you have read the correct invocation counter value. There might be multiple invocation counters.
If you can read the IC from the meter and then read data, everything should be okay. I believe that one of your settings is different from what the meter expects.
BR,
Mikko
Hi Mikko, Thanks for your…
Hi Mikko,
Thanks for your suggestions :)
What I don't understand is why I can read data from the meter without having read or updated the IC first but I need it for the write requests.
Now I am updating the frame counter based on the message we first get when the meter establishes the connection (UDP "connection") but still gets the error:
I checked client's documentation and this is what I found (Assuming I just want to update the IP the meter sends the messages to)
- logical_name -> "0002190900FF"
- push_object_list -> array[0..*](push_object_definition). This is not being set as I don't want to update objects list.
- send_destination_and_method ->
"{
0, //ipv4
""192.168.4.1:4000""
}"
{
ip_type: ENUM,
ip_port: octetstring[]
}
- the rest properties are not supported (like number of retries, repetition delay).
Then, based on my code, could you please help me understand what I am doing wrong? (Above in the thread there are the request and response I get)
GXDLMSPushSetup push = new GXDLMSPushSetup() { LogicalName = "0.2.25.9.0.255" };
push.Destination = "46.105.164.139:7000";
push.Service = Gurux.DLMS.Objects.Enums.ServiceType.Udp;
byte[][] requests = client.Write(push, 3);
// REUSE EXISTING CONNECTION TO SEND REQUEST
foreach (var request in requests)
{
connection.Send(request, request.Length);
}
Thanks again for your help.
Cheers,
Carlos.
Hi, This has not been tested…
Hi,
This has not been tested in DLMS conformance tests. The meter manufacturer can implement this as they want to.
The only one who knows what the meter expects is the meter manufacturer. You need to ask for documentation from them.
BR,
Mikko