00:03
In this video we're going to go over the steps required to communicate with a
00:08
Modbus TCP device using PAC control. I'm going to be using this groov EPIC
00:14
Learning Center, it's perfect for learning more about groov EPIC or doing
00:18
a proof-of-concept project. I'm also going to be using this SATEC P 130
00:22
power meter. There's my Modbus TCP device it's measuring the voltage of the mains
00:27
power here in the studio. And, our goal is to display that voltage in engineering
00:32
units In PAC Control. To get started you'll need the IP address and device ID
00:37
of your Modbus device. And the hostname of your EPIC processor. You'll need the
00:43
Modbus device registers and this is usually found in a manual or
00:46
supplementary manual for the device. You'll also need both devices on the
00:51
same network and lastly you'll need to have downloaded and installed PAC
00:56
Control on your Windows computer. For more information and tutorials on PAC
01:01
Control check out our other videos and tutorials on training.opto22.com
01:07
to download the Modbus code visit opto22.com and search for Modbus
01:14
integration kit. Click on the link and download the zip file to your
01:20
computer. Unzip it to a memorable location and we're ready to start. Since
01:27
we're going to be talking to this SATEC power meter we want the EPIC
01:30
Controller to be the master device since the meter is a Modbus slave device. So
01:36
we'll need to choose the master strategy.
01:40
If you need your Opto to be a slave choose the other strategy file
01:48
Open the strategy and configure your control engine.
01:56
The first thing we need to do is check the configuration options in the general
02:00
setup block. Here is where we set the IP address of
02:04
our Modbus TCP slave device. I know that the SATEC meter's IP address is 10.19
02:12
2.57.19 Now it's Modbus port is the default port of 502. Check
02:21
your device for its IP address and what port it's listening on. Next we know from
02:26
the power meter device manual that we're looking for a 16-bit integer to read the
02:31
voltage. So that's going to be typed for an integer input register.
02:38
We can check the configuration here at first and make sure it all looks good. As
02:43
you can see there are lots of comments in the code to help you adjust settings
02:47
as needed. If we scroll down we can see the few parameters that we need to check
02:52
in this block. We have selected Modbus TCP protocol, device ID of 1, which
02:59
matches this SATEC meter, and the default of one second timeout looks fine as does
03:05
the word order for our registers. Now if we need to set up the register address
03:11
to read the voltage we need to do this in the matching type function for into
03:16
opto script block. Let's double click on it to open it up. Two main things we need
03:21
to set here are our address for phase 1 volts which we got from the SATEC
03:25
Modbus manual. It's 256 with a base 1 offset so we need to enter 257. And how
03:32
many registers we want to read from that address. Just the one in my case. We can
03:37
now download the strategy.
03:43
And to call this type for subroutine we need to set this variable true. Now we
03:48
can inspect our return value by right-clicking on the table name and
03:52
select inspect. And there is our Raw int 32 voltage. Since we want to see this in
03:59
engineering units we need to apply the conversion formula from the SATEC
04:02
manual. Go back to configure mode so that we can add the required code.
04:09
Let's create a new float variable say F volts. And now we're just going to use a
04:14
little Opto script to do the work for us.
04:17
If vaults equals
04:23
our input register index 0 / 9999 multiplied by our maximum
04:34
volts of 144. Let's download by going to debug mode
04:39
and see our Volts in engineering units.
04:45
Right click on the enable variable to run the subroutine first. Now we can
04:53
right click on our float variable and there our volts in engineering units. So
04:58
there you have it - using the PAC control Modbus master
05:01
toolkit to read a register from this SATEC power meter you can import the strategy
05:07
subroutines into your strategy and run them from there or you can flesh out
05:11
this strategy to do your required process. For more information on PAC
05:16
Control check out training.opto22.com Till next time
05:20
cheers mate