Python in Process Control?

Peter L Hansen peter at engcorp.com
Fri Oct 1 14:30:29 CEST 2004


Wolfgang Keller wrote:
> is it that my know-how to use Google is insufficient or...
> 
> ...does really noone use Python for industrial control applications?
> 
> At least I didn't manage to find any publicly available modules for such
> things as OPC/fieldbus communication etc...

The others have said mostly everything there is to say.  I just
wanted to point out a few more items to show that Python really
is used for industrial control, and is very suitable, even if
it isn't widely used, *yet*.  (And I'm sure my thoughts on this
subject are in line with Cameron's.)

While at Kaval Wireless my group used Python *extensively* for
industrial control.  I can't give much in the way of detail,
though some past postings probably contain more tidbits than
they should ;-), but we were doing lots of CAN work, talking
to equipment via GPIB, and so on.

Now that I'm back to consulting as Engenuity Corporation, I'm
working with Turnkey Automation (sorry for all the name-
dropping, but that was kinda the point of the post) on a variety
of robotic and industrial control projects *all* focusing on
the use of Python to provide vastly increased productivity,
reliability, maintainability, and flexibility.  (I believe
some wag in this newsgroup once opined that Python was good
at providing all the "ilities"...)

As one tiny example, I had to whip up a provisional driver for
a Tecan (Cavro) robot for a customer who needed to talk to it
with LabVIEW.  I spent the majority of two weeks learning
ActiveX issues from scratch, and wasted a fair bit of time trying
to do a COM server using the win32com stuff before switching
to and successfully using ctypes.  I also used the excellent
PySerial (thanks Chris!) module.

In the end, the code that represents the robot-specific aspects
of this, the protocol and command set and such, took only two
days to write.  And it worked, first time (after my log messages
allowed us to troubleshoot the customer's incorrectly wired
cable) *without ever visiting the site for testing*.  This was
for me an unprecedent occurrence in the history of my work in
software.  (For those that don't do control: code that talks
to robots *never* works the first time. :-) )

Had I done this with any of the past languages I've used for
the task, whether C, C++, Delphi, Java, I'm certain it would
have taken several times longer, probably at least as long
as two weeks.  (And I *have* done similar though simpler stuff
in each of those languages which did take much longer,
especially to debug.)

I attribute the productivity to two things, roughly equally:
Python, and test-driven development.

Cameron: let's set up that list!  If nothing else it might
encourage cowardly companies to start to share more things
via open source, such as drivers for robots, which while they
took time to develop are *not* part of a given company's core
IP and which, if they contributed them to the community,
would likely benefit from more improvements than the company's
own programmers will ever be able to make...

-Peter



More information about the Python-list mailing list