Hi Žiga & Ralph,
Thanks for the input and references.
I quickly tried options 1 and 2, and indeed both work. I will also give option 3 and let you know if I have issues.
With option 2 knowledge of the mapping is indeed useful here, I guess I would need to introduce another record to handle this mapping if I wanted to set it as "1 second" instead of setting the value to 6. Or is there a way to import the mapping in the db file to avoid this redundancy?
Another question, if I use a combination of option 1 and 2, they fall out of sync. For example, if I do a put on the ao record (option 2) and then a put on the SCAN field (option 1) doing a get for the ao record will not return the latest value, i.e. scan:calc1.SCAN != scan:ao1. Is there any way to keep them in sync, or to restrict changes directly to the SCAN field (option 1)?
Kind regards,
Tom
-----Original Message-----
From: Žiga Oven <ziga.oven at cosylab.com>
Sent: Wednesday, May 19, 2021 2:47 PM
To: tech-talk at aps.anl.gov; Stainer Tom <Tom.Stainer at sckcen.be>
Subject: Re: Control SCAN field with ai record
Hi Tom,
You can control the scan rate of the record via caput's directly:
caput <record_name>.SCAN <scan_rate>
where the scan rate can be a string or an number value that represents
the string (more details here:
https://epics.anl.gov/base/R7-0/5-docs/menuScan.html)
If you want to control this from another record you could use an AO
record and link the OUT of this record to SCAN field of the CALC record
-----
record(ao, "scan:ao1") {
field(VAL, 7)
field(OUT, "scan:calc.SCAN PP")
}
record(calc, "scan:calc") {
field(SCAN, "1 second") # valid only until scan:ao1 gets processed
field(CALC, "<calculation>")
}
-----
The values for the AO record must be between 0 and 9 for the default
menuScan.dbd.
Another option a bit more verbose would be to use an MBBO record, where
you can implement the menuScan from the link above and use strings for
control but this would be the same as writing to the SCAN field (maybe
useful if you want to change SCAN field of multiple records at the same
time ...
----
record(mbbo, "scan:menu") {
field(FLNK, "scan:dfanout")
field(ZRVL, "0")
field(ZRST, "Passive")
field(ONVL, "1")
field(ONST, "Event")
field(TWVL, "2")
field(TWST, "I/O Intr")
field(THVL, "3")
field(THST, "10 second")
field(FRVL, "4")
field(FRST, "5 second")
field(FVVL, "5")
field(FVST, "2 second")
field(SXVL, "6")
field(SXST, "1 second")
field(SVVL, "7")
field(SVST, ".5 second")
field(EIVL, "8")
field(EIST, ".2 second")
field(NIVL, "9")
field(NIST, ".1 second")
}
record(dfanout, "scan:dfanout") {
field(DOL, "scan:menu")
field(OMSL, "closed_loop")
field(OUTA, "scan:calc.SCAN PP")
field(OUTB, ...)
}
record(calc, "scan:calc") {
field(SCAN, "1 second") # valid only until scan:menu gets processed
field(CALC, "<calculation>")
}
----
Now the last database will only work as expected if the menuScan.dbd
hasn't been modified...
Best regards,
Žiga
On 19. 05. 2021 14:20, Stainer Tom via Tech-talk wrote:
> Dear Epics Community,
>
> I have a simple problem that I am sure has been asked before but my previous searches came up blank on tech-talk, so please forgive me if it is trivial.
>
> I have a simple database, consisting of two records, as shown below. This works fine, and is one of the most elementary databases you can conceive of, however, you will notice the two commented out lines.
> My desire is to have the SCAN field controlled by the "scan:ai1" PV, so I can do some *caput*s to control the scan, say to go from 0.1 second to 2 seconds.
> My commented out lines obviously don't work, but I wondered how this would be possible using the database file.
>
> Does anyone have any tips on how to solve this problem? (Or please point me to previous/similar solutions.)
>
> # mydb.db
> -------------------------------
> record(ai, "scan:ai1") {
> field(INP, ".1")
> }
>
> record(calcout, "scan:calc1"){
> # field(SCAN, "B second")
> # field(INPB, "scan:ai1")
> field(SCAN, ".5 second")
> field(INPA, "scan:calc1.VAL")
> field(CALC, "(A<20)?(A+1):0")
> }
> -------------------------------
>
> Kind regards,
> Tom
>
- Replies:
- Re: [EXTERNAL] Control SCAN field with ai record Hartman, Steven via Tech-talk
- References:
- Control SCAN field with ai record Stainer Tom via Tech-talk
- Re: Control SCAN field with ai record Žiga Oven via Tech-talk
- Navigate by Date:
- Prev:
Re: Control SCAN field with ai record Žiga Oven via Tech-talk
- Next:
Re: [EXTERNAL] Control SCAN field with ai record Hartman, Steven 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
2023
2024
- Navigate by Thread:
- Prev:
Re: Control SCAN field with ai record Žiga Oven via Tech-talk
- Next:
Re: [EXTERNAL] Control SCAN field with ai record Hartman, Steven 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
2023
2024
|