Jump to content

Recommended Posts

Posted

Hello!

 

I am trying to do first serial communication VFD control with PLC. (NX1p2)

I read and learned that CiA402 is "standard" for ethercat control, is there any reason to use something else, or is CiA402 way to go? 

What Fb should i use for VFD control, or should i make my own? Is there any library for VFD control?

 

Thanks for help!

 

Posted

The CiA402 PDO objects in an EtherCAT node allow you to use the PLCOpen Motion Control Function Blocks in the PLC by creating a motion axis and assigning the PDOs to the axis. There are many MC Function Blocks and I doubt a VFD can support all of them. They primarily operate in velocity control mode so if the VFD supports this mode then you should be good for the basic motion instructions in the PLC.

Posted

Hello!

 

I have problem with state machine function. I Am using Danfoss VLT FC280 Drives. Commonication is ok, but i cant complite state machine to start control the drive.

here is picture from manual for state transition.

image.thumb.png.ad7808121b7a2818cf6dee624f975e47.png

 

Do i need to make start sequency by sending control word like picture above shows? 

 

Like this?

Step 0 = control word 0

Step 1 = Control word 1

Step 2 Control word 6

 

if yes what about step 7? 1 or 0? Do i need to complite all steps? 

 

Thanks for help

Posted

I have two answers for this question.

1) If you have the drive configured as an Axis, then MC_x instructions will handle all of the necessary state transitions automatically. What you show in your table are the 'nuts and bolts' of the cia402 state machine states.

2) If you truly wish to manually change states, Omron has an undocumented instruction of this. In the Toolbox, look for Motion Control > MC_ChangePDSState instruction. You'll have to play around with in and study the system defined structures. I'm not sure why there is no documentation but I haven't found much use for it either.

Posted
4 hours ago, IO_Rack said:

I have two answers for this question.

1) If you have the drive configured as an Axis, then MC_x instructions will handle all of the necessary state transitions automatically. What you show in your table are the 'nuts and bolts' of the cia402 state machine states.

2) If you truly wish to manually change states, Omron has an undocumented instruction of this. In the Toolbox, look for Motion Control > MC_ChangePDSState instruction. You'll have to play around with in and study the system defined structures. I'm not sure why there is no documentation but I haven't found much use for it either.

According to this topic it is not possible to add vfd as axis? Is this old news? I did got the vfd running like it should run, but i think there must be easyer way to do this. atleast Omron should have example program to handle VFD with ethercat (I did not find any). I did just write sequency to write word values as table above shows. After that everything was smooth sailing. 

 

Posted

You are correct. Sorry.

I have only used Omron VFD with NJ PLC. It also, cannot be configured as an Axis. Instead, Global Variables are assigned via the I/O Map.

I haven't used the Danfoss EtherCAT devices. Are you able to edit the PDO Map to make these entries available? 

I'm not sure what data is available for Danfoss. If there were any function blocks or examples, I would expect them from Danfoss. Not Omron. 

 

Posted
14 hours ago, VulpesLago said:

Do i need to make start sequency by sending control word like picture above shows? 

 

Like this?

Step 0 = control word 0

Step 1 = Control word 1

Step 2 Control word 6

 

if yes what about step 7? 1 or 0? Do i need to complite all steps? 

I believe the answer to this is yes. When I reviewed the program that we have, I found a custom Function Block with this type of sequencing, except if was for an Omron VFD. 

 

https://www.danfoss.com/en/service-and-support/downloads/dds/plc-libraries/#tab-overview

I see an EtherCAT library for Beckhoff only in this link. If you could possibly see the code they produced for this, then maybe you can reproduce it in Sysmac Studio. 

4 hours ago, VulpesLago said:

I did just write sequency to write word values as table above shows. After that everything was smooth sailing. 

In any case, it seems you already know how to do it, so make a custom Function Block with your necessary variables (Speed, Direction, etc...). Then you won't have to write it over and over again.

Posted
8 hours ago, IO_Rack said:

I believe the answer to this is yes. When I reviewed the program that we have, I found a custom Function Block with this type of sequencing, except if was for an Omron VFD. 

If understand correctly Ethercat "standard" control is same with all the brands, thats why i want to use it. We use Vacon, Mitsubishi, Danfoss And Abb drives, so i want to have "same" program to handle them all. Not sure is this the smartes way to do it, but they way i try to go. I think you custom fb is the one I "need".

I did sequency like this:image.thumb.png.96f9fbe317f16481d7a89186b03c1373.png

This was only for test to make it work. Now i need to program it to wait feedback messages from drive and not use timers. 

 

12 hours ago, IO_Rack said:

 

I'm not sure what data is available for Danfoss. If there were any function blocks or examples, I would expect them from Danfoss. Not Omron. 

 

I tought Ethercat VFD control is "common" way to control vfd's with sysmac studio. Thats why i tought there would be some "default" FB's and sample programs. 

 

Next to my list is to make Positioning with encoder which is connected to EC0122. I just made program to count crane speed, number of pulses/m and calculate how far away crane need to start stopping in any speed before targer position. Crane will jog last 10cm ( 4 inch) with 2hz speed and stop when targer position is achived. Not sure how accurate i can make it this way, but this is the best way i have found out. 

  • Like 1
Posted
5 hours ago, VulpesLago said:

Next to my list is to make Positioning with encoder which is connected to EC0122. I just made program to count crane speed, number of pulses/m and calculate how far away crane need to start stopping in any speed before targer position. Crane will jog last 10cm ( 4 inch) with 2hz speed and stop when targer position is achived. Not sure how accurate i can make it this way, but this is the best way i have found out. 

I recently used a similar module and created an encoder axis for measuring. 

As for the VFD axis, I would have to defer to the Omron professionals on this one. @photovoltaic has mentioned above this could be done. I attempted this briefly but was unsuccessful. 

Posted
On 1/25/2025 at 6:18 PM, VulpesLago said:

This was only for test to make it work

What level of functionality do you need? Is it just basic start/stop with speed control and fault feedbacks or is it more advanced?

On 1/25/2025 at 6:18 PM, VulpesLago said:

I tought Ethercat VFD control is "common" way to control vfd's with sysmac studio. Thats why i tought there would be some "default" FB's and sample programs.

Only if you use Omron VSD's I believe. I have used Danfoss drives with EtherCAT (specifically the FC-302's), and about to program 2 more projects with them in the next couple of months), and I did have to write my own function blocks for these. Fair warning, I have never done motion control, so your requirements might differ.

I found the easiest way was to create some custom functions and a function block. I have attached these below. Sorry they don't have a lot of commenting, I made these several years ago when I was quite new to programming, and haven't updated them since 🤥. Also note that there are likely some better, more efficient ways to do certain things that I have learned since creating these.

I used structures to keep most of the data together, as I had to have it displayed or editable on the HMI (was using IAG's). Note that these structures also incorporate data from other sensors, and some members were controlled by other parts of my program. If you see something and wonder "why does that exist", I am happy to answer any questions. 

Fault_Reset exists as a Global variable and is used internally in the function block, but this is quite easy to change if you wanted.

When it comes to the control word and status word side of things, they basically do the following:

Take the Danfoss Status word (which is UINT), and convert it to a 16bit WORD. Note that when I did this I used a union - fairly sure there is a better way to do this that I will be looking at in the coming weeks, but that's how I did it when I didn't know any better 🙂. This allows the individual bits in the word to be referenced. The function of each bit is defined in the Danfoss EtherCAT manual that you have (section 6.4.2).

Create another 16 bit WORD for the control word. Using the "SetABit" and "ResetABit" functions, you can control each bit in this word. And then use a "WORD_TO_UINT" conversion to create the UINT variable that is needed in the IO Map. The details on each of the control word bits are in section 6.4.1

Similar story with speed control. Note that my function block does have multipliers and the like, as I had operator controlled variable speed sliders on the HMI (which need integers), but they wanted .1% resolution, so the slider actually had a max value of 1000 instead of 100, and the value was converted to REAL and divided by 10. The speed reference is required in HEX, so the function block works like this:

Max forward speed (I didn't need reverse) is 4000HEX. Which equates to 16384 decimal. So all the math is done based on 16384, and then converted to HEX at the end. This variable is then put in the IO Map accordingly. Details on the speed reference are in section 6.2.3 of the Danfoss EtherCAT manual.

Hope that helps. Using the SetABit and ResetABit functions for the control word means you should be able to create something for the other brands reasonably easily once you get the first one worked out. And if their Status & Control words have the same functionality on each bit and use UINT's for the variables, then I can't see why the same function/function block wouldn't work for different brand VSD's.

Danfoss VSD Function Block.smc2

  • Like 1
Posted
On 1/27/2025 at 8:20 AM, BE said:

What level of functionality do you need? Is it just basic start/stop with speed control and fault feedbacks or is it more advanced?

Thanks for great answer!

Plan is to make Function block that contains atleast multi step and motor potentiometer control options (Most commonly used on EOT cranes.) I will also use fault feedback to ease fault finding (HMI on crane panel) and for IOT indications aswell. I will use your ideas inside my function block and will share it to you aswell when finished.  

Posted
On 1/27/2025 at 8:20 AM, BE said:

I found the easiest way was to create some custom functions and a function block. I have attached these below. Sorry they don't have a lot of commenting, I made these several years ago when I was quite new to programming, and haven't updated them since 🤥. Also note that there are likely some better, more efficient ways to do certain things that I have learned since creating these.

used a union - fairly sure there is a better way to do this that I will be looking at in the coming weeks, but that's how I did it when I didn't know any better 🙂. This allows the individual bits in the word to be referenced. The function of each bit is defined in the Danfoss EtherCAT manual that you have (section 6.4.2).

 

I am bit confused about your state machine function. Manual gives following pattern to state transition:

 image.png.28a6c34b40cc5cc66d4237921b7025ce.png

you just did resetbit 0,1, set bit 2-5 and "start" with bit 6. Seems wierd after manual example. Maybe I am just stupid not to understand how does that work. I will test this out aswell. 

  • Solution
Posted (edited)

OK, Danfoss have 2 control/status word profiles available to use (see setting 810 (or 8.1.0) in the Danfoss VSD's). I just had a look at my VSD configurations, and I used the FC profile, not the DSP402. To my knowledge, the process is similar though.

I didn't worry about the state transitions much. But if you look at those values, they are in HEX. Convert them to Binary, and you have all the bit values for your control word and the status word. Basically the manual is saying "if you want the VSD to do this specific thing, the control word would be this......". That said, when you look at the DSP402 control word bits, some bits do reference what transition they would execute, so this would be helpful to understand exactly what each bit does.

Because I used the FC profile, not the DSP402 profile, my function looked something like the following (details on each bit are in pages 21-23 of the EtherCAT manual):

  • Bits 0,1,8,9,11-15 were reset
  • Bits 2-5,10 were set
  • Bit 6 was start (Set to start. Reset to stop)
  • Bit 7 was fault reset (Set to clear fault. Reset after fault cleared)

I find the easiest thing to do is read what each bit does, and then work out if you need its state to change or if you can just set it once and leave it. If you don't need its state to change, then you just need to work out if you need it to be 0 or 1 (ie. Reset or Set) and go from there. 

If I wanted to do something similar in the DSP402 profile, I think it would look something like the following: (note I haven't tested this....so it might not be 100% right) - details of each bit are on pages 17 & 18 of the EtherCAT manual.

  • Set Bits 0-5
  • Bit 6 is start/stop
  • BIt 7 is Clear Fault
  • Bit 8-10 don't matter (reserved)
  • Bit 11 Reset
  • Bit 12 doesn't matter (reserved)
  • Bits 13 & 14 Reset (I would use setup 1 in the VSD - I don't typically need multiple setups in my projects. Otherwise this would be changed based on whatever setup was required)
  • Bit 15 Set (I assume this just allows reversing, as forward/reverse is controlled by the speed reference value).

 

Hope that all makes sense 🙂

Edited by BE
Posted

@BE The brute force method! I like it!

 

@VulpesLago For what it's worth, I did the same as you for an Oriental Motor. In short, the Oriental Motor was a servo and I could create an Axis, except the Torque function was not EtherCAT compliant and I could not use Omron's MC_Torque instruction. I removed the Axis and programmed the state machine. It was a good learning experience. :)

 

Posted
On 1/27/2025 at 4:20 PM, BE said:

fairly sure there is a better way to do this that I will be looking at in the coming weeks

FYI, for anyone looking at this thread in future, the "better way" I mentioned was to use the "TestABit" function to get the value of the required bits, instead of using a union.

Posted

ESI files are readily available from Danfoss distributors, and they work fine with Sysmac Studio - but they don't include function blocks for the control and status words.

Posted

Could you please explain how to use the ESI I/O mapping variables to control the Vacon VFD? I am working on a project to control a Vacon VFD drive, which includes the ESI file. I need to control the motor by reading and writing through the I/O mappings. I am looking for a tutorial or guidance on how to achieve this.

Let me know if you'd like further adjustments!

Posted (edited)
13 hours ago, halaloee said:

Could you please explain how to use the ESI I/O mapping variables to control the Vacon VFD? I am working on a project to control a Vacon VFD drive, which includes the ESI file. I need to control the motor by reading and writing through the I/O mappings. I am looking for a tutorial or guidance on how to achieve this.

Let me know if you'd like further adjustments!

Hello! 

ESI files can be downloaded from manufacturers website. Danfoss / vacon Files can be downloaded form here: https://www.danfoss.com/en/service-and-support/downloads/dds/fieldbus-configuration-files/#tab-downloads

You can import Esi files from ethercat menu by right cliking master device and selecting "display" Esi library.

image.thumb.png.b83f193dafb003b2afab2d2c8d10ed76.png

After that pop window opens and just press "install files" -> choose Esi file to be installed. After instalation sysmac will update and you can now see your ethercat device in vendor list right side of ethercat "page" (Arrow 3.)

Drag and drop device to ethercat configuration and you will see your device on the I/O mapping like picture below

image.thumb.png.b9ac3da6fae369c894745a0d51557a46.png

Typical VFD are only controlled by control word and frequency reference. Like this thred tell's you need to make your own FB to control special fucntions for example multi step or Motor potentiometer like i mentioned earlier.

I am not 100% sure because i have not yet made program to Vacon NXP drive, but i think they also have special control words that works exatly like Digital inputs. So you just activate inputs with PLC.  This is something i will also try in the future. 

Hope so this helps. 

PS. CIA 402 need to be activated with state transition before it can operate! There might be atleast one topic named "VFD control with Ethercat CiA402" <-pun intended.

Hope so this helps!

Edited by VulpesLago

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...