3 Easy Steps to Add a VFD to your TIA PLC ApplicationSep 26, 2023
UPDATE - YouTube video tutorial available! Simply click the play button above to watch it.
If you're a PLC programmer or field technician, programming production lines or troubleshooting automation processes, then you're most likely familiar with VFDs or Variable Frequency Drives.
Variable frequency drives provide precise control of motor speed and torque, resulting in a better control of processes and equipment. They allow motors to run at a specific speed, which makes them extremely suitable for applications like conveyor systems, pumps, or fans. I work mainly with production lines in the food and beverage industry, and in these environments, VFDs are being used all over the place.
Now Siemens TIA Portal features a complete range of VFDs that you can integrate in your PLC applications. As an example, I will share with you today 3 simple steps, 3 things you need to do to integrate a versatile, low voltage SINAMICS G120C frequency converter into your TIA PLC application. Sounds good? Then let's go!
Here's what we'll cover today:
- How to add a VFD from the hardware catalog to your network
- How to set up which data to communicate between PLC and VFD by selecting a communication telegram for the drive
- How to create structured VFD inputs and outputs using user-defined data types
Adding a variable frequency drive to your TIA PLC program is relatively easy if you follow these steps, so stick with me till the end and you'll be integrating your own VFDs in no-time!
STEP 1 - ADD THE VFD TO YOUR HARDWARE CONFIGURATION
Frequency converters are hardware devices - actual tangible pieces of control equipment that you will need to build in your electrical cabinet and connect via ethernet cables to your Profinet network. In TIA Portal, ANY device you want to control directly via the Profinet network, needs to be added and configured in the hardware configuration first, so that is where we start our journey.
Have a look at the screenshot below. Here we are in the hardware configuration of the PLC device, and we are on the 'Network view' tab - giving us a clean overview of all devices currently connected to the Profinet.
Easy start - Drag-and-drop the frequency drive from the catalog to the network.
The easiest way to add a G120C to this network, is to search for it in the Catalog first (1). So we simply type in 'g120c' in the search field, and the next available result takes us to the 'SINAMICS G120C' sub-folder (= nested underneath the 'SINAMICS drives' folder).
Since we are using Profinet, we expand the 'PN' folder, and we are welcomed by a long list of G120C drives - neatly ordered by power rating (e.g. 0.55kW, 0.75kW, 1.1kW) and filter type (FA = filtered = EMC filter build in; UF = unfiltered = EMC filter not build in). In this example I have selected a 1.5kW drive with EMC filter (2) and by dragging and dropping it over to the 'Network view' (3), the VFD is automatically appointed to the Profinet network. This is indicated by the green line connecting the VFD device to the rest of the network.
When you add a new device - like a VFD - to a network, the device is initially unassigned. This means that there is no IO controller configured to communicate with the device. What we need to do before moving on to the next step, is to assign the device to our PLC device (4). We do this by first right-clicking on the device in the 'Network view' and selecting 'Assign to new DP master / IO controller' followed by selecting the PLC device. In my example above, I have added 2 G120C frequency converters and I have assigned them both to the 'PLC_Refill_Premium' PLC device.
Assigning an IO controller to an unassigned Profinet node.
Now that our VFDs have been added to the network, let's go and set up which data we are going to communicate between the PLC and VFD.
STEP 2 - SET UP WHICH DATA TO COMMUNICATE BETWEEN PLC AND VFD
The whole idea of having a frequency drive on Profinet - or any network for that matter - is to be able to control the VFD directly via signal interchange with the PLC. No need for wiring, everything is setup directly in the software and the only thing we need to program in our application are bits and bytes (sort of speak).
But which data are we communicating between the VFD and the PLC, and how is this configured? Happy you asked. The way TIA Portal allows you to communicate between your PLC application and the actual VFD unit is through TELEGRAMS. If you've happened to read an earlier blog article of mine about motion in TIA Portal, a lightbulb might have just gone up for you. That's correct, servo drives in TIA Portal use telegrams as well for communication.
A telegram basically uses a defined number of words to communicate between the PLC and the VFD.
- E.g. 'Standard telegram 1' uses 2 words in the send direction (VFD->PLC) and 2 words in the receive direction (PLC->VFD)
- E.g. 'Standard telegram 20' uses 6 words in the send direction (VFD->PLC) and 2 words in the receive direction (PLC->VFD)
- E.g. 'Siemens telegram 354' uses 10 words in the send direction (VFD->PLC) and 10 words in the receive direction (PLC->VFD)
In the example below, I have selected 'Standard telegram 1' for the communication.
Setting up the telegram communication between PLC and VFD.
So we have selected 2 words in send direction, and 2 words in receive direction. In other words (no pun intended) - 2 words for status from the VFD to the PLC, and 2 words for commands from the PLC to the VFD.
"That's all very intriguing Hans, but WHICH data are we communicating in these 2 command and status words?"
Ok... we'll get there in just a sec. Let's just start first by pressing the green link arrow for either the send or receive direction.
Open up the communications tab by pressing the green link arrows.
If we press for example on the green link arrow for the Receive direction, it opens up the receive communication tab for that VFD device (see screenshot below). This window displays all the data that the VFD will RECEIVE from the PLC, in other words the PLC command signals.
Standard telegram 1 structure for commands from PLC to VFD.
At the top of this communication tab, you can again select the communication telegram (1) which is set here to standard telegram 1 since we already configured it before. Below the telegram selection is the PROFIsafe telegram information - this we'll leave for now because it only applies if you use Profisafe communication. I might dive into that in a future blog post. What is more interesting for us, is the PROFIdrive telegram configuration (2).
Here, under PZD (= German abbreviation for 'process data'), you can see which information is received by the VFD drive. PZD 1 (= word 1) is connected to the control word STW1 (= German abbreviation for 'control word 1'). By clicking on the STW1 button, a pop-up window appears (3), showing the exact bit configuration of the STW1 control word. In short, the PLC application will write to these command bits (you will need to program that in your logic), to enable the different functions of the frequency drive (e.g. running the drive or resetting faults on the drive).
PZD 2 (= word 2) is connected to NSOLL_A, which is a German abbreviation for the main speed setpoint. I have to tell you, I am not sure why Siemens decided to keep all those German abbreviations in the English version of TIA Portal. I mean, I do speak German (not natively) but I am a strong believer of being consistent with a given language. Note to Siemens - please correct this in a future TIA Portal update.
Back to business. So now that we've had a look at the configured data for the receive direction, let's have a look at the data for the SEND direction (=transmit direction) - displayed here in the screenshot below.
Standard telegram 1 structure for status from VFD to PLC.
Similar to the receive direction, we can select the communication telegram here (1).
NOTE - The telegram for the send and receive directions are always the same = it is not possible to configure e.g. 'Standard telegram 1' for the send telegram and 'Siemens telegram 350' for the receive telegram.
In the Profidrive area (2), the communication words for the send direction are displayed. The first configured word for communication from VFD to the PLC is the ZSW1 status word (=German abbreviation for 'status word 1') and by opening it up, you get a list of all status bits (3) contained in this word.
The second word transmitted to the PLC is called NIST_A (yes, another German abbreviation), which stands for the actual speed of the drive.
So now we got a clear overview of which data is being communicated between the PLC and the VFD with 'Standard telegram 1':
- COMMANDS from the PLC to the VFD (receive direction from VFD point of view)
= 1 word for control bits + 1 word for setpoint speed
- STATUS from the VFD to the PLC (send direction from VFD point of view)
= 1 word for status bits + 1 word for actual speed
An important distinction here is that the example above only applies to data communication for 'Standard telegram 1'. If you would have selected a different telegram, the data communicated over Profinet would be different. As an example, here is screenshot showcasing the receive/send data for 'Siemens telegram 352', which consists of 6 words in each direction.
Data configuration for Receive/Transmit direction of 'Siemens telegram 352'.
Alright, now that you know how to set up WHICH data to communicate between VFD and PLC, let's go and have a look at how we can pour all that data into an awesome data-structure that we can then use in our PLC application.
STEP 3 - CREATE STRUCTURED VFD INPUTS AND OUTPUTS USING UDTs
If you've been following my posts here or on LinkedIn, OR you've been watching some of my YouTube tutorials, OR (even better) you have checked out my popular online PLC training courses here on plcskilltree.com - then you know that I put a lot of importance on creating STRUCTURED PLC applications. Striving to become a structured and organized PLC programmer is the best education you can gift to yourself and it will open up a lot of career opportunities, believe me.
This brings us to the final step in this post about adding a VFD to a TIA PLC application - data structuring.
So far we have added a VFD to our Profinet network in the hardware configuration, and we have specified which data we want to communicate between our PLC and the VFD using a telegram. Now we are going to structure that telegram data into user-defined data types. Have a look at the screenshot below.
Example of UDTs for status and command of 'Standard telegram 1'.
In this example, I have created two new user-defined data types (2) under the PLC data types folder (1) for the communication between PLC and VFD (3):
- UDT_VFD_Cmd: PLC commands to the VFD
- UDT_VFD_Sts: VFD status to the PLC
If you head back to step 2 and take a look at the data words configured for the receive/send direction for 'Standard telegram 1', you will notice that I have taken over the same data structure in my user-defined types.
PLC command data structure (= VFD receive direction).
PLC status data structure (= VFD send/transmit direction).
IMPORTANT NOTE - Due to Siemens byte swapping, the first byte of the ControlWord and StatusWord structures needs to be swapped with the second byte. In praxis, this means swapping bits x8-x15 with bits x0-x7.
Now the only thing left to do, is to create Inputs and Outputs for the VFD using these UDTs.
In the screenshot below, I have created a new tag table called 'VFD Equipment' (2) under the PLC tags group (1).
Declaring input and output structures using UDTs.
In the above tag table I have defined an input structure (3) for our VFD pump which I declared using the user-defined data type 'UDT_VFD_Sts', and an output structure (4) declared as data type 'UDT_VFD_Cmd'. If you look closer, you can see that I have pointed to input address %I500.0 for the input structure and output address %Q500.0 for the output structure - these are off course the same addresses which we defined in our hardware configuration in step 1.
Creating VFD inputs and outputs using the configured hardware addresses.
Create structured input and output tags for data communication between PLC and VFD -> DONE!
What to do next?
So is this the end? Is our PLC application ready for controlling a Siemens VFD?
Off course not! We still need to write the VFD logic. And since you and I are structured PLC programmers, we are going to do this right by encapsulating all VFD logic into a beautifully constructed function block that we can call in our program wherever we need a VFD control.
Now, if you'd like a helping hand creating such VFD logic for your own PLC applications, then I got exciting news for you. In a week or 2, I will release a fresh new update (V1.2) for the Premium Edition of my popular 'TIA Portal - All Basics Pack' training bundle, and in this updated version you'll get a complete step-by-step guide on how to add a VFD to your own TIA PLC and HMI applications. It will include everything explained in this post in much more detail, AND it will feature a fully functional TIA sample project containing the actual VFD control block (function block). If this is something you're looking for, make sure you sign up to my mailing list below (by signing up for the free guide) so you won't miss out on any important updates.
That brings us to the end of this article.
If you can't get enough of frequency converters, go and check out the following link for more information about SINAMICS low voltage frequency converters: SINAMICS Low Voltage Converters - 2020 (siemens.com)
And for more information about how to install, commission or configure a SINAMICS G120C, check out this Siemens link: SINAMICS G120C - SINAMICS Standard Performance Frequency Converter - Global (siemens.com)
I hope you enjoyed the read and that you'll feel more confident next time you'll have to integrate a Siemens VFD into your own TIA Portal PLC application.
Grab my '5 Simple Steps to Drastically Improve your PLC Program Structure in TIA Portal' and start building better PLC applications TODAY.
Where should I send you the guide?
When you signup, we'll be sending you further emails with additional free content. You can unsubscribe at any time by clicking the link in the footer of our emails. For information about our privacy practices, please visit our website.