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: [External] Re: Output records in StreamDevice
From: "Leblanc, Gregory via Tech-talk" <tech-talk at aps.anl.gov>
To: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Mon, 20 Mar 2023 15:46:37 +0000
Thanks Dirk that got me on the right track.  I changed the record in my .db file to read:

 record(ao, "$(P)$(R)writeOutput1") {
    field(DESC, "Write to Test Output 1")
    field(DTYP, "stream")
    field(PREC, "3")
    field(EGU,  "Volts")
    field(SCAN, "Passive")
    field(OUT, "@devKS_34980A_EPICS.proto setSourceVoltage(%E,2001) $(PORT) $(A)" )
    field(PINI, "YES")
    field(VAL, "0")
}

Which has done the trick.  
     Greg


> -----Original Message-----
> From: Zimoch Dirk <dirk.zimoch at psi.ch>
> Sent: Monday, March 20, 2023 10:51 AM
> To: Leblanc, Gregory <leblanc at ohio.edu>; tech-talk at aps.anl.gov
> Subject: [External] Re: Output records in StreamDevice
> 
> Use caution with links and attachments.
> 
> Hi Greg,
> 
> You use % formats just as for the inputs:
> 
> setSourceVoltage {
>     out "source:voltage \$1,(@\$2) %E";
> }
> 
> 'out' works like printf() while 'in' works like scanf().
> 
> Dirk
> 
> 
> On Mon, 2023-03-20 at 14:44 +0000, Leblanc, Gregory via Tech-talk wrote:
> > Hi folks,
> >
> > I'm struggling a bit to wrap my head around how to use output records in
> StreamDevice.  I'm missing the link between the value going into the PV and
> sending that value to my device.
> >
> > Background: I'm using EPICS base 7.0 checked out from GIT, running on
> CentOS 7. I've also installed asyn, calc, and streamdevice from git.   I'm
> communicating with an HP/Agilent/Keysight 34980A mainframe over ethernet.
> I'm reading from the mainframe DMM without any issues.  Snippets of the
> protocol file and record file look like:
> >
> > getResistance {
> >     out "measure:resistance? \$1,\$2,(@\$3)";
> >     in "%E";
> > }
> >
> > And
> >
> > record(ai, "$(P)$(R)switcherMagnetVoltage") {
> >     field(DESC, "Switcher Magnet Voltage")
> >     field(DTYP, "stream")
> >     # field(SCAN, "1 second")
> >     field(SCAN, "Passive")
> >     field(INP,  "@devKS_34980A_EPICS.proto getVoltageDC(100,0.0001,1001)
> $(PORT) $(A)")
> >     field(EGU, "Volts")
> >     field(PINI, "YES")
> > }
> >
> > Where I'm stuck is on writing values to the mainframe to control the DACs.
> I've got a section of the protocol file that looks like:
> >
> > setSourceVoltage {
> >     out "source:voltage \$1,(@\$2)";
> > }
> >
> > Where the first parameter is the DC voltage (-16V to 16V), and the second
> parameter is the output channel to set.  I've written an AO record, which is
> where I think the problem is like this:
> >
> > record(ao, "$(P)$(R)writeOutput1") {
> >     field(DESC, "Write to Test Output 1")
> >     field(DTYP, "stream")
> >     field(PREC, "3")
> >     field(EGU,  "Volts")
> >     field(SCAN, "Passive")
> >     field(OUT, "@devKS_34980A_EPICS.proto setSourceVoltage(3,2001)
> $(PORT) $(A)" )
> >     field(PINI, "YES")
> >     field(VAL, "0")
> > }
> >
> > From here, pvput to writeOutput1 will cause that output to get set back to 3V.
> The presentation at:
> > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Findi
> > co.fhi-
> berlin.mpg.de%2Fevent%2F52%2Fcontributions%2F578%2Fattachments%
> >
> 2F182%2F578%2FStreramDeviceIntroduction2020.pdf&data=05%7C01%7Clebla
> nc
> >
> %40ohio.edu%7Cd16f983379a545899fca08db29529519%7Cf3308007477c4a70
> 88893
> >
> 4611817c55a%7C0%7C0%7C638149206941740240%7CUnknown%7CTWFpbGZs
> b3d8eyJWI
> >
> joiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C300
> 0%7
> >
> C%7C%7C&sdata=7hpkZg9fvBdpAdP3V1DjBpH5Ouz6tq1CGdPHZRAW2Q0%3D&r
> eserved=
> > 0 has some AO records on page 24, but I still can't quite see how the
> > value gets from the AO record into the string that streamdevice is sending out.
> >
> > Any pointers on what I need to do are greatly appreciated,
> >      Greg
> >
> > P.S. More complete files are available at:
> > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgith
> >
> ub.com%2FleblancOUAL%2FKS_34980A_EPICS&data=05%7C01%7Cleblanc%40o
> hio.e
> >
> du%7Cd16f983379a545899fca08db29529519%7Cf3308007477c4a70888934611
> 817c5
> >
> 5a%7C0%7C0%7C638149206941896472%7CUnknown%7CTWFpbGZsb3d8eyJWI
> joiMC4wLj
> >
> AwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C
> %7C&s
> >
> data=oMfN%2FV%2FFOiutjdaJy1SWEMpGlVBFi9qeUi3FaYzVhtM%3D&reserved=
> 0
> >
> > --
> > Gregory Leblanc
> > Accelerator Engineer
> > Edwards Accelerator Lab - Ohio University
> > 123 University Terrace
> > Athens, OH 45701 USA
> > leblanc at ohio.edu
> > M: (401) 52-OUAL1 or (401) 526-8251
> >

References:
Output records in StreamDevice Leblanc, Gregory via Tech-talk
Re: Output records in StreamDevice Zimoch Dirk via Tech-talk

Navigate by Date:
Prev: Re: [External] RE: using macros in Action, Execute Command Paul Sichta via Tech-talk
Next: MongoDB Implementation using EPICS 7 Patel, Anjali Himanshukumar 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: Output records in StreamDevice Zimoch Dirk via Tech-talk
Next: MongoDB Implementation using EPICS 7 Patel, Anjali Himanshukumar 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, 21 Mar 2023 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·