Download as pdf or txt
Download as pdf or txt
You are on page 1of 35

Allen Bradley PLC programming course Enroll Today!

For Job LOG GET


Courses Pricing Resources  Community 
Business Boards IN STARTE

Contents Back to tutorials Related Tutorials

Prerequisites Beginner
Understanding
Programming a PLC
Programming |
SEW VFD using
the
Configuration How to Read
Ladder Logic
of a SEW
Movitrac Read Tutorial
28
Shares
Creating a
new project in Modbus TCP in Intermediate

Unity Pro

Step 3 -
Unity Pro Allen-Bradley
PointIO Safety
Modules
Configuring Wiring and
By Redouane Ait Ali Yahia
Programming
the Modbus
Tutorial
TCP Network
in Unity Pro Read Tutorial
Introduction
Programming
in ST in Unity In modern industrial environments, the most
Pro common way to remotely control VFDs
(Variable Frequency Drives or Inverters) is by
Conclusion
using a Fieldbus communication with a PLC.
This offers a higher level of control as it
Share This Tutorial enables access to the VFD’s parameters and
data, allowing us to precisely adjust the
28
Shares
motor’s behavior in our PLC programs and to
Advanced
monitor the status of the drive.
PowerFlex 525
SEW-EURODRIVE is one of the main players VFD Setup -
among the VFD manufacturers. They offer a Programming
user-friendly and accessible configuration
Parameters
Wiring
environment, making it one of the easiest to
Diagram
use when it comes to establishing Fieldbus RSLogix Studio
communication with PLCs from various 5000 EtherNet
manufacturers such as Siemens, AB, IP Address
Omron..etc.
Start Stop
Read Tutorial
In this tutorial, we will learn how to exchange
process data (Setpoint Speed, Ramp, Actual
Speed, and Output Current) between any
SEW Movitrac B inverter equipped with a
DFE33B Modbus TCP interface and a
Schneider Electric Modicon M340 PLC using
28
Shares
Unity Pro. The goal is to demonstrate the
general way to set a VFD/PLC Fieldbus
communication.

Prerequisites
To follow along with this tutorial, you will
need 

An Installation of SE’s Unity Pro. Click


here

Basic knowledge of the ST language 

Basic knowledge of VFDs parameters


and configuring.

Basic knowledge of Modbus TCP.

28
Shares
No PLC or VFD hardware is required for this
tutorial. 

Understanding the
Configuration of a
SEW Movitrac
The Movitrac B series comes as a compact
device with a modular Fieldbus interface
card equipped with RJ45 ports (Figure 1.1).
For this tutorial, we are considering any
Movitrac B model equipped with a DFE33B
Modbus TCP interface directly wired to the
PLC via an RJ45 cable.

NB: The instructions shown in this tutorial


28
Shares
apply to any SEW VFD model.
28
Shares
28
Shares
Figure 1.1 : SEW VFD model MC07B0022-5A3-4-
S0/DFE32B/FSC11B.

In the SEW configuration environment,


parameters are addressed as follows.

Figure 1.2: Breaking down of the SEW parameter


address.

For example, to define the inverter’s


maximum speed (P 302), you need to enter
the main group 3 (Motor Parameters),
Subgroup 0 (Limits 1),  Desired subgroup 2
(Maximum speed) and set an integer value
28
Shares
(from 0 to 5500 rpm). 

The default settings of the inverter allow you


to do quick setups and tests, but to
exchange data via Fieldbus, we need to
modify some parameters. You can access
the inverter’s parameters by using a DBG60B
keypad or by using the SEW software
Movitools.

In this example, we want to retrieve the


actual speed (rpm) and the output current
(%In, In being the rated current of the chosen
VFD model) from the inverter and send the
setpoint speed (rpm) and the ramp time
(ms). In the SEW environment, these kinds of
data inputs are called process data, and their
parameters are located at P 87x (Process
data parameter settings). 
28
Shares
On a typical Movitrac B inverter, process data
are sets of 3 integers (16-bit words) that can
either be read (PI) or written (PO). In our
case, that means that we have two 16-bit
words to read (PI1 and PI2) and write (PO1
and PO2).

We will not learn how to set parameters


during this tutorial, but we are assuming that
the target inverter has the following
parameters set as follows

P 100 (Setpoint source) value : 8


(MASTER Sbus).

P 870 (Setpoint description PO1) value : 1


(Setpoint speed).

28
Shares
P 871 (Setpoint description PO2)  value :
8 (Ramp time).

P 873 (Setpoint description PI1)  value : 1


(Actual speed).

P 874 (Setpoint description PI2)  value : 2


(Output current).

All other parameters are kept at their default


value including the IP address of the inverter
{192.168.10.4/255.255.255.0}.

You can refer to the Movitrac B manual for


more details  

Movitrac B System manual

28
Shares
DFE33B Ethernet/IP And Modbus TCP
Fieldbusinterface manual

Creating a new
project in Unity Pro
Now that we have prepared the inverter, it is
time to do some programming in Unity Pro.
Let’s start by launching Unity Pro and
creating a new project by clicking on File ->
New.

28
Shares
Figure 2.1: Creating a new
project in Unity Pro.

A project creation window opens asking you


to choose a CPU and a rack. Since we are
working with Modbus TCP, we select the
BMX P34 2020 CPU which inherently
supports Modbus TCP to avoid adding a
communication module. Besides, you are
free to choose the rack you want. In this
case, we will select a 4 slot rack. Once your
selections are done, click on OK.

28
Shares
Figure 2.2: CPU and rack selection.

When your project is created, save your


project to fully create your project file. Click
28
Shares
on the save icon, select a save folder (we
kept the default one), and click on OK.
Remember to save your project after each
step! 

Figure 2.3: Saving the project.

Step 3 - Configuring
the Modbus TCP
28
Network in Unity Pro
Shares
On the left side of your screen, you can find
the project browser (See Figure 3.1 below)
that shows the different components of your
project such as the hardware configuration,
networks, variables, tasks..etc. 

To establish a Modbus TCP communication,


we have to create a network in our project.
To do this, open the “Communication” folder,
right-click on the “Networks'' folder and
select “New Network”.

28
Shares
Figure 3.1: Creating a new network in Unity Pro.

The “Add Network” window opens, select


28
Shares “Ethernet” as network, and type
“sew_modbus” in the network name section.
Once done, click on OK.

Figure 3.2:  Add network window.

The network is created and you can see it


appearing in the project browser under the
28
Shares “Networks” folder. Double click on it to edit
its properties and select the “CPU 2020, CPU
2030 (>= V02.00), PRA 0100” model family.

Figure 3.3: Network properties in Unity Pro.

Upon selecting the model family, a warning


window will appear asking you to confirm
the network family change. This is a normal
warning, simply click on yes and wait for the
operation to be completed.
28
Shares
Figure 3.4: Network family change warning.

Once the network family is changed, click on


the “IP configuration” tab. This is where you
can define the IP address and sub-mask of
your network. Since the default IP address of
the inverter is {192.168.10.4/255.255.255.0},
we need to set an IP address located on the
same network. In my case, I chose the
address {192.168.10.2/255.255.255.0}. Keep
the gateway address untouched.

28
Shares
Figure 3.5: IP Configuration of a network in Unity Pro.

The last thing we have to do is to tell the


CPU that we will use its RJ45 Modbus port
for our network. To do so, open the
“Configuration” folder and all its subsequent
folders. Double-click the “Ethernet” port of
your CPU to open its configuration.
28
Shares
Set the Function as “ETH TCP IP” and select
“sew_modbus” in Net Link.

Figure 3.6: Ethernet port configuration in Unity Pro.

Programming in ST in
Unity Pro
To read or write process data, we have to
create a MAST task in our project that will
28
Shares
contain our ST code.

Open the “Program” folder in the Project


Browser followed by the “Tasks” folder.
Right-click on the “MAST” folder and select 
“New Section”.

28
Shares
Figure 4.1: Creating a new section in Unity Pro.

28
Shares
A task creation window opens. Type “Main”
in the name section and select the ST
language. Then click on OK.

Figure 4.2: New section window.

Now we have a task window where we can


start building our code. In this program, we
will be using the FFB functions “READ_VAR”
28
Shares
and “WRITE_VAR” to read or write
consequent data from the network we
created. 

To add a function, right-click in the “Main”


window add select “FFB Input Assistant”.

Figure 4.3: Opening the FFB Input Assistant in Unity


Pro.

In the FFB Input search bar, type


28
Shares
“READ_VAR”. Then, click on OK.
Figure 4.4: FFB Input Assistant in Unity Pro.

In the prototype section (Figure 4.4), you


may notice that all the READ_VAR function
parameters data types are displayed and
explained. This will be helpful during the
creation of the variables.

28
Shares
Figure 4.5: READ_VAR function in Unity Pro.

As you can see, the function’s parameters


are left empty with a comment telling the
data type of each parameter.

Use the FFB Input Assistant again, this time


to add the WRITE_VAR function.

28
Shares
Figure 4.6: READ_VAR and WRITE_VAR functions in
Unity Pro.

We need one last more FFB function, the


ADDM function which converts a set
character string into a topologic address that
the READ_VAR and WRITE_VAR functions
can take as an input in the “ADR” parameter.

Use the FFB Input Assistant to add the


28
Shares ADDM function. Be sure to add it before the
other functions. We need it to be executed
before them.

Figure 4.7: READ_VAR, WRITE_VAR, and ADDM


functions in Unity Pro.

You can fill in the function parameters right


away with the proper values but for more
clarity in our program, we will create some
variables.
28
Shares
Open the “Data Editor” by double-clicking in
the “Elementary variables” section of the
“Variables”  folder of the Project Browser.

Figure 4.8: Data Editor in Unity Pro.

Create the following variables by defining a


name and a type for each variable like shown
in Figure 4.9.

28
Shares
Figure 4.9: All variables we need.

Then add the variables to the code like


shown in Figure 4.10.

Figure 4.10: Using the variables we created in the FFB


functions.

28
Shares
According to the SEW documentation, speed
and current values in the inverter are scaled. 

For speed values, 1 digit equals 0.2 rpm. 

For current values, 1 digit equals 0.1 %In.

For the last step, we have to make the values


we are reading or writing practical to use in
the program by assigning them to more
explicit variables and adding the proper
divisions to respect the scales as explained
in the comments of Figure 4.11.

NB: To use the READ_VAR and WRITE_VAR


functions, you also need to initialize the 3rd
word of their GEST parameter to a non-null
28
Shares value in milliseconds. This parameter
defines the function’s timeout. I usually set it
at 100ms but feel free to use the value you
need for your future programs. 

Figure 4.11: Adding the assignments Initializations.

Conclusion
In this tutorial, you learned how to easily
interact with a SEW VFD using Unity Pro and
Modbus TCP. 

28
Shares
As an automation engineer, having to
establish different Fieldbus communications
between the different devices of your project
is a key skill to acquire. VFDs are the best
example to demonstrate how they can be
done since they are one of the most
common parts of an industrial machine.

SEW VFDs offer almost ready-to-use


systems with a user-friendly and intuitive
configuration environment. Making it easy to
work with. Especially when working with a
Fieldbus inherently supported by the PLC
environment as it is for Modbus TCP in
Schneider’s electric PLCs and software.

28
Shares
Back to tutorials

You might also like