Python Finite State Machines for EPICS
Project description
pysmlib
Python Finite State Machines for EPICS
Developers: Damiano Bortolato - Davide Marcato @ Laboratori Nazionali di Legnaro - INFN
Main Repository: https://github.com/darcato/pysmlib
Full documentation: https://darcato.github.io/pysmlib/docs/html/
Main features
- Easy to use and fast development of complex event based fsm - just code the states!
- Full EPICS Channel Access integration via PyEpics.
- High expandability as provided by all the libraries of Python.
- Integrated configurable logging systems.
- Convenient methods to access all the information on I/O.
- Timers can be used to execute actions after a time delay.
- Integrated watchdog logic.
- Multi-threading: each fsm is executed on a different thread, sharing I/O.
- Convenient loader to launch a daemon with multiple fsm.
- Possibility to apply a configurable naming convention on I/O.
Installation
To install simply run:
pip install pysmlib
or download the latest release/sources from github, unpack it and run:
cd pysmlib
pip install .
Dependencies
As of today, only python 2.7 is supported. Pyepics and numpy modules are required and automatically installed by pip. Sphinx and its theme "Read the Docs" are required to build the documentation.
Example
#! /usr/bin/python
from smlib import fsmBase, loader
# FSM definition
class exampleFsm(fsmBase):
def __init__(self, name, *args, **kwargs):
super(exampleFsm, self).__init__(name, **kwargs)
self.counter = self.connect("testcounter") # connect to PV "testcounter"
self.mirror = self.connect("testmirror")
self.enable = self.connect("testenable")
self.gotoState('idle')
# idle state
def idle_eval(self):
if self.enable.rising():
self.gotoState("mirroring")
# mirroring state
def mirroring_eval(self):
if self.enable.falling():
self.gotoState("idle")
elif self.mirror.changing():
readValue = self.mirror.val()
self.mirror.put(readValue)
# Main
if __name__ == '__main__':
# load the fsm
loader.load(exampleFsm, "myFirstFsm")
# start execution
loader.start()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pysmlib-2.0.0rc2.tar.gz
(35.7 kB
view hashes)
Built Distribution
pysmlib-2.0.0rc2-py2-none-any.whl
(22.2 kB
view hashes)
Close
Hashes for pysmlib-2.0.0rc2-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 926fc74782bd0b45e4002c4c4c165e9629fdfc574258e271a2ccbc00476370b6 |
|
MD5 | 43b338c62ff6cbdce91123db493889f5 |
|
BLAKE2b-256 | b98c83c52dfdb5e11c18f39ee5d557323c28eccfb388bbbb78c6a553012f8ee5 |