If you are Using Trinity Energy Meter and want to read data through Modbus Communication of Trinity Energy Meter then you don't need to worry. This Article will tell you How to Read Data through Trinity Meters Using MODBUS. For this you should keep in mind that the Meter you are using should have Modbus Compatibility, Your PLC which you are using should be MODBUS ready and you should know the MODBUS data words of your PLC. Subscribe to Automation-Talk by Email .
See below Procedure to Connect the Trinity Meters Using MODBUS
RS-485 address map for Trinity meter/ Trinity Meter Modbus Data Words
Click to Enlarge Trinity Energy Meter Modbus Data Word Table
1.You need to buy converter according to the device in which you want to load data value from Trinity meter. For example, if you want to load data in PC (Computer) from Trinity meter, then you need to buy converter which convert data from RS-485 to RS-232 or RS-485 to USB. If there is RS-232 port available inside your PC then you need to buy RS-485 to RS-232 converter. If there is only USB port inside your PC then you need to buy RS-485 to USB or RS-485 to RS-232 & RS-232 to USB converter. And, if your device supporting RS-485 port then you don’t need to purchase any converter, you can directly connect your device with our meter on A+, B- terminals.
2. If there is converter between your device and Trinity meter then connect A+ terminal of your converter to A+ Terminal of Trinity meter & A- (or B-) terminal of your converter to B- terminal of our meter.
3.Trinity meter has 8-Data Bits, 1-Stop Bit and No Parity. Adjust Baud Rate according to meter. It may possible that, Trinity meter have fixed baud rate like 9600 or 19200.
4.Configure your device (and converter) according this communication setting (mentioned in point-3) to match with Trinity meter.
5. Set, Meter Address (Station ID) inside Trinity meter according to your requirements. While programming of Meter Address, please take care that each meter on RS-485 bus should have unique address. Meter Address on RS-485 bus should not conflict with each other, otherwise they will do malfunction when we try to read data from conflicting meter addresses.
6.Trinity meter supports Query No. 3 – Read Holding Register on MODBUS-RTU protocol.
7.Now, Observe address map in below mentioned table. You can notice that, there is specific address for different parameters and different MF (Multiplying Factor) for each parameter.
8.Trinity , all parameters are 4-Byte Unsigned Long (Unsigned 32-Bits).
9.In single Query, you can read maximum 32-Bytes from Trinity meter. As per address map, if you want to read all mentioned parameters in table, you need to build 4-Quaries(For 3000 to 3019, 3030 to 3049, 3060 to 3079 & 3090 to 3109). But, this thing also depends on Meter Type. Here, I have write this thing according to below address map.
10.Now, For Example, If you want to read single parameter KVA (address 3000) from meter as per address map table, then your query in Hex Format will be
QUERY => 05030BB70002778D
Now, let see meaning of each bytes in above query.
i)1st Byte [05] shows Meter Address, which you have programmed as per your requirements.
ii) 2nd Byte [03] shows QUERY Type, which 03-Read Holding Register type query.
iii) 3rd & 4th Bytes [0BB7] shows starting address in meter address map from which you want to read data. Here, 0x0BB7 in hex shows that 2999 in decimal, But actual address of KVA is 3000. Now, according to MODBUS Protocol, most of MODBUS RTU supporting software decrement parameter address by 1 and then send query to meter. So, for that here build query is showing 2999 = 3000 – 1. If your device is not doing decrement by 1 then you need to do it by your self before build query. Now, suppose if we want to read data for KVAh then these 3rd & 4th Bytes will be 0BD7.
iv)5th & 6th Bytes [0002] shows number of bytes need to read from meter. Here, we want to read only KVA (single parameter) so that here it is 0002. Now, if we want to read 2 parameters then these 5th & 6th Bytes will be 0004 (0002 * 2). Same we if we want to read 3 parameters in one query then 5th and 6th Bytes will be 0006 (0002 * 3).
v)7th & 8th Bytes [778D] shows CRC for MODBUS RTU query. To, calculate CRC for build query, you need consider string from 1st Byte to 6th Byte.
11.When Trinity meter will receive these 8-Bytes, it will 1st compare received meter address with programmed meter address, if it is not matching then it will ignore received query and it will not give response. So, only the meter which have same programmed meter address, only that meter will give response to received query. But, before giving response meter will compare received CRC with calculated CRC, if it is matching then and then meter will give response to received query otherwise meter will not give response to received query even though meter address is matching.
12.When, query/response is going on through RS-485 medium, at that time, it may possible that because of external noise, data value change so that calculated CRC will not match with received CRC bytes at receiving end. So, external noise can affect communication.
13.After receiving query, meter will process it, So, meter will take few milliseconds before giving response. So, you need to configure RESPONSE TIME inside your device. This response time will differ from meter type to type. Suppose, PowerPro takes 10 milliseconds to give response after receiving query, then this will not same for GOBLIN or PowerCube or Saturn. But, this response time will same for same type of meters. So, you need to consider this parameter also while communicating with Trinity meters.
14.Now, Response to above query will be look like
RESPONSE => 05030400000059778D
Now, let see, what above response shows,…..
i) 1st Byte [05] shows Meter Address, which you have programmed as per your requirements.
ii) 2nd Byte [03] shows QUERY Type, which 03-Read Holding Register type query.
iii) 3rd Byte [04] shows total number of data bytes inside response. In query we were given 0002 so in response we got 04 (0002 * 2). If, in query we were given 0004 then in response we will get 08 (0004 * 2). So, this byte is multiply by 2 in 3rd & 4th data bytes of received query.
iv)4th, 5th, 6th & 7th Bytes [00000059] shows data for KVA. This value is shown in Hexadecimal format, so in decimal format it will 89. Now, according to address map, there is MF = 100 for KVA. So, actual value of KVA = 89 / 100 = 0.89. Now, according to address map shown in table, in address 3000 there is 0000 byte data and in address 3001 there is 0059 data. Now, suppose if KVA = 673.97 then these 4th, 5th, 6th & 7th Bytes will be 00010745 (in hexadecimal format). In, this case according to address map, in address 3000 there is 0001 byte data and in address 3001 there is 0745 data. So, here you can see received data bytes order (MSB & LSB).
v)8th & 9th Bytes [778D] shows CRC for MODBUS RTU response. Here, in this example it is showing dummy CRC. As, number of data bytes increase, CRC bytes position will also change, but it will always at last 2 bytes.
For any Query you can respond here in comments. Subscribe to Automation-Talk by Email for more MODBUS Tutorials.
Advertisements :-
Nice blog... Thanks for sharing details on how to read data through trinity meters using MODBUS. I found best information on Modbus protocol.
ReplyDelete