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

Subject: Re: Runtime Input Question
From: Tim Mooney <[email protected]>
To: [email protected]
Date: Tue, 17 Aug 2010 21:17:26 -0500
Hi Andrew,
 Replies embedded:

On 8/17/2010 6:13 PM, Andrew Wagner wrote:
Hey again,

I'm pretty close to having my magnet ramp code implemented but I need to know how to have a record access a user defined input during run time. For instance I want to turn a dial in MEDM to set the ramp point of the magnet. So far I've implemented a database as follows:

#Calc Coil Current

record(calc, "Current:Coil") {
field(DESC, "Coil Current")
field(SCAN, "Passive")
field(MDEL, ".1")
field(ADEL, ".1")
field(CALC, "LA + A*1/1200")
This expression won't be understood.  You could say this:
field(INPB,"Current:Coil.A")
field(CALC,"B+A*1/1200")
   field(INPA, "$(MUX):VOLT:Chan204.VAL  PP MS")
   field(PINI, "NO")
   field(EGU, "A")	
   field(SDIS, "0")
}

#Calc output and write to AG3631 Voltage programmer

record(calcout, "Voltage:Output") {
field(DESC, "Output Voltage")
field(SCAN, "1 second")
field(CALC, "Voltage:Output.VAL + (B - A)*.5/1")
This calc expression won't be understood.  You could say this:
field(INPC,"Voltage:Output.VAL")
field(CALC,"C + (B - A)*.5/1")
field(INPA, "Current:Coil.VAL PP MS")
field(INPB, "Runtime Input") # How do I link to user input?
You can either use a separate record, and point INPB at that record's VAL field, or
you can have the user write directly to Voltage:Output.B. The first solution is better
if you want to enforce limits or attach engineering units, precision, a description, etc.


The two choices can't in this case make any difference in the algorithm, because
Voltage:Output is periodically scanned. If it were "Passive", writing directly to B
from a CA client would process the calcout record whenever the user wrote, but
using the INPB link to read from a separate record would not have this effect.


   field(OOPT, "On Change")
   field(DOPT, "CALC")
   field(DTYP, "AG3631")
   field(OUT, "#L$(L) $(A) @0")
   field(PINI, "NO")
   field(EGU, "V")	
   field(SDIS, "0")

}

How do I set the INPB to link to a runtime input? I've seen an example where a "dummy" AI record is linked, but I'm not sure if there is a better way. I would also like to put some protection logic in place. For instance, I would like to calculate a V_min and V_max (functions of Current:Coil) that Voltage:Output must be between in order for the OUT link to be processed. Are there any examples of how to implement this? The documentation doesn't really have any. Thanks again for your help.

You could use a separate output record, and have two calcout record's write to its DRVH and DRVL
fields. This would clip the output at those values.








-- Tim Mooney ([email protected]) (630)252-5417 Software Services Group, Advanced Photon Source, Argonne National Lab.


Replies:
Re: Runtime Input Question Ned Arnold
References:
Runtime Input Question Andrew Wagner

Navigate by Date:
Prev: Runtime Input Question Andrew Wagner
Next: sCalcout Pierrick Hanlet
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Runtime Input Question Andrew Wagner
Next: Re: Runtime Input Question Ned Arnold
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  <20102011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·