Order of operations for math calculations
For anyone who has taken a high school-level algebra course, the term PEMDAS may be familiar. In short, PEMDAS stands for Parentheses, Exponents, Multiplication, Division, Addition, and Subtraction. What this entails is the order of operation in which an equation is calculated. For example, let’s say we were presented with the following equation:
We would need to solve the equation by performing the following steps:
- .
- .
- .
- .
The same general rules apply to writing a PLC program or a program in any other language.
Note
You must understand the order of operation as not understanding the order of operation can easily lead to wrong calculations, which, in turn, can lead to adverse and potentially dangerous situations.
As you program equations, you’ll naturally get a grasp of math ordering. However, following the PEMDAS hierarchy will serve as a good starting point.
You should now have a...