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: Rolf Keitel via Tech-talk <tech-talk at aps.anl.gov>
To: tech-talk at aps.anl.gov
Date: Thu, 23 Nov 2023 08:57:41 -0800
Title: signature text

Hello Gerrit,

here is another solution for your dutycycle which uses one calcout record (DUTYCYCLE) and one analog input record (CYCLERESET).

I added the TRIGGERED for demonstration purpose only. It gets processed every time the TEST:DUTYCYCLE transitions to 0.


DUTYCYCLE reads the value of CYCLERESET every second via its INPA link.
The CALC _expression_ compares its A value to the value of A from the previous scan, which is acquired via tha INPB link.
If A changes, it is used as a new VAL for DUTYCYLE, otherwise VAL is counted down. 

Because DUTYCYLE.DOPT is set to "Use OCAL", the DUTYCYLE.OUT link sends the value calculated by the DUTYCYLE.OCAL _expression_ (here a constant 1)  every time when VAL transitions to 0.

If you want the DUTYCYLE counter always to count down to 0 before accepting a new starting value, you can simplify the CALC _expression_ to VAL>0?VAL-1:A

Note that DUTYCYLE.VAL can be changed by a Channel Access put at any time. If you want to prevent this, set DUTYCYCLE.DISP to 1.

#= database generated by tdct V3.1.8 #= on 2023-11-23 08:31

record(calcout,"DUTYCYCLE") { field(OOPT,"Transition To Zero") field(SCAN,"1 second") field(DESC,"duty cycled output") field(CALC,"A#B?A:(VAL>0?VAL-1:A)") field(DOPT,"Use OCAL") field(OCAL,"1") field(OUT,"TEST:TRIGGERED.PROC") field(INPB,"TEST:DUTYCYCLE.LA") field(INPA,"TEST:CYCLERESET.VAL") } record(ai,"CYCLERESET") { field(LINR,"LINEAR") field(EGU,"volts") field(ASLO,"0.0000000e+00") field(DESC,"analog input record") } record(calc,"TRIGGERED") { field(CALC,"A+1") field(DESC,"calculation record") field(EGU,"units") field(INPA,"TEST:TRIGGERED.VAL") }

--
Rolf Keitel, Ph.D.
Researcher Emeritus
e-mail: rolf at triumf.ca
------ Home ------
4158 West 13th Ave
Vancouver, BC, V6R 2T6
604 228 0594
------ Office: ------
604 222 7453
TRIUMF Canada’s particle accelerator centre
4004 Wesbrook Mall Vancouver, BC, V6T 2A3
www.triumf.ca | Twitter | Facebook | Instagram

TRIUMF is located on the traditional, ancestral, and unceded territory of the xʷməθkʷəy̓əm (Musqueam) people,
who for millennia have passed on their culture, history, and traditions from one generation to the next on this site.

Replies:
Re: "duty cycle" records Ralph Lange via Tech-talk
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
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 Ralph Lange 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 Ralph Lange 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, 24 Nov 2023 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·