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: "duty cycle" records
From: Žiga Oven via Tech-talk <tech-talk at aps.anl.gov>
To: Gerrit Kühn <gerrit.kuehn at aei.mpg.de>
Cc: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Thu, 23 Nov 2023 09:42:49 +0000
Hey Geritt,

I see where the problem with my proposal is. I didn't foresee the user interaction with setting the delay and thus processing the record...

My suggestion would still be to have a dedicated record that holds the duration value (and is appropriately named and thus better documented than just a field in the record) and maybe have calcout record read the value and push it to the counter record when the reset happens. 

With this you can also limit the user to enter the length of the countdown to the allowed range only, by specifying the DRVH and DRVL values of the AO record. 

Hope this helps,

Žiga


> -----Original Message-----
> From: Gerrit Kühn <gerrit.kuehn at aei.mpg.de>
> Sent: Thursday, November 23, 2023 10:19 AM
> To: Žiga Oven <ziga.oven at cosylab.com>
> Cc: tech-talk at aps.anl.gov
> Subject: Re: "duty cycle" records
> 
> Am Thu, 23 Nov 2023 08:38:59 +0000
> schrieb Žiga Oven <ziga.oven at cosylab.com>:
> 
> Hello Žiga,
> 
> I had tried that first, but couldn't get the "only on reset" part working:
> 
> ---
> record (ao, "$(CHAN)_DUTY_CYC_TIM1") {
>   field (DESC, "duty cycle time 1")
>   field (VAL, "10")
>   field (OUT, "$(CHAN)_DUTY_CYC1")
>   field (PINI, "YES")
>   field (SCAN, "Passive")
> }
> 
> record (ao, "$(CHAN)_DUTY_CYC_TIM2") {
>   field (DESC, "duty cycle time 2")
>   field (VAL, "20")
>   field (OUT, "$(CHAN)_DUTY_CYC2")
>   field (SCAN, "Passive")
> }
> 
> record (calcout, "$(CHAN)_DUTY_CYC1") {
>   field (DESC, "duty cycled counter 1")
>   field (CALC, "VAL-1")
>   field (OUT, "$(CHAN)_DUTY_RESET2 PP")
>   field (OOPT, "Transition To Zero")
>   field (SCAN, "1 second")
> }
> 
> record (calcout, "$(CHAN)_DUTY_CYC2") {
>   field (DESC, "duty cycled output 2")
>   field (CALC, "VAL-1")
>   field (OUT, "$(CHAN)_DUTY_RESET1 PP")
>   field (OOPT, "Transition To Zero")
>   field (SCAN, "1 second")
> }
> 
> record (calcout, "$(CHAN)_DUTY_RESET1") {
>   field (DESC, "reset cycle counter 1")
>   field (INPA, "$(CHAN)_DUTY_CYC_TIM1")
>   field (CALC, "A")
>   field (OUT, "$(CHAN)_DUTY_CYC1")
>   field (SCAN, "Passive")
> }
> 
> record (calcout, "$(CHAN)_DUTY_RESET2") {
>   field (DESC, "reset cycle counter 2")
>   field (INPA, "$(CHAN)_DUTY_CYC_TIM2")
>   field (CALC, "A")
>   field (OUT, "$(CHAN)_DUTY_CYC2")
>   field (SCAN, "Passive")
> }
> ---
> 
> 
> This is pretty much what you proposed as far as I understand? This does
> what I need, but you have to take care when changing TIM1 or TIM2 as it
> gets at once pushed out to the respective CYC record. This is fine for the
> one being "active" (running on positive numbers) but it will screw up
> everything if you change the one running on negative numbers.
> 
> So my idea was that having the timing values in the INP/A fields of the CYC
> records lets you change them independently of the running cycles, they
> will only be picked up when the reset record is processed (the action
> records are still dummies that just count how often they are called):
> 
> 
> ---
> record (calcout, "$(CHAN)_DUTY_CYC1") {
>   field (DESC, "duty cycled counter 1")
>   field (VAL, "10")  # 1st cycle time
>   field (INPA, "10") # cycle time 1
>   field (CALC, "VAL-1")
>   field (OUT, "$(CHAN)_DUTY_RESET2 PP")
>   field (OOPT, "Transition To Zero")
>   field (SCAN, "1 second")
> }
> 
> record (calcout, "$(CHAN)_DUTY_CYC2") {
>   field (DESC, "duty cycled output 2")
>   field (INPA, "20") # cycle time 2
>   field (CALC, "VAL-1")
>   field (OUT, "$(CHAN)_DUTY_RESET1 PP")
>   field (OOPT, "Transition To Zero")
>   field (SCAN, "1 second")
> }
> 
> record (calcout, "$(CHAN)_DUTY_RESET1") {
>   field (DESC, "reset cycle counter 1")
>   field (INPA, "$(CHAN)_DUTY_CYC1.A")
>   field (CALC, "A")
>   field (OUT, "$(CHAN)_DUTY_CYC1")
>   field (SCAN, "Passive")
>   field (FLNK, "$(CHAN)_DUTY_ACT1")
> }
> 
> record (calcout, "$(CHAN)_DUTY_RESET2") {
>   field (DESC, "reset cycle counter 2")
>   field (INPA, "$(CHAN)_DUTY_CYC2.A")
>   field (CALC, "A")
>   field (OUT, "$(CHAN)_DUTY_CYC2")
>   field (SCAN, "Passive")
>   field (FLNK, "$(CHAN)_DUTY_ACT2")
> }
> 
> record (calcout, "$(CHAN)_DUTY_ACT1") {
>   field (DESC, "duty cycle action 1")
>   field (CALC, "VAL+1")
>   field (SCAN, "Passive")
> }
> 
> record (calcout, "$(CHAN)_DUTY_ACT2") {
>   field (DESC, "duty cycle action 2")
>   field (CALC, "VAL+1")
>   field (SCAN, "Passive")
> }
> ---
> 
> 
> 
> > Why not have an AO record that holds the timeout duration value and
> > pushes it to the calc record only on reset?
> >
> > record(ao, "$(CHAN)_DUTY_CYC_LEN") {
> >   field(VAL, "10")
> >   field(OUT, "$(CHAN)_DUTY_CYC.VAL")
> >   field(PINI, "YES")
> > }
> >
> > record (calcout, "$(CHAN)_DUTY_CYC") {
> >    field (DESC, "duty cycle")
> >    field (CALC, "VAL-1")
> >    field (OUT, "$(CHAN)_DUTY_CYC_LEN.PROC")
> >    field (OOPT, "Transition To Zero")
> >    field (SCAN, "1 second")
> > }
> >
> > The only drawback of the approach above, is that while the countdown
> > will have 10 values [1..10] the DUTY_CYC.VAL will never be reported as 0
> > on the camonitor.
> >
> > Best regards,
> >
> > Žiga
> > > -----Original Message-----
> > > From: Tech-talk <tech-talk-bounces at aps.anl.gov> On Behalf Of Gerrit
> > > Kühn via Tech-talk
> > > Sent: Thursday, November 23, 2023 8:35 AM
> > > To: Rolf Keitel via Tech-talk <tech-talk at aps.anl.gov>
> > > Subject: Re: "duty cycle" records
> > >
> > > Am Wed, 22 Nov 2023 11:06:46 -0800
> > > schrieb Rolf Keitel via Tech-talk <tech-talk at aps.anl.gov>:
> > >
> > >
> > > Hello Rolf,
> > >
> > > This works, thanks.
> > > However, now I wonder how to properly change these settings while
> > > running. When I write a different value (using caput) into .INPA, this
> > > doesn't get picked up by .A. I can write to .A directly, but I had
> > > actually expected this to be read from .INPA on each cycle. Somehow it
> > > feels wrong to have .A and .INPA not in sync.
> > >
> > >
> > > cu
> > >   Gerrit
> > >
> > >
> > > > Hi Gerrit,
> > > >
> > > > You cannot point a link field at another link field.
> > > >
> > > > If you set in the second record
> > > >
> > > > field (INPA, "$(CHAN)_DUTY_CYC.A")
> > > >
> > > > you should get what you want. - rolf -
> > > >
> > > > On 2023-11-22 8:07 a.m., Gerrit Kühn via Tech-talk wrote:
> > > > > Am Wed, 22 Nov 2023 16:23:29 +0100
> > > > > schrieb Gerrit Kühn via Tech-talk<tech-talk at aps.anl.gov>:
> > > > >
> > > > >>> You need to put PP at the end of your OUT link to force the
> > > > >>> second record to process.
> > > > >> Yes, that was the mssing bit. Thanks to both of you for pointing
> > > > >> this out to me.
> > > > > Last question for today (hopefully). I have these records now:
> > > > >
> > > > > ---
> > > > > record (calcout, "$(CHAN)_DUTY_CYC") {
> > > > >    field (DESC, "duty cycled output")
> > > > >    field (VAL,  "10") # 1st cycle time
> > > > >    field (INPA, "10") # cycle time
> > > > >    field (CALC, "VAL-1")
> > > > >    field (OUT, "$(CHAN)_DUTY_RESET PP")
> > > > >    field (OOPT, "Transition To Zero")
> > > > >    field (SCAN, "1 second")
> > > > > }
> > > > >
> > > > > record (calcout, "$(CHAN)_DUTY_RESET") {
> > > > >    field (DESC, "reset cycle counter")
> > > > >    field (VAL, "11")
> > > > >    field (INPA, "$(CHAN)_DUTY_CYC.INPA")
> > > > >    field (CALC, "A")
> > > > >    field (OUT, "$(CHAN)_DUTY_CYC")
> > > > >    field (SCAN, "Passive")
> > > > > }
> > > > > ---
> > > > >
> > > > > The second record gets processed when the counter in the first
> > > > > record reaches zero. However, it only resets the counter as
> > > > > desired when the INPA field in the second record is defined
> > > > > constant (i.e., INPA, "10" directly in the second record).
> > > > > My original idea as written above was to get the INPA field of the
> > > > > second record from the INPA field of the first record. However,
> > > > > this does not work. camonitor reports this as "LINK INVALID"
> > > > > although I can use caget on the reported link just fine (and get
> > > > > the correct value). Again, this feels like I'm missing a simple
> > > > > thing...
> > > > >
> > > > >
> > > > > cu
> > > > >    Gerrit

Replies:
Re: "duty cycle" records Gerrit Kühn via Tech-talk
References:
"duty cycle" records Gerrit Kühn via Tech-talk
Re: "duty cycle" records Ralph Lange via Tech-talk
Re: "duty cycle" records Gerrit Kühn via Tech-talk
Re: "duty cycle" records Ralph Lange via Tech-talk
Re: "duty cycle" records Gerrit Kühn via Tech-talk
Re: "duty cycle" records Mark Rivers via Tech-talk
Re: "duty cycle" records Gerrit Kühn via Tech-talk
Re: "duty cycle" records Gerrit Kühn via Tech-talk
Re: "duty cycle" records Rolf Keitel via Tech-talk
Re: "duty cycle" records Gerrit Kühn via Tech-talk
RE: "duty cycle" records Žiga Oven via Tech-talk
Re: "duty cycle" records Gerrit Kühn via Tech-talk

Navigate by Date:
Prev: Re: "duty cycle" records Gerrit Kühn via Tech-talk
Next: Re: "duty cycle" records Gerrit Kühn 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: "duty cycle" records Gerrit Kühn via Tech-talk
Next: Re: "duty cycle" records Gerrit Kühn 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, 23 Nov 2023 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·