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

Advanced UPB Lighting Packages from Simply Automated

Advanced UPB Lighting Packages from Simply Automated

Custom scenes (connecting up to 250 switches) in your living, family or great room, kitchen, study, master bedroom/bathroom, and office. Turn off all lights in your home at the touch of a button. Automatically (Timer Scheduler) turn on/off outdoor security lights, heating and AC, or provide night light convenience anywhere in your home. From creating a virtual 3 way switch anywhere in your home, to turning a group of lights when your garage door is opened, door bell or phone rings.