|
1 | | -from textwrap import dedent |
| 1 | +# Import the basic framework components. |
| 2 | +from softioc import asyncio_dispatcher, builder, softioc |
2 | 3 |
|
3 | | -from caproto.server import PVGroup, ioc_arg_parser, pvproperty, run |
| 4 | +# Create an asyncio dispatcher, the event loop is now running |
| 5 | +dispatcher = asyncio_dispatcher.AsyncioDispatcher() |
4 | 6 |
|
| 7 | +# Set the record prefix |
| 8 | +builder.SetDeviceName("simulated") |
5 | 9 |
|
6 | | -class SimpleIOC(PVGroup): |
7 | | - """ |
8 | | - An IOC with three uncoupled read/writable PVs. |
| 10 | +# Create records |
| 11 | +AA = builder.aOut("A", initial_value=1.0) |
| 12 | +BB = builder.aOut("B", initial_value=1.0) |
| 13 | +CC = builder.aOut("C", initial_value=1.0) |
| 14 | +DD = builder.aOut("D", initial_value=1.0) |
| 15 | +EE = builder.aOut("E", initial_value=1.0) |
| 16 | +FF = builder.aOut("F", initial_value=1.0) |
| 17 | +GG = builder.aOut("G", initial_value=1.0) |
| 18 | +HH = builder.aOut("H", initial_value=1.0) |
| 19 | +II = builder.aOut("I", initial_value=1.0) |
| 20 | +JJ = builder.aOut("J", initial_value=1.0) |
9 | 21 |
|
10 | | - Scalar PVs |
11 | | - ---------- |
12 | | - A, B, C, D, E, F, G, H, I, J (float) |
13 | | - """ |
| 22 | +# Get the IOC started |
| 23 | +builder.LoadDatabase() |
| 24 | +softioc.iocInit(dispatcher) |
14 | 25 |
|
15 | | - A = pvproperty(value=1.0, doc="Value A") |
16 | | - B = pvproperty(value=1.0, doc="Value B") |
17 | | - C = pvproperty(value=1.0, doc="Value C") |
18 | | - D = pvproperty(value=1.0, doc="Value D") |
19 | | - E = pvproperty(value=1.0, doc="Value E") |
20 | | - F = pvproperty(value=1.0, doc="Value F") |
21 | | - G = pvproperty(value=1.0, doc="Value G") |
22 | | - H = pvproperty(value=1.0, doc="Value H") |
23 | | - I = pvproperty(value=1.0, doc="Value I") # noqa:E741 |
24 | | - J = pvproperty(value=1.0, doc="Value J") |
25 | | - |
26 | | - |
27 | | -if __name__ == "__main__": |
28 | | - ioc_options, run_options = ioc_arg_parser(default_prefix="simulated:", desc=dedent(SimpleIOC.__doc__)) |
29 | | - ioc = SimpleIOC(**ioc_options) |
30 | | - run(ioc.pvdb, **run_options) |
| 26 | +# Finally leave the IOC running with an interactive shell. |
| 27 | +# softioc.interactive_ioc(globals()) |
| 28 | +softioc.non_interactive_ioc() |
0 commit comments