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

Jun Yuan j.yuan at rtleaders.com
Tue Dec 13 02:32:10 CET 2011


Hello Shahbaz, Hello Emanuele,

so there are 30000 pdos, 100 slaves on the bus, WOW. If I understand
it rightly, those slaves have different updating rates, all the pdos
were putted into one domain, and the bus cycle was in 40ms only
because some slaves (sensors) need 37ms to update its data. Having
those data with a nearly 40ms delay for the processing is
unacceptable, so we need to improve it.

I've got an idea. I am not sure if it actually works, but this is my suggestion:

The first thing I want to point out, is that the bus cycle and the
slave's internal updating cycle are two different things. The bus
cycle should not be limited to the slaves' internal cycle. The bus
cycle is only limited by two things: the processing time in the while
loop of the EtherCAT, and the datagram transmission time. Please
correct me if I am wrong.

As the 40ms delay is a concern here, I think we should have the bus
running faster. Let's say 1ms cycle time, if it allows. So the data
would only have a max. 1ms delay for processing.

Those pdos would be splitted into different domains, according to
their updating frequency. There shall be one EtherCAT thread dealing
only with the bus. And if the data processing may cost more time than
1 ms(bus cycle), each domains can have one data processing thread.

There shall be two list, one for those domain to be sent, the other
one for those domains that have been sent and waits for receiving the
answer. The while loop of the EtherCAT thread shall be like this:

while(true) {
  ecrt_master_receive(master_ptr);

  for (each domain in receiving list) {
    ecrt_domain_process(domain_ptr);
    if (answer_is_there) {
        notify_its_data_process_thread();
        delete_itself_from_receiving_list();
    }
  }

 for (each domain in sending list) {
   ecrt_domain_queue(domain_ptr);
   add_itself_to_receving_list();
 }

 ecrt_master_send(master_ptr);

  wait_for_bus_cycle();
}

The data processing thread while loop:
while(true) {
  add_domain_to_sending_list();
  wait_for_the_answer();
  data_processing();
  wait_for_domain_cycle();
}

The worst case for datagram transmission is that when all the domains
require data update.  I don't known how long does it take to transmit
all the 30000 pdos in all that different domains. You'll need to find
it out for deciding the bus cycle time. And if it too takes too long,
well, try to not let that "all domain requiring data" happens.

Hope this can help you.


Best Regards,

Jun YUAN



More information about the Etherlab-users mailing list