Add README.md
This commit is contained in:
43
README.md
Normal file
43
README.md
Normal file
@ -0,0 +1,43 @@
|
||||
## Morbidissimo -- A _very soft_ IOC.
|
||||
|
||||
Consists of two parts:
|
||||
|
||||
### ModuleManager
|
||||
|
||||
A manager/runner of scripts:
|
||||
|
||||
- Checks a folder (e.g., `./scripts/`) for files `*.py`.
|
||||
- If file contains a function `run()`, this is imported and executed.
|
||||
- At a fixed interval, the function is run again (if the last call has finished). If it is still running, it will **not** be started a second time (i.e., continuous scripts also work).
|
||||
- If a file's mtime changes, its potentially running function will be killed, the script reloaded and executed again.
|
||||
|
||||
### MorIOC
|
||||
|
||||
A trivially easy to use softIOC:
|
||||
|
||||
- Uses `pcaspy` (in a slightly unintended way).
|
||||
- `serve` (output) PVs and `host` (input) PVs:
|
||||
|
||||
```python
|
||||
with MorIOC("mtest") as mor:
|
||||
while True:
|
||||
# serve MTEST:RAND1 and MTEST:RAND2
|
||||
# holding a random float and a random int
|
||||
mor.serve(
|
||||
rand1 = random(),
|
||||
rand2 = randint(10, 100)
|
||||
)
|
||||
|
||||
# host MTEST:BUCKET
|
||||
# can be filled from external via caput
|
||||
# get current value
|
||||
# serve MTEST:DOUBLED holding the doubled value
|
||||
mor.host(bucket = int)
|
||||
value = mor.get("bucket")
|
||||
mor.serve(doubled = value * 2)
|
||||
|
||||
sleep(0.5)
|
||||
```
|
||||
|
||||
- PV's data type is inferred from the value
|
||||
- Currently only supports scalar. Will add numpy arrays next...
|
Reference in New Issue
Block a user