http://www.perlmonks.org?node_id=1074556


in reply to Perl Code To Control Industrial Applications?



I have a home brewery I'd like to tinker with, and I'd like to build various process controls into my brew system. I'd like to be able to monitor temperatures, turn heating elements on and off, run timers, control systems remotely (well, inside my house), set alarms, and more. Can perl do this? If perl can't handle this, what type of coding would I be looking at to handle industrial applications?

Next, what is the piece of equipment that would I would connect thinks like my temperature probes, etc, to. There will naturally be some hard wiring utilized for things like a control box with switches to turn on the elements etc, but what piece of hardware would I need to connect to monitor my brewhouse and control the different elements in my brew house? Thanks,

Jeff
I would NOT use Perl in a industrial safety/property damage situation. First of all, you need an event loop. Signals are unreliable and filled with race conditions. What will happen if you have a kernel panic that leaves a heater relay energized because the pin controlling the relay is stuck on? If you use solenoids for fluid transfer, what happens when it is electrically stuck open? Pressure safety limit systems need to be mechanical and generally accepted industrial/commercial parts with a traceable manufacturer to sue if your 100 PSI safety valve doesnt open until 900 PSI and your tank burst at 800 PSI and now the FBI is investigating WTF you were doing. Think McMaster or Grainger.

What happens when a heater is stuck on, pressure valve opens and all water is boiled out dry over a number of hours, the tanks and pipes and frame of the tank reach 100s of degrees, will your wood or vinyl floor ignite from the heat of the frame legs touching the floor?

Since you are brewing, now in some cases you have flammable alcohol vapor in the air if there is an accident.

To learn what happens when your fluid, heat, and pressure machines have failures, watch a couple video reports from http://www.youtube.com/user/USCSB/videos. Some of the case reports involve software or rely on a "light switch on the wall controls the burner and remembering to turn it off for the night". Also read http://en.wikipedia.org/wiki/Therac_25 to learn what happens when you write your own event loop for a life safety system and have no idea what you are doing.

I've researched using Perl for novelty robot toys many years ago, I didn't find anything that didn't ship as a closed source C library from the IO board's mfg (National Instruments). So no Perl interface.

Regarding Arduino, I am not sure I trust it for anything but toys. With one of its predecessors I worked hands on with, which was toy/educational rated, the boards froze during uploaded or during operation, especially when there was a input problem and the operator jiggled the control joystick (event loop got into an impossible state I believe) and had the board/machine had to be power cycled for to respond for input again. What happens when short circuit happens on another circuit in the building and the lights dip? or an induction motor starts up or stalls? Relays have this problem which can fry controls http://en.wikipedia.org/wiki/Flyback_diode. What if you have a winter coat that generates crazy amounts of static, and you take the coat off then touch or get near a wire that leads to an IO pin?

I have such a problem. If I touch the plastic of my laptop, I usually hear a zap as it dischages. Laptop is fine, since I'm pretty sure the plastic case is slightly conductive and the laptop was zapped repeatedly in a lab to make sure you can't kill it in the field (but they position the electrodes only where the industry standard document says, not paying attention to the most vulnerable locations). If I touch the serial port on the back and the spark hits the serial port, laptop freezes (with audio stuttering in a loop if it was playing music) until a power cycle. Those are the kinds of things you need worry about.

In CS, when you fail, just hit the reset button, say we lost the data, and make a twitter post saying tough luck customers goto lunch and come back and it should be up by then. In ME/hard engineering, when you fail, you have lawsuits, clipboards holding PHBs, and badges with or without guns showing up looking for blood.