Skip to content

DiamondLightSource/pythonSoftIOC

Repository files navigation

pythonSoftIOC

Code CIDocs CITest CoverageLatest PyPI versionApache License

This module allows an EPICS IOC with Python Device Support to be run from within the Python interpreter. Records can be programmatically created and arbitrary Python code run to update them and respond to caputs. It supports cothread and asyncio for concurrency. PVs are served over Channel Access and PVAccess.

PyPIpip install softioc
Source codehttps://github.com/DiamondLightSource/pythonSoftIOC
Documentationhttps://DiamondLightSource.github.io/pythonSoftIOC
Changeloghttps://github.com/DiamondLightSource/pythonSoftIOC/blob/master/CHANGELOG.rst

A simple example of the use of this library:

# Import the basic framework components.fromsoftiocimportsoftioc, builderimportcothread# Set the record prefixbuilder.SetDeviceName("MY-DEVICE-PREFIX") # Create some recordsai=builder.aIn('AI', initial_value=5) ao=builder.aOut('AO', initial_value=12.45, on_update=lambdav: ai.set(v)) # Boilerplate get the IOC startedbuilder.LoadDatabase() softioc.iocInit() # Start processes required to be run after iocInitdefupdate(): whileTrue: ai.set(ai.get() +1) cothread.Sleep(1) cothread.Spawn(update) # Finally leave the IOC running with an interactive shell.softioc.interactive_ioc(globals())

See https://DiamondLightSource.github.io/pythonSoftIOC for more detailed documentation.

About

Embed an EPICS IOC in a Python process

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 10