u/Commercial_Fact_5632

▲ 7 r/PLC

I usually work with Beckhoff/Codesys and I'm trying to figure out how to handle large projects in Siemens.

So I have multiple UDT structures for Valve/Sensors etc. Basically something like Tag.AV001, Tag.AV002 ...

I'm trying to aggregate selected UDTs into an array, such that the array will reference the original tag.

arr[1] := Tag.AV001;
arr[2] := Tag.AV007;
arr[3] := Tag.AV015;
arr[4] := Tag.AV021;
arr[N] := Tag.AV00X;

fbDoSomething(arr := arr);

then inside this FB:

FOR i:= 1 TO N DO 
  arr[i].bCmdOpen := TRUE;
END_FOR;

so that finally

IF Tag.AV001.bCmdOpen THEN
  // Tag.AV001.bCmdOpen is true
END_IF;

this allows me to do things like:

arrInlet[1] := Tag.AV001;
...
arrTank01[1] := Tag.AV001;
...
fbDoSomethingToInlets(arr := arrInlet);
fbDoSomethingToTank01Valves(arr := arrTank01);
fbDoSomethingToVakve(valve := Tag.AV001);

But I couldn't find a way to build such array and pass it to the FB. Is there any way of doing this?

reddit.com
u/Commercial_Fact_5632 — 25 days ago