# Modbus TCP Reading Energy Meter thru OPC-UA

**URL:** <https://forum.inductiveautomation.com/t/modbus-tcp-reading-energy-meter-thru-opc-ua/3981>\
**Category:** General Discussion\
**Created:** [February 11, 2012, 7:20am UTC](https://forum.inductiveautomation.com/t/modbus-tcp-reading-energy-meter-thru-opc-ua/3981 "2012-02-11T07:20:23Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![M.Pathma](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@M.Pathma](https://forum.inductiveautomation.com/u/M.Pathma)\
**Post date:** [February 11, 2012, 7:20am UTC](https://forum.inductiveautomation.com/t/modbus-tcp-reading-energy-meter-thru-opc-ua/3981/1 "2012-02-11T07:20:23Z")

</div>

Hi, guys,

It has been some time I used Ignition, so bare with me for ‘basic question’.

I am try to connect Ignition to Carlo Gavazzi Energy Meter via OPC-UA (Modbus TCP).

I manage to setup the device and get “Connected” in current status and also able to get the [Diagnosetic] information within OPC Browser.

My major problem reading the voltage, current and power details from the meter, the Modbus Manual is attached. The reading I need to have as SQLTag are between Modicom  
address 300081 till 300219. (page.12 to page.13)

My problem is in the Addressing, I have read few time the Addressing section in manual and also tried few expriment, none give the correct reading, either the Connection get lost after I add to SQLTag, reading is abnormal or nothing happens.

Can someone please guide me on how to setup the addressing for this particular meter.

Thanks in advance  
M.Pathma  
[Communicaiton Protocol - V2.4.1.pdf](https://us1.discourse-cdn.com/inductiveautomation/original/1X/2f6c03c8945ca60c7a41d8aadb3bae25a4cfb5d2.pdf) (758 KB)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 11, 2012, 5:05pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-reading-energy-meter-thru-opc-ua/3981/2 "2012-02-11T17:05:59Z")

</div>

I’ve attached a modbus address config CSV file as well as a screenshot that might get you started. You can import it at the top of the “Address Configuration” page after clicking the Addresses link for that device.

After this if the values are coming in odd looking you made need to toggle the “Zero-based Addressing” advanced setting for this device.

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/1X/ecf6d2d7f409c60266f26d69953960c3002b2156.png)  

[modbus-config.csv](https://us1.discourse-cdn.com/inductiveautomation/original/1X/084abe5d8a2a2c639fc23d1c8e726b88cc528dbc.csv) (48 Bytes)

---

<div class="post-metadata">

**Author:** ![M.Pathma](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@M.Pathma](https://forum.inductiveautomation.com/u/M.Pathma)\
**Post date:** [February 14, 2012, 1:07pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-reading-energy-meter-thru-opc-ua/3981/3 "2012-02-14T13:07:04Z")

</div>

Hi, Kevin,

Your configuration worked fine, I did not need to change the “Zero-based Addressing”.

Obovisouly my mistake was not ticking the STEP check box to read address 81 and the 83

Thanks.

M.Pathma

---

<div class="post-metadata">

**Author:** ![M.Pathma](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@M.Pathma](https://forum.inductiveautomation.com/u/M.Pathma)\
**Post date:** [February 14, 2012, 1:51pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-reading-energy-meter-thru-opc-ua/3981/4 "2012-02-14T13:51:25Z")

</div>

Hi, Kevin,

Can you advice me for “UINT64” (4-word), which I need use at the Modbus Type.

Thanks  
M.Pathma

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 14, 2012, 3:14pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-reading-energy-meter-thru-opc-ua/3981/5 "2012-02-14T15:14:52Z")

</div>

[quote=“M.Pathma”]Hi, Kevin,

Can you advice me for “UINT64” (4-word), which I need use at the Modbus Type.

Thanks  
M.Pathma[/quote]

Unfortunately the driver doesn’t support Int64 or UInt64 data types right now. I’ll add this as a feature request but I can’t promise anything about how soon it will get implemented.

---

<div class="post-metadata">

**Author:** ![M.Pathma](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@M.Pathma](https://forum.inductiveautomation.com/u/M.Pathma)\
**Post date:** [February 15, 2012, 8:50am UTC](https://forum.inductiveautomation.com/t/modbus-tcp-reading-energy-meter-thru-opc-ua/3981/6 "2012-02-15T08:50:20Z")

</div>

Hi,

This is bad new for me and for my project

Is there any work-around for this, as this is one of the most important parameter I need to poll from the Energy Meter for my project, this is where the KWh is stored and that is my most important need.

M.Pathma

---

<div class="post-metadata">

**Author:** ![M.Pathma](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@M.Pathma](https://forum.inductiveautomation.com/u/M.Pathma)\
**Post date:** [February 17, 2012, 8:40am UTC](https://forum.inductiveautomation.com/t/modbus-tcp-reading-energy-meter-thru-opc-ua/3981/7 "2012-02-17T08:40:37Z")

</div>

Hi, Kevin Herron

Any lead for me.

M.Pathma

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 17, 2012, 4:49pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-reading-energy-meter-thru-opc-ua/3981/8 "2012-02-17T16:49:43Z")

</div>

Pull in the 4 16-bit registers that will make up the 64-bit value as separate tags. Create a DB tag that gets its value from an expression that ORs and shifts the 4 words together.

For 4 tags named HR1 through HR4, the expression might look like this:

```auto
({[~]HR1} << 48) | ({[~]HR2} << 32) | ({[~]HR3} << 16) | {[~]HR4}
```

I’m also going to try to work 64-bit support into the Modbus driver for the next release so this work-around isn’t necessary.

---

<div class="post-metadata">

**Author:** ![M.Pathma](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@M.Pathma](https://forum.inductiveautomation.com/u/M.Pathma)\
**Post date:** [February 19, 2012, 9:07am UTC](https://forum.inductiveautomation.com/t/modbus-tcp-reading-energy-meter-thru-opc-ua/3981/9 "2012-02-19T09:07:59Z")

</div>

Hi, Kevin,

Will try to do the proposed idea as I need to show to our customer current development.

Not to being pushing, any idea when you should be able to have the UINT64 within the OPC-UA.

Defiantly will make Ignition OPC-UA powerful.

M.Pathma

---

<div class="post-metadata">

**Author:** ![M.Pathma](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@M.Pathma](https://forum.inductiveautomation.com/u/M.Pathma)\
**Post date:** [February 20, 2012, 1:17pm UTC](https://forum.inductiveautomation.com/t/modbus-tcp-reading-energy-meter-thru-opc-ua/3981/10 "2012-02-20T13:17:56Z")

</div>

> [@Kevin.Herron](#):
>
> ```auto
> ({[~]HR1} << 48) | ({[~]HR2} << 32) | ({[~]HR3} << 16) | {[~]HR4}
> ```

Hi,

This idea works, for now I am putting the result into Float8, I think this should do the trick until next release of OPC-UA with UINT64

Thanks for the support

M.Pathma
