0c436e4ed6f71cf3a969d312b282bb42fcefa293
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 andhost(input) PVs:
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...
Description
Languages
Python
100%