private void ZoneLBS(string Rob1, TxObjectList Rob1Sigs, string Rob2, TxObjectList Rob2Sigs, string[] Zone, TxPlcLogicBehavior LB) { TxPlcExpressionBuilder eb1 = new TxPlcExpressionBuilder(); try { foreach (string z in Zone) { string str1 = textBox12.Text.Replace("X", z); string str2 = textBox11.Text.Replace("X", z); ITxPlcLogicBehaviorEntry en1 = SegEn(LB, FindSig(Rob1Sigs, str1, true)); ITxPlcLogicBehaviorEntry en2 = SegEn(LB, FindSig(Rob2Sigs, str2, true)); ITxPlcLogicBehaviorEntry en3 = SegEn(LB, FindSig(Rob2Sigs, str1, true)); eb1.Add(TxPlcExpressionOperator.Not); eb1.Add(en1); eb1.Add(TxPlcExpressionOperator.And); eb1.Add(TxPlcExpressionOperator.LeftParenthesis); eb1.Add(TxPlcExpressionOperator.Not); eb1.Add(en2); eb1.Add(TxPlcExpressionOperator.Or); eb1.Add(en3); eb1.Add(TxPlcExpressionOperator.RightParenthesis); ITxPlcLogicBehaviorExit ex1 = SegEx(LB, FindSig(Rob1Sigs, str2, false), eb1.Expression); } } catch (System.Exception ex) { } }
private void ZoneLBM(string Rob1, TxObjectList Rob1Sigs, string Rob2, TxObjectList Rob2Sigs, string[] Zone, TxPlcLogicBehavior LB) { TxPlcExpressionBuilder eb1 = new TxPlcExpressionBuilder(); try { foreach (string z in Zone) { string str1 = tb_ZoneReq.Text.Replace("Rob", Rob1).Replace("X", z); string str2 = tb_Zonefree.Text.Replace("Rob", Rob2).Replace("X", z); string str3 = tb_ZoneEnable.Text.Replace("Rob", Rob2).Replace("X", z); string str4 = tb_ZoneEnable.Text.Replace("Rob", Rob1).Replace("X", z); ITxPlcLogicBehaviorEntry en1 = SegEn(LB, FindSig(Rob1Sigs, str1, true)); ITxPlcLogicBehaviorEntry en2 = SegEn(LB, FindSig(Rob2Sigs, str2, true)); ITxPlcLogicBehaviorEntry en3 = SegEn(LB, FindSig(Rob2Sigs, str3, false)); eb1.Add(en1); eb1.Add(TxPlcExpressionOperator.And); eb1.Add(en2); eb1.Add(TxPlcExpressionOperator.And); eb1.Add(TxPlcExpressionOperator.Not); eb1.Add(en3); ITxPlcLogicBehaviorExit ex1 = SegEx(LB, FindSig(Rob1Sigs, str4, false), eb1.Expression); } } catch (System.Exception ex) { } }
private ITxPlcLogicBehaviorExit SegEx(TxPlcLogicBehavior LB, TxPlcSignalBase sig1, TxPlcExpression expression) { TxPlcLogicBehaviorExitCreationData ex1 = new TxPlcLogicBehaviorExitCreationData(); ex1.Name = sig1.Name; ex1.Expression = expression; ex1.HardwareType = TxPlcHardwareType.Bool; ITxPlcLogicBehaviorExit ex = LB.CreateExit(ex1); if (sig1 != null && !sig1.IsConnectedToLBExit) { ex.ConnectSignal(sig1); } return(ex); }