Hi,
Is it possible to change the out(n) of a CALC block with 16 outputs based on an Input?
‘OUT(‘IN1.CV’).CV’ := ‘IN2.CV’;
Thanks
Best I can tell is with IF statements:
IF IN1 = 1 THEN
OUT1 := IN2;
ENDIF;
IF IN1 = 2 THEN
OUT2 := IN2;
etc.
Andre Dicaire
In reply to Andre Dicaire:
In reply to Jack_France:
Hi
For the fun, here is one solution using Dynamic Reference input parameter named "OUT_NUMBER" (place this parameter at the same level as the CALC block, in your Module)
Calc expression :
Rem Init all OUT'OUT1.CV' := 0;'OUT2.CV' := 0;'OUT3.CV' := 0;'OUT4.CV' := 0;'OUT5.CV' := 0;'OUT6.CV' := 0;'OUT7.CV' := 0;'OUT8.CV' := 0;'OUT9.CV' := 0;'OUT10.CV' := 0;'OUT11.CV' := 0;'OUT12.CV' := 0;'OUT13.CV' := 0;'OUT14.CV' := 0;'OUT15.CV' := 0;'OUT16.CV' := 0;
Rem Prepare dynamicreference'^/OUT_NUMBER.$REF' := "^/CALC1/OUT" + 'IN1.CV' + ".CV";
Rem If Dynamic Reference link is establishedIf '^/OUT_NUMBER.ST' = 128 Then Rem Active the designed OUT '^/OUT_NUMBER.CV' := 1;EndIf;
In reply to RJA: