diff --git a/MTC_Sim/.vs/MTC_Sim/v14/.suo b/MTC_Sim/.vs/MTC_Sim/v14/.suo index 4f0d1c2..1783a27 100644 Binary files a/MTC_Sim/.vs/MTC_Sim/v14/.suo and b/MTC_Sim/.vs/MTC_Sim/v14/.suo differ diff --git a/MTC_Sim/CMSCncLib/CNC/CNC.FANUC/CNC.FANUC.vb b/MTC_Sim/CMSCncLib/CNC/CNC.FANUC/CNC.FANUC.vb index b2a9f5d..0a2198e 100644 --- a/MTC_Sim/CMSCncLib/CNC/CNC.FANUC/CNC.FANUC.vb +++ b/MTC_Sim/CMSCncLib/CNC/CNC.FANUC/CNC.FANUC.vb @@ -107,7 +107,7 @@ Namespace CNC End Set End Property - Public Sub New(ByRef connectionType As ConnectionType, Optional ByRef szIp As String = "192.168.1.1", _ + Public Sub New(ByRef connectionType As ConnectionType, Optional ByRef szIp As String = "192.168.1.1", Optional ByRef nPortIp As Integer = 8193, Optional ByRef CncScreenHssb As ConnectionType = FANUC.ConnectionType.Ethernet) MyBase.New() _Type = NcType.FANUC @@ -130,11 +130,11 @@ Namespace CNC Me._Descrizione = "NC FANUC" & vbNewLine Select Case _connectionType Case FANUC.ConnectionType.Ethernet - Me._Descrizione = Me._Descrizione & "Connection type: Ethernet" & vbNewLine & _ - "Ip address: " & _szIp & vbNewLine & _ + Me._Descrizione = Me._Descrizione & "Connection type: Ethernet" & vbNewLine & + "Ip address: " & _szIp & vbNewLine & "Port: " & _nPortIp Case FANUC.ConnectionType.Hssb - Me._Descrizione = Me._Descrizione & "Connection type: HSSB" & vbNewLine & _ + Me._Descrizione = Me._Descrizione & "Connection type: HSSB" & vbNewLine & "Hssb node: " & Hssb_node.ToString Case Else Me._Descrizione = Me._Descrizione & "Connection type: " & _connectionType.ToString & " !!!" @@ -405,8 +405,8 @@ Namespace CNC _ManineMagazzino(i) = CInt(cValueB(i)) End If Next - Case MemoryMapping.ToolManager, _ - MemoryMapping.ToolTable, _ + Case MemoryMapping.ToolManager, + MemoryMapping.ToolTable, MemoryMapping.Default Dim cValue(20 - 1) As Byte F_RW_Byte(False, MemType.D, 3040, cValue) @@ -434,8 +434,8 @@ Namespace CNC Select Case Settings.MemoryMapping Case MemoryMapping.ElsManager F_RW_Byte(R, MemType.D, 6792, cVal) - Case MemoryMapping.ToolManager, _ - MemoryMapping.ToolTable, _ + Case MemoryMapping.ToolManager, + MemoryMapping.ToolTable, MemoryMapping.Default F_RW_Byte(R, MemType.D, 3330, cVal) End Select @@ -610,6 +610,167 @@ Namespace CNC Return True End Function + Public Function getAllAxisPos() As Focas1.ODBAXIS + + Dim nPathIdx As Integer + Dim nNumAxisRead As Integer + Dim nReturn As Integer + 'Dim sOdbExAxisName As New Focas1.ODBEXAXISNAME + Dim szAssi() As String = {String.Empty} + 'Dim szAsse As String + + Dim sOdbAxPos As New Focas1.ODBAXIS + + + 'leggo il numero del processo attivo + nPathIdx = GetActivePath() + + 'serie 16 + If Is16Series Then + Dim sbAxis(0) + 'Dim ucAxisName() + Dim ucAssi, nMaxAxis As Byte + + 'leggo il parametro 1010 per sapere quanti assi + F_RW_Param_Integer(R, 0, 1010, 2, sbAxis) + ucAssi = sbAxis(0) + + 'leggo il parametro 9900 per sapere il numero massimo di assi + F_RW_Param_Integer(R, 0, 9900, 2, sbAxis) + nMaxAxis = sbAxis(0) + + 'leggo il 1020 per sapere i nomi degli assi + Dim sByteAxis As Focas1.IODBPSD_3 + focas.cnc_rdparam(nLibHandle(1), 1020, -1, 4 + (1 * nMaxAxis), sByteAxis) + + ReDim szAssi(ucAssi - 1) + For i = 0 To ucAssi - 1 + szAssi(i) = Chr(sByteAxis.cdatas(i)) + Next i + + + 'serie 30 + ElseIf Is30Series Then + + 'leggo num max assi dal cn + nNumAxisRead = Focas1.MAX_AXIS + + + 'Focas1.cnc_rdaxisdata(nLibHandle(nPathIdx), 0, Short * Type, Short num, Short * Len(), ODBAXDT * axdata); + 'nReturn = Focas1.cnc_absolute2(nLibHandle(nPathIdx), -1, 4 + 4 * nNumAxisRead, sOdbAxPos) + + 'nNumAxisRead = 4 + 'nReturn = Focas1.cnc_absolute2(nLibHandle(nPathIdx), 1, 8, sOdbAxPos) + + ' tento con ciclo diindovinare quanto deve essere lunga la struttura di memoria (teoria: 4 + 32*4 byte) + For index = 1 To 128 + nReturn = Focas1.cnc_absolute2(nLibHandle(nPathIdx), -1, index, sOdbAxPos) + If (nReturn = 0) Then + Throw New CmsNcException(String.Format("TROVATO! era {0}", nReturn)) + End If + Next + + + 'nReturn = Focas1.cnc_exaxisname(nLibHandle(nPathIdx), 0, nNumAxisRead, sOdbExAxisName) + If F_CheckRetError_Cnc(nReturn, "cnc_absolute2 RefreshAxisPosition CNC.FANUC.CMS_CncLib") Then + 'Throw New CmsNcException("ERR cnc_absolute2 RefreshAxisPosition CNC.FANUC.CMS_CncLib") + Else + ' 'vettorizzo il risultato dell'interrigazione + ' ReDim szAssi(nNumAxisRead - 1) + ' With sOdbExAxisName + ' If nNumAxisRead >= 1 Then szAssi(1 - 1) = .axname1 + ' If nNumAxisRead >= 2 Then szAssi(2 - 1) = .axname2 + ' If nNumAxisRead >= 3 Then szAssi(3 - 1) = .axname3 + ' If nNumAxisRead >= 4 Then szAssi(4 - 1) = .axname4 + ' If nNumAxisRead >= 5 Then szAssi(5 - 1) = .axname5 + ' If nNumAxisRead >= 6 Then szAssi(6 - 1) = .axname6 + ' If nNumAxisRead >= 7 Then szAssi(7 - 1) = .axname7 + ' If nNumAxisRead >= 8 Then szAssi(8 - 1) = .axname8 + ' If nNumAxisRead >= 9 Then szAssi(9 - 1) = .axname9 + ' If nNumAxisRead >= 10 Then szAssi(10 - 1) = .axname10 + ' If nNumAxisRead >= 11 Then szAssi(11 - 1) = .axname11 + ' If nNumAxisRead >= 12 Then szAssi(12 - 1) = .axname12 + ' If nNumAxisRead >= 13 Then szAssi(13 - 1) = .axname13 + ' If nNumAxisRead >= 14 Then szAssi(14 - 1) = .axname14 + ' If nNumAxisRead >= 15 Then szAssi(15 - 1) = .axname15 + ' If nNumAxisRead >= 16 Then szAssi(16 - 1) = .axname16 + ' If nNumAxisRead >= 17 Then szAssi(17 - 1) = .axname17 + ' If nNumAxisRead >= 18 Then szAssi(18 - 1) = .axname18 + ' If nNumAxisRead >= 19 Then szAssi(19 - 1) = .axname19 + ' If nNumAxisRead >= 20 Then szAssi(20 - 1) = .axname20 + ' If nNumAxisRead >= 21 Then szAssi(21 - 1) = .axname21 + ' If nNumAxisRead >= 22 Then szAssi(22 - 1) = .axname22 + ' If nNumAxisRead >= 23 Then szAssi(23 - 1) = .axname23 + ' If nNumAxisRead >= 24 Then szAssi(24 - 1) = .axname24 + ' If nNumAxisRead >= 25 Then szAssi(25 - 1) = .axname25 + ' If nNumAxisRead >= 26 Then szAssi(26 - 1) = .axname26 + ' If nNumAxisRead >= 27 Then szAssi(27 - 1) = .axname27 + ' If nNumAxisRead >= 28 Then szAssi(28 - 1) = .axname28 + ' If nNumAxisRead >= 29 Then szAssi(29 - 1) = .axname29 + ' If nNumAxisRead >= 30 Then szAssi(30 - 1) = .axname30 + ' If nNumAxisRead >= 31 Then szAssi(31 - 1) = .axname31 + ' If nNumAxisRead >= 32 Then szAssi(32 - 1) = .axname32 + ' End With + + ''leggo il parametro con l'ordine degli assi e riordono gli assi + 'Static bParameterReaded As Boolean + 'Static bParameterUsed As Boolean + 'Static nValue(nNumAxisRead - 1) As Integer + 'Try + ' Dim oValue(0) As Object + ' If Not bParameterReaded Then 'leggo solo una volta il parametro + ' bParameterReaded = True + ' For a = 0 To nNumAxisRead - 1 + ' F_RW_Param_Integer(R, a + 1, 3130, 1, oValue) + ' nValue(a) = oValue(0) + ' If nValue(a) <> 0 Then bParameterUsed = True 'se almeno un valore รจ diverso da 0 + ' Next + ' End If + + ' If bParameterUsed Then + ' Dim szAssi_Copy(szAssi.Length - 1) As String + ' Array.Copy(szAssi, szAssi_Copy, szAssi.Length) + ' Array.Clear(szAssi, 0, szAssi.Length) + ' For i = 0 To nNumAxisRead - 1 + ' If nValue(i) > 0 Then + ' szAssi(nValue(i) - 1) = szAssi_Copy(i) + ' End If + ' Next + ' End If + 'Catch ex As Exception + ' Debug.Print("RefreshAxisName: Error on reading Fanuc parameter 3130 dor Axis Order") + ' bParameterReaded = True + ' bParameterUsed = False + 'End Try + + + + ''pulisco le stringhe dei nomi assi letti + 'Dim j As Integer + 'For i = 0 To nNumAxisRead - 1 + ' For j = 1 To Len(szAssi(i)) + ' If Asc(Mid(szAssi(i), j, 1)) = 0 Or Asc(Mid(szAssi(i), j, 1)) = 12 Then Exit For + ' Next j + ' szAssi(i) = Mid(szAssi(i), 1, j - 1) + 'Next i + End If + End If + + ''scrivo i nomi assi sui pulsanti + 'For i = 0 To 11 + ' If szAssi.Length > i Then + ' szAsse = szAssi(i) + ' Else + ' szAsse = String.Empty + ' End If + ' If OpPanel_ref.NCPanel.OpPanelButtons(i + 33).Text <> szAsse Then OpPanel_ref.NCPanel.OpPanelButtons(i + 33).Text = szAsse + 'Next + + Return sOdbAxPos + + End Function + + ''' ''' Legge o scrive Byte da MEMORIE PLC ''' @@ -1541,7 +1702,9 @@ Namespace CNC End Select 'Stampo il messaggio - If Config.Settings.Settings.Debug > 0 Then + 'If Config.Settings.Settings.Debug > 0 Then + ' impostato a true x mostrare errore + If False Then 'If nReturn <> Focas1.EW_SOCKET Then 'tranne su errore di connessione 'CMSCncLib.App.Runtime.Log.WW("ERR pmc_wrpmcrng on F_RW_DWord CNC.FANUC", "Return=" & nReturn, True) MsgBox(szErrorDesc & vbLf & "Occurred in: " & Position, MsgBoxStyle.Exclamation + MsgBoxStyle.ApplicationModal, "Error on Fanuc CNC Data Window") diff --git a/MTC_Sim/MTC_Sim/AdapterFanuc.cs b/MTC_Sim/MTC_Sim/AdapterFanuc.cs index 59895a7..487d8cc 100644 --- a/MTC_Sim/MTC_Sim/AdapterFanuc.cs +++ b/MTC_Sim/MTC_Sim/AdapterFanuc.cs @@ -592,7 +592,18 @@ namespace MTC_Sim public override void getAxis() { - base.getAxis(); + string answ = ""; + //// Area di memoria x test... 84 byte (20 assi + intestazione) + //byte[] MemBlockTestData = new byte[84]; + + CMSCncLib.Focas1.ODBAXIS posAssi = FANUC_ref.getAllAxisPos(); + + string outMess = ""; + outMess += string.Format("AX1:{0:N3}{1}", (decimal)(posAssi.data[0]) / 1000, Environment.NewLine); + outMess += string.Format("AX2:{0:N3}{1}", (decimal)(posAssi.data[1]) / 1000, Environment.NewLine); + outMess += string.Format("AX3:{0:N3}{1}", (decimal)(posAssi.data[2]) / 1000, Environment.NewLine); + outMess += string.Format("AX4:{0:N3}{1}", (decimal)(posAssi.data[3]) / 1000, Environment.NewLine); + parentForm.showMessage(posAssi.data[0].ToString()); } } diff --git a/MTC_Sim/MTC_Sim/AdapterGeneric.cs b/MTC_Sim/MTC_Sim/AdapterGeneric.cs index c35a941..65e69ca 100644 --- a/MTC_Sim/MTC_Sim/AdapterGeneric.cs +++ b/MTC_Sim/MTC_Sim/AdapterGeneric.cs @@ -851,7 +851,6 @@ namespace MTC_Sim mAdapter.AddDataItem(vettPath[i].mPathAlarmCNC); mAdapter.AddDataItem(vettPath[i].mPathAlarmPLC); // altre aggiunte - } // UnOp vettUnOp = new UnOp[adpConf.nUnOp]; @@ -1066,6 +1065,7 @@ namespace MTC_Sim processStatus(); // processing degli strobes processStrobe(); + } else if (ciclo == gatherCycle.MF) { diff --git a/MTC_Sim/MTC_Sim/Analisi tempi.txt b/MTC_Sim/MTC_Sim/Analisi tempi.txt index 02c46d1..f4f7421 100644 --- a/MTC_Sim/MTC_Sim/Analisi tempi.txt +++ b/MTC_Sim/MTC_Sim/Analisi tempi.txt @@ -35,7 +35,19 @@ ---------------------------------------------------------------- - ciclo 5ms ---------------------------------------------------------------- - +---------------------------------------------------------------- +- ANALISI TEMPI MTConnect | IN MACCHINA +---------------------------------------------------------------- +--------------- START TIMING DATA --------------- +2016-05-16 18:08:32.4414 INFO Chiamate R128-STRB_DW0: effettuate 20, tempo medio 31,54 msec +2016-05-16 18:08:32.4414 INFO Chiamate R32-STROBES: effettuate 5400, tempo medio 7,63 msec +2016-05-16 18:08:32.4414 INFO Chiamate R4-STRB_DW0: effettuate 58, tempo medio 1,61 msec +2016-05-16 18:08:32.4544 INFO Chiamate W4-ACK_DW0: effettuate 86, tempo medio 1,98 msec +2016-05-16 18:08:32.4544 INFO Chiamate R46-STRB_DW1: effettuate 55, tempo medio 11,96 msec +2016-05-16 18:08:32.4544 INFO Chiamate W4-DW1: effettuate 101, tempo medio 2,02 msec +2016-05-16 18:08:32.4544 INFO Chiamate GLOBALI: 5720, periodo: 28,25 minuti.cent, tempo medio 7,51 msec, impegno MEDIO del canale 2,534% +2016-05-16 18:08:32.4734 INFO +--------------- STOP TIMING DATA --------------- ---------------------------------------------------------------- - ANALISI TEMPI MTConnect | SIM diff --git a/MTC_Sim/MTC_Sim/App.config b/MTC_Sim/MTC_Sim/App.config index c59537a..3d17587 100644 --- a/MTC_Sim/MTC_Sim/App.config +++ b/MTC_Sim/MTC_Sim/App.config @@ -7,7 +7,7 @@ - + diff --git a/MTC_Sim/MTC_Sim/CMS_MachineSim.Designer.cs b/MTC_Sim/MTC_Sim/CMS_MachineSim.Designer.cs index 9f6969f..8392a97 100644 --- a/MTC_Sim/MTC_Sim/CMS_MachineSim.Designer.cs +++ b/MTC_Sim/MTC_Sim/CMS_MachineSim.Designer.cs @@ -57,6 +57,7 @@ this.PlcErr_03 = new System.Windows.Forms.CheckBox(); this.PlcErr_01 = new System.Windows.Forms.CheckBox(); this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.ErrRT_03 = new System.Windows.Forms.CheckBox(); this.ErrRT_02 = new System.Windows.Forms.CheckBox(); this.CncErr_02 = new System.Windows.Forms.CheckBox(); this.CncErr_03 = new System.Windows.Forms.CheckBox(); @@ -208,7 +209,8 @@ this.lblCodaM = new System.Windows.Forms.Label(); this.addCodM = new System.Windows.Forms.TextBox(); this.label20 = new System.Windows.Forms.Label(); - this.ErrRT_03 = new System.Windows.Forms.CheckBox(); + this.label53 = new System.Windows.Forms.Label(); + this.lblOutMessage = new System.Windows.Forms.Label(); this.groupBox4.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.PosAct)).BeginInit(); this.groupBox3.SuspendLayout(); @@ -489,6 +491,17 @@ this.groupBox3.TabStop = false; this.groupBox3.Text = "Alarms"; // + // ErrRT_03 + // + this.ErrRT_03.AutoSize = true; + this.ErrRT_03.Location = new System.Drawing.Point(268, 66); + this.ErrRT_03.Name = "ErrRT_03"; + this.ErrRT_03.Size = new System.Drawing.Size(67, 17); + this.ErrRT_03.TabIndex = 11; + this.ErrRT_03.Text = "ERR_12"; + this.ErrRT_03.UseVisualStyleBackColor = true; + this.ErrRT_03.CheckedChanged += new System.EventHandler(this.SysErr_01_CheckedChanged); + // // ErrRT_02 // this.ErrRT_02.AutoSize = true; @@ -1249,6 +1262,8 @@ // tpStatus // this.tpStatus.BackColor = System.Drawing.Color.WhiteSmoke; + this.tpStatus.Controls.Add(this.lblOutMessage); + this.tpStatus.Controls.Add(this.label53); this.tpStatus.Controls.Add(this.groupBox6); this.tpStatus.Controls.Add(this.groupBox1); this.tpStatus.Controls.Add(this.groupBox11); @@ -1981,16 +1996,23 @@ this.label20.TabIndex = 52; this.label20.Text = "AddM"; // - // ErrRT_03 + // label53 // - this.ErrRT_03.AutoSize = true; - this.ErrRT_03.Location = new System.Drawing.Point(268, 66); - this.ErrRT_03.Name = "ErrRT_03"; - this.ErrRT_03.Size = new System.Drawing.Size(67, 17); - this.ErrRT_03.TabIndex = 11; - this.ErrRT_03.Text = "ERR_12"; - this.ErrRT_03.UseVisualStyleBackColor = true; - this.ErrRT_03.CheckedChanged += new System.EventHandler(this.SysErr_01_CheckedChanged); + this.label53.AutoSize = true; + this.label53.Location = new System.Drawing.Point(18, 281); + this.label53.Name = "label53"; + this.label53.Size = new System.Drawing.Size(52, 13); + this.label53.TabIndex = 59; + this.label53.Text = "LBL OUT"; + // + // lblOutMessage + // + this.lblOutMessage.AutoSize = true; + this.lblOutMessage.Location = new System.Drawing.Point(95, 281); + this.lblOutMessage.Name = "lblOutMessage"; + this.lblOutMessage.Size = new System.Drawing.Size(16, 13); + this.lblOutMessage.TabIndex = 60; + this.lblOutMessage.Text = "..."; // // CMS_MachineSim // @@ -2025,6 +2047,7 @@ this.menuStrip1.PerformLayout(); this.tabCtrlMain.ResumeLayout(false); this.tpStatus.ResumeLayout(false); + this.tpStatus.PerformLayout(); this.groupBox6.ResumeLayout(false); this.groupBox6.PerformLayout(); this.groupBox1.ResumeLayout(false); @@ -2232,6 +2255,8 @@ private System.Windows.Forms.TextBox STATUS_ACK_DW1; private System.Windows.Forms.Label label50; private System.Windows.Forms.CheckBox ErrRT_03; + private System.Windows.Forms.Label lblOutMessage; + private System.Windows.Forms.Label label53; } } diff --git a/MTC_Sim/MTC_Sim/CMS_MachineSim.cs b/MTC_Sim/MTC_Sim/CMS_MachineSim.cs index ddd2686..e2b58a7 100644 --- a/MTC_Sim/MTC_Sim/CMS_MachineSim.cs +++ b/MTC_Sim/MTC_Sim/CMS_MachineSim.cs @@ -1152,6 +1152,15 @@ namespace MTC_Sim #endregion + /// + /// mostra il messaggio richiesto... + /// + /// + public void showMessage(string messaggio) + { + lblOutMessage.Text = messaggio; + } + private void CMS_MachineSim_FormClosing(object sender, FormClosingEventArgs e) { diff --git a/MTC_Sim/MTC_Sim/CMS_MachineSim.resx b/MTC_Sim/MTC_Sim/CMS_MachineSim.resx index 707fc60..d24e7d7 100644 --- a/MTC_Sim/MTC_Sim/CMS_MachineSim.resx +++ b/MTC_Sim/MTC_Sim/CMS_MachineSim.resx @@ -138,24 +138,6 @@ True - - True - - - True - - - True - - - True - - - True - - - True - 104, 17