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

IntraSonic Technology - I600 In-Wall Digital Stereo Music System

IntraSonic Technology - I600 In-Wall Digital Stereo Music System

You asked, we listened! Music lovers that want to enjoy their tunes everywhere - yes, everywhere! - now have a high-tech, easy-to-use option that upgrades the look and functionality of any home or office. The I600 In-Wall Digital Stereo Music System is a music distribution system that provides enhanced usability and delivers mind-blowing stereo quality sound. With touch screen controls, Bluetooth connectivity, and several music source options, the I600 turns your surroundings into an amazing music entertainment experience.