Hi,
First of all, sorry if this same query has been uploaded on the forum but I was unable to find any regarding this.
I have downloaded the sample repository from github (https://github.com/Gurux/gurux.dlms.java). I want to know how to start running the files. I am new to DLMS, so please help.
Till now, I have unzipped the gurux.dlms.java-master folder and have imported the projects (development, gurux.dlms.client.example.java, gurux.dlms.push.listener.example, gurux.dlms.server.example.java, gurux.dlms.simulator.java, and gurux.dlms.xmlClient). Now, I don't have any physical meter, so I want to create one in java if possible and after that which java files should I run to start the transfer of data.
I have Maven and Eclipse installed and I have imported the projects listed above. Please help me in starting up the connection and for successful data transfer over TCP.
I just tried the things that you suggested. After running the client, the program gave the following output and terminated:
GuruxDlmsSample reads data from the DLMS/COSEM device.
GuruxDlmsSample -h [Meter IP Address] -p [Meter Port No] -c 16 -s 1 -r sn
-h host name or IP address.
-p port number or name (Example: 1000).
-S serial port.
-a Authentication (None, Low, High, HighMd5, HighSha1, HighGMac, HighSha256).
-P Password for authentication.
-c Client address. (Default: 16)
-s Server address. (Default: 1)
-n Server address as serial number.
-l Logical Server address.
-r [sn, ln] Short name or Logical Name (default) referencing is used.
-t [Error, Warning, Info, Verbose] Trace messages.
-g "0.0.1.0.0.255:1; 0.0.1.0.0.255:2" Get selected object(s) with given attribute index.
-C Security Level. (None, Authentication, Encrypted, AuthenticationEncryption or DigitallySigned)
-V Security Suite version. (Default: Suite0). (Suite0, Suite1 or Suite2)
-K Used Key agreement scheme (OnePassDiffieHellman or StaticUnifiedModel).
-v Invocation counter data object Logical Name. Ex. 0.0.43.1.1.255
-I Auto increase invoke ID
-o Cache association view to make reading faster. Ex. -o C:\device.xml
-T System title that is used with chiphering. Ex -T 4775727578313233
-A Authentication key that is used with chiphering. Ex -A D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF
-B Block cipher key that is used with chiphering. Ex -B 000102030405060708090A0B0C0D0E0F
-D Dedicated key that is used with chiphering. Ex -D 00112233445566778899AABBCCDDEEFF
-d Used DLMS standard. Ex -d India (DLMS, India, Italy, SaudiArabia, IDIS)
-E Export client and server certificates from the meter. Ex -E 0.0.43.0.0.255.
-R Generate new client and server certificates and import them to the server. Ex. -R 0.0.43.0.0.255.
-i Used communication interface. Ex. -i WRAPPER.
-m Used PLC MAC address. Ex. -m 1.
Example:
Read LG device using TCP/IP connection.
GuruxDlmsSample -r sn -c 16 -s 1 -h [Meter IP Address] -p [Meter Port No]
Read LG device using serial port connection.
GuruxDlmsSample -r sn -c 16 -s 1 -S COM1 -i
Read Indian device using serial port connection.
GuruxDlmsSample -S COM1 -c 16 -s 1 -a Low -P [password]
After running the server, the program gave the following output and is now sitting idle without getting terminated:
System Title: 41 42 43 44 45 46 47 48
Authentication key: D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
Block cipher key: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
Client System title:
Master key (KEK) title:
Short Name DLMS Server in port 4060
Example connection settings:
Gurux.DLMS.Client.Example.Net -r sn -h localhost -p 4060
----------------------------------------------------------
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[9,1]
Message: XML document structures must start and end within the same entity.
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(Unknown Source)
at gurux.dlms.objects.GXXmlReader.read(GXXmlReader.java:152)
at gurux.dlms.objects.GXXmlReader.isStartElement(GXXmlReader.java:173)
at gurux.dlms.objects.GXDLMSAssociationLogicalName.load(GXDLMSAssociationLogicalName.java:1228)
at gurux.dlms.objects.GXDLMSObjectCollection.load(GXDLMSObjectCollection.java:257)
at gurux.dlms.objects.GXDLMSObjectCollection.load(GXDLMSObjectCollection.java:148)
at gurux.dlms.server.example.GXDLMSBase.init(GXDLMSBase.java:769)
at gurux.dlms.server.example.GXDLMSBase.<init>(GXDLMSBase.java:319)
at gurux.dlms.server.example.GXDLMSServerLN.<init>(GXDLMSServerLN.java:51)
at gurux.dlms.server.example.GuruxDlmsServerExample.main(GuruxDlmsServerExample.java:143)
System Title: 41 42 43 44 45 46 47 48
Authentication key: D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
Block cipher key: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
Client System title:
Master key (KEK) title: 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31
Logical Name DLMS Server in port 4061
Example connection settings:
Gurux.DLMS.Client.Example.Net -h=localhost -p 4061
----------------------------------------------------------
System Title: 41 42 43 44 45 46 47 48
Authentication key: D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
Block cipher key: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
Client System title:
Master key (KEK) title: 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31
Short Name DLMS Server with IEC 62056-47 in port 4062
Example connection settings:
Gurux.DLMS.Client.Example.Net -r sn -h localhost -w -p 4062
----------------------------------------------------------
System Title: 41 42 43 44 45 46 47 48
Authentication key: D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
Block cipher key: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
Client System title:
Master key (KEK) title: 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31
Logical Name DLMS Server with IEC 62056-47 in port 4063
Example connection settings:
Gurux.DLMS.Client.Example.Net -h localhost -w -p 4063
Press Enter to close.
Can you tell me how to move forward after this? I am not sure how to. Thanks for the previous response and looking forward to further responses.
I passed the client parameters as you asked. After passing these parameters, it is failing to send the data and shows the output shown in the screenshot attached. How should I fix this?
PS: The server showed Client connected when I ran the command with client parameters.
Thanks for helping and looking forward to a response.
The security was improved in the last version and one setting was not updated to the server example. Get the latest version from the server example from the GitHub. You need also to remove 406Xsettings.xml files from the target folder.
In the server example, there is a method invocation of setMinimumInvocationCounter(long) and getMinimumInvocationCounter(). These two methods are giving a compilation error as these are not available for the class GXICipher. I checked the documentation of GXICipher and these methods are not present there too. So can I comment these out before running the program?
I'm sorry. The new version is still on testing and that is the reason why it failed. Get the latest version from GitHub. This is commented out until the next version is released.
Thanks for such a quick response. The connection is established now. One thing I am unable to understand is why is the client sending the data? Shouldn't the server be sending the data. Maybe I am misinterpreting the output shown after running the program. Kindly help me in understanding the outputs of the client and server. I am attaching the server output in this comment and the client output in the next one.
Thanks for helping and looking forward to a response.
Please, don't add pics. They are compressed and hard to read the bytes. The Client establishes the connection and reads wanted data. The server might start the communication if its configured to do it. That is used when client can't establish the connection to the meter. Example when GPRS connection is used with dynamic IP addresses. You can read more: http://www.gurux.fi/Gurux.DLMS.DynamicIP
The meter might send push messages where is pre-configured data.
Server Ouput:
Client Connected.
Client Read value from 0.0.43.0.0.255 attribute: 2.
Client Read value from 0.0.43.0.0.255 attribute: 3.
Client Read value from 0.0.43.0.0.255 attribute: 4.
Client Read value from 0.0.43.0.0.255 attribute: 5.
Client Read value from 0.0.43.0.0.255 attribute: 6.
Client Disconnected.
Can you please explain these outputs? And about the server configuration, I haven't changed anything in the server example, so I am not sure if it is pre-configured to do that or not.
I added the meter. I am unable to understand how to read values as it is giving an error saying 'Specifying argument was out of the range of valid values'. Can you refer me a link from where I can learn to setup GXDLMSDirector?
Thanks for helping and looking forward to a response.
Hi,
Hi,
You need to run gurux.dlms.server.example.java. You can connect to it using gurux.dlms.client.example.java
Go the the project folder and build applications like this:
mvn clean package
Then start server and client something like this:
java -jar target\gurux.dlms.server.example.java-0.0.1-SNAPSHOT.jar
You can also use Eclipse in the same way.
BR,
Mikko
Hi,
Hi,
I just tried the things that you suggested. After running the client, the program gave the following output and terminated:
GuruxDlmsSample reads data from the DLMS/COSEM device.
GuruxDlmsSample -h [Meter IP Address] -p [Meter Port No] -c 16 -s 1 -r sn
-h host name or IP address.
-p port number or name (Example: 1000).
-S serial port.
-a Authentication (None, Low, High, HighMd5, HighSha1, HighGMac, HighSha256).
-P Password for authentication.
-c Client address. (Default: 16)
-s Server address. (Default: 1)
-n Server address as serial number.
-l Logical Server address.
-r [sn, ln] Short name or Logical Name (default) referencing is used.
-t [Error, Warning, Info, Verbose] Trace messages.
-g "0.0.1.0.0.255:1; 0.0.1.0.0.255:2" Get selected object(s) with given attribute index.
-C Security Level. (None, Authentication, Encrypted, AuthenticationEncryption or DigitallySigned)
-V Security Suite version. (Default: Suite0). (Suite0, Suite1 or Suite2)
-K Used Key agreement scheme (OnePassDiffieHellman or StaticUnifiedModel).
-v Invocation counter data object Logical Name. Ex. 0.0.43.1.1.255
-I Auto increase invoke ID
-o Cache association view to make reading faster. Ex. -o C:\device.xml
-T System title that is used with chiphering. Ex -T 4775727578313233
-A Authentication key that is used with chiphering. Ex -A D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF
-B Block cipher key that is used with chiphering. Ex -B 000102030405060708090A0B0C0D0E0F
-D Dedicated key that is used with chiphering. Ex -D 00112233445566778899AABBCCDDEEFF
-d Used DLMS standard. Ex -d India (DLMS, India, Italy, SaudiArabia, IDIS)
-E Export client and server certificates from the meter. Ex -E 0.0.43.0.0.255.
-R Generate new client and server certificates and import them to the server. Ex. -R 0.0.43.0.0.255.
-i Used communication interface. Ex. -i WRAPPER.
-m Used PLC MAC address. Ex. -m 1.
Example:
Read LG device using TCP/IP connection.
GuruxDlmsSample -r sn -c 16 -s 1 -h [Meter IP Address] -p [Meter Port No]
Read LG device using serial port connection.
GuruxDlmsSample -r sn -c 16 -s 1 -S COM1 -i
Read Indian device using serial port connection.
GuruxDlmsSample -S COM1 -c 16 -s 1 -a Low -P [password]
After running the server, the program gave the following output and is now sitting idle without getting terminated:
System Title: 41 42 43 44 45 46 47 48
Authentication key: D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
Block cipher key: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
Client System title:
Master key (KEK) title:
Short Name DLMS Server in port 4060
Example connection settings:
Gurux.DLMS.Client.Example.Net -r sn -h localhost -p 4060
----------------------------------------------------------
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[9,1]
Message: XML document structures must start and end within the same entity.
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(Unknown Source)
at gurux.dlms.objects.GXXmlReader.read(GXXmlReader.java:152)
at gurux.dlms.objects.GXXmlReader.isStartElement(GXXmlReader.java:173)
at gurux.dlms.objects.GXDLMSAssociationLogicalName.load(GXDLMSAssociationLogicalName.java:1228)
at gurux.dlms.objects.GXDLMSObjectCollection.load(GXDLMSObjectCollection.java:257)
at gurux.dlms.objects.GXDLMSObjectCollection.load(GXDLMSObjectCollection.java:148)
at gurux.dlms.server.example.GXDLMSBase.init(GXDLMSBase.java:769)
at gurux.dlms.server.example.GXDLMSBase.<init>(GXDLMSBase.java:319)
at gurux.dlms.server.example.GXDLMSServerLN.<init>(GXDLMSServerLN.java:51)
at gurux.dlms.server.example.GuruxDlmsServerExample.main(GuruxDlmsServerExample.java:143)
System Title: 41 42 43 44 45 46 47 48
Authentication key: D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
Block cipher key: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
Client System title:
Master key (KEK) title: 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31
Logical Name DLMS Server in port 4061
Example connection settings:
Gurux.DLMS.Client.Example.Net -h=localhost -p 4061
----------------------------------------------------------
System Title: 41 42 43 44 45 46 47 48
Authentication key: D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
Block cipher key: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
Client System title:
Master key (KEK) title: 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31
Short Name DLMS Server with IEC 62056-47 in port 4062
Example connection settings:
Gurux.DLMS.Client.Example.Net -r sn -h localhost -w -p 4062
----------------------------------------------------------
System Title: 41 42 43 44 45 46 47 48
Authentication key: D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF
Block cipher key: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
Client System title:
Master key (KEK) title: 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31
Logical Name DLMS Server with IEC 62056-47 in port 4063
Example connection settings:
Gurux.DLMS.Client.Example.Net -h localhost -w -p 4063
Press Enter to close.
Can you tell me how to move forward after this? I am not sure how to. Thanks for the previous response and looking forward to further responses.
Thanks and Regards,
Nakul
Hi,
Hi,
Give client parameters -h localhost and -p 4061.
BR,
Mikko
Hi,
Hi,
I passed the client parameters as you asked. After passing these parameters, it is failing to send the data and shows the output shown in the screenshot attached. How should I fix this?
PS: The server showed Client connected when I ran the command with client parameters.
Thanks for helping and looking forward to a response.
Hi,
Hi,
The security was improved in the last version and one setting was not updated to the server example. Get the latest version from the server example from the GitHub. You need also to remove 406Xsettings.xml files from the target folder.
BR,
Mikko
Hi,
Hi,
In the server example, there is a method invocation of setMinimumInvocationCounter(long) and getMinimumInvocationCounter(). These two methods are giving a compilation error as these are not available for the class GXICipher. I checked the documentation of GXICipher and these methods are not present there too. So can I comment these out before running the program?
Hi,
Hi,
I'm sorry. The new version is still on testing and that is the reason why it failed. Get the latest version from GitHub. This is commented out until the next version is released.
BR,
Mikko
Hi,
Hi,
Thanks for such a quick response. The connection is established now. One thing I am unable to understand is why is the client sending the data? Shouldn't the server be sending the data. Maybe I am misinterpreting the output shown after running the program. Kindly help me in understanding the outputs of the client and server. I am attaching the server output in this comment and the client output in the next one.
Thanks for helping and looking forward to a response.
Following is the client
Following is the client output.
Hi Nakul,
Hi Nakul,
Please, don't add pics. They are compressed and hard to read the bytes. The Client establishes the connection and reads wanted data. The server might start the communication if its configured to do it. That is used when client can't establish the connection to the meter. Example when GPRS connection is used with dynamic IP addresses. You can read more:
http://www.gurux.fi/Gurux.DLMS.DynamicIP
The meter might send push messages where is pre-configured data.
BR,
Mikko
Hi,
Hi,
Sorry for the inconvenience. Following are the client and server output, respectively:
Client Output:
Connect using network connection gurux.net.GXNet@19469ea2
Authentication: None
ClientAddress: 0x10
ServerAddress: 0x1
Standard: DLMS
-------- Reading GXDLMSAssociationLogicalName 0.0.40.0.0.255 Ch. 0 Current association
Index: 2 Value: 0.0.40.0.0.255 Ch. 0 Current association, 0.0.40.0.1.255 Ch. 0 Association #1, 0.0.43.0.0.255 Ch. 0 Security setup #0
Index: 3 Value: 16/1
Index: 4 Value: 2 16 756 5 8 1 LOGICAL_NAME
Index: 5 Value: [GET] 1024 0 6 0
Index: 6 Value: 2 16 756 5 8 2 None
Index: 7 Value: 47 75 72 75 78
Index: 8 Value: ASSOCIATED
Index: 9 Value: 0.0.43.0.0.255
Index: 10 Value:
Index: 11 Value: gurux.dlms.GXSimpleEntry@694f9431
-------- Reading GXDLMSAssociationLogicalName 0.0.40.0.1.255 Ch. 0 Association #1
Index: 2 Value: 0.0.40.0.0.255 Ch. 0 Current association, 0.0.40.0.1.255 Ch. 0 Association #1, 0.0.43.0.0.255 Ch. 0 Security setup #0
Index: 3 Value: 16/1
Index: 4 Value: 2 16 756 5 8 1 LOGICAL_NAME
Index: 5 Value: [GET] 1024 0 6 0
Index: 6 Value: 2 16 756 5 8 2 None
Index: 7 Value: 47 75 72 75 78
Index: 8 Value: ASSOCIATED
Index: 9 Value: 0.0.43.0.0.255
Index: 10 Value:
Index: 11 Value: gurux.dlms.GXSimpleEntry@f2a0b8e
-------- Reading GXDLMSSecuritySetup 0.0.43.0.0.255 Ch. 0 Security setup #0
Index: 2 Value: []
Index: 3 Value: SUITE_0
Index: 4 Value:
Index: 5 Value: 41 42 43 44 45 46 47 48
Index: 6 Value:
DisconnectRequest
Ended. Press any key to continue.
Server Ouput:
Client Connected.
Client Read value from 0.0.43.0.0.255 attribute: 2.
Client Read value from 0.0.43.0.0.255 attribute: 3.
Client Read value from 0.0.43.0.0.255 attribute: 4.
Client Read value from 0.0.43.0.0.255 attribute: 5.
Client Read value from 0.0.43.0.0.255 attribute: 6.
Client Disconnected.
Can you please explain these outputs? And about the server configuration, I haven't changed anything in the server example, so I am not sure if it is pre-configured to do that or not.
Hi,
Hi,
I believe that you should install GXDLMSDirector and read your meter with it. In that way, you get an idea of DLMS meters and how they operate.
BR,
Mikko
Hi,
Hi,
I don't have a physical meter with me. Is there any way I can simulate a server or do I need to get a meter for this to work?
Hi,
Hi,
You can connect to the example server in the same way. Select Gurux as a manufacturer.
BR,
Mikko
Hi,
Hi,
I added the meter. I am unable to understand how to read values as it is giving an error saying 'Specifying argument was out of the range of valid values'. Can you refer me a link from where I can learn to setup GXDLMSDirector?
Thanks for helping and looking forward to a response.