After 2 days of unsuccessful attempts I am forced to ask for help here.
I need to update the date and time of the Landis E650 meter and I tried using this method in VB.NET:
Dim objects As GXDLMSObjectCollection = Nothing
objects = comm.GetAssociationView()
Dim it As GXDLMSObject
it = objects.FindByLN(ObjectType.Clock, "0.0.1.0.0.255")
Dim newDate As Gurux.DLMS.GXDateTime = Now
Dim Values As New GXObisValueItemCollection
Dim itemValue As New GXObisValueItem(11200, newDate)
Values.Add(itemValue)
it.SetValues(0, Values)
comm.Write(it, 2)
Something is written on the meter because the meter date is reset to 01/01/2000 00:00:00
Can you help me?
Best regards
Giacomo
Hi, Landis+Gyr E650 doesn't…
Hi,
Landis+Gyr E650 doesn't support deviatation (Time zone).
Try to ignore it like this:
Dim newDate As Gurux.DLMS.GXDateTime = Now
newDate.Skip = newDate.Skip And DateTimeSkips.Deviation
Now I don't remember if the second should also be set to zero. Try that is it fails.
BR,
Mikko
But is this correct? (look…
But is this correct? (look under ==>)
Dim objects As GXDLMSObjectCollection = Nothing
objects = comm.GetAssociationView()
Dim it As GXDLMSObject
it = objects.FindByLN(ObjectType.Clock, "0.0.1.0.0.255")
Dim newDate As Gurux.DLMS.GXDateTime = Now
newDate.Skip = newDate.Skip And DateTimeSkips.Deviation
==> Dim Values As New GXObisValueItemCollection
==> Dim itemValue As New GXObisValueItem(11200, newDate)
==> Values.Add(itemValue)
it.SetValues(2, Values)
comm.Write(it, 2)
Now works! ' ---------------…
Now works!
' -----------------------------------------------------------------------------
' Update date and time on meter Landis E650
' The following items are to be considered prerequisites:
' [comm] is GXCommunicatation object with connection established with the meter
' [objects] is GXDLMSObjectCollection with comm.GetAssociationView()
' -----------------------------------------------------------------------------
Try
' reads the current date and time of the meter
Dim it As GXDLMSObject = objects.FindByLN(ObjectType.None, "0.0.1.0.0.255")
Dim currentMeterDate As DateTime = comm.Read(it, 2)
' reads the current date and time of the system
Dim currentSystemDate As DateTime = DateTime.Now
' difference in seconds between the system time and the meter's
Dim secondsDifference As Long = DateDiff(DateInterval.Second, currentMeterDate, currentSystemDate)
If secondsDifference <= -60 Or secondsDifference >= 60 Then
' difference greater than 60 seconds
Dim Clock1 As New GXDLMSClock("0.0.1.0.0.255", 11200) ' it is important to specify the shortname otherwise it won't work
Dim newDate As New GXDateTime(Now.Year, Now.Month, Now.Day, Now.Hour, Now.Minute, Now.Second, 0)
newDate.Skip = newDate.Skip And DateTimeSkips.Deviation
Clock1.Time = newDate
comm.Write(Clock1, 2)
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Hi Giacomo, I'm glad that…
Hi Giacomo,
I'm glad that you solved this. You can find the clock object from association view and use it. In that way, you don't need set the short name. Something like this:
Dim it As GXDLMSObject = objects.FindByLN(ObjectType.None, "0.0.1.0.0.255")
it.Time = newDate
it.Skip = newDate.Skip And DateTimeSkips.Deviation
comm.Write(it, 2)
You can also save the association view to the database or file. That makes reading faster.
BR,
Mikko