This question is a little out there. Is there a way, other than a triple nested List
, to declare attributes to a List
element?
Context: I have a List of PLCs where each PLC has 4 "attribute" Elements and a List of Tags.
Ex: I know this is wrong, just trying to illustrate the idea.
List<List<string>> plcTagInfo;
plcTagInfo[0][0] = PLC Name
plcTagInfo[0][1] = IP address of aforementioned PLC
plcTagInfo[0][2] = protocol used to communicate with PLC.
plcTagInfo[0][3] = processor type of aforementioned PLC.
plcTagInfo[0][4] = List of ALL tags inside of that PLC and each tag has 4 elements.
plcTagInfo[1] = new plc to cycle through.
In which I will cycle through each tag and tag attribute.
Tag Elements are: tagName(string), dataType(string = uint32), elemSize(string = "4"), elemCount(string = "10") as an example.
Is there an easy route to go about this? Or should I just split the plcs into one list and the tags into a separate list and associate the two incrementally?
Just in case I wasn't clear enough. Here is the XML that I am importing the data from.
<?xml version="1.0" encoding="utf-8"?>
<PLCS>
<PLC Name="Test">
<PLCInfo IPAddress="192.168.1.60" ProcessorType="LGX" Protocol="ab_eip" />
<Tags>
<Tag TagName="TagName1" DataType="uint8" ElemSize="4" ElemCount="10" />
<Tag TagName="TagName2" DataType="uint8" ElemSize="4" ElemCount="1" />
<Tag TagName="TagName3" DataType="uint8" ElemSize="4" ElemCount="1" />
<Tag TagName="TagName4" DataType="uint8" ElemSize="4" ElemCount="1" />
<Tag TagName="TagName5" DataType="uint8" ElemSize="4" ElemCount="1" />
<Tag TagName="TagName6" DataType="uint8" ElemSize="4" ElemCount="1" />
<Tag TagName="TagName" DataType="uint8" ElemSize="4" ElemCount="10" />
</Tags>
</PLC>
<PLC Name="Test2">
<PLCInfo IPAddress="192.168.1.30" ProcessorType="LGX" Protocol="ab_eip" />
<Tags>
<Tag TagName="Tagname1" DataType="uint8" ElemSize="4" ElemCount="10" />
<Tag TagName="Tagname2" DataType="uint8" ElemSize="4" ElemCount="10" />
<Tag TagName="Tagname3" DataType="uint8" ElemSize="4" ElemCount="10" />
<Tag TagName="Tagname4" DataType="uint8" ElemSize="4" ElemCount="10" />
<Tag TagName="Tagname5" DataType="uint8" ElemSize="4" ElemCount="10" />
<Tag TagName="Tagname6" DataType="uint8" ElemSize="4" ElemCount="10" />
<Tag TagName="Tagname7" DataType="uint8" ElemSize="4" ElemCount="10" />
<Tag TagName="Tagname8" DataType="uint8" ElemSize="4" ElemCount="10" />
<Tag TagName="TagName1" DataType="uint8" ElemSize="4" ElemCount="10" />
</Tags>
</PLC>
</PLCS>
Muchos Dankeschön!