cancel
Showing results for 
Search instead for 
Did you mean: 

Troubleshooting Inconsistent Response Times in EtherCAT Sensor Communication Using Byte Arrays

Troubleshooting Inconsistent Response Times in EtherCAT Sensor Communication Using Byte Arrays

TY14
New Poster

I have a project with a sensor that is connected via EtherCat. In general it works like this: You send a request to the sensor and it responds.
I use the EtherCat app to do this and send a request to Transmit_data.Value and get a response via Receive_data.Value. The problem is that the two nodes are of the byte array type and this is not displayed properly in the data layer, which is why I had to think outside the box:
getMemoryMap reads the MemoryMap and writeByteArray overwrites the Transmit_data.Value node

I then created two nodes, one to request the name of the sensor with a bool and one node for the output. When the node is triggered, the function handleTransmitReadDeviceName is called which then overwrites the Transmit_data.Value with the corresponding byte array and then executes the handshake(processNodes).
In the processAndWriteToNodes function, the response of the sensor and the expected byte sequence is compared and if this matches, the output node I created is overwritten. The function runs permanently
This all works pretty well, but I have a problem: A time waster must have crept in somewhere during the output process, but I can't find it. The output process usually takes 3-4 seconds on average, but sometimes within milliseconds. How could I approach this problem

Thanks in advance

 

4 REPLIES 4

Thoomas
Community Moderator
Community Moderator

This probably needs to be looked at in more detail.

ArcherThompson
Established Member

I might be facing a similar issue in the codesys version as well I am doing a similar task reading the memory map of the ethercat and saw my time to retrieve go from a fews ms to at least 100s of ms (or just a few ms again in some cases). It seems to be maybe related to the content or content length of the ethercat map. When adding a Safex Controller to the system that's when I found I had an issue. 

This leads me to think the issue might be related to the Datalayer or Ethercat application.

Thanks for the reply.

I can send you my whole project via private message, if you want.

TheCodeCaptain
Community Moderator
Community Moderator

Hi Folks,

to get the real time data in a consitent way, you have to do it in a real time capable way and language.
With the codesys PLC you can do it using the Datalayer Node in the ctrlX PLC Engineering, and running your task synchronized to the EtherCAT Master.
Here an example picture:TheCodeCaptain_0-1727262598986.png


Have you seen this? Collection-of-how-to-videos-blogs-and-examples-for-ctrlX/ba-p/12343#toc-hId-1976839065 

If you do your own C/C++ app you have to write a real time bundle.
For more information about real time bundles and SDK please get in touch with your responsible sales/support.

Regards

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist