Reader small image

You're reading from  Mastering PLC Programming

Product typeBook
Published inMar 2023
PublisherPackt
ISBN-139781804612880
Edition1st Edition
Right arrow
Author (1)
Mason White
Mason White
author image
Mason White

M.T. White has been programming since the age of 12. His fascination with robotics flourished when he was a child programming microcontrollers such as Arduinos. M.T. currently holds an undergraduate degree in mathematics, a master's degree in soft ware engineering, and is currently working on an MBA in IT project management. M.T. is currently working as a soft ware developer for a major US defense contractor and is an adjunct CIS instructor at ECPI University. His background mostly stems from the automation industry where he programmed PLCs and HMIs for many different types of applications. M.T. has programmed many different brands of PLCs over the years and has developed HMIs using many different tools.
Read more about Mason White

Right arrow

Alarms — Avoiding Catastrophic Issues with Alarms

Thus far in this book, we have covered the basics of catching errors, mainly by doing something such as blinking an LED or changing the color of a control. For many things, simply changing a control’s color or blinking an LED is fine. However, there are times when a more dedicated HMI element is needed. With all that said, enter the world of alarms.

In many SCADA and HMI systems, alarms are dedicated controls that are specifically designed to warn operators about the status of the machine. Normally, alarms will allow you to change colors, display text, log issues, and more. Each HMI or SCADA package that offers alarms will offer different alarms, styles, functionality, and more. However, the core principles that govern most alarms are universal.

Much like HMIs, developing and properly implementing an alarm is as much a science as it is an art. This chapter is dedicated to implementing alarms logically and effectively...

Technical requirements

As per every other chapter in the book, a full version of CODESYS will need to be installed. Also, as usual, the examples can be downloaded from the following URL:

https://github.com/PacktPublishing/Mastering-PLC-programming/tree/master/Chapter%2014

Unlike most of the other chapters, this one will require you to know about HMIs. Hence, it is highly recommended that you read Chapters 11, 12, and 13 before exploring the concepts in this chapter.

What are alarms?

The name alarm will normally conjure up images of flashing lights and critical errors on your machine. In many cases, this is exactly what alarms are used for – their main purpose is to relay information to the operator. As we will see later on in the chapter, in the section Alarm configuration: Info, Warning, and Error setup, alarms relay way more information than just catastrophic errors.

For most PLC applications, alarms have two sections. The first component of an alarm is the PLC logic itself. The PLC logic is the code that will trigger the alarm. The other section is the HMI component that will display the alarm in a logical, user-friendly manner. Therefore, before you can start using alarms, you’re going to want to ensure that you have a decent understanding of PLC programming and HMI layouts for your custom alarms to work.

Alarms are multifaceted. Not only can they display information to the operator, but with the right PLC logic, they can...

Alarm configuration – I, Warning, and Error setup

To do anything with alarms, the first thing we need to do is set up an alarm configuration. An alarm configuration is the configuration setup, such as the colors, the fonts, and so on that will govern the info, warning, or error alarms. In CODESYS, this is a relatively easy task. To add an alarm configuration, you will simply need to right-click Applications and follow the path in the following screenshot:

Figure 14.1 – Path to add an alarm

Figure 14.1 – Path to add an alarm

This will bring you to a wizard like the one in the following screenshot. In the wizard, give the alarm configuration a name and click Add. For our alarm configuration, we will simply keep the default name. Once you click Add, you will see the Error, Info, and, Warning attributes under the Alarm Configuration attribute in the project tree.

Figure 14.2 – Alarm configuration wizard

Figure 14.2 – Alarm configuration wizard

The Info, Error, and Warning attributes...

Alarm HMI components

After we set up the alarm’s configuration, we can drop in an HMI component. In terms of CODESYS, there are two types of HMI controls. One is the Alarm Banner and the other is the Alarm Table. Consider the following to understand the difference between a banner and a table:

  • Banner: Shows one message at a time. It will prioritize alarms and only show the Error, Warning, or Info alarm in that order unless configured otherwise. In other words, a banner will show the most important alarm. No matter the type of alarm, the alarm can be toggled by toggling the variable in the alarm group.
  • Table: An alarm table will show active alarms for an alarm group. New alarms will show at the top of the table. Alarms can be toggled simply by toggling the variable the alarm is tied to. Where banners are meant to be on every HMI screen, tables can be set on one diagnostic screen. Compared to banners, a table can give more information as it will show more alarms.
  • ...

PLC alarm logic

Now that we have set up an alarm, we need to get into the guts of the alarm, which is what I like to call the alarm logic. There is nothing fancy or complex about triggering an alarm. As we have seen, all we have to do is set a variable to true or false. However, understanding when to set the variable is the trick. For most things in automation, we use bounds or operating ranges to determine whether the part is in a healthy state or not. In other words, many things, such as heaters, motors, and so on, have an optimal operating range that they should always be in. Straying from the optimal range can easily affect the performance of the machine. Some of the most common situations that need immediate alarms are situations that can result in the injury of a person or the surrounding environment. In these cases, you will not want to set up a tolerance range; you will simply want to throw an alarm.

Typically, when you’re working with a range, you will use the HMI...

Alarm acknowledgment

If you’ve noticed, thus far, when you throw an error alarm, the text doesn’t go away, whether it be an alarm in the banner or chart. This is because error alarms must be acknowledged. Essentially, if you throw an error, an alarm will be present, at least in text, if you do not acknowledge the alarm. An acknowledgment is basically a confirmation that an operator has seen the alarm and has decided to clear it. No matter whether you’re using a table or a banner, you will clear alarms in the same way.

In short, there is an acknowledgment field that holds a variable. When the variable is true, the text in the alarm display will clear out. For our example, we are going to add a button to the HMI. In short, your HMI should be modified to look like the following:

Figure 14.31 – HMI with Ack button

Figure 14.31 – HMI with Ack button

Once you add the button, add a variable called ack of type bool to the PLC_PRG file. We’re going to want to...

Final project – motor alarm system

For the final project, we are going to create a motor alarm system. In the real world, motors are a pivotal part of automation. However, if a motor starts drawing too much or too little current, there could be a problem. Also, if the operating temperature is over or under range for the motor, there could be a problem. Therefore, we need alarms to indicate when these events occur and what they are. To round out the chapter, we are going to create an HMI similar to the one in the last section; however, we are going to add more alarms. So, the first thing we are going to do is lay out some requirements.

Requirements

Motors have an optimal operating range for temperature, drawn voltage, and communication between the drive and PLC. We need to monitor these, and if there is any abnormal behavior, we need to trigger an alarm. Also, since there can be multiple issues all at once, we need to log all the issues so the technician can search the...

Summary

In summary, this chapter has been a crash course on HMI alarms. We have covered the HMI and PLC side, as well as the setup of the alarms. We have also learned how to acknowledge alarms and more. By this point, you should know the basics of alarm systems. Overall, you will need to understand this chapter to be an automation programmer, so please ensure that you understand the material. In all, you should have a good grasp of advanced PLC programming in general at this point. This means we can move on to our final project of the book, creating an industrial oven.

Questions

Answer the following questions based on what you've learned in this chapter. Cross-check your answers with those provided at the end of the book, under Assessments.

  1. What is an alarm?
  2. Name the three types of alarms?
  3. What does a red alarm usually mean?
  4. What is an alarm group?
  5. What is an alarm acknowledgment?

Further reading

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Mastering PLC Programming
Published in: Mar 2023Publisher: PacktISBN-13: 9781804612880
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime

Author (1)

author image
Mason White

M.T. White has been programming since the age of 12. His fascination with robotics flourished when he was a child programming microcontrollers such as Arduinos. M.T. currently holds an undergraduate degree in mathematics, a master's degree in soft ware engineering, and is currently working on an MBA in IT project management. M.T. is currently working as a soft ware developer for a major US defense contractor and is an adjunct CIS instructor at ECPI University. His background mostly stems from the automation industry where he programmed PLCs and HMIs for many different types of applications. M.T. has programmed many different brands of PLCs over the years and has developed HMIs using many different tools.
Read more about Mason White