026-1620 Rev 0 09-15-05 E2 User’s Manual Supplement: Flexible Combiner Programming
Computer Process Controls, Inc. 1640 Airport Road Suite #104 Kennesaw, GA 31044 Phone (770) 425-2724 Fax (770) 425-9319 ALL RIGHTS RESERVED The information contained in this manual has been carefully checked and is believed to be accurate. However, Computer Process Controls, Inc. assumes no responsibility for any inaccuracies that may be contained herein. In no event will Computer Process Controls, Inc.
Table of Contents 1 FLEXIBLE COMBINER .......................................................................................................................................... 1-1 1.1 OVERVIEW ................................................................................................................................................................. 1.2 HOW IT WORKS ...........................................................................................................................................
1 Flexible Combiner 1.1 Overview The Flexible Combiner application, a new feature of E2 versions 2.20 and above, is a highly advanced and versatile I/O control program used to combine multiple analog and digital input values using programmed equations similar to those used in spreadsheets.
series of temperature sensors? Will it calculate enthalpy from temperature and humidity sensors? Will it read a set of proofs and turn an output ON if more than half of them fail? Setup When you have determined this, make a note of the following: • How many inputs of each type you will need (analog and digital) • How many outputs of each type you will need (analog and digital) • The types of analog inputs that will be used (temperature, pressure, etc.
DO1-DO8 Trigger If any of the DO1-DO8 Type fields were set up as oneshot outputs, choose the method the Flexible Combiner will use to generate pulses. The choices are: • Edge - Pulse is generated when the application transitions the output from OFF to ON. of each input you defined (AI1-AI8 and DI1-DI8). These names are the ones that are used when building equations. When finished, press B to proceed to the Outputs screen. 1.3.1.
mathematical operation or function on them to yield a single numerical value or digital state. 1.4.2 Output Equations When entering an equation, you must follow a strict format so that the E2 can properly understand and use the equation. This section will explain how to build equations in detail. 1.4.1 Types of Equations and Where Equations are Entered There are three different screens in the Flexible Combiner setup for output equations.
tions. Desired Function Equation AND combination of digital inputs DI1 through DI8 DO1: AND(DI1:DI8) Table 1-1 - Commonly Used Equation Examples 1.4.3 Delay Equations Figure 1-6 - Flexible Combiner Delay Equations The digital outputs of a Flex Combiner application have optional equations that can be used to program ON and OFF delays.
monly will only be constant values, since there is usually little need for variance in one-shot pulse width. However, a delay equation can be any mathematical expression (including inputs, constants, operators, or functions) that results in an analog value representing number of seconds. Desired Function Equation 5 second pulse on DO1 DO1 PulseWidth: 5 2 minute pulse on DO2 DO2 PulseWidth 00:02 15 second pulse width on DO3 unless the current time is before 8 a.m.
2 Building Equations Equations are made up of different combinations of four major elements: inputs, defined in the Flexible Combiner application, constants such as numerical values used in mathematical computations, operators such as plus signs (+) or greater than signs (>) used to perform basic math functions, and functions such as if-then statements or boolean logic (AND/OR). 2.
Input Type Choices SI Unit Electrical Current amperes (A) milliamperes (MA) amperes (A) Power Rate watts (W) kilowatts (KW) watts (W) Power Consumption watt-hours (WH) kilowatt-hours(KWH) watt-hours (WH) Lumination foot-candles (FTC) lux (LUX) lux (LUX) Numeric Constant Types Examples Integers 7, -30 Whole numbers. A minus sign in front will make it negative. Non-integers 1.0, -0.3, 3.14 Also called decimal or floating-point values. A minus sign in front will make it negative.
unitless numbers. In other words, a “3.0” in an equation by itself is not assumed to be 3.0 degrees or kilowatts. However, when used with a function or operator that involves inputs of a specific type, the result of the operation or function will use the inputs’ engineering unit designation. For example, if analog input AI6 is a 0-100% humidity sensor that is currently reading a humidity of 50%, the result of the equation “AI6 / 5” will result in an output value of 10%, even though the number 5 has no unit.
to 1 hour (3600 seconds). Use this format for minute/seconds by entering “00” for the hour (example: “00:30:00” for 30 minutes). • As a time of day in HH:MMx, where x is “a” if the time is a.m. or “p” if the time is p.m. This is converted to a number of seconds after midnight. Example: 04:00a is converted to 14400 seconds.
2.3 Operators Operators are symbols in equations that perform certain mathematical or logical operations. The most recognizable (and perhaps most common) example of operators Operator + * / ^ = <> > < >= <= ! NOT && || are plus (+) and minus (-) signs. An operator is typically placed between two inputs and/or constants in an equation and yield a single value. Table 2-7 lists the operators available in Flexible Combiner.
left to right. 6. All logical operators (!, NOT, &&, ||) from left to right. If you cannot arrange an equation’s operators in a way that parses them in the order you need (or if you simply want to remove all doubt), you may use parenthesis to specify a different order of operator execution. Expressions that are in parenthesis are executed first before any operators outside of parenthesis are used.
2.4.1 Extended Math Functions Function Description MOD(number, divisor) Divides the number by the divisor, and returns the modulo (or the “remainder”) of the division operation. In the example MOD(16,5), the modulo is 1 because 5 goes into 16 three times with a remainder of 1. Returns the absolute value of the number.
Function Description MEDIAN(range) Returns the median of all values in parenthesis. Range can be a set of constants or input variable separated by commas, or a range of inputs designated by a colon between the two ends of the range (e.g. AI1:AI7). Returns the sum-square of all values in parenthesis. Each input or constant is squared, and then added together.
2.4.2 Extended Logical Functions Function Description CUTINOUT(test, low, high, between) Returns a 1.0 or a 0.0 based on the following: If test is below low, the result is 0.0 If test is above high, the result is 1.0 If test is between the value of low and high, the result will be equal to between.
2.4.3 Logarithm Functions Function SQRT(value) POWER(value,power) LOG10(value) EXP(value) LN(value) Description Returns the square root of value. Value must not be negative, or else a Bad Result error will occur. Returns value to the power of power. This is the same as the “^” operator. Returns the base-10 logarithm of value. Returns e (2.72) raised to the power of value. Returns natural logarithm of value. Examples SQRT(4) result: 2 SQRT(77) result: 8.
Function Description TANR(value) Same as the TAN function, except value is assumed to be radians. Same as the ASIN function, except value is assumed to be radians. Value must be constrained to between -1 and 1, otherwise a Bad Result math error will occur. Same as the ACOS function, except value is assumed to be radians. Value must be constrained to between -1 and 1, otherwise a Bad Result math error will occur. Same as the ATAN function, except value is assumed to be radians.
2.4.6 Extended Digital Functions Function Description BOTHEDGE(input) Returns 1.0 when the digital input has transitioned either from OFF to ON or ON to OFF. When used as an equation for a one-shot output, the result will be an ON (1.0) pulse for an amount of time determined by the PW equation (see Section 1.4.4, Pulse Width Equations) Returns 1.0 when the digital input has transitioned either from ON to OFF. When used as an equation for a one-shot output, the result will be an ON (1.
Function Description Examples NEWYEAR() Returns a 1.0 if the year has changed since the last time the algorithm has been run. Otherwise, it returns a 0.0. The result is a short ON transition once per year at 12 midnight on January 1st. Parenthesis accepts no arguments, but empty parenthesis must still be placed at the end of this function name in the equation. Returns the current time in the number of seconds since midnight.
2.4.8 IF Functions Function Description Examples IF(value,true,false) If value is non-zero, returns the value of true. If value is zero, returns the value of false. In this function, value, true, and false can each be separate equations that include inputs, operators, and functions. IF(AI1>=70DF,AI2,0.0) result: AI2, if AI1 is equal to or greater than 70DF; otherwise, 0. IF(VOTE(DI1:DI8),AI3,AI4) result: AI3 if more than four of the eight DI inputs are ON; otherwise, AI4. IF(TIME()>64800,1.0,0.
3 Testing and Troubleshooting Equations sages. If all equations are formatted in a way the Flex Combiner application understands and the equations are yielding valid results, the “Status” will read OK. Otherwise, if there are problems, the “Status” field will read “Math Error.” When the Status field reads “Math Error,” you can check Detailed Status to learn more about which equation is causing the error and why it is occurring. To access the “Eq Errors” screen of Detailed Status: 1.
Message Description Resolution Mismatch() Mismatched parenthesis Verify that each open parenthesis “(“ has a corresponding close parenthesis. Example: ((AI3+7)*2 should be ((AI3+7)*2). Missing() A function that requires arguments in parenthesis does not have parenthesis. Verify if a function needs parenthesis that they are present and correctly paired: for example, SIN(PI) is correct, not SIN PI or SIN (PI.
• Press >, then select “ - Override.” yields a “Bad Type” error. It still isn’t quite obvious why the error occurs, so the next step is to reduce it further. Because the “=” operator requires two valid values to compare, the expression AND(DI1||(AND(DI4:DI8)),DI2) if formatted correctly should result in some value that can be compared to TRUE. Entering this expression by itself in the equation field, however, causes a “Missing Arg” error.