Skip to content

Commit

Permalink
Rename pyRecord into pycalcRecord
Browse files Browse the repository at this point in the history
  • Loading branch information
klemenv committed Dec 30, 2021
1 parent 6685853 commit 95b067b
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 354 deletions.
2 changes: 1 addition & 1 deletion iocBoot/iocpydev/st.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pydevioc_registerRecordDeviceDriver pdbbase

## Load record instances
dbLoadRecords("${TOP}/db/pydevtest.db")
dbLoadRecords("${TOP}/db/pyrectest.db")
dbLoadRecords("${TOP}/db/pycalcrectest.db")

cd ${TOP}/iocBoot/${IOC}

Expand Down
22 changes: 11 additions & 11 deletions PyRecord.md → pycalcRecord.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PyRecord
# pycalcRecord

PyRecord is a custom record that allows passing multiple parameters to
pycalcRecord is a custom record that allows passing multiple parameters to
Python code and returning result of executed code as record value.
Most common use case is to invoke Python function and using it's return
value. But any Python expression can be evaluated the same way, including
Expand All @@ -11,12 +11,12 @@ pass a single parameter to Python code at a time.
## Parameter fields

### Processing
PyRecord has the standard fields for specifying under what
pycalcRecord has the standard fields for specifying under what
curcuimstances the record will process. Refer to EPICS record commond
[Scan Fields](https://wiki-ext.aps.anl.gov/epics/index.php?title=RRM_3-14_dbCommon#Scan_Fields)
documentation for their description, ie. SCAN, PINI and other
processing fields. When INPx field contains a link and uses CP or CPP
subscription, the PyRecord will process when link's monitor is posted
subscription, the pycalcRecord will process when link's monitor is posted
according to [Channel Access Links](https://wiki-ext.aps.anl.gov/epics/index.php?title=RRM_3-14_Concepts#Channel_Access_Links) specification.

### Input fields
Expand Down Expand Up @@ -54,22 +54,22 @@ transfered to VAL field and the monitor is posted. In case Python code can
not be executed or throws an exception, the record alarm is set to
epicsAlarmCalc and severity is epicsSevInvalid.

### Including PyRecord support in the IOC
### Including pycalcRecord support in the IOC

In addition to linking against pydev library as explained in
[README.md](README.md#adding-pydevice-support-to-ioc), one must also include
pyRecord.dbd in the IOC as
pycalcRecord.dbd in the IOC as

```
<yourioc>_DBD += pyRecord.dbd
<yourioc>_DBD += pycalcRecord.dbd
```

## Examples

### Simple expression

```
record(py, "PyRecTest:MathExpr") {
record(py, "PyCalcTest:MathExpr") {
field(INPA, "17")
field(INPB, "3")
field(CALC, "%A%*%B%")
Expand All @@ -86,7 +86,7 @@ FTVL field.
### Adaptive parameter and return value types

```
record(py, "PyRecTest:AdaptiveTypes") {
record(py, "PyCalcTest:AdaptiveTypes") {
field(INPA, "Test:Input1 CP")
field(INPB, "Test:Input2 CP")
field(CALC, "pow(max([%A%, %B%]), 2)")
Expand All @@ -104,12 +104,12 @@ float() functions surrounding the expression.
### Trigger record alarm

```
record(py, "PyRecTest:InvalidAlarm") {
record(py, "PyCalcTest:InvalidAlarm") {
field(CALC, "unknown_function()")
}
```

When Python code fails to execute, the records' alarm is set to CALC and the
severity is set to INVALID. Python code can fail due to a syntax error,
a module or a function not defined, or a Python exception is raised.
Set TPRO field to 1 to print error details to the IOC console.
Set TPRO field to 1 to print error details to the IOC console.
6 changes: 3 additions & 3 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ CXXFLAGS += -g -ggdb -O0
LIBRARY_IOC += pydev

DBD += pydev.dbd
DBDINC += pyRecord
DBDINC += pycalcRecord

pydev_DBD += pyRecord.dbd
pydev_DBD += pycalcRecord.dbd

pydev_SRCS += asyncexec.cpp
pydev_SRCS += epicsdevice.cpp
Expand All @@ -30,7 +30,7 @@ pydev_SRCS += pydev_longout.cpp
pydev_SRCS += pydev_stringin.cpp
pydev_SRCS += pydev_stringout.cpp
pydev_SRCS += pydev_waveform.cpp
pydev_SRCS += pyRecord.cpp
pydev_SRCS += pycalcRecord.cpp

# 3.15 and above support lsi, lso and printf records
ifdef BASE_3_15
Expand Down
287 changes: 0 additions & 287 deletions src/pyRecord.cpp.bck

This file was deleted.

Loading

0 comments on commit 95b067b

Please sign in to comment.