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.

  • Modbus4J Source Code

    3
    0 Votes
    3 Posts
    5k Views
    L
    @lordportux said: Hello team! I'm looking for the modbus4j source code. I've looked at the SourceForge site but there are old versions and don't work on Mango 1.12.4 (Modbus4J 1.1 works on Mango 1.10.0) Why is too hard to find the Mango & Modbus4J source code?? is no longer open source? Look forward for your answers! Thanks I´ve found the lastest Source Code of Modbus4j in: http://modbus4j.cvs.sourceforge.net/viewvc/modbus4j/ Thanks to Eduardo Leal from Scadabr!
  • SeroUtils.jar management

    41
    0 Votes
    41 Posts
    64k Views
    A
    I thougth that the the whole thing is there, to add new DataPoints to RT if the RT is polling the dataPoints. with the lock only one Thread can access the add/Remove or pointList. I have a lock for the addList (the addList) one for remove and one for the pointList. so adding will lock only the addList ... If I copy over I must lock all. src is here (modified) https://scadabr.svn.sourceforge.net/svnroot/scadabr/trunk/scadabr/scadabr/src/main/java/com/serotonin/mango/rt/dataSource/DataSourceRT.java
  • The read is timiing out

    2
    0 Votes
    2 Posts
    2k Views
    H
    Here is the code for the following info we need to pull ModbusFactory factory = new ModbusFactory(); IpParameters params = new IpParameters(); params.setHost("192.168.1.100"); params.setPort(502); params.setEncapsulated(true); ModbusMaster master = factory.createTcpMaster(params, false); // master.setRetries(4); master.setTimeout(50000); master.setRetries(5); long start = System.currentTimeMillis(); try { master.init(); for (int i = 0; i < 40; i++) { System.out.println(master.getValue(100, RegisterRange.COIL_STATUS, 100+i, DataType.BINARY)); } } catch (Exception e) { e.printStackTrace(); } finally { master.destroy(); } System.out.println("Took: " + (System.currentTimeMillis() - start) + "ms"); We are trying to pull the values from the following information Slave ID: 100 Function: 01 Read Coils (0x) Address: 100 Quantity: 40 This works on another program we downloaded just to see if the PLC was ok and the PLC is working. Whenever we try with Modbus4j it times out. Any help is appreciated!
  • IO Exception in seroUtils.jar

    2
    0 Votes
    2 Posts
    4k Views
    F
    Matthew, I'm getting an exception in seroUtils.jar. Near as I can tell it occurs when there are multiple concurrent requests for values for several different slaves. The exception stack is: java.io.IOException: Stream closed. at java.net.PlainSocketImpl.available(PlainSocketImpl.java:434) at java.net.SocketInputStream.available(SocketInputStream.java:217) at java.io.BufferedInputStream.available(BufferedInputStream.java:381) at com.serotonin.io.InputStreamListener.run(InputStreamListener.java:67) The only way it appears I can correct the problem is to restart the application and everything will work fine so long as I don't hammer the requests concurrently. Have you seen this before? The version of Modbus4J is 1.02. Regards, Fred
  • Setting the IP Address of Modbus slave

    2
    0 Votes
    2 Posts
    3k Views
    T
    I am trying to simulate an TCP Modbus slave. I extended the class TcpSlave for this and added some Process Images. Unfortunately, the TcpSlave provides only the port to set. How can I set the IP Address of the slave ? I tried to add the following code snippet in TcpSlave but it doesn't help : @Override public void start() throws ModbusInitException { try { serverSocket = new ServerSocket(port); //Socket socket; //this should be the ip address of the slave Socket socket = new Socket("192.168.20.100", 502); while (true) { socket = serverSocket.accept(); TcpConnectionHandler handler = new TcpConnectionHandler(socket); executorService.execute(handler); } Can someone help me ?
  • Tried to access field gnu.io.RXTXPort.IOLocked from class gnu.io.RXTXHack

    4
    0 Votes
    4 Posts
    7k Views
    M
    See this post: http://mango.serotoninsoftware.com/forum/posts/list/297.page#1392
  • Newest cvs doesn't compile

    4
    0 Votes
    4 Posts
    3k Views
    P
    All OK now, thank you!
  • Modbus polling frequency

    4
    0 Votes
    4 Posts
    5k Views
    M
    Not sure what the problem is. I've personally had sub-second modbus polling working. How many slaves are you polling, and how many points in each?
  • Concurrency parameter

    5
    0 Votes
    5 Posts
    4k Views
    M
    You are correct.
  • RTU example

    4
    0 Votes
    4 Posts
    9k Views
    W
    Thank you Matthew. I was able to use the factory and create the RTU master. The issue I was having was related with the definition of the serial parameters .. This is the code I came up with. It works .. knowing that the slave I'm reading from has the ID 7, and the connection over RS485 (COM6 here) is of "N81" type, at 9600 baudrate . package appliancemb; import com.serotonin.modbus4j.ModbusFactory; import com.serotonin.modbus4j.ModbusMaster; import com.serotonin.modbus4j.code.DataType; import com.serotonin.modbus4j.code.RegisterRange; import com.serotonin.modbus4j.exception.ModbusInitException; import com.serotonin.io.serial.*; // declare variables public class appliance { public static void main(String[] args) throws Exception { ModbusFactory factory = new ModbusFactory(); SerialParameters params = new SerialParameters(); params.setCommPortId("COM6"); params.setBaudRate(9600); params.setDataBits(8); params.setStopBits(1); params.setParity(0); ModbusMaster master = factory.createRtuMaster(params); // master.setRetries(4); master.setTimeout(1000); master.setRetries(0); long start = System.currentTimeMillis(); // Don't start if the RTU master can't be initialized. try { master.init(); } catch (ModbusInitException e) { System.out.println( "Modbus Master Init Error: " + e.getMessage()); return; } try { System.out.println("Reg. 1001 Value:" + master.getValue(7, RegisterRange.HOLDING_REGISTER, 1000, DataType.FOUR_BYTE_FLOAT_SWAPPED)); // more like the above until all required register values are read. // .. } finally { master.destroy(); } System.out.println("Time elapsed: " + (System.currentTimeMillis() - start) + "ms"); } } Thanks again.
  • CVS repo problem?

    10
    0 Votes
    10 Posts
    6k Views
    M
    Feel free to regenerate as required.
  • RTU modbus packet format over ip

    3
    0 Votes
    3 Posts
    3k Views
    M
    Have you tried using encapsulation?
  • Android App based on Modbus4J

    4
    0 Votes
    4 Posts
    5k Views
    V
    I love the app. A nice feature for a future release would be to log data from the registers being read to a text file or something at a defined interval. very cool!
  • Multiple TCP Modbus Slaves

    25
    0 Votes
    25 Posts
    22k Views
    M
    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.
  • License update

    2
    0 Votes
    2 Posts
    4k Views
    M
    The license for Modbus4J has been updated from LGPL to GPL v3.0. Users of Modbus4J that use the product for commercial purposes may purchase a license from Serotonin that permits them to continue to use it as such. Please use the Contact Us page to inquiry of the details.
  • Pluggable Exception Handler example

    15
    0 Votes
    15 Posts
    8k Views
    M
    Good to hear. Thanks for following up.
  • SendTimeoutException

    3
    0 Votes
    3 Posts
    3k Views
    M
    Couldn't say. Do you have traces of the communication between the two?
  • Inverted Byte order

    4
    0 Votes
    4 Posts
    3k Views
    B
    Good to know, thanks! Looking at this made me wonder, using the convenience methods in the TCP master class, and the modbuslocator, is there currently a way to get multiple values. Looking at the getValue method, it appears like it utilizes the batch feature, but only with a single read (or multiple registers, but only up to the required number for the specified value type). For my app, the user sets the starting register/bit location, and the length they want to read, so I would ideally get some type of array back with the data in it. Then they can also select how to display that data (i.e. float, signed int, unsigned it, word swapped float, etc.) Sending that information to the locator and pulling it back out directly from it in that form would be handy. In general, I've really liked what you're doing here, and love some of the flexibility in this library over jamodbus (hence why I'm trying to adapt from it), but I'm just trying to get my head around everything, so forgive me if my questions are pretty noob-ish.
  • Modbus4j on Android

    7
    0 Votes
    7 Posts
    6k Views
    B
    Yeah, I think that will work. And then for my 'disconnect' button I'll just call the destroy, and re-instance the TCPmaster w/ a new init() if the user tries to re-connect. Thanks!
  • Addressing issue

    5
    0 Votes
    5 Posts
    3k Views
    M
    Simplest is to make the appropriate changes to the Modbus4J code.