I assume the customer is trying to reset the accumulated kWh registers on a PM2000 series device. If so, you could either:
1. Issue a "Reset All Accumulated Energies" command (2021). This will reset all accumulated energy registers to zero (kWh, kVARh, kVAh, etc.)
2. Issue a "Reset All Energies" command (2020). This will reset all energy registers (accumulated and interval) to zero.
3. Finally, you could set the kWh register to zero using the "Preset Accumulated Energy" command (2006). This will allow you to program the kWh register to any value you wish. You may have to read the existing energy values you do not wish to change and place those value into the appropriate command register locations or it might allow you to put in NAN into those registers and it will not change the other registers.
See the Commands tab of the spreadsheet you have. In any of these options, they will need to first grab the semaphore (register 5680) and use the Protected Command register interface (registers 5000-5124) to issue the command and read registers 5125 onward to check the results.
The order of operation should be:
1. Read the semaphore register (5680). If the contents of the register is non-zero, make note of that value (i.e. Semaphore value). If the value is zero, then something else already has the semaphore (either the front panel or some other software) and you will have to wait for the timeout to occur (a few minutes) or for the holder of the semaphore to release it (more on that later).
2. Assuming you got a non-zero semaphore value. You will next, write you command into the Protected Command register interface (registers 5000 thru 5124).
Using a Modbus Preset Multiple Register command (0x10), you would write the following values into these registers:
5000 => 2020
5001 => Semaphore Value
3. Assuming you got an actual valid Preset Multiple Register command response, you now need to verify that the command actually worked. This is done by reading the Command Status (5125) and Command Result register (5126).
The Command Status should contain the Command # you had done in 5000 (otherwise hasn't even attempted it yet), and if the Command Result register reads 0 (zero), then everything worked OK. If it is non-zero, then something about the command didn't work properly.
4. Lastly, you will need to release the semaphore so that something else can do something. This is accomplished by writing the semaphore value back into the semaphore register (5680) using a Preset Multiple Register Command (0x10).
Here is a step by step explanation with an actual packet trace of ION Setup successfully sending a Reset All Energies command to a PM2230 (Modbus RTU).
; Step 1: Request the semaphore by Reading register 5680, 1 register
TX: 16 03 16 2F 00 01 B2 AC
; PM2230 responds with non-zero semaphore (0xB157), proceed to Step 2.
RX: 16 03 02 B1 57 F9 E9
; Step 2: Send Command to reset all energies (0x07E4 = 2020) plus semaphore (0xB157) to registers 5000 to 5001.
TX: 16 10 13 87 00 02 04 07 E4 B1 57 59 40
; PM2230 responds with non-exception write response indicating successful 2 registers are written
RX: 16 10 13 87 00 02 F6 42
; Step 3: Confirm command is written properly by Reading registers 5125 thru 5127
TX: 16 03 14 04 00 03 42 DD
; PM2230 responds but register 5125 does not match original command value of 2020 (0x07E4)
RX: 16 03 06 00 00 00 00 00 00 CA 85
; Repeeat Step 3 again…
TX: 16 03 14 04 00 03 42 DD
; PM2230 responds with register 5125 contains command value of 2020 (0x07E4), register 5126 has value of 0. Go to Step 4.
RX: 16 03 06 07 E4 00 00 00 00 BB 24
; Step 4: Release semaphore by writing semaphore value back into register 5680
TX: 16 10 16 2F 00 01 02 B1 57 08 50
; PM2230 responds with non-exception write response indicating successful 1 register is written
RX: 16 10 16 2F 00 01 37 6F
Register 5680 is used as a semaphore. It is meant to be read ONCE and when it returns a non-zero value, you should *NOT* be reading it yet again (and expecting a non-zero value yet again). You need to record the value in register 5680 if it is non-zero and use it for the remainder of any actions you want to perform (as long as those actions are done within a reasonable amount of time).
As far as your questions go:
1. This would be a question for the firmware team in Bangalore but it could take a few seconds after power up before the device allows the semaphore register to properly be used.
2. A value of 3010 in register 5126 indicates an "Invalid Semaphore" indicating that the customer is *NOT* reading the value out of register 5680 properly and inserting it into register 5001.
You can see how this is performed in the above trace by the highlighted in yellow values where ION Setup reads the register in 5680 (returning a value of 0xB157) and then it subsequently places that exact same value into register 5001 (writing 0x07E4 and 0xB157 into registers 5000 and 5001).
3. I can't say exactly where there error is without knowing precisely what packets they are sending. If the customer can provide a packet trace of the actual Modbus RTU communications, I can point out where they are doing the incorrect procedure.
Hi, Kim. Just adding some information.
I was dealing with this procedure also, it is not so simple.
Mr. Lee has described the step by step very well. It worked to me. I guess your problem is you are using Kepware OPC server. The server keeps reading the register 5680 and this force it to zero. You CAN NOT keep reading it. You need to read it ONCE and get his value. If it is zero, you need to wait about 3 minutes and try to read ONCE again.
Believe me, it works.
I spent some hours to succeed on doing the kWh modbus reset operation.
I know a little about Kepware OPC server and I don't think it will be able to do the whole operation. You better use some modbus client that allows you to control the modbus transactions.
Thank you Mr. Marcos
I will check your advice.
Moreover, you must use modbus function 16 to write the value back to the 5680. It will not work using function 06.