<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"Plain Text Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
span.PlainTextChar
{mso-style-name:"Plain Text Char";
mso-style-priority:99;
mso-style-link:"Plain Text";
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-NZ" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoPlainText">> -----Original Message-----<o:p></o:p></p>
<p class="MsoPlainText">> From: Sy Meshkat [mailto:sy.meshkat@dspcg.com] <o:p></o:p></p>
<p class="MsoPlainText">> Sent: Friday, 12 January 2018 12:42 p.m.<o:p></o:p></p>
<p class="MsoPlainText">> To: Graeme Foot <Graeme.Foot@touchcut.com><o:p></o:p></p>
<p class="MsoPlainText">> Subject: FW: EtherCAT stack time requirement per domain is too long<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> Sorry, it actually takes 400 microseconds --> 8*400 microseconds = 3.2 ms<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> -----Original Message-----<o:p></o:p></p>
<p class="MsoPlainText">> From: Sy Meshkat [mailto:sy.meshkat@dspcg.com] <o:p></o:p></p>
<p class="MsoPlainText">> Sent: Thursday, January 11, 2018 5:39 PM<o:p></o:p></p>
<p class="MsoPlainText">> To: 'Graeme.Foot@touchcut.com'<o:p></o:p></p>
<p class="MsoPlainText">> Subject: EtherCAT stack time requirement per domain is too long<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> Dear Graeme,<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> This is Sy, I supervise Rahul Deshpande with his EtherCAT project. In the<o:p></o:p></p>
<p class="MsoPlainText">> past, Rahul has written several emails to you and your help has proven<o:p></o:p></p>
<p class="MsoPlainText">> invaluable. <o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> Our EtharCat core in Linux works properly and we use it in a coordinated<o:p></o:p></p>
<p class="MsoPlainText">> motion control application using multiple Yaskawa Ethercat Sigmas.
<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> In reviewing various timings, the time EtherCAT stack requires to process<o:p></o:p></p>
<p class="MsoPlainText">> each domain, in our application is about 300 microseconds. This is too<o:p></o:p></p>
<p class="MsoPlainText">> long, especially because we have 8 Sigma 5 drives which means it takes 8*300<o:p></o:p></p>
<p class="MsoPlainText">> microseconds = 3.2 ms to process all domains per cycle!<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> What was your experience in your application? Did you notice that stack time<o:p></o:p></p>
<p class="MsoPlainText">> requirement to process a domain was that long? If so, how could we reduce<o:p></o:p></p>
<p class="MsoPlainText">> it?<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> Thanks in advance!<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> Sy Meshkat<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Hi,<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">(Remember to send or cc to the etherlab users forum.)<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">We use a Beckhoff CX2020 pc (1.4GHz Celeron single core). We have machines with up to around 20 axes. The cycle time is 1000Hz (1ms per cycle). The Yaskawa axes use 65 bytes of PDO data per axis (I use a few more than just the standard
parameters). I use three domains for the application:<o:p></o:p></p>
<p class="MsoPlainText">- Yaskawa axes read domain<o:p></o:p></p>
<p class="MsoPlainText">- Yaskawa axes write domain<o:p></o:p></p>
<p class="MsoPlainText">- Read/Write domain for all other modules.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">My three domains with the 20 odd axes (and various digital and analogue IO) take approximately 30us to perform the following functions:<o:p></o:p></p>
<p class="MsoPlainText">- ecrt_master_receive()<o:p></o:p></p>
<p class="MsoPlainText">- ecrt_domain_process() (x3)<o:p></o:p></p>
<p class="MsoPlainText">- ecrt_domain_state() (x3)<o:p></o:p></p>
<p class="MsoPlainText">- ecrt_master_state()<o:p></o:p></p>
<p class="MsoPlainText">- do some funky stuff with my data<o:p></o:p></p>
<p class="MsoPlainText">- ecrt_domain_queue() (x3)<o:p></o:p></p>
<p class="MsoPlainText">- ecrt_master_reference_clock_time()<o:p></o:p></p>
<p class="MsoPlainText">- ecrt_master_sync_slave_clocks()<o:p></o:p></p>
<p class="MsoPlainText">- ecrt_master_64bit_reference_clock_time_queue()<o:p></o:p></p>
<p class="MsoPlainText">- ecrt_master_application_time()<o:p></o:p></p>
<p class="MsoPlainText">- ecrt_master_send()<o:p></o:p></p>
<p class="MsoPlainText">- some distributed clock calculations<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">My total processing time per cycle is approximately 160us, so around 16% of my cycle time. This includes the above the above EtherCAT processing and all logic required to process the data. It does not include command calls from our
external control application, which get processed via the Linux context.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">It sounds like you are creating two domains per axis. If so, you don't need to do this. You just need one domain per type of function (read, write, read/write) and add the IO from each module as appropriate.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">From memory you are using Xenomi. What network card driver are you using? I don't think you can use the generic driver with Xenomi to achieve realtime EtherCAT, you certainly can't with RTAI (which I use).<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">In RTAI there is a utility you can use (cat /proc/rtai/scheduler | grep 'transitions') that will tell you if you are making any syscalls from your realtime context. If you do so, then you drop out of realtime and are running code under
the Linux context, which can take any amount of time. Check if Xenomi has a similar utility.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Check that you have a stable realtime system with as little jitter as possible.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Other than that, put timers around various sections of the code and see if you can pinpoint any particularly slow functions.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Here is an example of the statistics page from our application for a machine running 16 axes:<o:p></o:p></p>
<p class="MsoPlainText"><span style="mso-fareast-language:EN-NZ"><img width="803" height="707" style="width:8.3645in;height:7.3645in" id="Picture_x0020_1" src="cid:image001.png@01D38DF5.579569B0"></span><o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">I've circled the EtherCAT processing time in red and the axis specific logic time in green.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><span style="color:black"><o:p> </o:p></span></p>
<p class="MsoPlainText"><span style="color:black">Regards,<br>
Graeme.<o:p></o:p></span></p>
<p class="MsoPlainText"><span style="color:black"><o:p> </o:p></span></p>
</div>
</body>
</html>