0

I'm trying to read a power meter, model Shark200 using Modbus RTU. I was already able to read it, but I couldn't interpret the returned data. How to interpret the date and value fields?

Example of the returned data:

0; 2; 6144; 3840; 17239; -26413; 17267; -27130; 17250; 31448; 16765; 23237; 16612; -9774; 16571; -17050; 2; 6144; 7680; 17237; -1267; 17267; 2169; 17249; -21791; 16745; 27777; 16681; -27502; 16550; 23033; 2; 6144; 11520; 17240; -224; 17267; -919; 17250; -1291; 16771; 13918; 16607; 26412; 16547; 23206; 2; 6145; 11520; 17238; -28002; 17267; -16499; 17250; 14486; 16771; 1838; 16612; 22630; 16541; 28452; 2; 6146; 0; 17237; -15796; 17266; -2358; 17249; 26544; 16917; 963; 16889; 15450; 16858; -447; 2; 6146; 3840; 17238; 22871; 17267; -8911; 17250; 11932; 16710; -25045; 16676; 32575; 16489; 16235; 2; 6146; 7680; 17239; -7892; 17268; 25489; 17250; -5705; 16771; -15073; 16674; 7403; 16544; -6094; 2; 6146; 11520; 17241; 13096; 17268; -12353; 17251; 29292; 16774; -296; 16676; 18266; 16540; -14520; 2; 6147; 0; 0

In the manual it says:

Historical Log Record In the manual

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
João Soares
  • 49
  • 1
  • 12

3 Answers3

0

Basically each byte represents a HEX value in your Timestamp

Looking at the example

0x060717101600

is meant to be read:

YYMMDDHHMMSS in HEX format, so

YY = 06h = 06dec or (2006)
MM = 07h = 07dec (July)
DD = 17h = 23dec 
HH = 10h = 16dec
MM = 16h = 22dec
SS = 00h = 00dec

Modbus protocol works with 16bit registers so you will receive the timestamp in 6 bytes (3 registers), so your registers will look like:

YYMM = 0607h
DDHH = 1710h
MMSS = 1600h

EDIT: looks like the time is expressed in 24h format

Dharman
  • 30,962
  • 25
  • 85
  • 135
Simon
  • 123
  • 1
  • 7
  • Yea, values are in HEX. But trying to read the data returned from my read, I can't extract a date. In the manual it says that the first record is the status, the second record is the index. Next would be the date. So it would be: 0x6144384017239 YY = 06 = 2006 MM = 14 = Month 20? – João Soares Nov 09 '21 at 14:23
  • I think in your example the values are in DEC format. So 6144 = 1800h and 3840 = F00h and 17239 = 4357h – Simon Nov 09 '21 at 14:24
  • How to convert 1800h, F00h, 4357h to readable date? Year 2018, Month 00? – João Soares Nov 09 '21 at 14:39
  • Are you sure that you're reading the registers in the correct order and format? I dont think the data you're receiving is in the correct format. – Simon Nov 09 '21 at 14:46
  • I think so. In the manual it says to read position 0xC351 and 125 registers. Converting 0xC351 hex to DEC would be position 50001. My code to read the position: int[] final = conn.ReadHoldingRegisters(50001, 125); – João Soares Nov 09 '21 at 14:50
  • You don't mention your programming language nor which library you're using. Maybe you have invalid data in your energy meter? – Simon Nov 09 '21 at 14:54
  • Im using C# and Easymodbus library. Good point on invalid data. But trying to read 2 more registers, return this: 1) 30; 2; 6151; 11520; 17238... 2) 29; 2; 6151; 7680; 17238... It still doesn't make sense. – João Soares Nov 09 '21 at 15:10
  • Make sure you're reading from the correct addresses, seems there is no timestamp there. Maybe you're reading some settings address? I found two manuals of Shark200 and both says that register 0xC351 is used to program the log retrieval window block?? – Simon Nov 09 '21 at 15:18
  • There are several logs you can read. To read the desired log, you need to write the log number in position 0xC34F or DEC 49999. I will post a screen of the manual. – João Soares Nov 09 '21 at 15:28
  • Manual screenshot posted. – João Soares Nov 09 '21 at 15:33
  • Or go to: "B.5.4.4: Log Retrieval Example" in the manual. – João Soares Nov 09 '21 at 15:38
  • I think there are some errors in your read. The first two register that you read, should be 0x00 = window ready, and next one is the index. Assuming your read is correct, you are gettin 30 as first register and 2 as second register and according to manual, this is not consistent. – Simon Nov 09 '21 at 15:46
  • If there's something wrong with my reading, it's exactly in step 2 that I just posted. Because that's where I write what I want to read and engage the log for reading. If I change anything, the read returns all -1. – João Soares Nov 09 '21 at 15:58
0

There are several logs you can read. To read the desired log, you need to write the log number in position 0xC34F or DEC 49999.

My code to write:

c.WriteSingleRegister(49999, 640);

Log Number:

0 - System Events; 1 - Alarms; 2 - Historical Log 1; 3 - Historical Log 2; 4 - Historical Log 3

enter image description here

João Soares
  • 49
  • 1
  • 12
0

I believe there's no erros in my reading. Because even when reading other addresses that have timestamps, the returned data has the same format. Reading the manual, I found this but I dont know what it means:

enter image description here

João Soares
  • 49
  • 1
  • 12