Hi Paul,
you may see working example of calc record here:
https://github.com/star-controls/gasread/blob/master/gasread.py
It is done by a utility function 'make_fm_calc' on line 68,
which is then used in 'gasread_tof' class on lines 61 and 62.
The IPNA and INPB fields are set as record names (string) with
maximize severity MS flag. Forward link FLNK is set from both
inputs.
Hope it helps, cheers,
Jarda
On Fri, 5 Feb 2021, Paul Nord via Tech-talk wrote:
>>> dbpr("XX:CALC",2)
A: 0 ACKS: NO_ALARM ACKT: YES ADEL: 0
ASG: B: 42 BKPT: 00 C: 0
CALC: A*B D: 0 DESC: DISA: 0
DISP: 0 DISS: NO_ALARM DISV: 1 DTYP: <nil>
E: 0 EGU: EVNT: 0 F: 0
FLNK:CONSTANT 0 G: 0 H: 0 HHSV: NO_ALARM
HIGH: 0 HIHI: 0 HOPR: 0 HSV: NO_ALARM
HYST: 0 I: 0 INPA:DB_LINK XX:VALUE NPP NMS
INPB:CONSTANT INPC:CONSTANT INPD:CONSTANT INPE:CONSTANT
INPF:CONSTANT INPG:CONSTANT INPH:CONSTANT INPI:CONSTANT
INPJ:CONSTANT INPK:CONSTANT INPL:CONSTANT J: 0
K: 0 L: 0 LCNT: 0 LLSV: NO_ALARM
LOLO: 0 LOPR: 0 LOW: 0 LSV: NO_ALARM
MDEL: 0 NAME: XX:CALC NSEV: NO_ALARM NSTA: NO_ALARM
PACT: 0 PHAS: 0 PINI: NO PREC: 0
PRIO: LOW PUTF: 0 RPRO: 0 SCAN: Passive
SDIS:CONSTANT SEVR: INVALID STAT: UDF TIME: <undefined>
TPRO: 0 TSE: 0 TSEL:CONSTANT UDF: 1
VAL: 0
>>> dbpr("XX:VALUE",2)
ACKS: NO_ALARM ACKT: YES ADEL: 0 AOFF: 0
ASG: ASLO: 1 BKPT: 00 DESC:
DISA: 0 DISP: 0 DISS: NO_ALARM DISV: 1
DTYP: Python EGU: EGUF: 0 EGUL: 0
EOFF: 0 ESLO: 1 EVNT: 0 FLNK:DB_LINK XX:CALC
HHSV: NO_ALARM HIGH: 0 HIHI: 0 HOPR: 0
HSV: NO_ALARM HYST: 0 INP:INST_IO @XX:VALUE
LCNT: 0 LINR: NO CONVERSION LLSV: NO_ALARM LOLO: 0
LOPR: 0 LOW: 0 LSV: NO_ALARM MDEL: 0
NAME: XX:VALUE NSEV: NO_ALARM NSTA: NO_ALARM PACT: 0
PHAS: 0 PINI: NO PREC: 0 PRIO: LOW
PUTF: 0 ROFF: 0 RPRO: 0 RVAL: 0
SCAN: I/O Intr SDIS:CONSTANT SEVR: INVALID SIML:CONSTANT
SIMM: NO SIMS: NO_ALARM SIOL:CONSTANT SMOO: 0
STAT: UDF SVAL: 0 TIME: <undefined> TPRO: 0
TSE: 0 TSEL:CONSTANT UDF: 0 VAL: 7
>>>
On Fri, Feb 5, 2021 at 1:48 PM Johnson, Andrew N. <anj at anl.gov> wrote:
Sounds like you still need a Python softIoc expert then.
It might be helpful if you post the output of
dbpr("XX:CALC", 2)
and
dbpr("XX: VALUE", 2)
though so we can see what it sets all the fields to though.
- Andrew
On Feb 5, 2021, at 1:39 PM, Paul Nord <Paul.Nord at valpo.edu> wrote:
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. <anj at anl.gov> wrote:
Hi Paul,
On Feb 5, 2021, at 12:23 PM, Paul Nord via Tech-talk <tech-talk at aps.anl.gov> 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.
--
Complexity comes for free, simplicity you have to work for.
- 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
- Re: Creating calc record in Python softioc Paul Nord via Tech-talk
- Re: Creating calc record in Python softioc Johnson, Andrew N. via Tech-talk
- Re: Creating calc record in Python softioc Paul Nord via Tech-talk
- Navigate by Date:
- Prev:
RE: Dynamic user limits in softMotor Mark Rivers via Tech-talk
- Next:
Re: Re: Re: Re: RE: Re: Re: modbus write registers error to Pilz PLC 高振华 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
2023
2024
2025
- Navigate by Thread:
- Prev:
Re: Creating calc record in Python softioc Paul Nord via Tech-talk
- Next:
Dynamic user limits in softMotor Laurenz Rettig 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
2023
2024
2025
|