PLC Programming


This is the start of some information I would like to pass on for those who may be interested in looking at how PLC’s may be used in your automations.

I would first like to repeat what I mentioned earlier in my introduction to my project.
“The one key feature for me is that: PLC’s operate autonomously with a high degree or reliability and accuracy.”

Given this ability to use all the logic you have built in to your program, the PLC can then continue to function safely while many other systems may fail for various reasons (HA server, Router, MQTT server, Node-Red server, etc) around the PLC system. Due to the PLC system being wired and programmed as a discrete system it will remain working as long as it has (in my case) 24VDC control power for the PLC and 240VAC to run any connected/controlled devices.

In a system where you are looking for 100% reliability this is a must have characteristic.

xLogic Soft

First I would like to give a brief look at the programming software I use. xLogic Soft is a free download 71 and once installed and open on your desktop it looks like the below screenshot. You don’t need to own any PLC’s to start having a go at designing a new program. It is specific to Reivetech PLC’s 59 so if you like another brand of PLC you will need to checkout it’s related software.

In the above image you can see I have a project open called Master PLC 54 (Top Left) and that I am looking at a “Simulation” of the actual PLC (at the bottom of the image) which is displayed powered up with a program status message on the LCD screen telling the user the name of the PLC, which Slot number the PLC is and that it is in the RUN state with No Faults.

Below is a two page chunk of the complete program which shows the relatively simple Storm Water Sump Pump control system.

The whole program (Master PLC 54) runs to 68 pages (1267 KB) presently. This PLC has had quite a bit of development on it since it came online around 2011 and I only rename at major updates.

If you look closer at the Function Blocks on the page (see above Page 1 of Storm Water Control) you may be able to see one of the features which make this program quite useful when connecting up your sensors, binary sensors, switches, etc, in Home assistant. If you look closely at the F21 Digital Flag labeled as ‘Auto Empty Start’ then to the lower left there is a listing which reads Modbus_0x=1556(614H). The important information to connect that to HA is ‘1556’ which is the coil number. This PLC is Slot 3 (as shown on the LCD screen above) and is Static IP

HA Integration (the short story)

With those two pieces of information I can setup this ‘Flag’ in HA as a modbus switch in my config.
The IP address is also required to setup the Modbus Hub but that is beyond the scope of this discussion for now.

Copy to clipboard

- name: Storm Water Auto Empty hub: hub3 slave: 3 coil: 1556

Easy as that!
You can add a bunch of items or one at a time to the HA config but HA must be restarted to bring the new device/devices online and then you will simply need to add your new ‘entity’ to your Lovelace UI.

Function Block Diagrams (or ‘Blocks’)

This software is based on the user picking up ‘Blocks’ from the ‘Workspace’ and dragging them to where you want to place them on the ‘Circuit Diagram’. You then begin wiring up the connections to other ‘Blocks’ until you build a working program.

As a sparky who is used to working with electrical schematics this software came easily to me but I also had to develop more skills with logic boxes of Boolean algebra. Anyone used to that will find it even easier.

The key thing which makes the whole process of creating your programs easy (fun even) is that at any moment you can choose to ‘simulate’ your program which will power up the simulated PLC and give you a chance to see whats working, OR NOT?

Even better, once the program is uploaded to the PLC the software can be connected to monitor the running program live to the PC. When problems need to be diagnosed this feature is priceless as you can scroll around the program you have constructed and read the actual process values. Even the buttons on the PLC can be operated as if you were in front of the PLC.

Background

I’m an Electrical Fitter/Mechanic with a wide range of experience but I certainly have an interest leaning towards automation and control.

Aside from work, my own personal journey into automation really began when I moved my family from a remote location in north Queensland to a suburban home south of Brisbane. After constructing a new shadehouse I realised that (due to work commitments eating into my free time) I really needed to automate the watering and misting of my extensive plant collection.

Initially I installed an off the shelf irrigation controller but things quickly progressed to a more refined programmable timer system.

Later I began utilizing a couple of Eaton Mini PLC’s 5 to build my own custom irrigation and misting controller with more precise misting control and early recycled water control.

The Eaton PLC’s were added to as more treatment functionality was needed.

This system was equipped with a simple LED Mimic Panel which I divised to allow operators (the wife or kids) to diagnose system status faults for me.

This was usually in conjunction with phone calls at night to me as I was often working away. Very soon I began to recognise that I also needed remote monitoring and control capability.

Above is an early stopgap measure where I mounted an IP camera to enable me to see the mimic panel remotely…not so good in the night but it was fine during daylight hours. The image above is a screenshot off my iPad mini using the IP camera app.

So I moved on to higher spec Rievtech PLC’s. 3 My system was expanding beyond irrigation, misting and water storage to include water treatment, solar power monitoring and outside lighting control.

To fulfil those needs I chose the Rievetech PLC’s because they were well priced, easily expandable and equipped with with ethernet connectivity using the Modbus Protocol. I was now able to include a SCADA system 1with local and remote control by various devices including PC’s, Mobile Phones and Tablets. Programming of the PLC’s is easy to learn and very intuitive using the xLogic Soft - Function Block Diagram Software which is a free download from here. 2 You can also download Manuals, regular PLC updates and a bunch of other useful items as well.

But why PLC’s?

PLC’s 8 have been a large part of my professional life as an electrician so I naturally looked at options for automation using them for my own purposes. These days there are also a large range of very affordable Mini PLC’s available which are not quite industrial grade but are still built to very high standards.

The one key feature for me is that: PLC’s operate autonomously with a high degree or reliability and accuracy.

Operator input can be implimented via local switch inputs (Local Control Station or LCS), HMI Panels or a networked supervisory system (SCADA) which can allow advanced remote monitoring and control functions. Failure of the HMI Panels or communications network does not necessarily stop the process controls, and on resumption of communications the operator can continue with monitoring and control.

If all critical sensors, switches, instruments, etc are hard wired to the PLC AND the PLC program is carefully designed and tested, then any unsafe outcomes will (by design) halt the process autonymously with no user intervention required.

If the control system remains down for long periods the operator can use local control stations (LCS) to halt any chance of unsafe equipment operation OR terminate the whole process.

Scada

Once the hardware was in place the SCADA (SUPERVISORY, CONTROL and DATA AQUISITION) product I chose to impliment was myScada 2. When I first started using the mySCADA product it was at Version 4 and still in beta development.

As such the makers offered a free for personal use, unlimited tags and PLC connections product which was really fantastic. As time went by they also developed very affordable iOS and Android apps which were quite good and relatively bug free. Surprisingly they also included very good technical help for free.

Unfortunately mySCADA changed to become a very expensive and very buggy platform with the arrival of Version 7. They no longer offered a useful free to use version but as I had become a satisfied user I chose to pay for a 500 tag, unlimited PLC connection version to accommodate my project which had well over 300 tags and 4 PLC’s which were equipped with 15 expansion devices. MySCADA now offered a paid tech support service for ‘premium support’ and a free tech support service ‘without any real support’ unfortunately. The final straw for me was when Version 8 arrived and I wanted to shift my software to new physical server. I received zero help with procurement of a new Product Key which was required to install on the new server.

So the search began for a better solution to my SUPERVISORY, CONTROL and DATA AQUISITION needs which ended up (perhaps a little surprisingly?) being Home-Assistant.

Home-Assistant

I purchased a Raspberry PI 3 b+ and setup some Sonoff Basic switches flashed with Tasmota as a first test and quickly realized how powerful HA was. What really thrilled me was the incredible wealth of community help for seemingly every problem that arose.

My only real concern was how long it took to reboot the PI. I could literally go and boil the kettle and make a cup of coffee every time a restart of the PI was required.

By contrast, I could upload a completely updated mySCADA project from my PC to the mySCADA SERVER across my network and restart the mySCADA server software in 20-30 seconds.

After some more research I realised that HA could also be installed on a higher spec machine as well.

It was after installing Home-Assistant 1 on a QNAP TS-453 Pro NAS 1 that I realized I might actually be able to use it as a viable alternative to a buggy, poorly supported and overpriced mySCADA product.

NOTE: My HA container restarts in 15 seconds.

As Home-Assistant natively supports Modbus 4 I started the next test to see if my PLC’S were compatible. I used a spare PLC and set it up with a test program with examples of switches, binary sensors and sensors to check that moving would be possible.

My initial modbus testing worked well however I soon realised there was a problem with having multiple modbus clients and as I have four modbus devices requiring four modbus hubs then that was a real problem for me. Luckily for me there was a workaround which had been developed by PtP so I setup the spare PLC along with the first of my four system PLC’s and they worked seamlessly with the workaround. Next the final two PLC’s were also added and I confidently flicked the switch off on the myScada server for good. The best news came when support for multiple modbus hubs and writing to registers was added to the 0.88.0 release 1.

Current HA version running in my QNAP ContainerStation: 0.94.0

My Guiding Automation Principles

  1. Always include local lockout where malfunction of automation or control could cause unsafe conditions as a consequence.

  2. Always ensure all equipment is installed and maintained in a safe manner.

  3. Never allow remote control or supervisory systems to override a local lockout

Comments

  1. Plc Programming >>>>> Download Now

    >>>>> Download Full

    Plc Programming >>>>> Download LINK

    >>>>> Download Now

    Plc Programming >>>>> Download Full

    >>>>> Download LINK 2m

    ReplyDelete

Post a Comment

Please Share Your Views

Popular posts from this blog

SSO — WSO2 API Manager and Keycloak Identity Manager

Recommendation System Using Word2Vec with Python

Video Analysis: Creating Highlights Using Python