Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020 
<== Date ==> <== Thread ==>

Subject: RE: Delay problem in ca_array_put() command
From: "Jeff Hill" <johill@lanl.gov>
To: "'Perrier Pierre'" <piperrier@sopragroup.com>, <tech-talk@aps.anl.gov>
Date: Mon, 18 Jul 2011 10:46:01 -0600

Hello Pierre,

 

Ø  I don’t know which type of implementation (Portable CA Server or IOC) is the most

Ø  efficient. In this case, I started implementing an IOC. is it a good choice ?

 

It’s hard to make specific recommendations without more knowledge of your application. Nevertheless, a strong benefit of using an IOC to control motors will be that you can use all of the EPICS device drivers already written for motors now  and in the future if you upgrade. The portable server works well when you have a preexisting data store which needs to be interfaced to EPICS, or when you do not want to configure a subsystem using EPICS records.

 

Ø  And to be notified of change events, I’ve created a thread to launch :

Ø  ca_pend_event (0.0);

 

In a preemptive callback application you will receive callbacks from the ca client library’s auxiliary threads at any time, and accordingly user callback execution isn’t restricted to occur only when executing in the ca client library (as is the case with non-preemptive callback mode). So therefore, a call to ca_pend_event in the thread that you have launched isn’t strictly necessary.

 

Ø  The problem occurs when I want to change a PV value. All seems ok but the pv is 

Ø  only really modified 30 seconds to 1 min after the call to ca_array_put (I have

Ø  tested this in localhost) . To change a value, I proceed in the following manner

Ø  for a double :

Ø  ca_array_put(DBR_DOUBLE, 1, channel, &val);

Ø  status=ca_pend_io(put_timeout);

 

A better approach is as follows. First issue the put request, and second force the output queue to be flushed to the network.

 

ca_array_put(DBR_DOUBLE, 1, channel, &val);

ca_flush_io();

 

The ca_pend_io is a synchronize-by-blocking function which waits for ca get and ca channel connect requests to complete (but such requests will only participate if they are not synchronized by callbacks). Thus, ca_pend_io isn’t typically used with a ca put request. Also, ca_pend_io is used typically only in single threaded ca client applications, and not in a multithreaded (preemptive callback) ca client applications (which are typically synchronized by callbacks).

 

Ø  Is this a normal behaviour? If not, how can this issue be solved?

 

No, as soon as the request is flushed out of the output queue it will be delivered immediately to the IOC. While the ca_pend_io function call isn’t appropriate in a put request context, it does nevertheless issue internally a flush request so I _am_ surprised that you see this delay.

 

Are you certain that the delay is in the ca subsystem? The motor record is actually more complex in its implementation than other EPICS records.

 

Perhaps you can use the dbpr command from the IOC’s shell to verify that the field which is the target of the put request is in fact being modified after a delay?

 

Jeff
______________________________________________________
Jeffrey O. Hill           Email       
johill@lanl.gov
LANL MS H820              Voice        505 665 1831
Los Alamos NM 87545 USA   FAX          505 665 5107

 

Message content: TSPA

 

From: tech-talk-bounces@aps.anl.gov [mailto:tech-talk-bounces@aps.anl.gov] On Behalf Of Perrier Pierre
Sent: Monday, July 18, 2011 1:46 AM
To: tech-talk@aps.anl.gov
Subject: Delay problem in ca_array_put() command

 

Hi everybody,

 

I 'm working on a IOC or Portable CA Server capable of managing other IOC in order to sequence them, for instance. Typically this IOC controls multiple motors, each represented by an IOC.

 

I don’t know which type of implementation (Portable CA Server or IOC) is the most efficient. In this case, I started implementing an IOC. is it a good choice ?

 

More particularly, I’ve a problem with the part of this IOC acting as the client of the others IOC it controls. This client monitors  a few PV of the motor’s IOC and all seems ok. It’s a multi-threaded client. I’ve created my CA context with :

                                ca_context_create(ca_enable_preemptive_callback);

                              

And to be notified of change events, I’ve created a thread to launch :

ca_pend_event (0.0);

 

The problem occurs when I want to change a PV value. All seems ok but the pv is only really modified 30 seconds to 1 min after the call to ca_array_put (I have tested this in localhost) . To change a value, I proceed in the following manner for a double :

                               ca_array_put(DBR_DOUBLE, 1, channel, &val);

status=ca_pend_io(put_timeout);

 

Is this a normal behaviour? If not, how can this issue be solved?

 

 

Thanks in advance,

 

Best regards,

 


Pierre PERRIER

Stagiaire - MCO LIL

Sopra group.

Parc Innolin
9 rue du Golf 33700 Merignac
Phone : +33 (0)5 56 12 79 59
piperrier@sopragroup.com - www.sopragroup.com

 

Ce message peut contenir des informations confidentielles dont la divulgation est à ce titre rigoureusement interdite en l'absence d'autorisation explicite de l'émetteur. Dans l'hypothèse où vous auriez reçu par erreur ce message, merci de le renvoyer à l’émetteur et de détruire toute copie.

P Pensez à l’environnement avant d’imprimer.

 


References:
Delay problem in ca_array_put() command Perrier Pierre

Navigate by Date:
Prev: Re: Alarm Handler and $ALARMCOUNTFILTER Andrew Johnson
Next: RE: EPICS OSI and events michael.abbott
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020 
Navigate by Thread:
Prev: Delay problem in ca_array_put() command Perrier Pierre
Next: EPICS OSI and events michael.abbott
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·