With real number capability and transcendental functions one could incorporate a sunrise/sunset algorithm in the PLC to turn off or on lights in the morning or evening without having to use a photocell or pre set time clock.

PLC - Real Math

Eugene Kowch | P.I.D. Consultants Inc

Programmable Logic Controller
---- Real Math ----
By Eugene Kowch, P.I.D. Consultants Inc

With real number capability and transcendental functions one could incorporate a sunrise/sunset algorithm in the PLC to turn off or on lights in the morning or evening without having to use a photocell or pre set time clock.


Programmable logic controllers (PLCs) have the capability of working with real numbers. A real number, in mathematics, is a quantity that can be expressed as an infinite decimal expansion.  In other words, very large numbers or very small numbers can be expressed as real numbers using an exponential notation. For example; 5.3 x 106 or 5.3E6 is a real number representation for 5.3 million ( 5,300,000 ).

These real numbers are in the IEEE 32-bit floating point format when stored in the PLC.

They occupy two consecutive word registers regardless of how big or small the number may be. If you view the register of a stored real number it would be very difficult to decipher. Just like the other number types; binary, hex or even BCD, you must keep track of real number registers, so they can be read by their proper numerical functions.

The typical numerical functions are; add, subtract, multiply and divide. The PLC have special numerical functions to complement its real number capability. The transcendental functions include the trigonometric sine, cosine, and tangent and also their inverses (arc sine, arc cosine, and arc tangent). The square root function is also grouped with these other functions. The square root function operates on the full range of positive real numbers. The transcendental math instructions operate on real numbers only, not binary, hex or BCD. The sine, cosine and tangent functions require numbers expressed in radians. You can work with angles expressed in degrees by first converting them to radians.

The following example takes the sine of 45 degrees. Since these transcendental functions operate only on real numbers, we do a LDR (load real) 45. The trig functions operate only in radians, so we must convert the degrees to radians by using the RADR function.

After using the SINR (Sine Real) instruction, the result must be stored in two word registers because the resultant is a 32-bit real number.

With real number capability and transcendental functions one could incorporate a sunrise/sunset algorithm in the PLC to turn off or on lights in the morning or evening without having to use a photocell or pre set time clock.


Comments (0)

This post does not have any comments. Be the first to leave a comment below.


Post A Comment

You must be logged in before you can post a comment. Login now.

Featured Product

Light sockets; Not just for lights anymore

Light sockets; Not just for lights anymore

Smart Bulbs are out there and they can do far more then just provide light. Speakers, projectors, wi-fi extenders and more. The standard light socket that is wired up and ready to go in nearly every home in North America is now providing an easy and affordable option for home owners and renters alike to enter into the world of the "Smart Home". Here is a look at some of the Smart Bulbs and Smart Lighting options out there, and this list is just the beginning. In this ongoing article we hope to continue to add to and grow this list, so stay tuned!