Arrowhead Client Modbus Library contains the dependencies "Arrowhead Client Library" and "jlibmodbus" to provide the data transfer between modbus tcp and http/https. It helps to register the existing modbus slave or master devices to arrowhead core system and enables the http/https communication.
The project has the following dependencies:
- JRE/JDK 11 Download from here
- Maven 3.5+ Download from here | Install guide
- GitHub Packages Configuring Maven for GitHub Packages
Location: src/main/resources. The defination of the properties will be explained, that can be used for the real application later.
-
Custom Parameters: it defines the basic config of the client
- Change the
client_system_nameproperty to your system name. (Note that it should be in line with your certificate common name e.g.: when your certificate common name ismy_awesome_client.my_cloud.my_company.arrowhed.eu, then your system name ismy_awesome_client) - Adjust the
server.addressandserver.portproperties based on your system configuration. - Adjust the Service Registry Core System location by the
sr_addressandsr_portproperties.
- Change the
-
Secure mode: it decides if the arrowhead client system runs in secure mode. It depends on Arrowhead Core System.
- Decide the required security level and set the
server.ssl.enabledandtoken.security.filter.enabledproperties accordingly. - If
server.ssl.enabledandtoken.security.filter.enabledis set astrue, create your own client certificate (or for demo purpose use the provided one) and update the furtherserver.ssl...properties accordingly. (Note thatserver.ssl.key-store-passwordandserver.ssl.key-passwordmust be the same.)
- Decide the required security level and set the
-
Modbus Data Writer: it declares the record content depending on the modbus data.
record_period: defines the how offen the modbus data will be recorded. default value 200 msrecord.fileName: the name of the file "*.csv"record.slaveAddress: the slave id. The modbus data is from this slave.record.content[]: defines the data that needs to be recorded. There are two special data and four kinds of data type (coil, discrete input, holding register and input register). Two special data are timestemp which records the time and slaveAddress which records the slave id. The number from the data type array means the data address.record: it can be changed, in case that more diffenet file can be created at the same time. But the name should be passed to the real application.
-
Provider service: it describes the connected modbus slave address which will be registered to arrowhead core system
provider.slaveAddress: declares the connected modbus slave.
-
Modbus System Parameters: it explains the topologie of the production systems
modbus.system.name: defines the name of the systemmodbus.system.modules[]: defines the modules in the systemmodbus.system.modules[0].name: defines the name of the modulemodbus.system.modules[0].preModuleName: declares the previous modulemodbus.system.modules[0].nextModuleName: declares the next modulemodbus.system.modules[0].service[]: defines services in the module.modbus.system.modules[0].service[0].namedefines the name of the service.modbus.system.modules[0].service[0].propertiesdefines the properties of the service. The Definition of service is not used. It is dessigned for the usage in the future.modbus.system.modules[0].input: defines the input of the module from the definedmodbus.system.modules[0].preModuleName.modbus.system.modules[0].input.slaveAddressdefines which modbus entity uses the input.modbus.system.modules[0].input.typedefines in which data type the input should store.modbus.system.modules[0].address.typedefines in which address from the data type the input should store.modbus.system.modules[0].input.defaultValuedefines the default if the module doesnot get the information from the previous module.modbus.system.modules[0].output: defines the output of the module from the definedmodbus.system.modules[0].nextModuleName.modbus.system.modules[0].output.slaveAddressdefines from which slave the data should be used as output.modbus.system.modules[0].output.typedefines the output data type.modbus.system.modules[0].output.addressdefines the address in data type.modbus.system.modules[0].output.defaultValuedefines the default value. If there is no data in that data address, the default value will be used.
-
Publisher event: it describes the publishing event type, publishing period and publishing data.
event.modbusdata.eventType: define the event typeevent.modbusdata.publishingPeriodTime: define how often the event will be published.event.modbusdata.slaves[]: defines the content of the the eventevent.modbusdata.slaves[0].slaveAddress: defines the slave id where the data comes from.event.modbusdata.slaves[0].data[]: defines the exact data information.event.modbusdata.slaves[0].data[0].typedefines the data type.event.modbusdata.slaves[0].data[0].startAddressdefines the data starting address.event.modbusdata.slaves[0].data[0].lengthdefines the nummer of data.event.modbusdata.slaves[0].data[0].moduledefines the module that the data comes from.event.modbusdata: the name can be changed, but it needs to be passed to the real application.
-
Subscriber event handling:
event.eventTypeURIMap.{YOUR_EVENT_TYPE}={notificationuri for YOUR_EVENT_TYPE}: defines data type and uri
-
modbus slave parameters:
slave.app.remoteIO: defines the basic config of the remote IO that the connected master wants to read or write.slave.app.remoteIO.addressandslave.app.remoteIO.portdefines the remote IO IP address and port.slave.app.remoteIO.offsetdefines the offset between the data address from connected master and stored in remote IO.slave.app.port: defines the port of the slave.slave.app.memoryRange: defines the max memory of each data typeslave.app.readModule: defines how to get the data from other arrowhead modbus client. There are two types here, namely evnet and service, that defines uses consumer service oder subscriber event to get the data. Notes: If the network speed is not fast enough, service can not be used.slave.app: the name can be changed, but it needs to be passed to the real application.
-
modbus master parameters:
master.data.{DATA_ACCESS_OPTION}.{DATA_TYPE}.{DATA_RANGE_DEFINITION}={DATA_ADDRESS}: defines the data access option information. DATA_ACCESS_OPTION defines to read or write the data. DATA_TYPE defines the data type. DATA_RANGE_DEFINITION defines the start and end address of the data. DATA_ADDRESS defines the data address.master.slave: declares the connected modbus slave information.master.slave.addressandmaster.slave.portdeclares the slave's IP address and port.master.periodTime: defines how often the modbus master operates the data access options.
This Arrowhead Modbus Client Libraray can be seperated into seven parts, namely sevice provider/consumer, event publisher/subscriber, modbus slave/master, data recorder. They can be combined randomly according to different commands to meet tasks in various situations. Depending on the Combination, the application.properties file needs to be redefined with corresponding parts as well. However, there are still some restrictions like following:
- Custom Parameters and Secure mode must be defines by every application
- If the service provider is used, the modbus slave should be also applied by the same client.
- If the modbus slave is used, the service consumer should be alse applied by the same client.