EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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

Subject: Re: ASLO / AOFF scaling for ai and ao record
From: Tim Mooney <[email protected]>
To: Stefan Heim <[email protected]>
Cc: EPICS tech talk <[email protected]>
Date: Fri, 13 Jul 2007 12:39:20 -0500
Stefan Heim wrote:
Hello all,

I have a device that came with a controller from the vendor. This controller offers a TCP/IP server you can connect to and send a certain set of commands to operate the device.

Using EPICS, asyn and streamdevice, it has been close to trivial to set up a basic softIOC to operate the device (essentially a getPosition/setPosition operation).

In the streamdevice protocol file I have (among others)

getX {
        out "Joe Crds ?";
        in "Joe Crds %f %*f %*f %*f %*f %*f %*f ";
}

setX {
        out "Joe AxisAbs 1 %(VAL)f";
        in "Joe started";
}

In the database I have (among others)

record (ai, "MyIOC:X")
{
        field (SCAN, ".1 second")
        field (DTYP, "stream")
        field (INP,  "@device.proto getX MYPORT")
	# EGU, HOPR, LOPR, PREC, warning limits, ... left out for brevity
}

record (ao, "MyIOC:setX")
{
        field (SCAN, "Passive")
        field (DTYP, "stream")
        field (INP,  "@device.proto setX MYPORT")
	# EGU, DRVL, DRVH, PREC, warning limits, ... left out for brevity
}

This works like a charm, I can do "caget MyIOC:X" to get the current position and "caput MyIOC:setX <targetpos>" to drive to a target position.

Now I want these records to operate in different, linearly transformed coordinates rather than in the device's very own coordinates, let's say for example

myCoords = -20.5 * devCoords + 5.3 .

Therefore, I added

        field (ASLO, "-20.5")
        field (AOFF, "5.3")

to the ai and ao records described above; for the ai record, this had the desired effect, i.e. the record now delivers the position in transformed coordinates.

However, the ao record _ignores_ ASLO and AOFF with a streamdevice device support. Is this the intended behaviour? Or a bug in streamdevice's device support for the ao record?
I think you are *telling* the streamDevice to ignore ASLO and AOFF, by using the
format "%(VAL)f". As I read the doc, it would do what you want if you used the
format "%f". According to streamDevice/doc/ao.html, the streamDevice would,
in this case, perform the calculation
|OUTPUT_VALUE = (OVAL-AOFF)/ASLO
without converting to integer. (I.e., the streamDevice would grab the required
field values, and perform the calculation independently of the record.)
|
How are you supposed to solve the problem of linear coordinate transformations without adding a bunch of helper records (calc & calcout, or even motor) to the database?

The LINR="Slope" ESLO/EOFF scaling of the ao record would be sufficient, if only RVAL was a double rather than a long; atm if you use it, it truncates "devices coordinates" to whole numbers after doing the correct transformation.

Any suggestions?

-Stefan

Tim Mooney
Replies:
Re: ASLO / AOFF scaling for ai and ao record Stefan Heim
References:
ASLO / AOFF scaling for ai and ao record Stefan Heim

Navigate by Date:
Prev: Re: ASLO / AOFF scaling for ai and ao record Stefan Heim
Next: Re: Scan question John Sinclair
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: ASLO / AOFF scaling for ai and ao record Stefan Heim
Next: Re: ASLO / AOFF scaling for ai and ao record Stefan Heim
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  <20072008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Nov 2011 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·