Using Duro PLM

I’m excited to be using Duro PLM for a new client. Duro is an exciting new cloud PLM and I was fortunate to have the company founder give me a tour of Duro just before Christmas. I will be posting about my experiences once I get my feet wet.

I also hope to compare using Duro to ERPNext for stabilizing and consolidating sub-assembly engineering BOMs (bill of materials) to create the top-level hierarchical BOMs for product SKUs, and for transfer to a CM (contract manufacturer).

Install ERPNext on FreeBSD 11.2 using VirtualBox

Search for other ERPNext-related posts. You may also visit the demo on dalescott.net.

The simplest way to “install” ERPNext on FreeBSD is to simply use the Virtual Image provided by the ERPNext project with VirtualBox.

The ERPNext project provides the Easy Install script for bare-metal installation but it has a number of Linux dependencies and will not work without changes on FreeBSD. Happily, the project also provides a fully configured virtual machine (based on Ubuntu Linux).

It may also be possible to use bhyve, the BSD hypervisor, with the virtual image, but the OVF file must first be converted to bhyve’s raw format.

Install VirtualBox

Install the virtualbox-ose-nox11 package for running headless virtual machines.

% sudo pkg install virtualbox-ose-nox11

The VirtualBox kernel module (virtualbox-ose-kmod) will also be installed, but it must be re-compiled from source and re-installed (at the very least, the system will crash when next re-booted once it has been configured to load the kernel module at boot). 

Update the ports collection to prepare for compiling the kernel module. 

# portsnap fetch update

If the ports collection has not been installed, install.

# portsnap fetch extract

The FreeBSD sources are required to compile the kernel module. If not already installed, install the FreeBSD sources.

% fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/11.2-RELEASE/src.txz % tar -C / -xzvf src.txz

Compile and install the virtualbox-ose-kmod port. Make will first refuse to install the module because it is already installed (recall it was installed by being a dependency of virtualbox-ose-nox11). De-install the virtualbox-ose-kmod package, then re-install the newly compiled version.

% cd /usr/ports/emulators/virtualbox-ose-kmod
% sudo make
% sudo make install
% sudo make deinstall
% sudo make reinstall

Perform post-install configuration.

1) edit /boot/loader.conf to load the vboxdrv kernel module at boot,

# vi /boot/loader.conf
...
vboxdrv_load="YES"

2) increase AIO limits by editing /etc/sysctl.conf (my server is using AIO, for more information refer to the virtualbox-ose-nox11 pkg-message).

vfs.aio.max_buf_aio=8192
vfs.aio.max_aio_queue_per_proc=65536
vfs.aio.max_aio_per_proc=8192
vfs.aio.max_aio_queue=65536

Reboot the system to load the kernel module (or load it manually).

Make a mental note before doing an OS update to first edit /boot/loader.conf to not load the module. Otherwise the system will likely crash when next rebooted.

The user that VirtualBox runs as must be a member of the vboxusers group. For simplicity, I’ll run VirtualBox using my own username, although best practise would be to create a dedicated user.

# pw groupmod vboxusers -m dale

Edit /etc/rc.conf to run vboxwebsrv (the Virtual Box web interface daemon) using the provided startup script installed in /usr/local/etc/rc.d/

% sudo vi /etc/rc.conf

vboxwebsrv_enable="YES"
vboxwebsrv_user="dale"

and finally start the vboxwebsrv service.

% sudo service vboxwebsrv start
% sudo service vboxwebsrv status

The vboxmanage cli utility can be used to manage virtual machines but I will be using phpVirtualBox which provides a familiar GUI.

Install phpVirtualBox

phpVirtualBox can be installed from the FreeBSD ports collection but it currently has a dependency on PHP 7.1 while I have PHP 7.2. I installed phpVirtualBox manually to avoid pkg attempting to revert my PHP install to 7.1, and have not encountered any issues.

Download the latest release from the phpVirtualBox Github project . Follow the instructions in README.md file and on the wiki. Extract the project to /usr/local/www, and edit the configuration.

# vi /usr/local/www/phpvirtualbox/config.php

var $username = 'dale';
var $password = 'dale_login_password';

Configure the webserver to serve phpVirtualBox. I’m using the basic Apache 2.4 http server package. I added a virtual host definition to /usr/local/etc/apache24/extra/httpd-vhosts.conf to serve phpvirtualbox as a phpvirtualbox.dalescott.net.

<VirtualHost phpvirtualbox.dalescott.net>
  DocumentRoot "/usr/local/www/phpvirtualbox"
  <Directory "/usr/local/www/phpvirtualbox">
    allow from all
    Options None
    Require all granted
  </Directory>
</VirtualHost>

Change the default phpVirtualBox login password to something secure after logging in for the first time.

“Install” ERPNext

Download the desired ERPNext Virtual Machine image (*.ova).

% cd ~/downloads
% wget http://build.erpnext.com/ERPNext-Production.ova

Using phpVirtualBox, create a new vm by importing the downloaded ERPNext-Production.ova Virtual Image file (File/Import). The OVF includes port forwarding rules to forward client port 80 to host port 8080 (for serving ERPNext) and a rule to forward ssh from client port 22 to host port 3022 (for system administration).

Start the vm and then login to ERPNext from a browser (e.g. www.dalescott.net:8080) using the default credentials. The new site wizard will run and lead you through ERPNext configuration. Use a secure password when defining the initial (admin) user, and the wizard will delete the initial Administrator user (with default password) when complete. 

Once logged into ERPNext, setup email processing so that users will receive notifications outside of ERPNext. This will be valuable to understanding and appreciating ERPNext’s significant social aspect. You will also want to change the system login (i.e. ssh) password for “frappe” user to something secure (or disable password authentication entirely in favor of key-based authentication).

Cheers,
Dale

 

Modbus Simulator Review

(updated January 2024)

Modbus is a communication protocol for industrial devices developed in 1979 by Modicon, now Schneider Electric.

A Modbus network consists of up to 247 Servers (originally Slave), and typically one Client (originally Master). A server is commonly a dedicated end-point device, such as a sensor or control device, and a client is commonly a Programmable Logic Controller (PLC) or gateway device in a SCADA network. A client reads or writes to the Coils and Registers in a server, whose purpose is unique to that server.

A Modbus communication starts when a client sends a message to a specific server, either requesting current coil states or register values, or sending states or values for the server to use. The server responds with either the requested data, or confirmation the sent data was accepted.

Modican designed the Modbus protocol for their PLC products, and freely provided the specification so that others could communicate with their PLCs. Modbus has since become a de facto industry standard for industrial devices, due at least in part to the specification being freely available to use. Modbus has evolved over time to remain current, starting with Modbus ASCII using serial RS-232 and RS-485 communications, then binary Modbus RTU for efficiency (also using RS-232 and RS-485), and more recently Modbus TCP for use with Ethernet networks.

The Modbus specification is now controlled by Modbus.org, a U.S. non-profit trade association, which continues to freely publish the Modbus protocol specifications and related technical resources.

Interest in Modbus has surged recently for use in the Industrial Internet of Things (IIoT). Modbus TCP enables data to be exchanged over a wide network, leveraging the advantages of Ethernet and the IwIP network stack for wireless end devices.

For testing and evaluation, general purpose Modbus software running on a desktop or laptop computer is often more convenient than using a purpose-designed Modbus device. A Modbus Client (Master) simulator can be used to query data from devices, and can be a valuable test tool when developing a Modbus Server (Slave) device. A Server (Slave) simulator can be useful as a digital twin for verification testing when developing a physical slave device, or as a device to interact with when developing a Modbus Client.

The following is a non-comprehensive list of available Modbus Server and Client software. If one of these doesn’t quite suite your needs, you consider adapting an existing open-source project or create your from-scratch solution using an open-source Modbus library.

Please post a comment to say if you have found any of these useful, or if you use software that is not listed.

Free Client (Master) Simulators

CAS Modbus Scanner

CAS Modbus Scanner is free Windows-only software from Chipkin Automation Systems recommended by Stephen. CAS Modbus Scanner can retrieve coils, inputs, holding registers, and input registers (displaying values in a variety of formats), and also discover Modbus devices on a network (testing every address, function, length, and offset to check for exceptions or responses). Source is not provided.

The scanner function came in handy recently when I used it as part of the verification test program for a new industrial controller.

ModbusScope

ModbusScope is a free open-source cross-platform app for capturing and graphing Modbus data. In the past, I would capture Modbus data using Modpoll and hammer the output into CSV with sed, or use ModScan to capture CSV directly, and plot using using either DatPlot or spreadsheet software. However, thanks to Ben’s comment, ModbusScope is now my go-to for data logging and capture when I’m looking at three or fewer registers from up to three devices.

ModbusScope is a Qt app and coded in C++, and uses muparser (“fast math parser library”) and QCustomplot (“easy to use plotting widget for Qt”), with icons from Lucide.

Modbus Tester

Modbus Tester from Schneider Electric is a free proprietary Windows GUI program for reading Modbus registers, and supports Modbus RTU and TCP. I found “Tester” did what it claimed, but it didn’t do anything better than I was already doing with other software.

modpoll

modpoll from proconX is a command-line program for Windows and Linux. It supports Modbus ASCII, RTU and TCP, and is a de facto standard based on the number of references it has on the web.

proconX provides modpoll as reference software for their commercial driver libraries. Source is provided, but compiling requires a paid license for the libraries.

mbpoll

mbpoll is an open source (GPL-3) cross-platform command-line utility based on libmodbus (see Libraries). It supports Modbus RTU and TCP and is available in many (most?) Linux distributions. mbpoll conveniently uses similar output syntax and command options as modpoll, I use mbpoll on a Linux Mint test computer and the two are essentially interchangeable. Unfortunately, although mbpoll claims to be multiplatform, I haven’t found a pre-built Windows binary and have found building from source on Windows to be problematic (if you are building mbpoll on Windows, please submit a comment explaining your procedure).

QModMaster

QModMaster is a free open-source Qt-based Modbus master based on libmodbus (see Libraries below). QModMaster is licensed using the LGPL and includes a bus monitor for examining traffic on the bus.

A binary executable is available for Windows, but using on Linux will require compiling the from source using Qt Creator (which I was unable to do successfully, so on Linux I use ModbusScope or Scanbus-BR when I prefer GUI software).

RMMS

Radzio! Modbus Master Simulator (RMMS) is a free proprietary Windows utility (GUI) and claims to replace commercial ModScan and Modbus Poll utilities. It supports Modbus RTU and TCP, and multiple Modbus slave devices. 

Scanbus-BR

Scanbus-BR is is a free cross-platform multi-lingual Modbus RTU and TCP GUI client (Windows and Linux, and Portuguese, Spanish and English). Rodrigo Hernandes created Scanbus to scratch his own itch and released it publicly to help others and as a demo to support his project development work (he is also a Brazilian, which presumably is the reason for the “- BR” suffix). I found the charting capability very handy (plotting up to six registers vs time), and having register values shown in integer, hex and binary simultaneously saved time by not having to convert or switch display formats.

Paid Client (Master) Simulators

Modbus Poll

Modbus Poll from modbus tools was designed to help developers of Modbus slave devices and others to test and simulate the Modbus protocol. Using a multiple document interface, several Modbus slaves and/or data areas can be monitored at the same time. US$129 per developer. The modbus tools website also has a good intro to Modbus.

ModScan

ModScan from WinTECH Software was developed to verify correct protocol operation in new or existing systems. ModScan supports an arbitrary number of queries, each with its own document window, and you can create your own custom windows and add content using the provided widgets (for example, using the trendline display shown below, which can plot up to four difference sources in one display). The data from each document window can be logged to its own data file.

Extensions provide third-party data acquisition using Control Automation routines or the MS Jet Database engine, and a debug mode displays raw serial data to and from a connected device. A single-user license cost US$65 when I last checked. 

Simply Modbus Master

Simply Modbus Master (RTU and ASCII ). The Free mode allows six request messages before the application must be re-started. C$60. A slave simulator and TCP client are also available. The website has a nice intro to Modbus and Modbus Enron.

Free Server (Slave) Simulators

ModRSsim2

ModRSsim2 was forked from MOD_RSSIM and includes compiling on Visual Studio 2010. ModRSsim2 supports RS-232 and TCP/IP connections, the full range of Modbus addresses for all four Modbus types (0xxxxx, 1xxxx, 3xxxx, & 4xxxx addresses), as well as diagnostics with complete traffic byte capture and logging capability. ModRSsim2 supports CSV loading and a scripting environment for testing as well as HTML custom displays. It is free and open-source, and licensed under the GPL.

MOD_RSSIM

MOD_RSSIM is a Windows-based Modbus PLC Simulator (and parent of ModRSsim2). It is free and open-source, and started as a test program for a SCADA/HMI with Modbus RTU and TCP/IP. Typical uses are to verify device configuration, support development of Modbus master and slave drivers for embedded and desktop platforms, and as an educational tool to learn Modbus protocols. 

pyModSlave

pyModSlave is a free and open-source Qt-based Python-code ModBus RTU and TCP slave from the developer of QModMaster. A Windows executable is provided and pyModSlave includes a bus monitor for examining all traffic on the bus. pyModSlave is licensed under the LGPL

UnSlave Modbus Slave Simulator

UnSlave Modbus Slave Simulator . UnSlave simulates any number of Modbus slaves. UnSlave is provided free from Unserver, possibly as a source of test data for Unserver’s Modbus REST API Server, which provides data from Modbus networks and devices to higher-level clients – and is monetized. The informative Complete Modbus Guide is also provided by Unserver.

Paid Server (Slave) Simulators

SimServe

SimServe by SCADAmatic can simulate Modbus ASCII, RTU, or TCP/IP. It provides a user interface for setting up a network topology of multiple devices simultaneously. The developer James brought it to my attention, and was kind enough to provide a guest key for evaluation. SimServe could be a valuable development aid if you are developing SCADA software and need simulated devices for testing, or if you are developing a device and could benefit from having a digital twin for comparison (assuming SimServe is capable of simulating your device).

WinModbus

WinModbus is a Modbus Slave Simulator for Windows. When I found it, the price was GBP62.50 which included lifetime support. A 14-day functional demo is available, and there is an attractive polished website.

Libraries

A number of Modbus libraries are available to leverage application development.

FreeMODBUS

FreeMODBUS is a free open-source implementation of the Modbus protocol with separate ASCII/RTU and TCP ports for a variety of embedded systems. I can recommend FreeMODBUS based on first-hand experience replacing a DIY protocol stack in an embedded industrial controller with an 8-bit MPU. FreeMODBUS is licensed using the BSD 3-clause license. 

libmodbus

libmodbus is a free open-source library for Linux, Mac OS X, FreeBSD, QNX and Win32. The library is written in C, supports RTU (serial) and TCP (Ethernet) communications, and is licensed using the BSD 3-clause license. QModMaster, pyModSlave and mbpoll (reviewed above) use libmodbus.

Other Resources

Peter Chipkin has a nice list of Modbus-related tools on the CHIPKIN website, including their own CAS Modbus Scanner, which is handy for investigating the functions, coils and registers supported by a device.

com0com is a free open-source kernel-mode virtual serial port driver for Windows. An unlimited number of virtual COM port pairs can be created, and any pair can be used to connect one COM port based application to another. The module is signed with a test certificate, and requires configuring Windows to load test-signed boot modules.

Has your server been owned?

Do you know what your server is doing when you’re not watching?

The morning mail delivered another phishing attempt. Someone apparently wants to send me money. I should be so lucky!

It was an obvious attempt since I don’t know any Katelyn’s, let alone one who would want to send me money. However, my browser was asking if I wanted to load the images, and that was curious.

Who was gruppoaceto.it I wondered? Were they an Italian anonymous file sharing site?

A little more typing and I learned “Gruppo Aceto” is an Italian automobile dealer.  Could Katelyn be working there?

 

Reports indicating what your servers are doing are probably already available, but is anyone reviewing them? Keep your systems maintained, but please, please, take a look at your log files every once in a while. 

Dale