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 ZoneModlueM(string Rob1, TxObjectList Rob1Sigs, string Rob2, TxObjectList Rob2Sigs, string[] Zone, ITxPlcModule p1) { TxPlcExpressionBuilder eb1 = new TxPlcExpressionBuilder(); try { foreach (string z in Zone) { string str1 = textBox1.Text.Replace("Rob", Rob1).Replace("X", z); string str2 = textBox3.Text.Replace("Rob", Rob2).Replace("X", z); string str3 = textBox2.Text.Replace("Rob", Rob2).Replace("X", z); string str4 = textBox2.Text.Replace("Rob", Rob1).Replace("X", z); eb1.Add(FindSig(Rob1Sigs, str1, true)); eb1.Add(TxPlcExpressionOperator.And); eb1.Add(FindSig(Rob2Sigs, str2, true)); eb1.Add(TxPlcExpressionOperator.And); eb1.Add(TxPlcExpressionOperator.Not); eb1.Add(FindSig(Rob2Sigs, str3, false)); p1.AddEntry(FindSig(Rob1Sigs, str4, false), eb1.Expression); } } catch (System.Exception ex) { } }
private void ZoneModlueS(string Rob1, TxObjectList Rob1Sigs, string Rob2, TxObjectList Rob2Sigs, string[] Zone, ITxPlcModule p1) { TxPlcExpressionBuilder eb1 = new TxPlcExpressionBuilder(); try { foreach (string z in Zone) { string str1 = textBox12.Text.Replace("X", z); string str2 = textBox11.Text.Replace("X", z); eb1.Add(TxPlcExpressionOperator.Not); eb1.Add(FindSig(Rob1Sigs, str1, true)); eb1.Add(TxPlcExpressionOperator.And); eb1.Add(TxPlcExpressionOperator.LeftParenthesis); eb1.Add(TxPlcExpressionOperator.Not); eb1.Add(FindSig(Rob2Sigs, str2, false)); eb1.Add(TxPlcExpressionOperator.Or); eb1.Add(FindSig(Rob2Sigs, str1, true)); eb1.Add(TxPlcExpressionOperator.RightParenthesis); p1.AddEntry(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 void SegModlueS() { TxPlcExpressionBuilder eb1 = new TxPlcExpressionBuilder(); try { for (int i = 0; i < dataGridView2.Rows.Count; i++) { if (dataGridView2.Rows[i].Cells[0].Value != null && dataGridView2.Rows[i].Cells[1].Value != null) { string rob1name = dataGridView2.Rows[i].Cells[0].Value.ToString(); string strseg1 = dataGridView2.Rows[i].Cells[1].Value.ToString(); string str1 = textBox9.Text; string str2 = textBox10.Text; string str3 = textBox8.Text; TxRobot r1 = RobDictionary[rob1name]; eb1.Add(FindSig(r1.Signals, str3.Replace("Rob", rob1name), true)); eb1.Add(TxPlcExpressionOperator.And); //eb1.Add(TxPlcExpressionOperator.LeftParenthesis); eb1.Add(TxPlcExpressionOperator.LeftParenthesis); int c = 0; if (int.TryParse(strseg1, out c)) { TxPlcValue pv = new TxPlcValue(); pv.ByteValue = (ushort)c; eb1.Add(TxPlcExpressionOperator.LeftParenthesis); eb1.Add(FindSig(r1.Signals, str2.Replace("Rob", rob1name), true)); eb1.Add(TxPlcExpressionOperator.IsEqualTo); eb1.Add(TxPlcSignalDataType.Byte, pv); eb1.Add(TxPlcExpressionOperator.RightParenthesis); eb1.Add(TxPlcExpressionOperator.And); } for (int j = 0; j < dataGridView8.Columns.Count; j++) { string rob2name = dataGridView8.Columns[j].HeaderText; if (dataGridView8.Rows[i].Cells[j].Value != null) { if (j > 0) { eb1.Add(TxPlcExpressionOperator.And); } string strseg2 = dataGridView8.Rows[i].Cells[j].Value.ToString(); eb1.Add(TxPlcExpressionOperator.LeftParenthesis); eb1.Add(FindSig(Robots[j].Signals, str2.Replace("Rob", rob2name), true)); eb1.Add(TxPlcExpressionOperator.IsEqualTo); int c1 = 0; if (int.TryParse(strseg2, out c1)) { TxPlcValue pv = new TxPlcValue(); pv.ByteValue = (ushort)c1; eb1.Add(TxPlcSignalDataType.Byte, pv); eb1.Add(TxPlcExpressionOperator.RightParenthesis); } } } //eb1.Add(TxPlcExpressionOperator.RightParenthesis); eb1.Add(TxPlcExpressionOperator.RightParenthesis); if (string.Equals(rob1name, dataGridView2.Rows[i + 1].Cells[0].Value)) { eb1.Add(TxPlcExpressionOperator.Or); } else { ITxPlcSignal sig = FindSig(r1.Signals, str1.Replace("Rob", rob1name), false); ITxPlcModuleEntry pe = ModDictionary[rob1name].AddEntry(sig, eb1.Expression); eb1 = new TxPlcExpressionBuilder(); } } } } catch (System.Exception ex) { } }