I'm trying to set up a PLC controller and a connection to an EtherCAT slave device in Codesys.
I want to create a flexible program that I can upload to multiple controllers with different remote IO connected (same program).
On one plant i may have 5 AI-cards and 3 DO-cards, and on another I may have 4 AI-cards and 2 DO-cards.
For not needing to maintain several different programs wih different devices defined in the program (one for each set up) I thought that using a remote IO would make it easier having a single program. That way I could refer to different memory addresses instead of predefined slots/channels and IO's, that would give me errors if there was a different IO on the plant than what the program expected.
When I tried setting up the etherCAT master, I saw that I had to define the etherCAT slave devices with the different IO'cards for me to be able to refer to the memory addresses in a PRG. Exactly what I was trying to avoid.
My setup is something like a program that can handle 16 separate pump controls. In a year maybe 6 plans get deployed, and depending on how large the project is, the number of pumps can vary between 4 and 16. And the managers dont want to have IO's for all 16 pumps on every cabinet, and I dont want to maintain 16 separate projects files in case of updates etc.
I thought the best way to tackle this was having a single project that read/write data to the different pump IO's by remote IO (fieldbus ethercat) addresses.
And the number of pump controls are activated by an external GUI. If pump 1-6 is activated by the GUI, then the PLC-program tries to read/write input/outputs from predefined addresses for the expected IO's.
My test setup is a PFC200 WAGO controller and a EtherCAT fieldbus coupler (750-354) with some IO.
I hope I didn't explain this too horrible, and if there is a more easy and elegant solution for this challenge I appreciate a feedback on this.
The simplest way to do this would be to add a bus coupler dedicated to the expansion IO. The EtherCAT network does not fault when modules connected to the expander are not present. In the image below, nothing below the red line is present in the network - with the network working correctly. In your "base" project, simply include all of the possible modules, and then plug them in as you add pumps to the system. I would also highly recommend against the use of direct addressing.
There are other methods to accomplish this, including using the "Optional" checkbox for modules and explicitly addressing them. Although, this would require more upfront work to design the network, and some additional work each time modules were added. https://content.helpme-codesys.com/en/CODESYS%20EtherCAT/_ecat_edt_slave_slave.html
I think the codesys modbus libraries support configuration and connection to modbus slaves without having to add the slave devices in the device tree. Just do it from function blocks inside the program. I was hoping for something similar with EtherCAT.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, everyone!
I'm trying to set up a PLC controller and a connection to an EtherCAT slave device in Codesys.
I want to create a flexible program that I can upload to multiple controllers with different remote IO connected (same program).
On one plant i may have 5 AI-cards and 3 DO-cards, and on another I may have 4 AI-cards and 2 DO-cards.
For not needing to maintain several different programs wih different devices defined in the program (one for each set up) I thought that using a remote IO would make it easier having a single program. That way I could refer to different memory addresses instead of predefined slots/channels and IO's, that would give me errors if there was a different IO on the plant than what the program expected.
When I tried setting up the etherCAT master, I saw that I had to define the etherCAT slave devices with the different IO'cards for me to be able to refer to the memory addresses in a PRG. Exactly what I was trying to avoid.
My setup is something like a program that can handle 16 separate pump controls. In a year maybe 6 plans get deployed, and depending on how large the project is, the number of pumps can vary between 4 and 16. And the managers dont want to have IO's for all 16 pumps on every cabinet, and I dont want to maintain 16 separate projects files in case of updates etc.
I thought the best way to tackle this was having a single project that read/write data to the different pump IO's by remote IO (fieldbus ethercat) addresses.
And the number of pump controls are activated by an external GUI. If pump 1-6 is activated by the GUI, then the PLC-program tries to read/write input/outputs from predefined addresses for the expected IO's.
My test setup is a PFC200 WAGO controller and a EtherCAT fieldbus coupler (750-354) with some IO.
I hope I didn't explain this too horrible, and if there is a more easy and elegant solution for this challenge I appreciate a feedback on this.
The simplest way to do this would be to add a bus coupler dedicated to the expansion IO. The EtherCAT network does not fault when modules connected to the expander are not present. In the image below, nothing below the red line is present in the network - with the network working correctly. In your "base" project, simply include all of the possible modules, and then plug them in as you add pumps to the system. I would also highly recommend against the use of direct addressing.
There are other methods to accomplish this, including using the "Optional" checkbox for modules and explicitly addressing them. Although, this would require more upfront work to design the network, and some additional work each time modules were added.
https://content.helpme-codesys.com/en/CODESYS%20EtherCAT/_ecat_edt_slave_slave.html
Okey, thank you! Do you think it is something in this library, that makes it possible to do the configuration in a PRG? https://content.helpme-codesys.com/en/libs/IODrvEtherCATDriver/Current/IoDrvEtherCAT.html#id1
I think the codesys modbus libraries support configuration and connection to modbus slaves without having to add the slave devices in the device tree. Just do it from function blocks inside the program. I was hoping for something similar with EtherCAT.
There is an example for activating/deaktivating an optional Slave in the FAQ's:
https://faq.codesys.com/pages/viewpage.action?pageId=49283084
Last edit: dkugler 2024-04-12