Support Center

HOWTO: Create Custom Devices - DEXGate2

Last Updated: Mar 24, 2018 12:42AM CET
If any Modbus device is not compatible yet with DEXGate v2, you can integrate it yourself using the Custom Device feature! In order to do so a JSON device template must be created with the format explained below.
Click on "Custom devices" menu and follow these steps: 
 
  1. Click in "New custom device" button or in "Import device" button if you have a JSON file already created. 
  2. Introduce a "Device name" (for example, Circutor CVM-mini) and click in "Add Subdevice"
  3. Click in "Add Service" to start configuring the corresponding device and fill the following fields:
    1. Initial Register (address)is the initial modbus register (address) (an integer between 0 and 65535). ​#Note that "Address" is the "Register-1"
    2. Type Registeris either: 'input' or 'holding'​
    3. DEXCell service: is the dexcell service identificator. You can find them here.
    4. Operation: nothing, multiply, divide or sum. 
    5. Operand: is the operand of the operation. For example, in the kW to W case, we would set the operand value to 1000 to set the divisor of the operation to 1000.
    6. Type value: uint8_msb, int8_msb, uint8_lsb, int8_lsb, uint16, int16, uint32, int32, uint32inv,  int32inv, uint48, int48, uint64, int64, float
*Note: All type values are Big Endian (AB, ABCD), except int32inv, uint32inv and floatinv that correspond to Mid-Little Endian (CDAB)
  1. If you want to add additional services for the same subdevice, click on "Add Service"
  2. For additional subdevices under the same "Custom device" click on "Add Subdevice"
*Note: Keep in mind that it is not always necessary to define the "Name extension" field unless you need to create different values of the same type, such as several pulse channels, or create several phases (a, b, c) of a three-phase device. This extension will be added to the DeviceID in DEXCell following the Modbus address of the target device (eg 2a, 2b, 2c)
  1. When you finish to configure all the devices, click on "Save Device" to apply changes. 
Your custom device should look like this:
 
  1. After creating a file called "yourdevice" you'll need to add a line "customdevice.yourdevice=" in your modbus configuration file followed by the modbus addresses of your custom devices. For example if your device is called Circutor-CVM-mini and it has the modbus addres 13 you'll use this line:
    ​customdevice.Circutor-CVM-mini=13


MASTERING CUSTOM DEVICES:

Creating a Custom device is not different than integrating a Modbus device into DEXGate2 but in an easier way than writng code. However, we need some previous concepts and some checks have to be performed in order to be sure that we are doing things right.

The most important thing when starting a custom device, is to understand that you are trying to read and translate Hexadecimal numbers that are stored in a certain device, and that you want to convert them to the reading you need following a predefined schema, that depends on that specific device. This means that the first thing you need is the Modbus Registers Table that usually can be found in the device Manual, and that explains the way to read and transform these Hexadecimal numbers to get useful information.

Creating a Custom device is just defining how the DEXGate2 has to read a certain device, to get the Modbus registers we need, and transform them into the correct parameter and units to insert it into DEXCell. 

But even before starting the custom device you should check previously that you can read those Modbus registers (that there is Modbus communication), and this has to be performed through the Read & Write Register feature in DEXGate2.

If you don't check that you can read the registers before you create the Custom Device, three things can happen:
1- All works correctly and you're done
2- Communication is fine but you get errors because the custom device is wrong defined
3- The custom device is fine but you get errors because communication is not working

In the second and third options you'll be totally lost until you check if there is communication. Once you are sure you can read those registers, then you can start defining how to play with them ;)

*NOTE: Remember that DEXGate2 is set by default to 9600 Bd, 8 data bits, 1 stop bit and parity N. Please check that all the devices in the RS485 BUS have the same values. 

Also, while you are creating the custom device you can have doubts about the correct way to read the registers (holding or input, INT32 or UINT32, etc.) and looking at the hexadecimal registers can help you to understand what you are doing ( if a certain registry is empty, for example).
The best you can do when starting a custom device, is trying to read at least one of the registers you want to integrate, and then try to convert it manually to the expected value. This will give you the peace of mind of doing things well.

To convert the Hexadecimal values to decimal values, there are lots of different tools, from excel to online calculators.
Here you can find a link to scadacore.com online calculator that makes Hexadecimal conversions to different formats INT32 float UINT16 etc, and will help you understand what you have to define in the Custom device to obtain the reading given by the analyzer.

Online Hex Converter

The first time you face a Modbus integration, it seems impossible, but once the first is done you will have any Modbus device at your fingertips

We also reccomend you to take a look to our Hardware webinar, where you will find some interesting tips about how to configure your Modbus devices in DEXGate2




 

Contact Us

  • Post a Public Question
  • Email Us
  • Tel : +34 931 810 195
    Hours: 9am - 6pm CEST, Mon to Fri
    support@dexmatech.com

    Check Public holidays here

    Support
support@dexma.com
http://assets3.desk.com/
false
dexma
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete