To test AHMI in Linux environment, one can use ModbusPal java simulator, found here:
https://sourceforge.net/projects/modbuspal/files/modbuspal/RC%20version%201.6b/I would suggest to just follow these steps:
1) Create AHMI folder inside the Home folder
2) Download ModbusPal.jar file to AHMI folder
3) Copy your project's Debug folder to AHMI folder
4) Open Terminal window and run commands to open ModbusPal (as the 1st picture shows)
5) Configure and run the ModbusPal simulation (as the 2nd picture shows):
---- Add one or more slaves
---- Add Holding registers and Coils to each slave
---- Click the "Run" button
6) Open another Terminal window and run commands to open AHMI window (as the 3rd picture shows)
---- AHMI should be configured to use the ModbusTCP driver with 127.0.0.1 address and 502 port
It's probably the easiest to use the pop up Keypad of the BasicLabel controls to change Holding registers and Coils values but you can also use the ModbusPal window to do this as well (the editor window that shows Holding registers and Coils and has "Stay on top" checkbox).
This was tested in Kubuntu 14.04 but should work in other distributions for as long as Java and Mono are installed (possibly on Raspberry Pi too).
There is an option in ModbusPal for Serial communication but is disabled until your Linux installation has RXTX java library installed and configured properly. Here is what worked in Kubuntu:
1) Use Package Manager to install librxtx-java package, which is Full Java CommAPI implementation from Sun for Serial/Parallel/RS485/Raw communication, but we will just observe Serial part.
---- this installation will only copy the following files to kind of wrong location:
RXTXcomm.jar ---> in folder /usr/share/java/
librxtxSerial.so ---> in folder /usr/lib/jni/
---- here is where they need to be so things work:
RXTXcomm.jar ---> <JAVA_HOME>/jre/lib/ext
librxtxSerial.so ---> <JAVA_HOME>/jre/lib/i386/
One could use the following command to see Java parameters including JAVA_HOME: java -XshowSettings:properties.
I ended up adding the following line to /etc/environment: JAVA_HOME="/usr/lib/jvm/java-7-openjdk-i386"
2) Copy the files:
sudo cp /usr/share/java/RXTXcomm.jar /usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/RXTXcomm.jar
sudo cp /usr/lib/jni//librxtxSerial.so /usr/lib/jvm/java-7-openjdk-i386/jre/lib/i386/librxtxSerial.so
The 4th picture shows the Serial tab of ModbusPal.
Resource:
http://java-buddy.blogspot.com/2013/06/setup-rxtx-jar-and-so-for-ubuntu.html