Shop OBEX P1 Docs P2 Docs Learn Events
Tachyon based PLC implemented as a state machine — Parallax Forums

Tachyon based PLC implemented as a state machine

I want to start up an initial project to realize a PLC based on Tachyon, currently using a P1, later move it to the P2 and so on.
The idea is to define a list of states where every state corresponds to a set of output signals. A transition to another state takes place whenever a certain condition is reached. Then the outputs are changed and a new state is reached.
The PLC is list-oriented. That means for every item of a given character a list is created. Those items can be lists also. In modifying the lists the program is changed, due to the interaction possible in Tachyon at runtime such an PLC should be extremely flexible as new words can be created on the fly.
Do I have to invent the wheel or just to reinvent? Anybody knows of such a system? Thanks, ErNa

Comments

  • I have recently been thinking about the P1 as a PLC and then I thought; wouldn't this be a perfect application for Blockly?

    I am certainly not a fan of ladder logic.
  • @Mickster My thoughts exactly. I'm not surprised you answered first :). But a Tachyon looks promising.
  • I was around when the Gould Modicon was introduced and it was at huge hit because regular electricians could work with its ladder logic as opposed to the TI boolean alternative.

    Forth would be a retrograde step because Joe Schmoe would be lost.
  • Joe Schmoe is lost anyway. Always. I know what you mean. And I agree. And these guys are making far to much money for what they're worth but let us not continue along these lines :).

    @ErNa I'll be watching closely your efforts as I like the idea . I'm not promising my support software-wise, not just yet as I'm a noob but I'll keep my fingers crossed.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2020-08-26 00:30
    Unlike most conventional computer languages, the basic Forth kernel words are building blocks for application specific languages (ASL) that can also change the behavior of the compilation process itself. My first real product using Forth was in POS terminals with hardware I developed. It was obvious to me with the little bit of exposure to Forth I had previously that this was a way to build an ASL so that higher level words could be handled and described as if it were a language designed for the job. So while it is a REPL, it is also an ASL.

    At one stage I wanted to use these newer multi-level PLDs but didn't want to spend the $$$$$ for the compiler and programmer etc. So I reverse engineered the programming protocol interactively using Forth to try this and check that etc. Then I wrote the PLD compiler in Forth that just changed the way it handled console text so I was able to input equations and configurations in essentially the standard PLD language, which compiled it and programmed it at the same time. The source for this compiler was originally 50 pages of Fortran code that was reduced to a mere single page and ran on a tiny part of a little 8-bit Forth system.

    Initially I had tried to "convert" the Fortran code into Forth but it was a horrible horrible mess. However, once I started "thinking Forth" it was a piece of cake. The interactive P2 assembler uses Forth words but processes regular assembler syntax yet it is not running "an assembler program", it is still interactive Forth.

    I found the same too with industrial control as well and while Blockly has predefined blocks, and hopefully the ones you need, Forth on the other hand lets you build your "blocks". Tachyon has proved itself over the years as the go-to gets-the-job-done method for the P1 when others look promising for small demos but quickly run our of memory or run too slow etc.

    I think Joe Schmoe gets lost even with Blockly type "programming" (ahem), unless there is a block there that does what Joe wants.
  • Unlike most conventional computer languages, the basic Forth kernel words are building blocks for application specific languages (ASL) that can also change the behavior of the compilation process itself.....
    ....I found the same too with industrial control as well and while Blockly has predefined blocks, and hopefully the ones you need, Forth on the other hand lets you build your "blocks". Tachyon has proved itself over the years as the go-to gets-the-job-done method for the P1 when others look promising for small demos but quickly run our of memory or run too slow etc.

    I think Joe Schmoe gets lost even with Blockly type "programming" (ahem), unless there is a block there that does what Joe wants.

    And that's the beauty of the beast (Tachyon Forth). That's why I so desperately need to get that beast on my ugly dev board as soon as possible (and that would be today at the latest).

    Forget Joe Schmoe. He just needs very few (1 or 2) buttons he could press with the screwdriver he just happens to hold in his hand while doing so. If he's smart enough he'll put away that screwdriver he's holding and use his thumb instead. That may seem to sound rude but it's true.
  • ErNaErNa Posts: 1,742
    Read the answers in the morning and now have to look for some coffee first. Then I'll try to sketch the solution I imagine and will for sure be asking for support on how to do it in Tachyon..
    With an P2 on my desk and asseccory hardware scheduled for today and Peters boards in the advent we'll should see progress we never saw before and noone could imagine, even don't feel it's possible!
  • I've had to use solid metal industrial buttons, or "Joe buttons" if you like. Some have had knives in their hands at the time, or maybe they were hatchets, because they look like a hatchet job when you get them back. Then again some have taken to equipment with angle grinders and sledge hammers, or they pour cola into the guts of it, so it could be worse :(

    Oh, other times you get it back and there is absolutely nothing wrong with it. Despite instructions and labels that say "+24VDC" they can't work out how to connect it.

    Joe controls: 2 buttons, one marked "yes", one marked "no".
    Joe whines: it's too complicated, can't we just have one button.
  • I've had to use solid metal industrial buttons, or "Joe buttons" if you like. Some have had knives in their hands at the time, or maybe they were hatchets, because they look like a hatchet job when you get them back. Then again some have taken to equipment with angle grinders and sledge hammers, or they pour cola into the guts of it, so it could be worse :(

    Oh, other times you get it back and there is absolutely nothing wrong with it. Despite instructions and labels that say "+24VDC" they can't work out how to connect it.

    Joe controls: 2 buttons, one marked "yes", one marked "no".
    Joe whines: it's too complicated, can't we just have one button.

    @"Peter Jakacki" You've just given me a good morning laugh and I've only had three hours of sleep last night. Thanks. Now I know things are all the same everywhere in the world. At some places a bit better or a bit worse here and there but still the same.
  • From a commercial perspective, Joe Schmoe is your best friend. He's the one who recommends to his management, the product that gives him the least grief. It doesn't look good for him to have to bring in outside help @ $2,000/day. Not to mention the cost of lost production.
  • Joe whines: it's too complicated, can't we just have one button.

    I'd like to share a true experience:

    I was the founder/owner of what became the #1 producer of CNC tube benders for the US auto industry. I had a unique approach in that I had two business cards. One had the title of President and the other was Service Tech.

    I would visit the front office to discuss commercial issues and then I'd run back to the hotel and change into my service tech uniform and grab my tools.
    I would spend the rest of the day hanging out on the plant floor with maintenance personnel and operators. I was up against one competitor for a very significant new order. I only learned from an operator that; although they preferred my software and machine build-quality, all the operators preferred working on my competitor's machine. I was stunned and when I asked why, he told me that my machine requires two footswitch presses whereas the competition only requires one. They found this irritating. I made a software change, there and then, updated all the machines, bought a few pitchers of beer in their after-work bar and I had friends for life. I got all of their business. :smile:
  • MaciekMaciek Posts: 668
    edited 2020-08-26 11:11
    We have two best friends then.
    For one we have Joe Schmoe - he recommends us to his management and has the ability to break whatever there is to break no matter how well built (hence our services are needed) and for the other one we have Joes' management that only cares for the costs of lost production and (being cheap) employs our friend Joe to take care of that very production. We also have one, but a powerful enemy and that is "time to fix".
  • has the ability to break whatever there is to break no matter how well built

    :lol::lol::lol:
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2020-08-26 13:33
    Even when it's only got one button, Joe always manages to press the other one.
    There are also management type Joes as well. Don't ever let them specify what they need. It's like when Homer Simpson got to design his dream car, and his half-brother Herb built it. Now, Steves, I've had better luck with.


    From my first non-industrial Forth project with POS terminals I appreciated the advantage I had with being able to remotely dial into the system and monitor, debug even, and modify stuff on the fly. Although at the time we only had UVEPROMs and that part I couldn't change remotely, I could have code stubs sitting in non-volatile RAM to tie things over.

    On another later project I had problems with a particular brand of note validator on a vending machine design and I came under a lot of flak from the machine manufacturer, because, as you know, it is always your fault, even though the manufacturer chose the validator they wanted to use, and the validator manufacturer swore black and blue that it could never be their certified unit at fault.

    Fortunately I had an IR serial link hidden in the display LEDs and I could interrogate these machines on-site (some were within 100km) in close proximity without touching them and this was used mainly for collecting reports via a portable HP IR printer. Since I used the first Flash based MSP430F chips at the time with a Forth I wrote, I was able to see what was going on as it happened. So I wrote some datalogging routines that wrote all these events to some of the spare Flash. Using that information I was able to then demonstrate how certain $5 plastic notes would curl up on the rollers going back and forth and while not being accepted would then be rejected, not out to the customer where it was trying to send it, but back into the stacker. The logs showed that it had been rejected by the validator but it would end up in the machine. However, the logs also showed people trying to game the machines by turning it on and off and pressing all the buttons repeatedly etc. With the IR link and Forth I could type in a line and get it to show on the portable terminal what was happening. A video of the whole thing tied in with the logs completed the story.

    I haven't told you about the great big misoperating mechanical presses yet, or that killer 1500kVA 3-phase regulator maybe, or hanging off the side of high-rises, or being "encouraged" by kick boxing henchmen, or (redacted), or one of my first Prop projects, a high-speed 12 channel multi-Prop based pill counter, but they are only some of the stories perhaps for another day.
  • @"Peter Jakacki"
    I, for one, enjoy reading about real-world experiences. Keep them coming although another thread might be a good idea.
    They are usually both entertaining and informative. :smile:
  • Peter, Good story... Would love to read more!
  • Me too (I hate the phrase :) ), but as it was suggested by @Mickster let us not plague this thread but create another one instead. Just for stories like that.
Sign In or Register to comment.