String Array Pointer in a Calc Block

Hi,

why does the Code not work in DeltaV Calc-Block?

'^/STRING[0].CV' := "TEST1";

'^/STRING[1].CV' := "TEST2";
'^/STRING[2].CV' := "TEST3";

TEMP := 'IN1.CV';
'^/OUTPUT.CV' := '^/STRING[TEMP].CV';

This Selector (TEMP) does not work. How can we fix it?

Thanks 

  • DeltaV doesn't support String arrays, only floating point.
  • In reply to AdrianOffield:

    Hi,


    but this Works:

    '^/STRING[0].CV' := "TEST1";
    '^/STRING[1].CV' := "TEST2";
    '^/STRING[2].CV' := "TEST3";

    TEMP := 'IN1.CV';
    '^/OUTPUT.CV' := '^/STRING[1].CV';


    The Output is "TEST2", when '^/STRING[0].CV Output is "TEST1"
  • As Adrian points out it doesn't support strings but there is also another problem if you want to use arrays:
    ROW := 'IN1.CV';'^/OUTPUT.CV' := '^/STRING'[ROW][COLUMN];
    Notice that the .CV is removed when referencing the array and the [ROW][COLUMN] is outside of the ' marks
  • In reply to Matt Stoner:

    Hi,


    '^/STRING[0][0].CV' := "TEST1";
    '^/STRING[1][0].CV' := "TEST2";
    '^/STRING[2][0].CV' := "TEST3";

    TEMP := 'IN1.CV';
    '^/OUTPUT.CV' := '^/STRING'[TEMP][0];


    Output is "TEST3".
  • In reply to Lars:

    What are you trying to use Output for that is not working?
  • In reply to Lars:

    I've done something similar for silo history, I had to store the product grade and a string array is what would of helped.  To do it, I had to use a dynamic reference that was built in the calc block, and then written to once the connection status was OK.

    IF '^/HIS_LOT_PT.CST' = 0 THEN

    '^/HIS_LOT_PT.CV' := '^/ACTIVE_LOT';

    '^/HIS_GD_PT.CV' := '^/ACTIVE_GD';

    '^/HIS_INDEX.CV' := ('^/HIS_INDEX.CV' > 3) ? 0 : '^/HIS_INDEX.CV' + 1;

    (* Establish link to History Pointers*)

    '^/HIS_LOT_PT.$REF' := "^/LOT_PREV" + '^/HIS_INDEX.CV';

    '^/HIS_GD_PT.$REF' := "^/GD_PREV" + '^/HIS_INDEX.CV';

    '^/ACTIVE_LOT' := '^/NEW_LOT.CV';

    '^/ACTIVE_GD' := '^/NEW_GD.CV';

    ENDIF

  • In reply to AdrianOffield:

    Hi,

    sorry i dont understand this code....
  • In reply to kdculb:

    We are trying to get an output text in depending on an input number.
  • In reply to Lars:

    String arrays don't exist so you will have to manually build a series of string parameters STRING'x' that you will index using a dynamic pointer.

    TEMP := IN1.CV
    POINTER.$REF := "^/STRING" + TEMP

    If POINTER.CST = 0 then
    OUTPUT := POINTER.CV

    Does this make it any clearer?
  • In reply to AdrianOffield:

    Do we need one parameter for each string in this solution?
  • In reply to Lars:

    Yep, for your example you need 3 string parameters and a dynamic ref parameter.
  • In reply to AdrianOffield:

    Hi,

    or you could just go with If in= 1 Then output:= "text 1" ... codes... [;)]

    can´t remember if Case is supported in DV ??

    Niklas Flykt 

    Klinkmann Oy

    Key Account Manager safety products

    nikfly@gmail.com