From 6d9ab7b3ded205ad2f7602f693b65a5a9910c0ad Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 10 Sep 2021 19:07:42 +0200 Subject: [PATCH 1/5] Update conf variabile contapezzi Cosmap --- IOB-WIN-NEXT/DATA/CONF/1032.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IOB-WIN-NEXT/DATA/CONF/1032.json b/IOB-WIN-NEXT/DATA/CONF/1032.json index 674a4cff..0588bfec 100644 --- a/IOB-WIN-NEXT/DATA/CONF/1032.json +++ b/IOB-WIN-NEXT/DATA/CONF/1032.json @@ -69,7 +69,7 @@ }, "ContatoreParziale": { "name": "ContatoreParziale", - "description": "Contapezzi Parziale2", + "description": "Contapezzi MES DBB208", "memAddr": "DB6.DBB208", "tipoMem": "DInt", "index": 208, From 0cb09974476619f19eb808b0660882dce905f714 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 23 Sep 2021 17:10:03 +0200 Subject: [PATCH 2/5] Aggiunta gest opzione RobotService --- IOB-UT-NEXT/Enums.cs | 5 +++++ IOB-WIN-NEXT/AdapterForm.cs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/IOB-UT-NEXT/Enums.cs b/IOB-UT-NEXT/Enums.cs index 5cda4813..82854520 100644 --- a/IOB-UT-NEXT/Enums.cs +++ b/IOB-UT-NEXT/Enums.cs @@ -354,6 +354,11 @@ namespace IOB_UT_NEXT /// SIEMENS_PRESSOIL_CEI, + /// + /// Adapter SIEMENS, interfaccia verisone RobotService (Donati, smerigliatrici) + /// + SIEMENS_ROBOTSERVICE, + /// /// Adapter SIEMENS, interfaccia versione SAET (Valvital, forni / tempra) /// diff --git a/IOB-WIN-NEXT/AdapterForm.cs b/IOB-WIN-NEXT/AdapterForm.cs index f3dd7900..d319f5b8 100644 --- a/IOB-WIN-NEXT/AdapterForm.cs +++ b/IOB-WIN-NEXT/AdapterForm.cs @@ -1264,6 +1264,11 @@ namespace IOB_WIN_NEXT start.Enabled = true; break; + case tipoAdapter.SIEMENS_ROBOTSERVICE: + iobObj = new IobSiemensRobotService(this, IOBConf); + start.Enabled = true; + break; + case tipoAdapter.SIEMENS_SAET: iobObj = new IobSiemensSaet(this, IOBConf); start.Enabled = true; From 0f8fdce5b30fb41da888555e4afb14fda3e486e2 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 23 Sep 2021 17:10:22 +0200 Subject: [PATCH 3/5] Lettura Char[] su TestS7 --- Test-S7/App.config | 23 +++++------ Test-S7/TestMainForm.Designer.cs | 68 ++++++++++++++++---------------- 2 files changed, 46 insertions(+), 45 deletions(-) diff --git a/Test-S7/App.config b/Test-S7/App.config index 5ebab194..02f5d6d3 100644 --- a/Test-S7/App.config +++ b/Test-S7/App.config @@ -1,16 +1,17 @@  - + - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/Test-S7/TestMainForm.Designer.cs b/Test-S7/TestMainForm.Designer.cs index 859798ff..da7a239e 100644 --- a/Test-S7/TestMainForm.Designer.cs +++ b/Test-S7/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.btnReadChar = new System.Windows.Forms.Button(); this.btnReadString = new System.Windows.Forms.Button(); this.btnReadDWord = new System.Windows.Forms.Button(); this.btnReadWord = new System.Windows.Forms.Button(); @@ -58,6 +59,7 @@ this.toolStripProgressBar1 = new System.Windows.Forms.ToolStripProgressBar(); this.tslRTime = new System.Windows.Forms.ToolStripStatusLabel(); this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.btnCharWrite = new System.Windows.Forms.Button(); this.btnNumWriteReal = new System.Windows.Forms.Button(); this.btnStrWrite = new System.Windows.Forms.Button(); this.btnNumWriteB = new System.Windows.Forms.Button(); @@ -71,8 +73,6 @@ this.label10 = new System.Windows.Forms.Label(); this.txtWriteAddr1 = new System.Windows.Forms.TextBox(); this.label7 = new System.Windows.Forms.Label(); - this.btnCharWrite = new System.Windows.Forms.Button(); - this.btnReadChar = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); @@ -85,9 +85,9 @@ this.txtIP.Location = new System.Drawing.Point(64, 19); this.txtIP.Margin = new System.Windows.Forms.Padding(2); this.txtIP.Name = "txtIP"; - this.txtIP.Size = new System.Drawing.Size(83, 20); + this.txtIP.Size = new System.Drawing.Size(99, 20); this.txtIP.TabIndex = 0; - this.txtIP.Text = "192.168.0.51"; + this.txtIP.Text = "127.0.0.1"; this.txtIP.TextChanged += new System.EventHandler(this.txtIP_TextChanged); // // lblIP @@ -112,7 +112,7 @@ this.cbCpuType.Location = new System.Drawing.Point(64, 50); this.cbCpuType.Margin = new System.Windows.Forms.Padding(2); this.cbCpuType.Name = "cbCpuType"; - this.cbCpuType.Size = new System.Drawing.Size(83, 21); + this.cbCpuType.Size = new System.Drawing.Size(99, 21); this.cbCpuType.TabIndex = 2; this.cbCpuType.Text = "S7300"; this.cbCpuType.SelectedIndexChanged += new System.EventHandler(this.cbCpuType_SelectedIndexChanged); @@ -192,6 +192,17 @@ this.groupBox1.TabStop = false; this.groupBox1.Text = "Memoria: READ param"; // + // btnReadChar + // + this.btnReadChar.Location = new System.Drawing.Point(104, 74); + this.btnReadChar.Margin = new System.Windows.Forms.Padding(2); + this.btnReadChar.Name = "btnReadChar"; + this.btnReadChar.Size = new System.Drawing.Size(76, 20); + this.btnReadChar.TabIndex = 12; + this.btnReadChar.Text = "R Char[]"; + this.btnReadChar.UseVisualStyleBackColor = true; + this.btnReadChar.Click += new System.EventHandler(this.btnReadChar_Click); + // // btnReadString // this.btnReadString.Location = new System.Drawing.Point(10, 74); @@ -318,18 +329,18 @@ this.textBox2.BackColor = System.Drawing.SystemColors.Menu; this.textBox2.BorderStyle = System.Windows.Forms.BorderStyle.None; this.textBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.textBox2.Location = new System.Drawing.Point(226, 31); + this.textBox2.Location = new System.Drawing.Point(240, 31); this.textBox2.Margin = new System.Windows.Forms.Padding(2); this.textBox2.Multiline = true; this.textBox2.Name = "textBox2"; - this.textBox2.Size = new System.Drawing.Size(105, 44); + this.textBox2.Size = new System.Drawing.Size(91, 44); this.textBox2.TabIndex = 7; this.textBox2.Text = "S7-1200/S7-1500: 0/0\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(226, 11); + this.label6.Location = new System.Drawing.Point(236, 11); this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(91, 13); @@ -338,7 +349,7 @@ // // txtSlot // - this.txtSlot.Location = new System.Drawing.Point(190, 50); + this.txtSlot.Location = new System.Drawing.Point(201, 50); this.txtSlot.Margin = new System.Windows.Forms.Padding(2); this.txtSlot.Name = "txtSlot"; this.txtSlot.Size = new System.Drawing.Size(32, 20); @@ -349,7 +360,7 @@ // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(156, 52); + this.label5.Location = new System.Drawing.Point(167, 52); this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(25, 13); @@ -358,7 +369,7 @@ // // txtRack // - this.txtRack.Location = new System.Drawing.Point(190, 19); + this.txtRack.Location = new System.Drawing.Point(201, 19); this.txtRack.Margin = new System.Windows.Forms.Padding(2); this.txtRack.Name = "txtRack"; this.txtRack.Size = new System.Drawing.Size(32, 20); @@ -369,7 +380,7 @@ // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(156, 21); + this.label4.Location = new System.Drawing.Point(167, 21); this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(33, 13); @@ -441,6 +452,17 @@ this.groupBox4.TabStop = false; this.groupBox4.Text = "Memoria: WRITE param"; // + // btnCharWrite + // + this.btnCharWrite.Location = new System.Drawing.Point(548, 32); + this.btnCharWrite.Margin = new System.Windows.Forms.Padding(2); + this.btnCharWrite.Name = "btnCharWrite"; + this.btnCharWrite.Size = new System.Drawing.Size(79, 24); + this.btnCharWrite.TabIndex = 12; + this.btnCharWrite.Text = "W Char[]"; + this.btnCharWrite.UseVisualStyleBackColor = true; + this.btnCharWrite.Click += new System.EventHandler(this.btnCharWrite_Click); + // // btnNumWriteReal // this.btnNumWriteReal.Location = new System.Drawing.Point(258, 13); @@ -577,28 +599,6 @@ this.label7.TabIndex = 7; this.label7.Text = "ADDR 1"; // - // btnCharWrite - // - this.btnCharWrite.Location = new System.Drawing.Point(548, 32); - this.btnCharWrite.Margin = new System.Windows.Forms.Padding(2); - this.btnCharWrite.Name = "btnCharWrite"; - this.btnCharWrite.Size = new System.Drawing.Size(79, 24); - this.btnCharWrite.TabIndex = 12; - this.btnCharWrite.Text = "W Char[]"; - this.btnCharWrite.UseVisualStyleBackColor = true; - this.btnCharWrite.Click += new System.EventHandler(this.btnCharWrite_Click); - // - // btnReadChar - // - this.btnReadChar.Location = new System.Drawing.Point(104, 74); - this.btnReadChar.Margin = new System.Windows.Forms.Padding(2); - this.btnReadChar.Name = "btnReadChar"; - this.btnReadChar.Size = new System.Drawing.Size(76, 20); - this.btnReadChar.TabIndex = 12; - this.btnReadChar.Text = "R Char[]"; - this.btnReadChar.UseVisualStyleBackColor = true; - this.btnReadChar.Click += new System.EventHandler(this.btnReadChar_Click); - // // TestMainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); From 826553d245be5ece88bd5bf1276e8509934ecb4b Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 23 Sep 2021 17:10:31 +0200 Subject: [PATCH 4/5] Aggiunta preliminare IOB RobotService --- IOB-WIN-NEXT/IobSiemensCosmap.cs | 2 +- IOB-WIN-NEXT/IobSiemensRobotService.cs | 289 +++++++++++++++++++++++++ 2 files changed, 290 insertions(+), 1 deletion(-) create mode 100644 IOB-WIN-NEXT/IobSiemensRobotService.cs diff --git a/IOB-WIN-NEXT/IobSiemensCosmap.cs b/IOB-WIN-NEXT/IobSiemensCosmap.cs index 5fbcce14..9bc31354 100644 --- a/IOB-WIN-NEXT/IobSiemensCosmap.cs +++ b/IOB-WIN-NEXT/IobSiemensCosmap.cs @@ -18,7 +18,7 @@ namespace IOB_WIN_NEXT * - S7 vers 1500 * * STRUTTURA MEMORIA DB29: (lettura) 10byte, - * G:\Drive condivisi\30_Clienti\Donati\Schemi DB\COSMAP + * G:\Drive condivisi\30_Clienti\Donati\Schemi IOB-WIN\COSMAP * * Si intende lettura/scrittura con DB6.DBxx * diff --git a/IOB-WIN-NEXT/IobSiemensRobotService.cs b/IOB-WIN-NEXT/IobSiemensRobotService.cs new file mode 100644 index 00000000..38039e3b --- /dev/null +++ b/IOB-WIN-NEXT/IobSiemensRobotService.cs @@ -0,0 +1,289 @@ +using MapoSDK; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; + +namespace IOB_WIN_NEXT +{ + /// + /// Controllo Siemens specifico x impianti RobotSerice (es Smerigliature DONATI) + /// + public class IobSiemensRobotService : IobSiemens + { + /* -------------------------------------------------------------------------------- + * Controlli SIEMENS RobotService + * - basasto su SIEMENS + * - S7 vers 1500 + * + * STRUTTURA MEMORIA DB15: (lettura) 10byte, + * G:\Drive condivisi\30_Clienti\Donati\Schemi IOB-WIN\RobotService + * + * + * DB15 + * B0.0 Bit PowerOn + * B0.1 Bit Run + * B0.2 Bit Contapezzi + * B0.3 Bit Allarme + * B0.4 Bit Manuale + * B0.5 Bit MagOutPieno + * B0.6 Bit MagInVuoto + * Contapezzi DInt 2 + * PezziRiman DInt 6 + * + * + * STRUTTURA MEMORIA DB14: (scrittura) 520byte, + * G:\Drive condivisi\30_Clienti\Donati\Schemi IOB-WIN\RobotService + * + * + * DB14 + * Commessa Odl String[000..256] String (254) + * CodArt String[256..512] String (254) + * QtaRich DInt 512 numero pezzi lanciati + * PzCountRes Bool/Byte 516 al fronte di salita (0-->1) reset contapezzi e NON CONTA mentre è 1, se 0 conta + * + * -------------------------------------------------------------------------------- */ + + #region Public Constructors + + /// + /// Classe base con i metodi x Siemens + /// + /// + /// + public IobSiemensRobotService(AdapterForm caller, IobConfiguration IOBConf) : base(caller, IOBConf) + { + lgInfo("NEW IOB SIEMENS versione RobotService"); + } + + #endregion Public Constructors + + #region Protected Methods + + /// + /// Effettua decodifica aree memoria alla bitmap usata x MAPO + /// + protected override void decodeToBaseBitmap() + { + // init a zero... + B_input = 0; + + /* ----------------------------------------------------- + * bitmap MAPO STANDARD + * B0: POWER_ON + * B1: RUN + * B2: pzCount + * B3: allarme + * B4: manuale + * B5: emergenza (1=attiva/premuta, 0=armed) + * + ----------------------------------------------------- */ + + bool fatto = false; + ushort currStatus = 0; + ushort allarme = 0; + ushort valW = 0; + + var MemInt = new byte[2]; + + // recupero + //fatto = S7ReadBB(ref MemInt, "DB6.DBW204", 2); + //valW = S7.Net.Types.Word.FromByteArray(MemInt.ToArray()); + //var testalW = S7.Net.Types.Word.FromByteArray(RawInput.Skip(204).Take(2).ToArray()); + currStatus = S7.Net.Types.Word.FromByteArray(RawInput.Skip(204).Take(2).ToArray()); + + //fatto = S7ReadBB(ref MemInt, "DB6.DBW206", 2); + //valW = S7.Net.Types.Word.FromByteArray(MemInt.ToArray()); + //allarme = valW; + allarme = S7.Net.Types.Word.FromByteArray(RawInput.Skip(206).Take(2).ToArray()); + + int byteSignals = 0; + // bit 0 (poweron) imposto a 1 SE connected... + if (currPLC.IsConnected) + { + byteSignals += (1 << 0); + } + + // processo dagli stati + gravi... + if (allarme > 0) + { + byteSignals += (1 << 3); + } + + switch (currStatus) + { + case 1: + byteSignals += (1 << 1); + break; + + case 2: + byteSignals += (1 << 4); + break; + + case 3: + byteSignals += (1 << 5); + break; + + default: + break; + } + + // salvo! + B_input = byteSignals; + + // log opzionale! + if (verboseLog) + { + lgInfo($"Trasformazione dati: Status:{currStatus} | alarm:{allarme} --> B_input: {B_input}"); + } + } + + #endregion Protected Methods + + #region Public Methods + + /// + /// Processo i task richiesti e li elimino dalla coda 1:1 + /// + /// + public override Dictionary executeTasks(Dictionary task2exe) + { + lgInfo($"Chiamata executeTasks specifica IobSiemensCosmap: {task2exe.Count} task ricevuti"); + // Verificare il protocollo: dovrebeb togliere SOLO i task eseguiti... + Dictionary taskDone = new Dictionary(); + bool taskOk = false; + string taskVal = ""; + // inizio con 1 byte di default + byte[] MemBlock = new byte[1]; + string memAddrWrite = ""; + if (task2exe != null) + { + // cerco task specifici + foreach (var item in task2exe) + { + taskOk = false; + taskVal = ""; + // converto richiesta in enum... + taskType tName = taskType.nihil; + Enum.TryParse(item.Key, out tName); + // controllo sulla KEY + switch (tName) + { + case taskType.nihil: + case taskType.fixStopSetup: + case taskType.forceSetPzCount: + case taskType.setProg: + case taskType.sendWatchDogMes2Plc: + taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | SKIPPED | NO EXEC"; + break; + + case taskType.setPzComm: + case taskType.setArt: + case taskType.setComm: + saveProdData(item); + int byteSize = 0; + // recupero dati da memMap... altrimenti NULLA + if (memMap.mMapWrite.ContainsKey(item.Key)) + { + dataConf currMem = memMap.mMapWrite[item.Key]; + byteSize = currMem.size; + memAddrWrite = currMem.memAddr; + MemBlock = new byte[byteSize]; + if (currMem.tipoMem == plcDataType.String) + { + saveStringOnMemBlock(ref MemBlock, item.Key, 0, byteSize); + } + else if (currMem.tipoMem == plcDataType.DInt) + { + int valDInt = 0; + int.TryParse(item.Value, out valDInt); + MemBlock = S7.Net.Types.DInt.ToByteArray(valDInt); + } + else if (currMem.tipoMem == plcDataType.Int) + { + short valInt = 0; + short.TryParse(item.Value, out valInt); + MemBlock = S7.Net.Types.Int.ToByteArray(valInt); + } + } + else + { + string rawMemConf = JsonConvert.SerializeObject(memMap, Formatting.Indented); + lgError($"Errore: non trovata chiave write in memMap.mMapWrite per {item.Key}{Environment.NewLine}Configurazione memoria R/W:{Environment.NewLine}{rawMemConf}"); + } + taskVal = item.Value; + break; + + case taskType.forceResetPzCount: + // processo scrittura BIT su DB6.DBDW216 + MemBlock = new byte[4]; + MemBlock = S7.Net.Types.DInt.ToByteArray(1); + memAddrWrite = "DB6.DBDW216"; + break; + + case taskType.startSetup: + // processo scrittura BIT su DB6.DBDW216 + MemBlock = new byte[4]; + MemBlock = S7.Net.Types.DInt.ToByteArray(1); + memAddrWrite = "DB6.DBDW216"; + break; + + case taskType.stopSetup: + // processo scrittura BIT su DB6.DBDW216 + MemBlock = new byte[4]; + MemBlock = S7.Net.Types.DInt.ToByteArray(0); + memAddrWrite = "DB6.DBDW216"; + break; + + case taskType.setParameter: + // richiedo da URL i parametri WRITE da popolare + lgInfo("setParameter --> processMemWriteRequests"); + taskVal = processMemWriteRequests(); + // se restituiscce "" faccio altra prova... + if (string.IsNullOrEmpty(taskVal)) + { + // i parametri me li aspetto come stringa composta paramName|paramvalue + if (item.Value.Contains("|")) + { + string[] paramsJob = item.Value.Split('|'); + taskVal = $"REQUEST SET PARAMETERS: {paramsJob[0]} --> {paramsJob[1]}"; + } + else + { + taskVal = $"WRONG REQUEST FOR SET PARAMETERS: {item.Value} doesnt contain pipe for splitting key/value"; + } + } + break; + + default: + taskVal = "SKIPPED | NO EXEC"; + break; + } + + lgInfo($"executeTask: {tName} | {taskVal}"); + // aggiungo task! + taskDone.Add(item.Key, taskVal); + if (!string.IsNullOrEmpty(memAddrWrite)) + { + // scrivo! + taskOk = S7WriteBB(ref MemBlock, memAddrWrite); + } + if (taskOk) + { + // aggiorno valore memoria... + memMap.mMapWrite[item.Key].value = item.Value; + lgInfo($"Eseguita con successo S7WriteBB per executeTasks: {item.Key} | {item.Value}"); + } + else + { + lgError($"Errore in S7WriteBB durante executeTasks: {item.Key} | {item.Value}"); + } + } + } + return taskDone; + } + + #endregion Public Methods + } +} \ No newline at end of file From 419e13a82fcddee36d81356a3a9906ca8bb461ed Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 23 Sep 2021 19:06:39 +0200 Subject: [PATCH 5/5] COmpletata prima revisione sw x RobotService --- IOB-WIN-NEXT/DATA/CONF/1033.ini | 67 +++++++++++++++++++++++ IOB-WIN-NEXT/DATA/CONF/1033.json | 52 ++++++++++++++++++ IOB-WIN-NEXT/IOB-WIN-NEXT.csproj | 7 +++ IOB-WIN-NEXT/IobSiemensRobotService.cs | 74 +++++++------------------- 4 files changed, 144 insertions(+), 56 deletions(-) create mode 100644 IOB-WIN-NEXT/DATA/CONF/1033.ini create mode 100644 IOB-WIN-NEXT/DATA/CONF/1033.json diff --git a/IOB-WIN-NEXT/DATA/CONF/1033.ini b/IOB-WIN-NEXT/DATA/CONF/1033.ini new file mode 100644 index 00000000..dc69397a --- /dev/null +++ b/IOB-WIN-NEXT/DATA/CONF/1033.ini @@ -0,0 +1,67 @@ +;Configurazione IOB-WIN +[IOB] +;Macchina transfer COSMAP per Donati +CNCTYPE=SIEMENS_ROBOTSERVICE +PING_MS_TIMEOUT=500 + +[MACHINE] +VENDOR=RobotService +MODEL=SMER12 + +[CNC] +IP=192.168.51.138 +CPUTYPE=S71500 +RACK=0 +SLOT=0 + +[SERVER] +MPIP=http://192.168.51.79 +MPURL=/MP/IO +CMDBASE=/IOB/input/ +CMDFLOG=/IOB/flog/ +CMDALIVE=/IOB +CMDENABLED=/IOB/enabled/ +CMDADV1=?valore= +CMDREBO=/sendReboot.aspx?idxMacchina= + +[MEMORY] +ADDR_READ=DB15.DBB0 +ADDR_WRITE=DB14.DBB0 +SIZE_READ=10 +SIZE_WRITE=517 + + +[BLINK] +;MAX_COUNTER_BLINK = 30 +MAX_COUNTER_BLINK = 15 +;bit0 = 0 +;bit1 = 0 +;bit2 = 1 +;bit3 = 1 +;bit4 = 1 +;bit5 = 0 +;bit6 = 0 +;bit7 = 0 +BLINK_FILT=0 +;BLINK_FILT=28 + +[OPTPAR] +;PZCOUNT_MODE=STD.[PAR/MEM].info|BIT.indice +PZCOUNT_MODE=STD.DB15.DBDW2 +DISABLE_PZCOUNT=FALSE +ENABLE_SEND_PZC_BLOCK=TRUE +MIN_SEND_PZC_BLOCK=0 +MAX_SEND_PZC_BLOCK=100 +; gestione custom timer +timerIntMs=30 +; GEST DATI DYN +ENABLE_DYN_DATA=TRUE +FORCE_DYN_DATA=TRUE +; gestione scrittura string/char[]: true = string / false = char[] +WRITE_PRE=TRUE + +; conf parametri memoria READ/WRITE +PARAM_CONF=1033.json + +[BRANCH] +NAME=master \ No newline at end of file diff --git a/IOB-WIN-NEXT/DATA/CONF/1033.json b/IOB-WIN-NEXT/DATA/CONF/1033.json new file mode 100644 index 00000000..681d6240 --- /dev/null +++ b/IOB-WIN-NEXT/DATA/CONF/1033.json @@ -0,0 +1,52 @@ +{ + "mMapWrite": { + "setComm": { + "name": "setComm", + "description": "Commessa", + "tipoMem": "String", + "memAddr": "DB14.DBB0", + "index": 0, + "size": 50 + }, + "setArt": { + "name": "setArt", + "description": "Articolo", + "tipoMem": "String", + "memAddr": "DB14.DBB256", + "index": 256, + "size": 50 + }, + "setPzComm": { + "name": "setPzComm", + "description": "Qty", + "memAddr": "DB14.DBB512", + "tipoMem": "DInt", + "index": 512, + "size": 4 + } + }, + "mMapRead": { + "Contatore01": { + "name": "PezziFineCiclo", + "description": "Mancanti programmati", + "memAddr": "DB15.DBB6", + "tipoMem": "DInt", + "index": 6, + "size": 4, + "func": "MAX", + "period": 60, + "factor": 1 + }, + "ContatoreParziale": { + "name": "ContaPezzi", + "description": "Contapezzi MES DBB2", + "memAddr": "DB15.DBB2", + "tipoMem": "DInt", + "index": 2, + "size": 4, + "func": "MAX", + "period": 60, + "factor": 1 + } + } +} \ No newline at end of file diff --git a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj index 897e6301..ffe9e62b 100644 --- a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj +++ b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj @@ -178,6 +178,7 @@ + @@ -223,6 +224,12 @@ + + Always + + + Always + Always diff --git a/IOB-WIN-NEXT/IobSiemensRobotService.cs b/IOB-WIN-NEXT/IobSiemensRobotService.cs index 38039e3b..194026fe 100644 --- a/IOB-WIN-NEXT/IobSiemensRobotService.cs +++ b/IOB-WIN-NEXT/IobSiemensRobotService.cs @@ -76,66 +76,28 @@ namespace IOB_WIN_NEXT * B2: pzCount * B3: allarme * B4: manuale - * B5: emergenza (1=attiva/premuta, 0=armed) + * B5: MagOutPieno + * B6: MagInVuoto * ----------------------------------------------------- */ - bool fatto = false; - ushort currStatus = 0; - ushort allarme = 0; - ushort valW = 0; + byte mainData = RawInput[0]; - var MemInt = new byte[2]; - - // recupero - //fatto = S7ReadBB(ref MemInt, "DB6.DBW204", 2); - //valW = S7.Net.Types.Word.FromByteArray(MemInt.ToArray()); - //var testalW = S7.Net.Types.Word.FromByteArray(RawInput.Skip(204).Take(2).ToArray()); - currStatus = S7.Net.Types.Word.FromByteArray(RawInput.Skip(204).Take(2).ToArray()); - - //fatto = S7ReadBB(ref MemInt, "DB6.DBW206", 2); - //valW = S7.Net.Types.Word.FromByteArray(MemInt.ToArray()); - //allarme = valW; - allarme = S7.Net.Types.Word.FromByteArray(RawInput.Skip(206).Take(2).ToArray()); - - int byteSignals = 0; + // copio il primo byte + int byteSignals = RawInput[0]; // bit 0 (poweron) imposto a 1 SE connected... if (currPLC.IsConnected) { byteSignals += (1 << 0); } - // processo dagli stati + gravi... - if (allarme > 0) - { - byteSignals += (1 << 3); - } - - switch (currStatus) - { - case 1: - byteSignals += (1 << 1); - break; - - case 2: - byteSignals += (1 << 4); - break; - - case 3: - byteSignals += (1 << 5); - break; - - default: - break; - } - // salvo! B_input = byteSignals; // log opzionale! if (verboseLog) { - lgInfo($"Trasformazione dati: Status:{currStatus} | alarm:{allarme} --> B_input: {B_input}"); + lgInfo($"Trasformazione dati: B0: {mainData} --> B_input: {B_input}"); } } @@ -216,24 +178,24 @@ namespace IOB_WIN_NEXT break; case taskType.forceResetPzCount: - // processo scrittura BIT su DB6.DBDW216 - MemBlock = new byte[4]; - MemBlock = S7.Net.Types.DInt.ToByteArray(1); - memAddrWrite = "DB6.DBDW216"; + // processo scrittura BIT su DB6.DBB516 + MemBlock = new byte[1]; + MemBlock = S7.Net.Types.Byte.ToByteArray(1); + memAddrWrite = "DB14.DBB516"; break; case taskType.startSetup: - // processo scrittura BIT su DB6.DBDW216 - MemBlock = new byte[4]; - MemBlock = S7.Net.Types.DInt.ToByteArray(1); - memAddrWrite = "DB6.DBDW216"; + // processo scrittura BIT su DB6.DBB516 + MemBlock = new byte[1]; + MemBlock = S7.Net.Types.Byte.ToByteArray(1); + memAddrWrite = "DB14.DBB516"; break; case taskType.stopSetup: - // processo scrittura BIT su DB6.DBDW216 - MemBlock = new byte[4]; - MemBlock = S7.Net.Types.DInt.ToByteArray(0); - memAddrWrite = "DB6.DBDW216"; + // processo scrittura BIT su DB6.DBB516 + MemBlock = new byte[1]; + MemBlock = S7.Net.Types.Byte.ToByteArray(0); + memAddrWrite = "DB14.DBB516"; break; case taskType.setParameter: