473,594 Members | 2,677 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python in Process Control?

Hello,

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...

TIA,

best regards,

Wolfgang Keller
Jul 18 '05 #1
26 7702
On 2004-09-30, Wolfgang Keller <wo************ ********@gmx.de > wrote:
is it that my know-how to use Google is insufficient or...

...does really noone use Python for industrial control applications?
I do -- I use Python to do DeviceNet stuff.
At least I didn't manage to find any publicly available
modules for such things as OPC/fieldbus communication etc...


I couldn't find any publically available DeviceNet modules for
_any_ language. That doesn't mean nobody is writing programs
that talk DeviceNet. ;)

--
Grant Edwards grante Yow! I hope the
at "Eurythmics " practice birth
visi.com control...
Jul 18 '05 #2
Wolfgang Keller wrote:
Hello,

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...


I had a go at OPC once. I had a working simple OPC client I think
(couldn't get the server working).
Basically OPC is all COM so it should be too hard with the win32com methods

David
Jul 18 '05 #3
>>>>> "Wolfgang" == Wolfgang Keller <wo************ ********@gmx.de > writes:

Wolfgang> ...does really noone use Python for industrial control
Wolfgang> applications?

People are known to do this.

Wolfgang> At least I didn't manage to find any publicly available
Wolfgang> modules for such things as OPC/fieldbus communication
Wolfgang> etc...

Such things don't necessarily float into open source. My adventures w/
OPC involved both Python and C++ code - with my current knowledge of
Python there would probably have been much less C++ code :-). OPC is
just DCOM, which should work directly w/ Python+pywin32 extensions
(used to be called win32all, which might help your googlings). Get
Mark Hammond's book Python Programming on Win32:

http://www.oreilly.com/catalog/pythonwin32/

Alternatively, you could buy/find a C library that makes OPC simple
(i.e. no need to deal w/ COM), and wrap it up in Python.

And BTW, OPC sucks. Those industrial decision makers must have smoked
lots of crack when they came up w/ the idea of using DCOM as the
integrator-facing interface that is supposed to be easy and
straightforward .

--
Ville Vainio http://tinyurl.com/2prnb
Jul 18 '05 #4
In article <du************ *@lehtori.cc.tu t.fi>,
Ville Vainio <vi***@spammers .com> wrote:
>> "Wolfgang" == Wolfgang Keller <wo************ ********@gmx.de > writes:


Wolfgang> ...does really noone use Python for industrial control
Wolfgang> applications?

People are known to do this.

Wolfgang> At least I didn't manage to find any publicly available
Wolfgang> modules for such things as OPC/fieldbus communication
Wolfgang> etc...

Such things don't necessarily float into open source. My adventures w/
OPC involved both Python and C++ code - with my current knowledge of
Python there would probably have been much less C++ code :-). OPC is
just DCOM, which should work directly w/ Python+pywin32 extensions
(used to be called win32all, which might help your googlings). Get
Mark Hammond's book Python Programming on Win32:

http://www.oreilly.com/catalog/pythonwin32/

Alternativel y, you could buy/find a C library that makes OPC simple
(i.e. no need to deal w/ COM), and wrap it up in Python.

And BTW, OPC sucks. Those industrial decision makers must have smoked
lots of crack when they came up w/ the idea of using DCOM as the
integrator-facing interface that is supposed to be easy and
straightforwar d.

Jul 18 '05 #5
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
Jul 18 '05 #6
Hello,
Such things don't necessarily float into open source.
Well, Python is pretty common in the university world, so I had thought
that quite a few people have already done lots of things with it and maybe
with a little bit of luck published one or the other basic module...

There seem to be some Python bits out there, for example MatPLC and
Lintouch use Python and some commercial products as well (PyDACHS), but
unfortunately there doesn't seem to be a more or less consistent library
for industrial automation or a coordinated effort to build up one.
OPC is just DCOM,
Well, if it is sooo easy, why has noone done a freeware twisted OPC module
yet...? >;->

To start with I "just" need to "emulate" an OPC server to play around a
little bit with a SCADA package, so everything more than importing a module
and instantiating an OPC server class with a few lines is a little bit over
my head...

(Could it be that I'm a little bit pampered by the vast Python module
collection available for other domains than industrial automation...? >:->)
which should work directly w/ Python+pywin32 extensions


I have the PythonWin IDE here at work.

Best regards,

Wolfgang Keller
Jul 18 '05 #7
Wolfgang Keller wrote:
There seem to be some Python bits out there, for example MatPLC and
Lintouch use Python and some commercial products as well (PyDACHS), but
unfortunately there doesn't seem to be a more or less consistent library
for industrial automation or a coordinated effort to build up one.


What, in your opinion, would it take to start one? I'm able to
offer the use of a server to host a web site, and would be happy
to register a domain name or something, but those are the easy
bits. Some kind of core group to get it off the group is likely
more important than a name, though sometimes threads in this
group might lead one to suspect otherwise. ;-)

-Peter
Jul 18 '05 #8
Hello,

Just out of interest - which tecan robot were you interfacing
to - every Tecan robot that I've ever programmed comes with a high level
API (Toolbox, Gemini, Logic, WinWash, Magellen). I would think however
that controlling a tecan robot in the environment that it is typically
being used in (life sciences R+D) is not industrial control (its my job
BTW!). It's not like making milk....

IMHO, I think that Python is not a suitable piece of software for
industrial control as it has poor support for bytes (a string shouldn't
be used to store bytes!) and also bit twiddling is difficult (people who
ask about his on the Python newsgroup are usually shouted at). The
other thing that is a problem for python in this is that it is very
difficult in python to make your your client is aware of all the errors
that you can throw and as you know, when controlling equipment there is
a lot of things that are out of your control (an exception that is
rarely thrown will often not be caught if the programmer never sees it
running and gets lazy).
This is why checked exceptions (as they said in Fantastic Four -
flame on!) in this area are very handy because you are forcing the
non-expert to actively think about these use cases. One thing that
python is good for in this area is comms and threading, the GIL which is
usually a pain in the arse makes multi-threaded IO heavy apps a little
easier to write - although I still spent about 2 days trying to work out
how to make a variable volatile (culminating in understanding the
threading module!). The serial module is good but I think that a model
of input and output streams with listeners/observers would make far more
sense, currently I have to make a polling loop to receive the data, the
reason for this is that a machine may send serial data with being
prompted and this obviously needs to be lexed seperatly than a <I've
done your command here is the response> communication.

Good to see that you didn't use ActiveX (if one more company
_boasts_ that their equipment comes with 'industry standard' ActiveX I
think I'm going to cry)!! Believe it or not I still have to interact
with some equipment using DDE!!!!

This is probably off topic but it's Friday afternoon!!

Cheers,

Neil

--

Neil Benn
Senior Automation Engineer
Cenix BioScience
BioInnovations Zentrum
Tatzberg 47
D-01307
Dresden
Germany

Tel : +49 (0)351 4173 154
e-mail : be**@cenix-bioscience.com
Cenix Website : http://www.cenix-bioscience.com

Jul 18 '05 #9
>>>>> "Wolfgang" == Wolfgang Keller <wo************ ********@gmx.de > writes:
OPC is just DCOM,


Wolfgang> Well, if it is sooo easy, why has noone done a freeware
Wolfgang> twisted OPC module yet...? >;->

I didn't say it is easy, it just shouldn't be harder than, say, doing
it in C++ (even if you will find more example programs in C++).

Wolfgang> To start with I "just" need to "emulate" an OPC server
Wolfgang> to play around a little bit with a SCADA package, so
Wolfgang> everything more than importing a module and
Wolfgang> instantiating an OPC server class with a few lines is a
Wolfgang> little bit over my head...

Well, I can say it's definitely not going to be that easy. You, too
will soon learn to apprecate how much OPC sucks ;-). I did implement
an OPC client library in my previous job (after which OPC was actually
quite usable), but it's proprietary.

Wolfgang> (Could it be that I'm a little bit pampered by the vast
Wolfgang> Python module collection available for other domains
Wolfgang> than industrial automation...? >:->)

Probably. Industrial automation is not necessarily "interestin g" if
you are not working there. Open industrial automation infrastructure
would be an extremely interesting avenue for academic research and
subsequent lucrative consulting, though...

--
Ville Vainio http://tinyurl.com/2prnb
Jul 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
9903
by: Alex Hunsley | last post by:
I'm running a monitoring script under linux written in python. It's nohup'ed so that I can log out and it will continue running happily and so on, but sometimes I need to kill the script before editing the source and relaunching it. Question is, what's the nicest way to kill the python process under linux? Is a simple 'kill ' the nicest way to do it, or is there a different signal I should send it? ta alex
2
2890
by: Michele Simionato | last post by:
Is there a way to send a SIGINT/KeyboardInterrupt to a Python process (knowing the pid) that works both on Unix and Windows? Michele Simionato
8
4348
by: MackS | last post by:
Hello! This question does not concern programming in python, but how to manage python processes. Is there a way to "name" a python process? At least on Linux, if I have two python programs running, they both run under the name "python" #pidof program1.py #pidof program1.py
0
1658
by: Shanon | last post by:
Hi, I would to know if there're some way to have a dump of all the threads started by a python process. I want to see the TID corresponding of each thread because I need them to get the CPU time of each thread by the command top. Thanks -- View this message in context: http://www.nabble.com/Thread-Dump-of-a-python-process-t1089322.html#a2840609
4
3141
by: yossi.kreinin | last post by:
Hi! Is there a way to save the state of a Python process for later inspection with a debugger? One way to do this is to dump core, but is the result usable for debugging with pdb (it can be debugged by gdb, which can inspect PyObjects in a CPython core, for example, but it's not much fun)? If there is no way to do this today, are there essential difficulties in implementing this on top of an OS support for "raw" core dumps?
7
1523
by: tylerca | last post by:
I'm attempting to start some process control using Python. I've have quite a bit of literature on networking, and have made some tinkering servers and clients for different protocols HTTP, FTP, etc... But now it's time for the murky web of industrial protocol. I'm looking to start with IO and servo controls via Ethernet. Questions: Is there an existing forum on this already? What protocols are the most python friendly? i.e. are...
1
6741
by: Adam Atlas | last post by:
What is the best way for a Python process (presumed to be a script run by the interpreter binary, not embedded in some other program) to restart itself? This is what I've been trying: import __main__ for path in sys.path: path += '/' + __main__.__file__ if os.access(path, os.F_OK): break else:
1
4747
by: Salim Fadhley | last post by:
Does anybody know of a python module which can do process management on Windows? The sort of thing that we might usually do with taskmgr.exe or process explorer? For example: * Kill a process by ID * Find out which process ID is locking an object in the filesystem * Find out all the IDs of a particular .exe file * Find all the details of a currently running process (e.g. given an
0
971
by: Fredrik Lundh | last post by:
projects.gg.aaron@gmail.com wrote: do you control the other process? can you make it listen to a local socket or a named pipe? </F>
0
8246
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8368
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8000
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8231
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5738
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5404
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3854
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3895
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1476
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.