Menu

Avoid modbus message coming from meter device

Kshitiz
2012-05-18
2013-05-28
  • Kshitiz

    Kshitiz - 2012-05-18

    Hi,

    We are using Jamod RTU for capturing raedings of variuos electric  meters connected serially. We have set modbus timeoutexception = 1200ms. Now what is happening, when we are pinging one meter and we dont get the result (or reading), we move to next one connected in the same series. But sometimes, the previous meter sends the reading back to the application and the reading of that meter is save for the new or the next one.

    To solve this issue, we have reduced network timeout in nport administrator (for managing com ports) from 5000 to 500 ms. But I dont think that is the permanent solution. Is there any way to avoid that late coming message or mark every message with its corrosponding meter?

     
  • John D Charlton

    John D Charlton - 2012-06-10

    Since the Modbus RTU response packet has the address in it would it work to just reject a packet if it doesn't have the same address as the response one is waiting for?

    John

     
  • Anonymous

    Anonymous - 2012-06-11

    By address you mean meter address right? If that so, how can we extract the address of that packet. I see no option in the code.  I am sending the batchRead like this:

    BatchResults<String> results = master.send(batchRead);

    Here, after getting the response in results, how to get the address of the meter to which that batchRead was sent?

     
  • John D Charlton

    John D Charlton - 2012-06-13

    Yes the meters modbus address.  There may be an error in the code that the master does not verify the slave address is the same as the one it is expecting a response from.  It may be necessary to avoid the problem you are having to add a check so that an exception is thrown if a slave responds with a different address than the request.  Not sure the best place for this but one possibility is in the following code from ModbusSerialTransaction.java:

      In the ModbusSerialTransaction.java when the master sends the request as follows:

              //write request message
              m_IO.writeMessage(m_Request);
              //read response message
              m_Response = m_IO.readResponse();
              finished = true;

    You can add the slave address which is part of the request packet as an argument to the readResponse(uid) and in the readResponse if the response received doesn't match throw an exception.

    I am not actively doing development with this code so may have missed something but I think something along those lines may be needed.

    John

     
  • Julie Haugh

    Julie Haugh - 2012-08-05

    Every Modbus/RTU packet contains the "Unit Number" of the Modbus slave which responded with the packet.  When the packet is received, do

    if (request.getUnitID() != response.getUnitID()) // toss it on the floor.
    

    Are you doing this on a wireless mesh network?  Those network timeouts are huge.

     

Log in to post a comment.

MongoDB Logo MongoDB