diff --git a/CMS_CORE_Library/S7Net/Nc_S7Net.cs b/CMS_CORE_Library/S7Net/Nc_S7Net.cs
index f49500c..cf7e9f4 100644
--- a/CMS_CORE_Library/S7Net/Nc_S7Net.cs
+++ b/CMS_CORE_Library/S7Net/Nc_S7Net.cs
@@ -72,7 +72,7 @@ namespace CMS_CORE_Library.S7Net
///
/// Lock per connessione PLC
///
- private readonly object connectLock = new object();
+ private readonly static object connectLock = new object();
#endregion
diff --git a/SiemensS7/Siemens-S7-Test/TestMainForm.Designer.cs b/SiemensS7/Siemens-S7-Test/TestMainForm.Designer.cs
index 1c936e2..a9c324a 100644
--- a/SiemensS7/Siemens-S7-Test/TestMainForm.Designer.cs
+++ b/SiemensS7/Siemens-S7-Test/TestMainForm.Designer.cs
@@ -37,6 +37,7 @@
this.label3 = new System.Windows.Forms.Label();
this.txtMemSize = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.cmbOutType = new System.Windows.Forms.ComboBox();
this.txtNumRep = new System.Windows.Forms.TextBox();
this.label13 = new System.Windows.Forms.Label();
this.btnReadStruct = new System.Windows.Forms.Button();
@@ -87,7 +88,7 @@
this.label15 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
- this.cmbOutType = new System.Windows.Forms.ComboBox();
+ this.chkDoParallel = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout();
this.groupBox3.SuspendLayout();
this.statusStrip1.SuspendLayout();
@@ -105,10 +106,10 @@
//
// txtIP
//
- this.txtIP.Location = new System.Drawing.Point(85, 23);
- this.txtIP.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.txtIP.Location = new System.Drawing.Point(64, 19);
+ this.txtIP.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtIP.Name = "txtIP";
- this.txtIP.Size = new System.Drawing.Size(109, 22);
+ this.txtIP.Size = new System.Drawing.Size(83, 20);
this.txtIP.TabIndex = 0;
this.txtIP.Text = "192.168.0.102";
this.txtIP.TextChanged += new System.EventHandler(this.txtIP_TextChanged);
@@ -116,9 +117,10 @@
// lblIP
//
this.lblIP.AutoSize = true;
- this.lblIP.Location = new System.Drawing.Point(16, 26);
+ this.lblIP.Location = new System.Drawing.Point(12, 21);
+ this.lblIP.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblIP.Name = "lblIP";
- this.lblIP.Size = new System.Drawing.Size(63, 17);
+ this.lblIP.Size = new System.Drawing.Size(51, 13);
this.lblIP.TabIndex = 1;
this.lblIP.Text = "IP ADDR";
//
@@ -131,10 +133,10 @@
"S7400",
"S71200",
"S71500"});
- this.cbCpuType.Location = new System.Drawing.Point(85, 62);
- this.cbCpuType.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.cbCpuType.Location = new System.Drawing.Point(64, 50);
+ this.cbCpuType.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.cbCpuType.Name = "cbCpuType";
- this.cbCpuType.Size = new System.Drawing.Size(109, 24);
+ this.cbCpuType.Size = new System.Drawing.Size(83, 21);
this.cbCpuType.TabIndex = 2;
this.cbCpuType.Text = "S71500";
this.cbCpuType.SelectedIndexChanged += new System.EventHandler(this.cbCpuType_SelectedIndexChanged);
@@ -142,27 +144,29 @@
// label1
//
this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(7, 64);
+ this.label1.Location = new System.Drawing.Point(5, 52);
+ this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(72, 17);
+ this.label1.Size = new System.Drawing.Size(56, 13);
this.label1.TabIndex = 3;
this.label1.Text = "CPU Type";
//
// label2
//
this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(9, 23);
+ this.label2.Location = new System.Drawing.Point(7, 19);
+ this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(80, 17);
+ this.label2.Size = new System.Drawing.Size(64, 13);
this.label2.TabIndex = 5;
this.label2.Text = "MEM AREA";
//
// txtMemArea
//
- this.txtMemArea.Location = new System.Drawing.Point(148, 20);
- this.txtMemArea.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.txtMemArea.Location = new System.Drawing.Point(111, 16);
+ this.txtMemArea.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtMemArea.Name = "txtMemArea";
- this.txtMemArea.Size = new System.Drawing.Size(101, 22);
+ this.txtMemArea.Size = new System.Drawing.Size(77, 20);
this.txtMemArea.TabIndex = 4;
this.txtMemArea.Text = "DB600.DBB20";
this.txtMemArea.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
@@ -171,18 +175,19 @@
// label3
//
this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(9, 52);
+ this.label3.Location = new System.Drawing.Point(7, 42);
+ this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(123, 17);
+ this.label3.Size = new System.Drawing.Size(96, 13);
this.label3.TabIndex = 7;
this.label3.Text = "MEM SIZE (BYTE)";
//
// txtMemSize
//
- this.txtMemSize.Location = new System.Drawing.Point(148, 50);
- this.txtMemSize.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.txtMemSize.Location = new System.Drawing.Point(111, 41);
+ this.txtMemSize.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtMemSize.Name = "txtMemSize";
- this.txtMemSize.Size = new System.Drawing.Size(101, 22);
+ this.txtMemSize.Size = new System.Drawing.Size(77, 20);
this.txtMemSize.TabIndex = 6;
this.txtMemSize.Text = "200";
this.txtMemSize.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
@@ -190,6 +195,7 @@
//
// groupBox1
//
+ this.groupBox1.Controls.Add(this.chkDoParallel);
this.groupBox1.Controls.Add(this.cmbOutType);
this.groupBox1.Controls.Add(this.txtNumRep);
this.groupBox1.Controls.Add(this.label13);
@@ -203,21 +209,38 @@
this.groupBox1.Controls.Add(this.txtMemSize);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label2);
- this.groupBox1.Location = new System.Drawing.Point(6, 5);
- this.groupBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.groupBox1.Location = new System.Drawing.Point(4, 4);
+ this.groupBox1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.groupBox1.Name = "groupBox1";
- this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
- this.groupBox1.Size = new System.Drawing.Size(672, 105);
+ this.groupBox1.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2);
+ this.groupBox1.Size = new System.Drawing.Size(504, 85);
this.groupBox1.TabIndex = 8;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Memoria: READ testing";
//
+ // cmbOutType
+ //
+ this.cmbOutType.FormattingEnabled = true;
+ this.cmbOutType.Items.AddRange(new object[] {
+ "byte",
+ "word",
+ "dword",
+ "real",
+ "struct"});
+ this.cmbOutType.Location = new System.Drawing.Point(392, 19);
+ this.cmbOutType.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+ this.cmbOutType.Name = "cmbOutType";
+ this.cmbOutType.Size = new System.Drawing.Size(92, 21);
+ this.cmbOutType.TabIndex = 16;
+ this.cmbOutType.Text = "byte";
+ this.cmbOutType.SelectedIndexChanged += new System.EventHandler(this.cmbOutType_SelectedIndexChanged);
+ //
// txtNumRep
//
- this.txtNumRep.Location = new System.Drawing.Point(148, 76);
- this.txtNumRep.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.txtNumRep.Location = new System.Drawing.Point(111, 62);
+ this.txtNumRep.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtNumRep.Name = "txtNumRep";
- this.txtNumRep.Size = new System.Drawing.Size(101, 22);
+ this.txtNumRep.Size = new System.Drawing.Size(77, 20);
this.txtNumRep.TabIndex = 14;
this.txtNumRep.Text = "1";
this.txtNumRep.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
@@ -225,18 +248,19 @@
// label13
//
this.label13.AutoSize = true;
- this.label13.Location = new System.Drawing.Point(9, 79);
+ this.label13.Location = new System.Drawing.Point(7, 64);
+ this.label13.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label13.Name = "label13";
- this.label13.Size = new System.Drawing.Size(72, 17);
+ this.label13.Size = new System.Drawing.Size(55, 13);
this.label13.TabIndex = 15;
this.label13.Text = "# samples";
//
// btnReadStruct
//
- this.btnReadStruct.Location = new System.Drawing.Point(405, 75);
- this.btnReadStruct.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btnReadStruct.Location = new System.Drawing.Point(304, 61);
+ this.btnReadStruct.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnReadStruct.Name = "btnReadStruct";
- this.btnReadStruct.Size = new System.Drawing.Size(110, 25);
+ this.btnReadStruct.Size = new System.Drawing.Size(82, 20);
this.btnReadStruct.TabIndex = 12;
this.btnReadStruct.Text = "Read Struc";
this.btnReadStruct.TextImageRelation = System.Windows.Forms.TextImageRelation.TextAboveImage;
@@ -245,10 +269,10 @@
//
// btnReadString
//
- this.btnReadString.Location = new System.Drawing.Point(405, 49);
- this.btnReadString.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btnReadString.Location = new System.Drawing.Point(304, 40);
+ this.btnReadString.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnReadString.Name = "btnReadString";
- this.btnReadString.Size = new System.Drawing.Size(110, 25);
+ this.btnReadString.Size = new System.Drawing.Size(82, 20);
this.btnReadString.TabIndex = 11;
this.btnReadString.Text = "Read String";
this.btnReadString.UseVisualStyleBackColor = true;
@@ -256,10 +280,10 @@
//
// btnReadDWord
//
- this.btnReadDWord.Location = new System.Drawing.Point(289, 75);
- this.btnReadDWord.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btnReadDWord.Location = new System.Drawing.Point(217, 61);
+ this.btnReadDWord.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnReadDWord.Name = "btnReadDWord";
- this.btnReadDWord.Size = new System.Drawing.Size(110, 25);
+ this.btnReadDWord.Size = new System.Drawing.Size(82, 20);
this.btnReadDWord.TabIndex = 10;
this.btnReadDWord.Text = "Read DWord";
this.btnReadDWord.TextImageRelation = System.Windows.Forms.TextImageRelation.TextAboveImage;
@@ -268,10 +292,10 @@
//
// btnReadWord
//
- this.btnReadWord.Location = new System.Drawing.Point(289, 48);
- this.btnReadWord.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btnReadWord.Location = new System.Drawing.Point(217, 39);
+ this.btnReadWord.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnReadWord.Name = "btnReadWord";
- this.btnReadWord.Size = new System.Drawing.Size(110, 25);
+ this.btnReadWord.Size = new System.Drawing.Size(82, 20);
this.btnReadWord.TabIndex = 10;
this.btnReadWord.Text = "Read Word";
this.btnReadWord.UseVisualStyleBackColor = true;
@@ -279,10 +303,10 @@
//
// btnReadReal
//
- this.btnReadReal.Location = new System.Drawing.Point(405, 19);
- this.btnReadReal.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btnReadReal.Location = new System.Drawing.Point(304, 15);
+ this.btnReadReal.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnReadReal.Name = "btnReadReal";
- this.btnReadReal.Size = new System.Drawing.Size(110, 25);
+ this.btnReadReal.Size = new System.Drawing.Size(82, 20);
this.btnReadReal.TabIndex = 9;
this.btnReadReal.Text = "Read Real";
this.btnReadReal.UseVisualStyleBackColor = true;
@@ -290,10 +314,10 @@
//
// btnReadByte
//
- this.btnReadByte.Location = new System.Drawing.Point(289, 19);
- this.btnReadByte.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btnReadByte.Location = new System.Drawing.Point(217, 15);
+ this.btnReadByte.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnReadByte.Name = "btnReadByte";
- this.btnReadByte.Size = new System.Drawing.Size(110, 25);
+ this.btnReadByte.Size = new System.Drawing.Size(82, 20);
this.btnReadByte.TabIndex = 9;
this.btnReadByte.Text = "Read Byte";
this.btnReadByte.UseVisualStyleBackColor = true;
@@ -311,11 +335,11 @@
this.groupBox3.Controls.Add(this.txtIP);
this.groupBox3.Controls.Add(this.lblIP);
this.groupBox3.Controls.Add(this.label1);
- this.groupBox3.Location = new System.Drawing.Point(6, 5);
- this.groupBox3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.groupBox3.Location = new System.Drawing.Point(4, 4);
+ this.groupBox3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.groupBox3.Name = "groupBox3";
- this.groupBox3.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
- this.groupBox3.Size = new System.Drawing.Size(479, 105);
+ this.groupBox3.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2);
+ this.groupBox3.Size = new System.Drawing.Size(359, 85);
this.groupBox3.TabIndex = 10;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Parametri PLC";
@@ -323,27 +347,29 @@
// label11
//
this.label11.AutoSize = true;
- this.label11.Location = new System.Drawing.Point(301, 39);
+ this.label11.Location = new System.Drawing.Point(226, 32);
+ this.label11.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label11.Name = "label11";
- this.label11.Size = new System.Drawing.Size(148, 51);
+ this.label11.Size = new System.Drawing.Size(115, 39);
this.label11.TabIndex = 7;
this.label11.Text = "S7-1200/S7-1500: 0/1\r\nS7-300/S7-400: 0/2\r\nSlot > 0 se eth ext";
//
// label6
//
this.label6.AutoSize = true;
- this.label6.Location = new System.Drawing.Point(301, 14);
+ this.label6.Location = new System.Drawing.Point(226, 11);
+ this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(114, 17);
+ this.label6.Size = new System.Drawing.Size(91, 13);
this.label6.TabIndex = 6;
this.label6.Text = "Note Rack / Slot:";
//
// txtSlot
//
- this.txtSlot.Location = new System.Drawing.Point(253, 62);
- this.txtSlot.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.txtSlot.Location = new System.Drawing.Point(190, 50);
+ this.txtSlot.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtSlot.Name = "txtSlot";
- this.txtSlot.Size = new System.Drawing.Size(41, 22);
+ this.txtSlot.Size = new System.Drawing.Size(32, 20);
this.txtSlot.TabIndex = 5;
this.txtSlot.Text = "1";
this.txtSlot.TextChanged += new System.EventHandler(this.txtSlot_TextChanged);
@@ -351,18 +377,19 @@
// label5
//
this.label5.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(208, 64);
+ this.label5.Location = new System.Drawing.Point(156, 52);
+ this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(32, 17);
+ this.label5.Size = new System.Drawing.Size(25, 13);
this.label5.TabIndex = 4;
this.label5.Text = "Slot";
//
// txtRack
//
- this.txtRack.Location = new System.Drawing.Point(253, 23);
- this.txtRack.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.txtRack.Location = new System.Drawing.Point(190, 19);
+ this.txtRack.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtRack.Name = "txtRack";
- this.txtRack.Size = new System.Drawing.Size(41, 22);
+ this.txtRack.Size = new System.Drawing.Size(32, 20);
this.txtRack.TabIndex = 5;
this.txtRack.Text = "0";
this.txtRack.TextChanged += new System.EventHandler(this.txtRack_TextChanged);
@@ -370,9 +397,10 @@
// label4
//
this.label4.AutoSize = true;
- this.label4.Location = new System.Drawing.Point(208, 26);
+ this.label4.Location = new System.Drawing.Point(156, 21);
+ this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(40, 17);
+ this.label4.Size = new System.Drawing.Size(33, 13);
this.label4.TabIndex = 4;
this.label4.Text = "Rack";
//
@@ -384,34 +412,34 @@
this.toolStripStatusLabel1,
this.toolStripProgressBar1,
this.tslRTime});
- this.statusStrip1.Location = new System.Drawing.Point(0, 583);
+ this.statusStrip1.Location = new System.Drawing.Point(0, 472);
this.statusStrip1.Name = "statusStrip1";
- this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 13, 0);
- this.statusStrip1.Size = new System.Drawing.Size(906, 28);
+ this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 10, 0);
+ this.statusStrip1.Size = new System.Drawing.Size(680, 24);
this.statusStrip1.TabIndex = 11;
this.statusStrip1.Text = "statusStrip1";
//
// tslConn
//
this.tslConn.Name = "tslConn";
- this.tslConn.Size = new System.Drawing.Size(72, 22);
+ this.tslConn.Size = new System.Drawing.Size(59, 19);
this.tslConn.Text = "Conn: ND";
//
// toolStripStatusLabel1
//
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
- this.toolStripStatusLabel1.Size = new System.Drawing.Size(13, 22);
+ this.toolStripStatusLabel1.Size = new System.Drawing.Size(10, 19);
this.toolStripStatusLabel1.Text = "|";
//
// toolStripProgressBar1
//
this.toolStripProgressBar1.Name = "toolStripProgressBar1";
- this.toolStripProgressBar1.Size = new System.Drawing.Size(100, 20);
+ this.toolStripProgressBar1.Size = new System.Drawing.Size(75, 18);
//
// tslRTime
//
this.tslRTime.Name = "tslRTime";
- this.tslRTime.Size = new System.Drawing.Size(37, 22);
+ this.tslRTime.Size = new System.Drawing.Size(32, 19);
this.tslRTime.Text = "...ms";
//
// groupBox4
@@ -430,21 +458,21 @@
this.groupBox4.Controls.Add(this.label10);
this.groupBox4.Controls.Add(this.txtWriteAddr1);
this.groupBox4.Controls.Add(this.label7);
- this.groupBox4.Location = new System.Drawing.Point(7, 7);
- this.groupBox4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.groupBox4.Location = new System.Drawing.Point(5, 6);
+ this.groupBox4.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.groupBox4.Name = "groupBox4";
- this.groupBox4.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
- this.groupBox4.Size = new System.Drawing.Size(1809, 71);
+ this.groupBox4.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2);
+ this.groupBox4.Size = new System.Drawing.Size(1357, 58);
this.groupBox4.TabIndex = 12;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Memoria: WRITE param";
//
// btnStrWrite
//
- this.btnStrWrite.Location = new System.Drawing.Point(799, 25);
- this.btnStrWrite.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btnStrWrite.Location = new System.Drawing.Point(599, 20);
+ this.btnStrWrite.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnStrWrite.Name = "btnStrWrite";
- this.btnStrWrite.Size = new System.Drawing.Size(41, 23);
+ this.btnStrWrite.Size = new System.Drawing.Size(31, 19);
this.btnStrWrite.TabIndex = 10;
this.btnStrWrite.Text = "SW";
this.btnStrWrite.UseVisualStyleBackColor = true;
@@ -452,10 +480,10 @@
//
// btnNumWriteB
//
- this.btnNumWriteB.Location = new System.Drawing.Point(329, 5);
- this.btnNumWriteB.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btnNumWriteB.Location = new System.Drawing.Point(247, 4);
+ this.btnNumWriteB.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnNumWriteB.Name = "btnNumWriteB";
- this.btnNumWriteB.Size = new System.Drawing.Size(48, 23);
+ this.btnNumWriteB.Size = new System.Drawing.Size(36, 19);
this.btnNumWriteB.TabIndex = 10;
this.btnNumWriteB.Text = "B";
this.btnNumWriteB.UseVisualStyleBackColor = true;
@@ -463,10 +491,10 @@
//
// btnNumWriteDW
//
- this.btnNumWriteDW.Location = new System.Drawing.Point(329, 44);
- this.btnNumWriteDW.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btnNumWriteDW.Location = new System.Drawing.Point(247, 36);
+ this.btnNumWriteDW.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnNumWriteDW.Name = "btnNumWriteDW";
- this.btnNumWriteDW.Size = new System.Drawing.Size(48, 23);
+ this.btnNumWriteDW.Size = new System.Drawing.Size(36, 19);
this.btnNumWriteDW.TabIndex = 10;
this.btnNumWriteDW.Text = "DW";
this.btnNumWriteDW.UseVisualStyleBackColor = true;
@@ -474,10 +502,10 @@
//
// btnNumWriteW
//
- this.btnNumWriteW.Location = new System.Drawing.Point(329, 23);
- this.btnNumWriteW.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.btnNumWriteW.Location = new System.Drawing.Point(247, 19);
+ this.btnNumWriteW.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnNumWriteW.Name = "btnNumWriteW";
- this.btnNumWriteW.Size = new System.Drawing.Size(48, 23);
+ this.btnNumWriteW.Size = new System.Drawing.Size(36, 19);
this.btnNumWriteW.TabIndex = 10;
this.btnNumWriteW.Text = "W";
this.btnNumWriteW.UseVisualStyleBackColor = true;
@@ -485,10 +513,10 @@
//
// txtWriteVal2
//
- this.txtWriteVal2.Location = new System.Drawing.Point(612, 25);
- this.txtWriteVal2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.txtWriteVal2.Location = new System.Drawing.Point(459, 20);
+ this.txtWriteVal2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtWriteVal2.Name = "txtWriteVal2";
- this.txtWriteVal2.Size = new System.Drawing.Size(187, 22);
+ this.txtWriteVal2.Size = new System.Drawing.Size(141, 20);
this.txtWriteVal2.TabIndex = 8;
this.txtWriteVal2.Text = "SAMUELEL";
this.txtWriteVal2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
@@ -496,18 +524,19 @@
// label9
//
this.label9.AutoSize = true;
- this.label9.Location = new System.Drawing.Point(571, 27);
+ this.label9.Location = new System.Drawing.Point(428, 22);
+ this.label9.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(36, 17);
+ this.label9.Size = new System.Drawing.Size(29, 13);
this.label9.TabIndex = 9;
this.label9.Text = "STR";
//
// txtWriteVal1
//
- this.txtWriteVal1.Location = new System.Drawing.Point(237, 25);
- this.txtWriteVal1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.txtWriteVal1.Location = new System.Drawing.Point(178, 20);
+ this.txtWriteVal1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtWriteVal1.Name = "txtWriteVal1";
- this.txtWriteVal1.Size = new System.Drawing.Size(85, 22);
+ this.txtWriteVal1.Size = new System.Drawing.Size(65, 20);
this.txtWriteVal1.TabIndex = 8;
this.txtWriteVal1.Text = "987654321";
this.txtWriteVal1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
@@ -515,18 +544,19 @@
// label8
//
this.label8.AutoSize = true;
- this.label8.Location = new System.Drawing.Point(197, 27);
+ this.label8.Location = new System.Drawing.Point(148, 22);
+ this.label8.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(39, 17);
+ this.label8.Size = new System.Drawing.Size(32, 13);
this.label8.TabIndex = 9;
this.label8.Text = "NUM";
//
// txtWriteAddr2
//
- this.txtWriteAddr2.Location = new System.Drawing.Point(448, 25);
- this.txtWriteAddr2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.txtWriteAddr2.Location = new System.Drawing.Point(336, 20);
+ this.txtWriteAddr2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtWriteAddr2.Name = "txtWriteAddr2";
- this.txtWriteAddr2.Size = new System.Drawing.Size(116, 22);
+ this.txtWriteAddr2.Size = new System.Drawing.Size(88, 20);
this.txtWriteAddr2.TabIndex = 6;
this.txtWriteAddr2.Text = "DB600.DBB2";
this.txtWriteAddr2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
@@ -534,18 +564,19 @@
// label10
//
this.label10.AutoSize = true;
- this.label10.Location = new System.Drawing.Point(389, 27);
+ this.label10.Location = new System.Drawing.Point(292, 22);
+ this.label10.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(59, 17);
+ this.label10.Size = new System.Drawing.Size(47, 13);
this.label10.TabIndex = 7;
this.label10.Text = "ADDR 2";
//
// txtWriteAddr1
//
- this.txtWriteAddr1.Location = new System.Drawing.Point(71, 25);
- this.txtWriteAddr1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.txtWriteAddr1.Location = new System.Drawing.Point(53, 20);
+ this.txtWriteAddr1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtWriteAddr1.Name = "txtWriteAddr1";
- this.txtWriteAddr1.Size = new System.Drawing.Size(123, 22);
+ this.txtWriteAddr1.Size = new System.Drawing.Size(93, 20);
this.txtWriteAddr1.TabIndex = 6;
this.txtWriteAddr1.Text = "DB600.DBB0";
this.txtWriteAddr1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
@@ -553,9 +584,10 @@
// label7
//
this.label7.AutoSize = true;
- this.label7.Location = new System.Drawing.Point(5, 27);
+ this.label7.Location = new System.Drawing.Point(4, 22);
+ this.label7.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(59, 17);
+ this.label7.Size = new System.Drawing.Size(47, 13);
this.label7.TabIndex = 7;
this.label7.Text = "ADDR 1";
//
@@ -565,12 +597,12 @@
this.txtOut.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.txtOut.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtOut.ForeColor = System.Drawing.Color.Yellow;
- this.txtOut.Location = new System.Drawing.Point(4, 21);
- this.txtOut.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.txtOut.Location = new System.Drawing.Point(3, 17);
+ this.txtOut.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtOut.Multiline = true;
this.txtOut.Name = "txtOut";
this.txtOut.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
- this.txtOut.Size = new System.Drawing.Size(569, 388);
+ this.txtOut.Size = new System.Drawing.Size(427, 315);
this.txtOut.TabIndex = 0;
this.txtOut.Text = "...";
//
@@ -578,11 +610,11 @@
//
this.groupBox2.AutoSize = true;
this.groupBox2.Controls.Add(this.txtOut);
- this.groupBox2.Location = new System.Drawing.Point(3, 11);
- this.groupBox2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.groupBox2.Location = new System.Drawing.Point(2, 9);
+ this.groupBox2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.groupBox2.Name = "groupBox2";
- this.groupBox2.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
- this.groupBox2.Size = new System.Drawing.Size(579, 428);
+ this.groupBox2.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2);
+ this.groupBox2.Size = new System.Drawing.Size(434, 349);
this.groupBox2.TabIndex = 9;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Risultati";
@@ -594,19 +626,21 @@
this.tabCtrl.Controls.Add(this.tabReadTest);
this.tabCtrl.Controls.Add(this.tabWriteTest);
this.tabCtrl.Controls.Add(this.tabParam);
- this.tabCtrl.Location = new System.Drawing.Point(15, 9);
+ this.tabCtrl.Location = new System.Drawing.Point(11, 7);
+ this.tabCtrl.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.tabCtrl.Name = "tabCtrl";
this.tabCtrl.SelectedIndex = 0;
- this.tabCtrl.Size = new System.Drawing.Size(879, 143);
+ this.tabCtrl.Size = new System.Drawing.Size(659, 116);
this.tabCtrl.TabIndex = 13;
//
// tabReadTest
//
this.tabReadTest.Controls.Add(this.groupBox1);
- this.tabReadTest.Location = new System.Drawing.Point(4, 25);
+ this.tabReadTest.Location = new System.Drawing.Point(4, 22);
+ this.tabReadTest.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.tabReadTest.Name = "tabReadTest";
- this.tabReadTest.Padding = new System.Windows.Forms.Padding(3);
- this.tabReadTest.Size = new System.Drawing.Size(871, 114);
+ this.tabReadTest.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2);
+ this.tabReadTest.Size = new System.Drawing.Size(651, 90);
this.tabReadTest.TabIndex = 0;
this.tabReadTest.Text = "Read Test";
this.tabReadTest.UseVisualStyleBackColor = true;
@@ -614,9 +648,10 @@
// tabWriteTest
//
this.tabWriteTest.Controls.Add(this.groupBox4);
- this.tabWriteTest.Location = new System.Drawing.Point(4, 25);
+ this.tabWriteTest.Location = new System.Drawing.Point(4, 22);
+ this.tabWriteTest.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.tabWriteTest.Name = "tabWriteTest";
- this.tabWriteTest.Size = new System.Drawing.Size(871, 114);
+ this.tabWriteTest.Size = new System.Drawing.Size(651, 90);
this.tabWriteTest.TabIndex = 2;
this.tabWriteTest.Text = "Write Test";
this.tabWriteTest.UseVisualStyleBackColor = true;
@@ -624,10 +659,11 @@
// tabParam
//
this.tabParam.Controls.Add(this.groupBox3);
- this.tabParam.Location = new System.Drawing.Point(4, 25);
+ this.tabParam.Location = new System.Drawing.Point(4, 22);
+ this.tabParam.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.tabParam.Name = "tabParam";
- this.tabParam.Padding = new System.Windows.Forms.Padding(3);
- this.tabParam.Size = new System.Drawing.Size(871, 114);
+ this.tabParam.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2);
+ this.tabParam.Size = new System.Drawing.Size(651, 90);
this.tabParam.TabIndex = 1;
this.tabParam.Text = "Parametri";
this.tabParam.UseVisualStyleBackColor = true;
@@ -637,7 +673,8 @@
this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.splitContainer1.Location = new System.Drawing.Point(15, 158);
+ this.splitContainer1.Location = new System.Drawing.Point(11, 128);
+ this.splitContainer1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
@@ -656,17 +693,19 @@
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.groupBox2);
- this.splitContainer1.Size = new System.Drawing.Size(875, 422);
- this.splitContainer1.SplitterDistance = 291;
+ this.splitContainer1.Size = new System.Drawing.Size(656, 343);
+ this.splitContainer1.SplitterDistance = 218;
+ this.splitContainer1.SplitterWidth = 3;
this.splitContainer1.TabIndex = 15;
//
// lblThroughtput
//
this.lblThroughtput.AutoSize = true;
this.lblThroughtput.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblThroughtput.Location = new System.Drawing.Point(224, 105);
+ this.lblThroughtput.Location = new System.Drawing.Point(168, 85);
+ this.lblThroughtput.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblThroughtput.Name = "lblThroughtput";
- this.lblThroughtput.Size = new System.Drawing.Size(35, 17);
+ this.lblThroughtput.Size = new System.Drawing.Size(28, 13);
this.lblThroughtput.TabIndex = 9;
this.lblThroughtput.Text = "000";
this.lblThroughtput.TextAlign = System.Drawing.ContentAlignment.TopRight;
@@ -675,18 +714,20 @@
//
this.label18.AutoSize = true;
this.label18.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label18.Location = new System.Drawing.Point(19, 105);
+ this.label18.Location = new System.Drawing.Point(14, 85);
+ this.label18.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label18.Name = "label18";
- this.label18.Size = new System.Drawing.Size(57, 17);
+ this.label18.Size = new System.Drawing.Size(48, 13);
this.label18.TabIndex = 8;
this.label18.Text = "Kb/sec";
//
// lblTotSize
//
this.lblTotSize.AutoSize = true;
- this.lblTotSize.Location = new System.Drawing.Point(227, 20);
+ this.lblTotSize.Location = new System.Drawing.Point(170, 16);
+ this.lblTotSize.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblTotSize.Name = "lblTotSize";
- this.lblTotSize.Size = new System.Drawing.Size(32, 17);
+ this.lblTotSize.Size = new System.Drawing.Size(25, 13);
this.lblTotSize.TabIndex = 7;
this.lblTotSize.Text = "000";
this.lblTotSize.TextAlign = System.Drawing.ContentAlignment.TopRight;
@@ -694,9 +735,10 @@
// lblTimeMin
//
this.lblTimeMin.AutoSize = true;
- this.lblTimeMin.Location = new System.Drawing.Point(227, 41);
+ this.lblTimeMin.Location = new System.Drawing.Point(170, 33);
+ this.lblTimeMin.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblTimeMin.Name = "lblTimeMin";
- this.lblTimeMin.Size = new System.Drawing.Size(32, 17);
+ this.lblTimeMin.Size = new System.Drawing.Size(25, 13);
this.lblTimeMin.TabIndex = 6;
this.lblTimeMin.Text = "000";
this.lblTimeMin.TextAlign = System.Drawing.ContentAlignment.TopRight;
@@ -704,9 +746,10 @@
// lblTimeMax
//
this.lblTimeMax.AutoSize = true;
- this.lblTimeMax.Location = new System.Drawing.Point(227, 75);
+ this.lblTimeMax.Location = new System.Drawing.Point(170, 61);
+ this.lblTimeMax.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblTimeMax.Name = "lblTimeMax";
- this.lblTimeMax.Size = new System.Drawing.Size(32, 17);
+ this.lblTimeMax.Size = new System.Drawing.Size(25, 13);
this.lblTimeMax.TabIndex = 5;
this.lblTimeMax.Text = "000";
this.lblTimeMax.TextAlign = System.Drawing.ContentAlignment.TopRight;
@@ -715,9 +758,10 @@
//
this.lblTimeAvg.AutoSize = true;
this.lblTimeAvg.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblTimeAvg.Location = new System.Drawing.Point(224, 58);
+ this.lblTimeAvg.Location = new System.Drawing.Point(168, 47);
+ this.lblTimeAvg.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblTimeAvg.Name = "lblTimeAvg";
- this.lblTimeAvg.Size = new System.Drawing.Size(35, 17);
+ this.lblTimeAvg.Size = new System.Drawing.Size(28, 13);
this.lblTimeAvg.TabIndex = 4;
this.lblTimeAvg.Text = "000";
this.lblTimeAvg.TextAlign = System.Drawing.ContentAlignment.TopRight;
@@ -726,64 +770,62 @@
//
this.label16.AutoSize = true;
this.label16.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.label16.Location = new System.Drawing.Point(19, 58);
+ this.label16.Location = new System.Drawing.Point(14, 47);
+ this.label16.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label16.Name = "label16";
- this.label16.Size = new System.Drawing.Size(80, 17);
+ this.label16.Size = new System.Drawing.Size(66, 13);
this.label16.TabIndex = 3;
this.label16.Text = "TIME: avg";
//
// label15
//
this.label15.AutoSize = true;
- this.label15.Location = new System.Drawing.Point(19, 75);
+ this.label15.Location = new System.Drawing.Point(14, 61);
+ this.label15.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label15.Name = "label15";
- this.label15.Size = new System.Drawing.Size(73, 17);
+ this.label15.Size = new System.Drawing.Size(58, 13);
this.label15.TabIndex = 2;
this.label15.Text = "TIME: max";
//
// label14
//
this.label14.AutoSize = true;
- this.label14.Location = new System.Drawing.Point(19, 41);
+ this.label14.Location = new System.Drawing.Point(14, 33);
+ this.label14.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label14.Name = "label14";
- this.label14.Size = new System.Drawing.Size(70, 17);
+ this.label14.Size = new System.Drawing.Size(55, 13);
this.label14.TabIndex = 1;
this.label14.Text = "TIME: min";
//
// label12
//
this.label12.AutoSize = true;
- this.label12.Location = new System.Drawing.Point(19, 20);
+ this.label12.Location = new System.Drawing.Point(14, 16);
+ this.label12.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label12.Name = "label12";
- this.label12.Size = new System.Drawing.Size(58, 17);
+ this.label12.Size = new System.Drawing.Size(44, 13);
this.label12.TabIndex = 0;
this.label12.Text = "Tot size";
//
- // cmbOutType
+ // chkDoParallel
//
- this.cmbOutType.FormattingEnabled = true;
- this.cmbOutType.Items.AddRange(new object[] {
- "byte",
- "word",
- "dword",
- "real",
- "struct"});
- this.cmbOutType.Location = new System.Drawing.Point(522, 23);
- this.cmbOutType.Name = "cmbOutType";
- this.cmbOutType.Size = new System.Drawing.Size(121, 24);
- this.cmbOutType.TabIndex = 16;
- this.cmbOutType.Text = "byte";
- this.cmbOutType.SelectedIndexChanged += new System.EventHandler(this.cmbOutType_SelectedIndexChanged);
+ this.chkDoParallel.AutoSize = true;
+ this.chkDoParallel.Location = new System.Drawing.Point(392, 46);
+ this.chkDoParallel.Name = "chkDoParallel";
+ this.chkDoParallel.Size = new System.Drawing.Size(74, 17);
+ this.chkDoParallel.TabIndex = 17;
+ this.chkDoParallel.Text = "do parallel";
+ this.chkDoParallel.UseVisualStyleBackColor = true;
//
// TestMainForm
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(906, 611);
+ this.ClientSize = new System.Drawing.Size(680, 496);
this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.tabCtrl);
- this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.Name = "TestMainForm";
this.Text = "SIEMENS S7 TEST";
this.groupBox1.ResumeLayout(false);
@@ -873,6 +915,7 @@
private System.Windows.Forms.Label lblThroughtput;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.ComboBox cmbOutType;
+ private System.Windows.Forms.CheckBox chkDoParallel;
}
}
diff --git a/SiemensS7/Siemens-S7-Test/TestMainForm.cs b/SiemensS7/Siemens-S7-Test/TestMainForm.cs
index 216d58f..fe938f6 100644
--- a/SiemensS7/Siemens-S7-Test/TestMainForm.cs
+++ b/SiemensS7/Siemens-S7-Test/TestMainForm.cs
@@ -76,6 +76,10 @@ namespace Siemens_S7_Test
/// Array oggetti letti
///
protected Byte[] memByteRead = new byte[0];
+ ///
+ /// Lock per connessione PLC
+ ///
+ private readonly static object connectLock = new object();
public TestMainForm()
{
@@ -212,24 +216,42 @@ namespace Siemens_S7_Test
int.TryParse(txtMemSize.Text, out numByte);
int numTest = 1;
int.TryParse(txtNumRep.Text, out numTest);
- //tslRTime.Text = "Start reading BYTE";
- //tslRTime.Invalidate();
- // effettuo numero di test secondo indicazioni...
- for (int i = 0; i < numTest; i++)
+
+ if (chkDoParallel.Checked)
{
- sw.Restart();
- // eseguo test
- try
+ Parallel.For(0, numTest, (i, state) =>
{
- memByteRead = currPLC.ReadBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, numByte);
+ lock (connectLock)
+ {
+ sw.Restart();
+ // eseguo test
+ memByteRead = currPLC.ReadBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, numByte);
+ sw.Stop();
+ // salvo risultati
+ PerfStats.addValue((double)sw.ElapsedMilliseconds);
+ }
}
- catch (Exception exc)
+ );
+ }
+ else
+ {
+ // effettuo numero di test secondo indicazioni...
+ for (int i = 0; i < numTest; i++)
{
- lg.Error(exc);
+ sw.Restart();
+ // eseguo test
+ try
+ {
+ memByteRead = currPLC.ReadBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, numByte);
+ }
+ catch (Exception exc)
+ {
+ lg.Error(exc);
+ }
+ sw.Stop();
+ // salvo risultati
+ PerfStats.addValue((double)sw.ElapsedMilliseconds);
}
- sw.Stop();
- // salvo risultati
- PerfStats.addValue((double)sw.ElapsedMilliseconds);
}
// mostro update lettura
@@ -264,14 +286,34 @@ namespace Siemens_S7_Test
int numTest = 1;
int.TryParse(txtNumRep.Text, out numTest);
// effettuo numero di test secondo indicazioni...
- for (int i = 0; i < numTest; i++)
+
+ if (chkDoParallel.Checked)
{
- sw.Restart();
- // eseguo test
- memByteRead = currPLC.ReadBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, numByte);
- sw.Stop();
- // salvo risultati
- PerfStats.addValue((double)sw.ElapsedMilliseconds);
+ Parallel.For(0, numTest, (i, state) =>
+ {
+ lock (connectLock)
+ {
+ sw.Restart();
+ // eseguo test
+ memByteRead = currPLC.ReadBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, numByte);
+ sw.Stop();
+ // salvo risultati
+ PerfStats.addValue((double)sw.ElapsedMilliseconds);
+ }
+ }
+ );
+ }
+ else
+ {
+ for (int i = 0; i < numTest; i++)
+ {
+ sw.Restart();
+ // eseguo test
+ memByteRead = currPLC.ReadBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, numByte);
+ sw.Stop();
+ // salvo risultati
+ PerfStats.addValue((double)sw.ElapsedMilliseconds);
+ }
}
// mostro update lettura