A vendor supplied a spreadsheet of gpm vs. pump speed for chemical dosing (4-20A) output. This results in a m x n = 210 x 2 with 210 values. First thought was use a SGCR, which limits me to 21 rows. This would require 10 SGCR, which seems excessive. I could decrease the resolution, and simplify it as it appears to be linear, but with a slightly different slope. Anyone able to suggest the optimal way to build an ARRAY, either via function blocks, CALC block or just stacking SGCR's? Thanks in advance.
I would use ARRAY type parameters for the curve and a CALC block with a WHILE...DO loop for the conversion. Here is a first pass at the logic in the CALC block:
[EDIT: I copied and pasted this directly from DeltaV, but apparently this board interprets [ I ] as a lightbulb icon...anything displayed as a lightbulb is [ I ] with no spaces between. :) ]
I := 1; IF 'IN1.CV' < 105 THEN WHILE ('IN1.CV' > '^/CURVE1'[I][1]) DO I := I+1; END_WHILE; 'OUT1.CV' := '^/CURVE1'[I][2] + ('IN1.CV'-'^/CURVE1'[I][1])/('^/CURVE1'[I+1][1]-'^/CURVE1'[I][1])*('^/CURVE1'[I+1][2]-'^/CURVE1'[I][2]); ELSE WHILE ('IN1.CV' > '^/CURVE2'[I][1]) DO I := I+1; END_WHILE; 'OUT1.CV' := '^/CURVE2'[I][2] + ('IN1.CV'-'^/CURVE2'[I][1])/('^/CURVE2'[I+1][1]-'^/CURVE2'[I][1])*('^/CURVE2'[I+1][2]-'^/CURVE2'[I][2]); ENDIF; The ARRAY parameter type is limited to 240 total values, so for 2 columns the max is 120 rows. You will need to use two 105 x 2 arrays; I assumed parameter names of CURVE1 and CURVE 2. Then at the beginning of the expression you need an IF statement to determine if the speed (assumed to be IN1) is less than the first speed in CURVE2 (here assumed as 105). The WHILE loop increments the index looking for the first speed value that is greater than the input. The GPM (assumed to be OUT1) calculation looks nasty, but it's just the GPM value at the index plus the fractional portion of the next differential in speed times the next differential in GPM. You may also want to add some checks to account for negative inputs or overrange values, but I think it should work.
In reply to Mike Link:
Andre Dicaire
In reply to Bill Tinley: