I’m currently working with an Itron SL7000 energy meter, which is connected to a Moxa NPort device via a serial COM port. The Moxa device converts the serial data to TCP and transmits it over port 4002 (IP: 10.100.121.101).
I’ve successfully tested the setup using the Ace Vision Web application, confirming that data is correctly transmitted from the source through the Moxa converter via HDLC tunneling over TCP. This indicates that the communication path from the energy meter to the Moxa device is functioning properly.
However, I’m encountering an issue with the VB GuruxDLMS receiver. In the ReadDLMSPacket function, the line succeeded = Media.Receive(p) consistently returns False, preventing data reception.
Could provide guidance on resolving this GuruxDLMS receiver issue? Any suggestions on configuration adjustments or troubleshooting steps would be greatly appreciated.
Current Configuration:
Energy Meter: Itrong SL7000
Converter: Moxa NPort (Serial to TCP)
TCP Endpoint: 10.100.121.101:4002
Protocol: HDLC tunneling over TCP
Public Sub Start()
Dim media As IGXMedia = Nothing
Dim comm As GXCommunicatation = Nothing
Dim dlms As New GXDLMSSecureClient()
Dim manufacturer As New GXManufacturer()
Try
manufacturer.Identification = "ACE" ' Itron manufacturer ID
manufacturer.Name = "Itron"
manufacturer.UseLogicalNameReferencing = True
manufacturer.Standard = Standard.DLMS
manufacturer.StartProtocol = StartProtocolType.IEC
'manufacturer.Address = HDLCAddressType.Default
'' Add authentication entry
manufacturer.Settings = New List(Of GXAuthentication)()
manufacturer.Settings.Add(New GXAuthentication(Authentication.None, 17))
'' Add server address settings (without HdlcAddressing)
manufacturer.ServerSettings = New List(Of GXServerAddress)()
Dim serverAddress As New GXServerAddress()
serverAddress.LogicalAddress = 1
serverAddress.PhysicalAddress = 1
manufacturer.ServerSettings.Add(serverAddress)
' Initialize TCP/IP connection to Moxa
media = New GXNet(NetworkType.Tcp, "10.100.121.101", 4002)
media.Open()
dlms.InterfaceType = InterfaceType.HDLC
dlms.UseLogicalNameReferencing = True
dlms.ClientAddress = 17
dlms.ServerAddress = 1 'GXDLMSClient.GetServerAddress(1, 1)
dlms.Authentication = Authentication.Low
dlms.Password = System.Text.Encoding.ASCII.GetBytes("ABCDEFGH")
'' Initialize communication
comm = New GXCommunicatation(dlms, media, False, Authentication.Low, "ABCDEFGH")
comm.InitializeConnection(manufacturer)
'' Read all available objects
ReadAllObjects(dlms, comm)
Catch ex As Exception
Console.WriteLine("Error: " & ex.Message)
Finally
If comm IsNot Nothing Then
comm.Close()
End If
End Try
End Sub
Public Sub ReadDLMSPacket(data As Byte(), reply As GXReplyData)
If data Is Nothing Then
Return
End If
reply.[Error] = 0
Dim eop As Object = If(Client.InterfaceType = InterfaceType.WRAPPER AndAlso TypeOf Media Is GXNet, Nothing, CByte(&H7E))
Dim pos As Integer = 0
Dim succeeded As Boolean = False
Dim rd As New GXByteBuffer()
Dim p As New ReceiveParameters(Of Byte())() With {
.Eop = eop,
.Count = Client.GetFrameSize(rd), ' Dynamic frame size
.AllData = True,
.WaitTime = WaitTime
}
SyncLock Media.Synchronous
While Not succeeded AndAlso pos <> 3
WriteTrace("<- " + DateTime.Now.ToLongTimeString() + vbTab + GXCommon.ToHex(data, True))
Media.Send(data, Nothing)
succeeded = Media.Receive(p)
If Not succeeded Then
If System.Threading.Interlocked.Increment(pos) >= 3 Then
Throw New Exception("Failed to receive reply from the device in given time.")
End If
If p.Eop Is Nothing Then p.Count = 1
Continue While
End If
End While
rd = New GXByteBuffer(p.Reply)
Try
pos = 0
'Loop until whole COSEM packet is received.
While Not Client.GetData(rd, reply)
p.Reply = Nothing
If p.Eop Is Nothing Then
p.Count = Client.GetFrameSize(rd) ' Update frame size
End If
While Not Media.Receive(p)
If System.Threading.Interlocked.Increment(pos) >= 3 Then
Throw New Exception("Failed to receive reply from the device in given time.")
End If
End While
End While
Catch ex As Exception
WriteTrace("-> " + DateTime.Now.ToLongTimeString() + vbTab + GXCommon.ToHex(p.Reply, True))
Throw ex
End Try
End SyncLock
WriteTrace("-> " + DateTime.Now.ToLongTimeString() + vbTab + GXCommon.ToHex(p.Reply, True))
If reply.[Error] <> 0 Then
If reply.[Error] = CShort(ErrorCode.Rejected) Then
Thread.Sleep(1000)
ReadDLMSPacket(data, reply)
Else
Throw New GXDLMSException(reply.[Error])
End If
End If
End Sub
Hi, Make sure that you are…
Hi,
Make sure that you are using HDLC framing. Also check that eop is 0x7E.
BR,
Mikko