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  <20212022  2023  2024  2025  2026  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  <20212022  2023  2024  2025  2026 
<== Date ==> <== Thread ==>

Subject: Re: Creating calc record in Python softioc
From: Paul Nord via Tech-talk <[email protected]>
To: "Johnson, Andrew N." <[email protected]>
Cc: EPICS tech-talk <[email protected]>
Date: Fri, 5 Feb 2021 13:39:17 -0600
Andrew,

That loads without error.  But the calculation doesn't actually work.
#!/usr/local/epics/modules/pythonIoc/pythonIoc

from softioc import softioc, builder
builder.SetDeviceName('XX')
rec = builder.aIn('VALUE',VAL=3)
calc = builder.records.calc('CALC', CALC = 'A*B', INPA = rec, B = 42)
rec.FLNK = builder.PP(calc)

#run the ioc
builder.LoadDatabase()
softioc.iocInit()

#start the ioc shell
softioc.interactive_ioc(globals())
===========
$ caput "XX:VALUE" 7
Old : XX:VALUE                       3
New : XX:VALUE                       7
$ caget "XX:CALC"
XX:CALC                        0
===========
>> dbpr("XX:CALC")
A: 0                ASG:                B: 42               C: 0                
CALC: A*B           D: 0                DESC:               DISA: 0            
DISP: 0             DISV: 1             E: 0                F: 0                
G: 0                H: 0                I: 0                J: 0                
K: 0                L: 0                NAME: XX:CALC       SEVR: INVALID      
STAT: UDF           TPRO: 0             VAL: 0    


On Fri, Feb 5, 2021 at 1:27 PM Johnson, Andrew N. <[email protected]> wrote:
Hi Paul,

On Feb 5, 2021, at 12:23 PM, Paul Nord via Tech-talk <[email protected]> wrote:

According to the documentation, this should work:
#!/usr/local/epics/modules/pythonIoc/pythonIoc
from softioc import softioc, builder
builder.SetDeviceName('XX')
rec = builder.aIn('VALUE')
calc = builder.records.calc('CALC', CALC = 'A*B', A = rec, B = 42)
rec.FLNK = builder.PP(calc)

I’ve never used the Python softIoc, but given this error message

AssertionError: Can't write "XX:VALUE" to field A: not a number

have you tried this instead?

calc = builder.records.calc('CALC', CALC = 'A*B', INPA = rec, B = 42)

- Andrew

-- 
Complexity comes for free, simplicity you have to work for.


Replies:
Re: Creating calc record in Python softioc Johnson, Andrew N. via Tech-talk
References:
Creating calc record in Python softioc Paul Nord via Tech-talk
Re: Creating calc record in Python softioc Johnson, Andrew N. via Tech-talk

Navigate by Date:
Prev: Re: Creating calc record in Python softioc Johnson, Andrew N. via Tech-talk
Next: Re: Creating calc record in Python softioc Johnson, Andrew N. 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  <20212022  2023  2024  2025  2026 
Navigate by Thread:
Prev: Re: Creating calc record in Python softioc Johnson, Andrew N. via Tech-talk
Next: Re: Creating calc record in Python softioc Johnson, Andrew N. 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  <20212022  2023  2024  2025  2026 
ANJ, 19 Mar 2026 · Home · News · About · Talk · Base · Modules · Extensions ·
· Distributions · Download · Documents · Links · Licensing ·