Procedural function block programming with node red (like PLC FBD)

When I first discovered Node-RED I was excited because it seemed very similar to Function Block Diagrams that I'd used in PLC programming. They are both visual programming but that's about where the similarities end. It took me a while to grasp the asynchronous nature of Node-RED and similarly why there are never multiple inputs to a node. I thought for a while about creating some nodes that would close these differences but ultimately concluded that it would be better to start from a blank slate.

So, that's what I've done. I used a block-diagramming front-end <http://rete.js.org> and wrapped it around a back-end that's designed to act like a PLC with a determined scan-rate and scan-order. The package (GitHub link below) consists of a few http files that get stored in your node-red's "httpStatic" folder and a flow that handles the data input / output and resolves the logic that's been defined on the frontend. Ultimately I think this could be a good way to code a raspberry pi / beaglebone microcontroller.

Below screenshot shows example logic simulating a stop light sequence

And here is the GitHub repo. There's instructions in the readme on how to set this thing up along with a flow that has the sample program embedded (it loads the above example automatically when you first deploy)

This is a work in progress which I likely won't have much time to work on in the near future, so let me know what you think and certainly let me know if you want to contribute.

Regards,
-Matt

1 Like