9
\$\begingroup\$

My team has decided to use a PLC for controlling an industrial process that requires simple, real-time IO to external devices with minimal processing. However, we expect the exact outputs needed to vary between runs (in fact, a given run will very rarely ever be repeated), and the operator will not have any PLC/ software programming experience.

While I can't disclose the actual product, the best analogy would be that we're designing an industrial smoothie maker, with PLC controlling precisely the opening and closing of different valves in real-time. The operator will use our software to design a custom sequence of additions of different reagents and the on/ off of relevant heavy machinery (e.g., an industrial mixer).

Here's the challenge: our current approach is to write our own compiler that translates the instructions that the operator gives (open valve A for 10 ms, open valve B for 20 ms) into ladder logic and PLC machine code. We would then directly download our self-compiled program to the PLC via serial. All of this would need to be automated so that the operator only needs to click a button after coming up with his sequence of steps.

However, despite my research, I have not found a single PLC vendor that both 1) has a compiler with API or publishes enough information about their PLC machine code to allow one to write a compiler, 2) supports direct downloading of programs to the PLC without use of the vendor's programming software (CX-programmer, Atmel studio, etc.).

I'm led to believe we might be taking the wrong approach, or at least don't know what product to look for. The i/o is simple enough to not justify the building of our own board, but the functionality we're looking for, namely PLC interaction with high level PC software, doesn't seem to be available.

Ideally, we'd like to download the entire program to the PLC at once and not be sending instructions one at a time. Execution of all instructions on the PLC (or whatever device we end up using) needs to be real time.

Are there any commercially available PLC's that support compiling and downloading of machine code, such that the entire process could be automated by a larger program? Is there any other way to download a real-time program to a PLC written by PC software written in a high level language?

\$\endgroup\$
  • \$\begingroup\$ What about using an OS and let the user edit your program code via a custom GUI und compile it, for example with GCC and then download the compiled program to your "PLC". \$\endgroup\$ – Eggi Jul 2 '18 at 5:37
  • \$\begingroup\$ Could you suggest materials or tutorials that introduce RTOS programming and principles? I'm most familiar with non-RT embedded development and traditional ladder logic, so while I'm very interested in this solution, I'm not quite sure where to start with this. \$\endgroup\$ – Dragonsheep Jul 2 '18 at 6:04
  • \$\begingroup\$ @What's an API? If it's "application program interface", then how do you compile/download through it? \$\endgroup\$ – Dmitry Grigoryev Jul 2 '18 at 10:38
  • 1
    \$\begingroup\$ @Dragonsheep Better ignore this idea. There are too many aspects which aren't industry proof like Henry Cun stated. 1st: How do you change the code before compiling? Put it somewhere in clear text? 2nd: support over decades with the OS \$\endgroup\$ – Eggi Jul 2 '18 at 11:38
11
\$\begingroup\$

You can definetely use a PLC for this. Except, you don't want to change the PLC code for each "smoothie recipe".
You should write a PLC application that reads recipes from any source, like sd cards, network storage, internal storage or even QR codes if you're feeling fancy.

Often PLC's already have a feature for this, where a recipe is a set of parameters you can load (and edit with the HMI).

real-time IO to external devices with minimal processing

Whatever you choose to use, do not invent your own PLC. It's probably not worth the time. And don't think the software or additional module is expensive, you are not able write it for that price.

\$\endgroup\$
5
\$\begingroup\$

I will assume that this is a pretty simple task for a minimal plc, rather than something using advanced industrial PLCs

I will also assume that this is industrially useful, which is to say, that the recipe should be able to be changed in 10 years time, by the customer. Also that its usefulness should survive you going out of business or moving on to new products.

Many systems will require some special piece of software to download and/or compile, as you say. In the long term , your customers will find that Windows 11,12,13 won't run the software anymore. To avoid this, you want the program to be plain ascii, sent over a serial port of some kind. This has been going for about 50 years now, and shows no sign of disappearing.

Forth is able to be "compiled" on the target, so the customer only has to send ascii to it from a terminal. It will never be obsoleted.

Part of the Forth ethos, is that you write domain specific primitives ("AddBanana", "Blend", "Pour") that your customers treat as a specific language for the product. While Forth is considered arcane by computer people, it is conceptually very easy to use for end users - this would be a valid program.

10 grams Thickener 500 grams Banana 15 seconds Hi Blend 50 grams Blueberry 5 seconds slow Blend Pour 5 seconds wait CleanCycle

As an example you could use a small Arduino based PLC and load FlashForth There are many other choices, e.g. MPEForth and an ARM -cortex based PLC

Your software is now any editor, and some program to send serial. There are standard tools for this, and long after you are gone, the customer can make it work from scratch, as it is so simple.

A failing with your whole idea, is that the customer is programming the product and can of course stuff it up by doing the wrong thing - whatever apporach you take.

Because it is just ascii files, its quite easy for you to make a fancy shell for the customer, but the product still will work without it.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the reply! Something like the Controllino you suggested is exactly what we're looking for! A minimalistic PLC where we have direct control over the software and can download programs via serial. When you say we have "many other choices", what would the relevant search terms be/ what other products do you suggest? My team is most familiar with heavy industry, so we ran out of ideas after going through the usual Siemens/ Mitsubishi/ Omron catalogues and not finding what we were looking for. \$\endgroup\$ – Dragonsheep Jul 2 '18 at 5:57
  • \$\begingroup\$ @Dragonsheep: We recommend that you wait a day or two before accepting an answer. This encourages others to write and you will get more replies and different points of view. \$\endgroup\$ – Transistor Jul 2 '18 at 6:10
  • \$\begingroup\$ If this is an interesting approach to you, and you are people who pay money for tools, expertise and support, then you might want to talk to Stephen Pelc at MPEForth. He does this sort of thing commercially. On the other hand if you are free-beer software people, then look for arduino based modules or plc's and FlashForth. \$\endgroup\$ – Henry Crun Jul 2 '18 at 6:28
  • 1
    \$\begingroup\$ I would also agree with @Transistor and Jeroen's answers: If what you need is an industrial PLC, then they are what you need. (and random Arduino plc modules are not robust enough to be factory controllers, more an inside-benign-box controller). I would tend to disagree with "get something with an OS and use GCC" type solutions as probably leading to the worst of all possible worlds. \$\endgroup\$ – Henry Crun Jul 2 '18 at 6:31
  • \$\begingroup\$ This is indeed an industrial application that we hope to sell to a client. We do hope to have the 20+ year reliability that the big industrial vendors (Mitsubishi, etc.) have demonstrated with their products, so there's some concern with going to one of these newer open-source hardware vendors. At the same time, software wise, open-source seems to give us the control we're looking for. Stephen seems to be a good person to reach out to. Thanks for the lead. \$\endgroup\$ – Dragonsheep Jul 2 '18 at 6:57
2
\$\begingroup\$

Don't mess with Arduino, etc., for an industrial application. PLCs are designed with reliability, robustness, standards and long-term support in mind. The company I work for is running at least one Texas Instruments PLC since 1987 and several others from the early 1990s. Spares are still available from industrial sources on eBay, etc.

Use a PLC and an industrial HMI with enough power to do what you require. I have recently completed a mixer job where we wanted recipe flexibility with automated and manual steps. The sequence is controlled by stepping through an array which is programmed via the HMI.

  • Step number. e.g. '5'.
  • Description. e.g. 'Auto weigh out banana', 'Manual load cherries', 'Scrape down'.
  • Mix speed (RPM). e.g. '25'.
  • Mix time (s). e.g. '120'.
  • Scrape-down required at end of step? (Y/N) e.g. 'Y'.
  • Heat required? (Y/N) e.g. 'N'.
  • Temperature (°C). e.g. '0'.

We designed the system with an array of twenty steps which is enough for the foreseeable future but could easily be expanded, if required. All settings have min and max values set in the HMI application.

This leaves the system very flexible and editable. We have a robust system with a PLC and HMI familiar and supportable by any of a huge number of companies.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the reply. The particular application we have is for automated biochemistry, so with hundreds of reagents and potentially hundreds of steps involved in the process we're automating, it's my current opinion that any kind of HMI device programming would be hopelessly complicated. \$\endgroup\$ – Dragonsheep Jul 2 '18 at 7:03
1
\$\begingroup\$

You haven't specified a budget for development hardware and software or for the per-unit cost of the deployed hardware, but if you can afford it your requirement could certainly be met using National Instruments CompactRIO hardware and LabVIEW Real-Time software.

The CompactRIO Controller is a rugged, reliable, high-performance, industrial-grade embedded controller with industry-standard certifications.

A range of I/O modules are available which plug into the controller chassis, or if your design is fixed and you want to reduce the per-unit cost, controllers and I/O are available as single boards for you to integrate with your hardware. You would write software in LabVIEW Real-Time to run on the controller and carry out the process control, and this could also serve a web-based UI for editing the process steps or could communicate with a UI program, written in LabVIEW or another language, running on a host PC. I have limited experience with PLCs but I think it's fair to say this solution would be an order of magnitude more powerful and flexible, although probably at higher cost.

Note that although the cRIO controller comes with an onboard FPGA, you don't need to buy the LabVIEW FPGA module unless you actually need to write FPGA code; it sounds as if Real-Time should be fine for your needs.

\$\endgroup\$
0
\$\begingroup\$

My suggestion is take a look at LabVIEW. I think it would satisfy the needs listed in your post. Avoid writing your compiler. That is way more work than you need to do. They are many commercial PLC's that would fit the bill. I think NI is one of the easier ones to work with. As for downloading user programs, you need to create an application to accomplish that.

http://www.ni.com/en-us/shop/labview.html

NI has a wide range of modules including AtoD, digital outputs, analog outputs, CAN interface, etc. The software is very useful for creating nice looking user interfaces. The downside is that is not cheap. If is also very different from text based programming. Some training would be required.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.