public static ProcedureFunctionChart CreateTestPfc5() { // Flip-flop pattern. ProcedureFunctionChart pfc = new ProcedureFunctionChart(new Highpoint.Sage.SimCore.Model("Test model", Guid.NewGuid()), "SFC 1"); #region Create Nodes char name = 'A'; A = pfc.CreateStep("Step_" + (name++), "", NextGuid()); B = pfc.CreateStep("Step_" + (name++), "", NextGuid()); C = pfc.CreateStep("Step_" + (name++), "", NextGuid()); D = pfc.CreateStep("Step_" + (name++), "", NextGuid()); E = pfc.CreateStep("Step_" + (name++), "", NextGuid()); F = pfc.CreateStep("Step_" + (name++), "", NextGuid()); nA = (IPfcNode)A; nB = (IPfcNode)B; nC = (IPfcNode)C; nD = (IPfcNode)D; nE = (IPfcNode)E; nF = (IPfcNode)F; #endregion Create Nodes #region Create Structure pfc.BindParallelDivergent(nA, new IPfcNode[] { nB, nC }); pfc.BindSeriesDivergent(nB, new IPfcNode[] { nD, nE }); pfc.BindSeriesDivergent(nC, new IPfcNode[] { nD, nE }); pfc.BindParallelConvergent(new IPfcNode[] { nD, nE }, nF); PfcLinkElementList links = new PfcLinkElementList(pfc.Links); links.Sort(new Comparison <IPfcLinkElement>(delegate(IPfcLinkElement a, IPfcLinkElement b) { return(Comparer.Default.Compare(a.Name, b.Name)); })); System.Reflection.BindingFlags bf = System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance; foreach (IPfcLinkElement link in links) { typeof(PfcElement).GetFields(bf); typeof(PfcElement).GetField("m_guid", bf).SetValue((PfcElement)link, NextGuid()); // Totally cheating. } //pfc.Bind(nD, pfc.Nodes["T_005"]); #endregion Create Structure return(pfc); }
public static ProcedureFunctionChart CreateTestPfc4() { ProcedureFunctionChart pfc = new ProcedureFunctionChart(new Highpoint.Sage.SimCore.Model("Test model", Guid.NewGuid()), "SFC 1"); #region Create Nodes char name = 'A'; A = pfc.CreateStep("Step_" + (name++), "", NextGuid()); B = pfc.CreateStep("Step_" + (name++), "", NextGuid()); C = pfc.CreateStep("Step_" + (name++), "", NextGuid()); D = pfc.CreateStep("Step_" + (name++), "", NextGuid()); E = pfc.CreateStep("Step_" + (name++), "", NextGuid()); nA = (IPfcNode)A; nB = (IPfcNode)B; nC = (IPfcNode)C; nD = (IPfcNode)D; nE = (IPfcNode)E; #endregion Create Nodes #region Create Structure pfc.Bind(nA, nB); pfc.Bind(nB, nE); pfc.Bind(nA.SuccessorNodes[0], nC); pfc.Bind(nC, nD); pfc.Bind(nD, nE.PredecessorNodes[0]); PfcLinkElementList links = new PfcLinkElementList(pfc.Links); links.Sort(new Comparison <IPfcLinkElement>(delegate(IPfcLinkElement a, IPfcLinkElement b) { return(Comparer.Default.Compare(a.Name, b.Name)); })); System.Reflection.BindingFlags bf = System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance; foreach (IPfcLinkElement link in links) { typeof(PfcElement).GetFields(bf); typeof(PfcElement).GetField("m_guid", bf).SetValue((PfcElement)link, NextGuid()); // Totally cheating. } #endregion Create Structure return(pfc); }
public static ProcedureFunctionChart CreateTestPfc3() { ProcedureFunctionChart pfc = new ProcedureFunctionChart(new Highpoint.Sage.SimCore.Model("Test model", Guid.NewGuid()), "SFC 1"); #region Create Nodes char name = 'A'; A = pfc.CreateStep("Step_" + (name++), "", NextGuid()); B = pfc.CreateStep("Step_" + (name++), "", NextGuid()); C = pfc.CreateStep("Step_" + (name++), "", NextGuid()); D = pfc.CreateStep("Step_" + (name++), "", NextGuid()); E = pfc.CreateStep("Step_" + (name++), "", NextGuid()); F = pfc.CreateStep("Step_" + (name++), "", NextGuid()); G = pfc.CreateStep("Step_" + (name++), "", NextGuid()); H = pfc.CreateStep("Step_" + (name++), "", NextGuid()); I = pfc.CreateStep("Step_" + (name++), "", NextGuid()); J = pfc.CreateStep("Step_" + (name++), "", NextGuid()); K = pfc.CreateStep("Step_" + (name++), "", NextGuid()); L = pfc.CreateStep("Step_" + (name++), "", NextGuid()); nA = (IPfcNode)A; nB = (IPfcNode)B; nC = (IPfcNode)C; nD = (IPfcNode)D; nE = (IPfcNode)E; nF = (IPfcNode)F; nG = (IPfcNode)G; nH = (IPfcNode)H; nI = (IPfcNode)I; nJ = (IPfcNode)J; nK = (IPfcNode)K; nL = (IPfcNode)L; #endregion Create Nodes #region Create Structure pfc.BindParallelDivergent(nA, new IPfcNode[] { nB, nC, nD, nE }); pfc.BindParallelDivergent(nB, new IPfcNode[] { nF, nG }); pfc.BindParallelDivergent(nE, new IPfcNode[] { nJ, nK }); pfc.BindParallelConvergent(new IPfcNode[] { nF, nG }, nH); pfc.BindParallelConvergent(new IPfcNode[] { nC, nD }, nI); pfc.BindParallelConvergent(new IPfcNode[] { nH, nI, nJ, nK }, nL); PfcLinkElementList links = new PfcLinkElementList(pfc.Links); links.Sort(new Comparison <IPfcLinkElement>(delegate(IPfcLinkElement a, IPfcLinkElement b) { return(Comparer.Default.Compare(a.Name, b.Name)); })); System.Reflection.BindingFlags bf = System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance; foreach (IPfcLinkElement link in links) { typeof(PfcElement).GetFields(bf); typeof(PfcElement).GetField("m_guid", bf).SetValue((PfcElement)link, NextGuid()); // Totally cheating. } #endregion Create Structure return(pfc); }