[etherlab-users] Knowing when the packet has finished cycle

Richard Hacker ha at igh-essen.com
Wed Oct 19 13:18:02 CEST 2011


Hello,

Please let me put things straight: there is no way of knowing when an EtherCAT 
packet has arrived, because there is *NO need to*!!!! 

Digital computer controlled systems are sampled data systems with one inherent 
delay cycle from input to output. They are not analog computers. In the limit 
when the cycle time tends to zero they start to *look like* analog computers. 
Where this limit is depends on your application!

So, normal controllers running EtherCAT do:
calculate;
exchange io;
wait;
calculate
exchange io;
wait;
... till the end of time

Inside "exchange io", data from the calculation is output to the slaves and AT 
THE SAME TIME the input slaves are sampled (ecrt_master_send() ). These inputs 
wait until the next calculation step before they get processed.

Inside calculate, ethercat data frames are fetched from the ethernet card 
(ecrt_master_receive() ), processed for inputs (which were fetched while the 
program was sleeping) (ecrt_domain_process() ), running your control 
algorithm, and queuing the outputs from your controller (ecrt_domain_queue() 
). The important thing to note, is that the ethercat frames must be waiting on 
the ethernet card before the master is requested to fetch them, otherwise the 
master will puke and think the frame was lost. Thus fetching data too early 
before the frame has arrived will get you into trouble. That is why it is VERY 
IMPORTANT to sleep after "exchange io".

If this concept does not suit your timing requirements, then EtherCAT is not 
your solution - you need directly attached IO where you can synchronously 
sample inputs, calculate and write outputs. Just before giving up on EtherCAT, 
it has been tested at rates to 10kHz ;)

Oh by the way, we and many others have been working successfully with EtherCAT 
on a number of not so small applications for a few years without needing 
synchronous IO.

- Richard

On Wednesday 19 October 2011 10:52:03 Jordi Blanch Carles wrote:
> In our case, the whole EtherCat loop would be:
> 
> ask_for_inputs() <----- ecrt_domain_queue + ecrt_master_send
> wait_for_packet_received()
> process_inputs() <----- ecrt_master_receive + ecrt_domain_process
> 
> make_calculations()
> 
> send_outputs() <----- ecrt_domain_queue + ecrt_master_send
> 
> wait_for_next_period()
> 

Mit freundlichem Gruß

Richard Hacker

-- 
------------------------------------------------------------------------

Richard Hacker M.Sc. 
richard.hacker at igh-essen.com
Tel.: +49 201 / 36014-16

Ingenieurgemeinschaft IgH
Gesellschaft für Ingenieurleistungen mbH
Heinz-Bäcker-Str. 34
D-45356 Essen
Amtsgericht Essen HRB 11500
USt-Id.-Nr.: DE 174 626 722
Geschäftsführung: 
- Dr.-Ing. S. Rotthäuser, 
- Dr.-Ing. T. Finke, 
- Dr.-Ing. W. Hagemeister
Tel.: +49 201 / 360-14-0
http://www.igh-essen.com

------------------------------------------------------------------------



More information about the Etherlab-users mailing list