HARD REAL TIME PYTHON

Hendrik van Rooyen mail at microcorp.co.za
Wed Oct 8 00:59:42 EDT 2008


"Blubaugh, David A." <dblub....elcan.com> wrote:


>I have done some additional research into the possibility of utilizing
>Python for hard real time development.  I have seen on various websites
>where this has been discussed before on the internet.  However, I was
>wondering as to how successful anyone has truly been in developing a
>program project either in windows or in Linux that was or extremely
>close to real time constraints? For example is it possible to develop a
>python program that can address an interrupt or execute an operation
>within 70 Hz or less?? Are there any additional considerations that I
>should investigate first regarding this matter??

I am running some i/o in a thing called an eBox running Slackware
Linux for which GPIO port we have made some I/O boards. 
This is a very weak machine - 500Mhz 486 without fp, 128Mb ram.
Its just cheap, which is why we are using it.

I can send it 64 bytes, which it then puts out from userland
using ctypes to do the Linux calls, and it reads 64 bytes of
input in - the actual I/O can accomodate only eight bytes of
bits in and out, but we intend to add some analogue capability
later, so the rest hits the bit bucket, and the extra reads see
bus pullup values for now.

>From my PC over the lan, it does this between 74 and 75 times
a second, reliably.

If I run it between 2 PC's, faking the I/O by writing to a disk,
I sometimes get up to 250 such "pings" per second. Going full
duplex would pass a lot more info, but you lose the stimulus-
response nature, which is kind of nice to have in a control
environment.

Its not real time, but its not exactly yesterday's stuff either.

Both PC's have more than a gig of memory and two processors,
but that is not remarkable anymore.

We have also used python to do the HMI for an Injection
Moulding machine, talking to a custom controller with
an 8031 and an ARM on it via an RS-422 link running at
115200 - and the python keeps the link fully occupied 

And this is python that is interpreting another virtual
machine assembler...

So don't be afraid - go for it!

- Hendrik

--
Real programmers disdain structured programming.  Structured
programming is for compulsive neurotics who were prematurely
toilet-trained.  They wear neckties and carefully line up
pencils on otherwise clear desks. 





More information about the Python-list mailing list