Skip to content

Commit cce7e35

Browse files
committed
Update docs wording
1 parent dc1b589 commit cce7e35

6 files changed

Lines changed: 55 additions & 41 deletions

File tree

‎docs/examples/example_records_calculate.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33

44
builder.SetDeviceName("XX-XX-XX-01")
55

6-
softioc_record = builder.aOut("VAL1", initial_value=5)
7-
iocbuilder_record = records.ao("VAL2", VAL=10)
6+
py_record = builder.aOut("VAL1", initial_value=5, on_update=print)
7+
soft_record = records.ao("VAL2", VAL=10)
88

9-
calc = records.calc("CALC", CALC="A*B", SCAN="1 second",
10-
INPA=softioc_record, INPB=iocbuilder_record)
9+
calc = records.calc("CALC", CALC="A*B", INPA=builder.CP(py_record), B=1)
10+
11+
soft_record.OUT = builder.PP(calc.B)
1112

1213
builder.LoadDatabase()
1314
softioc.iocInit()

‎docs/how-to/use-iocbuilder-records.rst‎

Lines changed: 0 additions & 27 deletions
This file was deleted.

‎docs/how-to/use-soft-records.rst‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Use soft records in an IOC
2+
==========================
3+
4+
It is possible to use records with soft device support mixed with pythonSoftIOC
5+
records (with Python device support). This allows use of ``calc``, ``fanout``
6+
and other EPICS database soft records.
7+
8+
.. literalinclude:: ../examples/example_records_calculate.py
9+
10+
The ``VAL1`` record is created in the usual pythonSoftIOC way, with Python
11+
device support. You can :meth:`~softioc.device.ProcessDeviceSupportOut.set` it,
12+
and `on_update` will be called when you ``caput`` it.
13+
14+
The ``VAL2`` record is created using the lower level
15+
:attr:`softioc.builder.records` object. You can `dbpf` it, and no Python will
16+
be called when you ``caput`` to it.
17+
18+
Note that the Device Name is shared between both kinds of records - both will
19+
have the same prefix.
20+
21+
We construct the ``calc`` record again using :attr:`softioc.builder.records`.
22+
This record will calculate ``A*B``:
23+
24+
- ``A`` is provided by the record pointed at by ``INPA``, which is
25+
``py_record``, and the `CP` link causes it to be monitored, processing
26+
``calc`` each time it updates.
27+
28+
- ``B`` is initially set to 1. When ``soft_record`` processes, it sends its
29+
value to ``calc.B``, and the `PP` link causes it to process.
30+
31+
.. note::
32+
33+
You could also use ``calc(SCAN="1 second", ...)`` instead of the `PP` and
34+
`CP` links, which would fetch the value periodically rather than just on
35+
change.
36+
37+
The output of this IOC can be examined by running this IOC in one terminal, and
38+
then modifying and running the example scripts found in `read-data-from-ioc`.
39+
Try setting the value of either ``VAL1`` or ``VAL2`` and observe the effect on
40+
the ``CALC`` output.

‎docs/index.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Table Of Contents
6161
how-to/use-asyncio-in-an-ioc
6262
how-to/make-publishable-ioc
6363
how-to/read-data-from-ioc
64-
how-to/use-iocbuilder-records
64+
how-to/use-soft-records
6565

6666
.. toctree::
6767
:caption: Explanations

‎docs/reference/api.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,12 +351,12 @@ The following attributes allow more direct access to record creation.
351351

352352
.. attribute:: records
353353

354-
This is the ``iocbuilder`` records object, and is populated with
354+
This is the `epicsdbbuilder.records` object, and is populated with
355355
functions named after each available record type. Records created with
356356
these calls are created with soft device support and Python is not involved
357357
in their processing.
358358

359-
See `../how-to/use-iocbuilder-records` for a full example of its usage.
359+
See `../how-to/use-soft-records` for a full example of its usage.
360360

361361
Finally, the following function is used to load record definitions before
362362
starting the IOC.

‎docs/tutorials/creating-an-ioc.rst‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ action.
7373

7474
.. note::
7575
The following section should only be used for debugging purposes, and not
76-
for production testing, as the functions used do not necessarily reflect
77-
what a real user would see when querying an IOC over the network.
76+
for production testing, as the functions used do not necessarily reflect
77+
what a real user would see when querying an IOC over the network.
7878
See `../how-to/read-data-from-ioc` for proper network access examples.
7979

8080
In this interpreter there is immediate access to methods defined in the
@@ -128,11 +128,11 @@ following types:
128128
``mbbo``, ``stringin``, ``stringout``, ``waveform``
129129

130130
Occasionally it may be desirable to create a soft record without ``Python``
131-
device support, particularly if any other record type is required. This can be done using
132-
the corresponding record creation functions provided as methods of
133-
:attr:`softioc.builder.records`. For example, if a ``calc`` record is required then this
134-
can be created by calling ``softioc.builder.records.calc``. See an example in
135-
`../how-to/use-iocbuilder-records`.
131+
device support, particularly if any other record type is required. This can be
132+
done using the corresponding record creation functions provided as methods of
133+
:attr:`softioc.builder.records`. For example, if a ``calc`` record is required
134+
then this can be created by calling ``softioc.builder.records.calc``. See an
135+
example in `../how-to/use-soft-records`.
136136

137137
For all records created by these methods both
138138
:meth:`~softioc.device.ProcessDeviceSupportIn.get` and

0 commit comments

Comments
 (0)