EPICS Controls 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  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: question about aSubRecord
From: Tim Mooney <[email protected]>
To: wantianmin <[email protected]>
Cc: [email protected]
Date: Thu, 2 Dec 2010 09:11:52 -0600 (CST)
wantianmin,

It's possible to overcome this, though it might not be a good idea,
depending on what link processing you have in mind.

If you look at the record's process() routine, in
base/src/rec/aSubRecord.c, you'll see what it's doing to execute
output links.  If you do this in your routine, you can cause both
input and output links to execute in any order you want.  If your routine
returns 0, however, the output links will all be executed again.  If your
routine returns other than 0 (no doubt this value was intended to signal
an error), the record will not execute the output links, but (currently)
this doesn't put the record into an alarm state, so the only side effect
will be that the record ends up with a nonzero VAL field.

    Maybe there should be a return value that calls for no output link
    processing but that doesn't also indicate an error.

If you plan an extended series of (write, read, decide, write, read, ...),
or if any of the records you write to are asynchronous, and you wait for
the result of their processing, your record is not going to play well with
other records that are executed by the same task. (For example, if your
record is periodically scanned, all the other records scanned with the same
period will be forced to wait for your record to finish before they will be
processed.)

It might be that your purpose would be better served by an SNL program.

Tim Mooney

----- Original Message -----
From: "wantianmin" <[email protected]>
To: [email protected]
Sent: Wednesday, December 1, 2010 8:55:28 PM
Subject: question about aSubRecord

Hi ,all:
When I use aSubRecord record to do some process, It was found that write
operation is not being done until myAsubProcess() finish.Is there some
way to overcome it?
here is a description of my situation:
db:
record(aSub,"asub")
{
field(INAM,"myAsubInit")
field(SNAM,"myAsubProcess")
field(FTA,"DOUBLE")
field(NOA,"1")
field(INPA,"test4 CA")
field(FTVA,"DOUBLE")
field(NOVA,"1")
field(OUTA,"test1 CA")
field(FTVB,"DOUBLE")
field(NOVB,"1")
field(OUTB,"test2 CA ")
}
dbSubExample.cpp:
static long myAsubProcess(aSubRecord *precord)
{
if (mySubDebug)
printf("Record %s called myAsubProcess(%p)\n",
precord->name, (void*) precord);
printf(" begin process\n");
double* p1=(double*)precord->vala;
p1[0]=20;
printf(" write vala 1 to 20 complete....\n");

double* p2=(double*)precord->a;
printf(" read from a :%lf\n complete",p2);


printf(" end process\n");
return 0;
}

I found that When I doing dbpf asub.PROC 1 in iocshell,
the first output value (test1) is not changed until the process finished.
but in some application ,I need to write some pv and read it again to
decide what is need to do next.
Is there some suggestions?
Thanks a lot
Best Regards
wantianmin
SSRF


-- 
Tim Mooney ([email protected]) (630)252-5417
Software Services Group (www.aps.anl.gov)
Advanced Photon Source, Argonne National Lab


Replies:
Re: question about aSubRecord wantianmin
References:
question about aSubRecord wantianmin

Navigate by Date:
Prev: RE: New StreamDevice version Craig.Haskins
Next: Asyn VXI-11 Driver and VXI-11 Locking William Lu
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: question about aSubRecord wantianmin
Next: Re: question about aSubRecord wantianmin
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 03 Dec 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·