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

MIDLITE®'s SPEEDPORT Universal Cable Pass Thru, Fastening & Anchor System

MIDLITE®'s SPEEDPORT Universal Cable Pass Thru, Fastening & Anchor System

Use for any Low Voltage Cabling, A/V, Telecom, Data, Networking Ideal for : Sound Bars & Wall Speakers • Home Theater Cabling • A/V Furniture The SPEEDPORT™ is incredibly versatile and is ideal for wall mounted box speakers, sound bars and wireless access devices mounted in ceilings. It can accommodate almost any device needed to be hung on a wall or ceiling with cable pass thru and mounting. The ultra low profile design features a rubber grommet insert for bulk cable pass thru. Two mounting screws are hidden behind the grommet and offer a clean, unobtrusive presentation. Installation is quick & simple using a hole saw and attaches to acoustical ceiling tiles and/or gypsum board. Reducing labor and a whole lot of mess from hand cutting large rectangular holes - Low voltage brackets are no longer needed. Just cut your hole in the desired location, insert SPEEDPORT™ and tighten adjustable mounting arms to fasten securely.