• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    Multiple TCP Modbus Slaves

    Scheduled Pinned Locked Moved Modbus4J general discussion
    25 Posts 3 Posters 23.5k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F Offline
      Fred
      last edited by

      Matthew,

      That should work. I think you're right in that you might have some class name confusion as people may view the slave at the device id level instead of the networking ip/port level as the new semantics are.

      Not that I think it would be a big performance hit, but with the process images backed by a hashmap keyed by slave id, you don't have to do a linear search to find the requested process image.

      I may keep my current implementation simply because my process image registry is a collection of process images keyed first by slave id and secondly by my concept of a slave configuration (allowing for more than one process image if a "spill over" process image is needed). This class is thread safe and handles the addition/removal of process images by my slave objects. That said, I think this logic could easily be moved into the ModbusSlave class where if necessary I can create my own implementation.

      So the answer to your question is yes with the reservation on the class naming as you pointed out.

      Regards,

      Fred

      1 Reply Last reply Reply Quote 0
      • M Offline
        mlohbihler
        last edited by

        Good points. The class is now called ModbusSlaveSet and has this relevant code:

            protected LinkedHashMap<Integer, ProcessImage> processImages = new LinkedHashMap<Integer, ProcessImage>();
        
            public void addProcessImage(ProcessImage processImage) {
                processImages.put(processImage.getSlaveId(), processImage);
            }
        
            public ProcessImage getProcessImage(int slaveId) {
                return processImages.get(slaveId);
            }
        
            public Collection<ProcessImage> getProcessImages() {
                return processImages.values();
            }
        ...
        

        I used a LinkedHashMap in order to preserve the order in which the process images were added in case the querying order is important to the user.

        Best regards,
        Matthew

        1 Reply Last reply Reply Quote 0
        • S Offline
          skiv71
          last edited by

          hi, just picked up on this thread.... is this some sort of data source that gives mango the ability to listen on port xxx and accept modbus requests? thus making it a TCP slave? think i needs this :)

          Neil

          1 Reply Last reply Reply Quote 0
          • M Offline
            mlohbihler
            last edited by

            This forum is for discussions around the Modbus4J product, which is used in Mango, but otherwise no associated. It is possible to get Mango to act as a modbus slave, but not trivial. If you need this, please use the contact page to request a quote.

            Best regards,
            Matthew

            1 Reply Last reply Reply Quote 0
            • First post
              Last post