Skip to content

Commit 0633d74

Browse files
committed
Add use cases
1 parent 7f14ed0 commit 0633d74

File tree

4 files changed

+58
-5
lines changed

4 files changed

+58
-5
lines changed

docs/explanations/use-cases.rst

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
Why use pythonIOC?
2+
==================
3+
4+
EPICS IOCs are flexible and modular, why do we need to wrap it in Python? This
5+
page attempts to answer that question and list a few good use-cases for it.
6+
7+
Calculating PVs from other values
8+
---------------------------------
9+
10+
Some use cases require PVs to be calculated from multiple sources. This is
11+
possible in EPICS records with ``calc`` or ``aSub`` records, but pythonIoc
12+
allows you to write this as:
13+
14+
.. code-block::
15+
16+
import numpy as np
17+
from cothread.catools import caget, camonitor
18+
from softioc import builder
19+
20+
# The PVs we want to average and their initial values
21+
PVs = [f"DEVICE{i}:CURRENT" for i in range(100)]
22+
values = np.array(caget(PVs))
23+
24+
# The PV we want to serve
25+
avg = builder.aOut("AVERAGE:CURRENT", np.mean(values))
26+
27+
# Make a monitor on the PVs to keep the value up to date
28+
def update_avg(value: float, index: int):
29+
values[index] = value
30+
avg.set(np.mean(values))
31+
32+
camonitor(PVs, update_avg)
33+
34+
ADD THE CONCENTRATOR USE CASE HERE
35+
36+
Dynamically created PVs
37+
-----------------------
38+
39+
Other use cases will do something like:
40+
41+
.. code-block::
42+
43+
connect to device
44+
make PVs
45+
46+
ADD THE PANDA USE CASE HERE
47+
48+
Existing Python Support
49+
-----------------------
50+
51+
It may be that you have specific device support written in Python that you wish
52+
to expose as PVs.
53+
54+
NEED A GOOD EXAMPLE HERE
55+

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ About the documentation
5959
:name: explanations
6060
:maxdepth: 1
6161

62-
explanations/use-cases
62+
explanations/why-use-pythonIoc
6363

6464
.. rst-class:: no-margin-after-ul
6565

docs/tutorials/creating-an-ioc.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Creating an IOC
22
===============
33

4+
THIS NEEDS UPDATING
5+
46
Using ``pythonSoftIoc``
57
-----------------------
68

0 commit comments

Comments
 (0)