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

Subject: Re: Process aSub record on arrival of data
From: Andrew Johnson via Tech-talk <tech-talk at aps.anl.gov>
To: tech-talk at aps.anl.gov
Date: Mon, 31 Jul 2023 11:38:15 -0500
Hi Matt,

On 7/30/23 10:37 PM, Matt Rippa via Tech-talk wrote:
This monitor style works as you say(changes below).  It was confusing when I put a camonitor on RX.A it only shows the latest array --but doesn't update as new data arrives.
The aSub record only posts monitors on VAL (when the  and the VAL[A-U] and NEV[A-U] array fields, i.e. the output arrays. If you want monitors on the input arrays you could add calls to db_post_events() on them inside your aSub subroutine, look at the record type's monitor() routine for an example to copy. However looks like your RX subroutine could just set prec->oval=1 to have the monitor on the VAL field fire every time it processes if you want to see the timestamp without monitoring RX.VALA.

Is there an easy way to measure statistics (flight time and jitter) of a modest payload?
We're trying to see if we can meet a 200 usec requirement to send corrections from our wavefront sensor to our secondary mirror.
We have 1 Gb network switches.
This is currently accomplished with reflected memory hardware (VMIC 5588).
That depends on the accuracy of your timing system — are your system clocks synchronized well enough to measure that? I would start by comparing the time-stamps from CA monitors of the two aSub records. I have no idea whether you'll be able to reliably achieve 200µs though, are these IOCs both running RTEMS? I'd be skeptical about that myself, but would do the test anyway.

HTH,

- Andrew


=====Setting RX.TPRO 1 Confirmed the RX processed every time TX processed=====
#seq sncxxx,"user=mrippa"
epics>  
epics>  
epics> scanOnce: dbProcess of 'test:RX'
scanOnce: dbProcess of 'test:RX'
scanOnce: dbProcess of 'test:RX'
scanOnce: dbProcess of 'test:RX'
...

===========IOC A==============
record(aSub,"test:TX")
{
   field(INAM,"TxInit")
   field(SNAM,"TxTransmit")
   field(FTVA,"DOUBLE")
   field(NOVA,"10")
   field(SCAN,"1 second")
}

static long TxInit(aSubRecord *precord)
{

   srand ( time ( NULL));
   if (mySubDebug)
       printf("Record %s called myAsubInit(%p)\n",
              precord->name, (void*) precord);
   return 0;
}

static long TxTransmit(aSubRecord *precord)
{

   for (int i=0; i<10; i++)
      testArray[i] = (double)rand()/RAND_MAX*2.0-1.0;//float in range -1 to 1

   memcpy(precord->vala, testArray, 10*sizeof(double));

   if (mySubDebug)
       printf("Record %s called myAsubProcess(%p): ta10=%f\n",
              precord->name, (void*) precord, testArray[9] );
   return 0;
}

===========IOC B==============
record(aSub,"test:RX") {
      field(SNAM, "receiver")
      field(FTA, "DOUBLE")
      field(FTVA, "DOUBLE")
      field(NOA, "10")
      field(NOVA, "10")
      field(INPA, "test:TX.VALA CPP NMS")
}

long receiver(aSubRecord *prec)
{
       double sum=0.0, *a;

       a = (double *)prec->a;

       /*sum goes to output valb*/
       for(int i=0; i<prec->noa; i++)
               sum += a[i];
       * (double *) prec->valb = sum;

       /*copy input A to output VALA*/
       memcpy(prec->vala, (double *)prec->a, 10 * sizeof(double));

       //printf("success: %f\n", sum);

       return 0;
}



On Thu, Jul 27, 2023 at 10:51 AM Ralph Lange via Tech-talk <tech-talk at aps.anl.gov> wrote:
On Thu, 27 Jul 2023 at 21:24, Andrew Johnson via Tech-talk <tech-talk at aps.anl.gov> wrote:
Hi Matt,

On 7/27/23 1:33 PM, Matt Rippa via Tech-talk wrote:
I have 2 aSub records: Tx on IOC  A and Rx on IOC B.
IOC A and B are on different machines on my network.

I want Tx to send an array to Rx over CA (or PVA). Once the data arrives is there a stock method to trigger Rx to process? IIUC, using the CPP attribute in Tx.OUTA will not cause the Rx to process since these records are on different IOC's. I'm using another OUT link in Tx to write to Rx.PROC.

Is that the most efficient way to do this?
The standard and most efficient way would be to have RX.INPA be a CA link to the TX.VALA field with the CPP link flag set, then every time TX updates its VALA field the CA monitor event will update the RX.A array and process that record immediately. If you want to make that processing conditional there are a couple of different ways to do that, but that's a different question for a different email.

Another advantage of this "monitor" style is that the receiving end Rx gets notified when the connection to Tx on IOC A goes down.
Writing data from Tx in "push" style is a fire-and-forget operation: neither side is notified if it fails.

Proper error handling for such setups is yet another question for yet another mail.

Cheers,
~Ralph


-- 
Complexity is free, it's Simplicity that takes work.

References:
Process aSub record on arrival of data Matt Rippa via Tech-talk
Re: Process aSub record on arrival of data Andrew Johnson via Tech-talk
Re: Process aSub record on arrival of data Ralph Lange via Tech-talk
Re: Process aSub record on arrival of data Matt Rippa via Tech-talk

Navigate by Date:
Prev: Re: Process aSub record on arrival of data Matt Rippa via Tech-talk
Next: Issues using IVOA field: 'Set output to IVOV' Crisp, Daniel via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024 
Navigate by Thread:
Prev: Re: Process aSub record on arrival of data Matt Rippa via Tech-talk
Next: measComp R4-2 available Mark Rivers via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024 
ANJ, 31 Jul 2023 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·