Console output:
C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Gurux.DLMS.Simulator.Net\bin\Debug\net8.0>Gurux.DLMS.Simulator.Net.exe -p 1000 -x sim1.xml -t Verbose -N 10
DLMS HDLC Logical Name simulator start in Tcp ports 1000-1009.
String '01/10/1900 00+00:00' was not recognized as a valid DateTime.
My simulator throws this error and I followed the stacktrace. The sim.xml file is from a device that is still currently in development and that i have no control over.
I tried debugging and following the stack trace which is as follows:
DLMS HDLC Logical Name simulator start in Tcp ports 1000-1009.
String '01/10/1900 00+00:00' was not recognized as a valid DateTime.
at Gurux.DLMS.GXDateTime..ctor(String value, CultureInfo culture) in C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Development\GXDateTime.cs:line 350
at Gurux.DLMS.Objects.GXXmlReader.ReadElementContentAsDateTime(String name) in C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Development\Objects\GXXmlReader.cs:line 318
at Gurux.DLMS.Objects.GXDLMSClock.Gurux.DLMS.Objects.IGXDLMSBase.Load(GXXmlReader reader) in C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Development\Objects\GXDLMSClock.cs:line 698
at Gurux.DLMS.Objects.GXDLMSObjectCollection.Load(Stream stream, GXDLMSObjectCollection objects) in C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Development\Objects\GXDLMSObjectCollection.cs:line 488
at Gurux.DLMS.Objects.GXDLMSObjectCollection.Load(Stream stream) in C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Development\Objects\GXDLMSObjectCollection.cs:line 367
at Gurux.DLMS.Objects.GXDLMSObjectCollection.Load(String filename) in C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Development\Objects\GXDLMSObjectCollection.cs:line 342
at Gurux.DLMS.Simulator.Net.GXDLMSMeter.LoadObjects(String path, GXDLMSObjectCollection items) in C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Gurux.DLMS.Simulator.Net\GXDLMSMeter.cs:line 180
at Gurux.DLMS.Simulator.Net.GXDLMSMeter.Init(Boolean exclusive) in C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Gurux.DLMS.Simulator.Net\GXDLMSMeter.cs:line 451
at Gurux.DLMS.Simulator.Net.GXDLMSMeter.Initialize(IGXMedia media, TraceLevel trace, String path, UInt32 sn, Boolean exclusive, GXDLMSObjectCollection sharedObjects) in C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Gurux.DLMS.Simulator.Net\GXDLMSMeter.cs:line 133
at Gurux.DLMS.Simulator.Net.Program.StartSimulator(Settings settings) in C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Gurux.DLMS.Simulator.Net\Program.cs:line 212
at Gurux.DLMS.Simulator.Net.Program.Main(String[] args) in C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Gurux.DLMS.Simulator.Net\Program.cs:line 327
C:\Users\admin\Downloads\Gurux.DLMS.Net-master\Gurux.DLMS.Simulator.Net\bin\Debug\net8.0\Gurux.DLMS.Simulator.Net.exe (process 14456) exited with code 1 (0x1).
I didn't want to mess too much with the GXDateTime class since my goal right now is to simply run the simulation. Hence this filthy solution... I took a previously accepted value and hardcoded it to overwrite the value that keeps calling the error.
(\Gurux.DLMS.Net-master\Development\GXDateTime.cs:line 171)
public GXDateTime(string value, CultureInfo culture)
: base()
{
if (value == "01/*/1900 00Z")
{
value = $"01/27/2025 07:46:14Z";
}
Worked well enough to run the simulation. But using the actual hardware I never noticed this error using the Director. I thought maybe it was something like ArgumentOutOfRange but I guess not??
Hi, 01/10/1900 00+00:00 is…
Hi,
01/10/1900 00+00:00 is an invalid date-time for DST Begin time. The minute and second parts are missing. Can you read Begin (attribute #5) with GXDLMSDirector and add your meter reply as a hex? I'll check that the meter returns and if something can be done for this.
BR,
Mikko
this is the output in the…
this is the output in the logs
8:23:42 pm Read object type Clock index: 5
7E A0 19 03 25 BA 4F B7 E6 E6 00 C0 01 C1 00 08 00 00 01 00 00 FF 05 00 68 57 7E
8:23:42 pm
7E A0 1E 25 03 DA 69 21 E6 E7 00 C4 01 C1 00 09 0C 07 6C 01 00 07 00 00 00 00 00 00 00 C6 7F 7E
Hi, Your meter says that DST…
Hi,
Your meter says that DST started every Sunday in January 1900. Ask if the meter manufacturer has a firmware update that fixes this.
In the mean time you can change this to the XML.
You can use this value: 03/01/* 12:00:00
BR,
Mikko