개정판 a19bd6e2
dev issue #1231 : OPC Modeling
Change-Id: I0283118489c2f522d66495ce75a3058ad2c8ccdf
DTI_PID/APIDConverter/AVEVA.PID.CustomizationUtility_ACAD2018_x64.csproj | ||
---|---|---|
162 | 162 |
<DependentUpon>APIDSplashScreen.cs</DependentUpon> |
163 | 163 |
</Compile> |
164 | 164 |
<Compile Include="Log.cs" /> |
165 |
<Compile Include="Model\PlantItem\OPC.cs" /> |
|
165 | 166 |
<Compile Include="Model\PlantItem\Other\AvevaSymbolInfo.cs" /> |
166 | 167 |
<Compile Include="Model\PlantItem\Other\AvevaLineInfo.cs" /> |
167 | 168 |
<Compile Include="Model\PlantItem\EndBreak.cs" /> |
DTI_PID/APIDConverter/AutoModeling.cs | ||
---|---|---|
38 | 38 |
|
39 | 39 |
System.Data.DataTable AvevaSymbolTable = null; |
40 | 40 |
|
41 |
private void SetConvertRule() |
|
42 |
{ |
|
43 |
#region OPC Setting |
|
44 |
document.OPCs.Sort(SortOPC); |
|
45 |
int SortOPC(OPC a, OPC b) |
|
46 |
{ |
|
47 |
if (a.FlowType == FlowType.In) |
|
48 |
return 1; |
|
49 |
else |
|
50 |
return 0; |
|
51 |
} |
|
52 |
#endregion |
|
53 |
} |
|
54 |
|
|
41 | 55 |
public AutoModeling(Model.Document document, System.Data.DataTable AvevaSymbolTable) |
42 | 56 |
{ |
43 | 57 |
this.document = document; |
... | ... | |
88 | 102 |
SplashScreenManager.ShowForm(typeof(APIDSplashScreen), true, true); |
89 | 103 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetAllStepCount, 2); |
90 | 104 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetDocumentName, document.AvevaDrawingNumber + document.AvevaSheetNumber); |
105 |
SetConvertRule(); |
|
91 | 106 |
|
92 | 107 |
RunLineModeling(); |
108 |
RunOPCModeling(); |
|
93 | 109 |
RunSymbolModeling(); |
94 | 110 |
} |
95 | 111 |
catch (System.Exception ex) |
... | ... | |
115 | 131 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.UpProgress, null); |
116 | 132 |
} |
117 | 133 |
} |
134 |
private void RunOPCModeling() |
|
135 |
{ |
|
136 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetAllProgress, document.OPCs.Count); |
|
137 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetStep, "OPC Modeling"); |
|
138 |
foreach (var item in document.OPCs) |
|
139 |
{ |
|
140 |
if (item.Aveva.Handle == 0) |
|
141 |
SymbolModeling(item); |
|
142 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
143 |
} |
|
144 |
} |
|
118 | 145 |
private void RunSymbolModeling() |
119 | 146 |
{ |
120 | 147 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetAllProgress, document.SYMBOLS.Count); |
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 |
|
DTI_PID/APIDConverter/Model/PlantItem/OPC.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
|
|
7 |
namespace AVEVA.PID.CustomizationUtility.Model |
|
8 |
{ |
|
9 |
public enum OPCType |
|
10 |
{ |
|
11 |
None, |
|
12 |
Pipe, |
|
13 |
Signal |
|
14 |
} |
|
15 |
|
|
16 |
public enum FlowType |
|
17 |
{ |
|
18 |
None, |
|
19 |
In, |
|
20 |
Out |
|
21 |
} |
|
22 |
|
|
23 |
public class OPC : Symbol |
|
24 |
{ |
|
25 |
public OPCType OPCType { get; set; } |
|
26 |
public FlowType FlowType { get; set; } |
|
27 |
} |
|
28 |
} |
내보내기 Unified diff