개정판 a19bd6e2
dev issue #1231 : OPC Modeling
Change-Id: I0283118489c2f522d66495ce75a3058ad2c8ccdf
DTI_PID/APIDConverter/Model/PlantItem/Document.cs | ||
---|---|---|
24 | 24 |
private List<EndBreak> _EndBreaks = new List<EndBreak>(); |
25 | 25 |
private List<SpecBreak> _SpecBreaks = new List<SpecBreak>(); |
26 | 26 |
private List<Equipment> _Equipments = new List<Equipment>(); |
27 |
private List<OPC> _OPCs = new List<OPC>(); |
|
27 | 28 |
private bool _Enable; |
28 | 29 |
private bool _Validation; |
29 | 30 |
private bool _MappingValidation; |
... | ... | |
70 | 71 |
public bool Validation { get => _Validation; set => _Validation = value; } |
71 | 72 |
public bool MappingValidation { get => _MappingValidation; set => _MappingValidation = value; } |
72 | 73 |
public string UID { get => _UID; set => _UID = value; } |
74 |
public List<OPC> OPCs { get => _OPCs; set => _OPCs = value; } |
|
73 | 75 |
|
74 | 76 |
StringBuilder validationStringBuilder = new StringBuilder(); |
75 | 77 |
|
... | ... | |
204 | 206 |
|
205 | 207 |
Equipments.Add(equipment); |
206 | 208 |
} |
209 |
else if (sType == "Piping OPC's" || sType == "Instrument OPC's") |
|
210 |
{ |
|
211 |
OPC opc = new OPC() |
|
212 |
{ |
|
213 |
UID = item.Element("UID").Value, |
|
214 |
DBUID = item.Element("DBUID").Value, |
|
215 |
NAME = item.Element("NAME").Value, |
|
216 |
TYPE = item.Element("TYPE").Value, |
|
217 |
OWNER = item.Element("OWNER").Value, |
|
218 |
ORIGINALPOINT = item.Element("ORIGINALPOINT").Value, |
|
219 |
CONNECTIONPOINT = item.Element("CONNECTIONPOINT").Value, |
|
220 |
LOCATION = item.Element("LOCATION").Value, |
|
221 |
SIZE = item.Element("SIZE").Value, |
|
222 |
ANGLE = Convert.ToDouble(item.Element("ANGLE").Value), |
|
223 |
PARENT = item.Element("PARENT").Value, |
|
224 |
CHILD = item.Element("CHILD").Value, |
|
225 |
HASINSTRUMENTLABEL = item.Element("HASINSTRUMENTLABEL").Value, |
|
226 |
AREA = item.Element("AREA").Value, |
|
227 |
FLIP = Convert.ToInt32(item.Element("FLIP").Value), |
|
228 |
CURRENTPOINTMODEINDEX = Convert.ToInt32(item.Element("CURRENTPOINTMODEINDEX").Value) |
|
229 |
}; |
|
230 |
|
|
231 |
SetAssociations(item.Element("ASSOCIATIONS"), opc.ASSOCIATIONS); |
|
232 |
SetSymbolConnectors(item.Element("CONNECTORS"), opc.CONNECTORS, opc.CONNECTIONPOINT); |
|
233 |
SetProperties(item.Element("PROPERTIES"), opc.PROPERTIES); |
|
234 |
SetAttributes(item.Element("SYMBOLATTRIBUTES"), opc.ATTRIBUTES); |
|
235 |
SetChildSymbol(opc); |
|
236 |
|
|
237 |
if (sType == "Piping OPC's") |
|
238 |
opc.OPCType = OPCType.Pipe; |
|
239 |
else if (sType == "Instrument OPC's") |
|
240 |
opc.OPCType = OPCType.Signal; |
|
241 |
|
|
242 |
OPCs.Add(opc); |
|
243 |
} |
|
207 | 244 |
else |
208 | 245 |
{ |
209 | 246 |
Symbol symbol = new Symbol() |
... | ... | |
240 | 277 |
PlantItems.AddRange(EndBreaks); |
241 | 278 |
PlantItems.AddRange(Equipments); |
242 | 279 |
PlantItems.AddRange(SYMBOLS); |
280 |
PlantItems.AddRange(OPCs); |
|
243 | 281 |
} |
244 | 282 |
|
245 | 283 |
private void SetLine(XElement node) |
... | ... | |
587 | 625 |
result = false; |
588 | 626 |
} |
589 | 627 |
|
628 |
foreach (var item in OPCs) |
|
629 |
{ |
|
630 |
DataRow[] rows = symbolMappingTable.Select(string.Format("UID = '{0}'", item.DBUID)); |
|
631 |
if (rows.Length == 1 && !DBNull.Value.Equals(rows[0]["APID_SYMBOL"]) && !string.IsNullOrEmpty((string)rows[0]["APID_SYMBOL"])) |
|
632 |
{ |
|
633 |
item.Aveva = new AvevaSymbolInfo(); |
|
634 |
double x = item.X; |
|
635 |
double y = SIZE_HEIGHT - item.Y; |
|
636 |
|
|
637 |
ConvertAvevaPoint(ref x, ref y); |
|
638 |
|
|
639 |
item.Aveva.X = x; |
|
640 |
item.Aveva.Y = y; |
|
641 |
|
|
642 |
item.Aveva.FullName = (string)rows[0]["APID_SYMBOL"]; |
|
643 |
string[] split = item.Aveva.FullName.Split(new char[] { '\\' }); |
|
644 |
item.Aveva.Name = split[split.Length - 1]; |
|
645 |
|
|
646 |
// Flow Type |
|
647 |
} |
|
648 |
else |
|
649 |
result = false; |
|
650 |
} |
|
651 |
|
|
590 | 652 |
return result; |
591 | 653 |
} |
592 | 654 |
|
내보내기 Unified diff