From beeac5786860389c1e27bead2e3865b70a4a5321 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Thu, 20 Apr 2017 17:18:24 +0200 Subject: [PATCH] prima chiamata a librerie (ok feed...) --- .../CMSCncLib/CNC/CNC.OSAI/CNC.OSAI.vb | 11 +++ .../CMSCncLib/CNC/CNC.OSAI/CNC.OSAI_SOAP.vb | 67 +++++++++---------- MTC_Adapter/MTC_Adapter/AdapterOsai.cs | 24 +++---- 3 files changed, 53 insertions(+), 49 deletions(-) diff --git a/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI.vb b/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI.vb index 9e765c2..a39778e 100644 --- a/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI.vb +++ b/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI.vb @@ -914,7 +914,18 @@ Namespace CNC szReturn = "" Return False 'assenza errori End Function +#Region "area chiamate IOT (dummy/overridden)" + ''' + ''' Chiama GenNcInfo x ottenere dati base del NC + ''' + ''' + ''' + Public Overridable Function O_GetNcInfo1(ByRef NcInfo As OPENcontrol.GETINFO1DATA) As Boolean + Return True + End Function + +#End Region End Class diff --git a/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI_SOAP.vb b/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI_SOAP.vb index c7ace77..a06f1c1 100644 --- a/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI_SOAP.vb +++ b/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI_SOAP.vb @@ -135,8 +135,6 @@ Namespace CNC _bConnected = False End Sub - - ''' ''' Legge le memorie di configurazione dal cn ''' @@ -680,8 +678,6 @@ Retry: nRetry += 1 End Try End Function - - ''' ''' Legge o scrive Length and Radius Offset da tabella Utensili CN ''' @@ -978,6 +974,38 @@ Retry: nRetry += 1 #Region "Funzioni specifiche IOT" + + Public Overloads Overrides Function O_GetNcInfo1(ByRef NcInfo As OPENcontrol.GETINFO1DATA) As Boolean + ' RIFERIMENTO: + ' CndexLinkUser.pdf | pag 148, 266 + + Dim szReturn As String = "" + Dim myGetNcInfo1R As OPENcontrol.GetNcInfo1R + Dim myGetNcInfo1 As New OPENcontrol.GetNcInfo1 + Dim ProcessId As Short + Dim nRetry As Integer +Retry: nRetry += 1 + + Try + O_GetSelectedProcess(ProcessId) + + myGetNcInfo1.ProcNum = ProcessId + myGetNcInfo1R = OPENws.GetNcInfo1(myGetNcInfo1) + If O_CheckRetError(myGetNcInfo1R.retval, myGetNcInfo1R.ErrClass, myGetNcInfo1R.ErrNum, "GetNcInfo1() O_GetNcInfo1 CNC.OSAI_OPEN", szReturn) Then + Throw New CmsNcException(szReturn) + Return False + End If + + NcInfo = myGetNcInfo1R.GetInfo + Return True + Catch ex As System.ServiceModel.CommunicationException + If nRetry < MAXRET Then GoTo Retry + Throw New CmsNcException(ex.Message) + Return False + End Try + + End Function + #If False Then Public Function getAllAxisPos() As Focas1.ODBPOS ' RIFERIMENTO: @@ -1100,37 +1128,6 @@ Retry: nRetry += 1 End Function - Public Function getAllDynData() As Focas1.ODBDY2_1 - ' RIFERIMENTO: - ' C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Position\cnc_rddynamic2.htm - - Dim nPathIdx As Integer - Dim nNumAxisRead As Integer - Dim nReturn As Integer - - Dim allData As Focas1.ODBDY2_1 - ' inizializzo - allData = New Focas1.ODBDY2_1 - - 'leggo il numero del processo attivo - nPathIdx = GetActivePath() - 'leggo num max assi dal cn - nNumAxisRead = Focas1.MAX_AXIS - - If Is30Series Then - - nReturn = Focas1.cnc_rddynamic2(nLibHandle(nPathIdx), 1, 28 + 4 * (4 * 1), allData) - '!!! non funziona: con -1 LEGGE 1 SOLO ASSE!!! - 'nReturn = Focas1.cnc_rddynamic2(nLibHandle(nPathIdx), -1, 28 + 4 * (4 * nNumAxisRead), allData) - - If F_CheckRetError_Cnc(nReturn, "cnc_rddynamic2 RefreshAllData CNC.FANUC.CMS_CncLib") Then - Throw New CmsNcException("ERR cnc_rddynamic2 RefreshAllData CNC.FANUC.CMS_CncLib") - End If - End If - - Return allData - - End Function Public Function getCncAlarm() As Focas1.ODBALMMSG2 ' RIFERIMENTO: diff --git a/MTC_Adapter/MTC_Adapter/AdapterOsai.cs b/MTC_Adapter/MTC_Adapter/AdapterOsai.cs index c3454d5..7bece99 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterOsai.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterOsai.cs @@ -161,10 +161,9 @@ namespace MTC_Adapter } /// - /// struttura dati fanuc x ALL DYN DATA - /// C:\Users\samuele\Documents\FOCAS A02B-0207-K737_04.20\Document\SpecE\Position\cnc_rddynamic2.htm + /// struttura dati OSAI x dati NC (pag 148) /// - protected CMSCncLib.Focas1.ODBDY2_1 allDynData; + protected CMSCncLib.OPENcontrol.GETINFO1DATA allNcData; /// /// Vettore degli allarmi CNC attivi /// @@ -1426,13 +1425,10 @@ namespace MTC_Adapter // leggo dati globali... inizio = DateTime.Now; -#if false - allDynData = OSAI_ref.getAllDynData(); - if (utils.CRB("recTime")) TimingData.addResult("R-ALL-DYN-DATA", DateTime.Now.Subtract(inizio).Ticks); - - FeedRate = allDynData.actf; -#endif - FeedRate = -999; // !!!FARE!!! + OSAI_ref.O_GetNcInfo1(ref allNcData); + if (utils.CRB("recTime")) TimingData.addResult("R-NcInfo", DateTime.Now.Subtract(inizio).Ticks); + // recupero feed... + FeedRate = Convert.ToInt32(allNcData.realfeed); // area path1/2: 7 WORD x ogni path... int memIndex = 19151; @@ -1456,16 +1452,15 @@ namespace MTC_Adapter // anche il secondo! procPathOverride(1, currPathData, ref sb); } +#if false // se ho allarmi li accodo... - if (allDynData.alarm != 0) + if (allNcData.alarm != 0) { - sb.AppendLine(string.Format("Allarmi CNC: {0}", allDynData.alarm)); + sb.AppendLine(string.Format("Allarmi CNC: {0}", allNcData.alarm)); inizio = DateTime.Now; -#if false allarmiCNC = OSAI_ref.getCncAlarm(); -#endif if (utils.CRB("recTime")) TimingData.addResult("R-CNC-ALARMS", DateTime.Now.Subtract(inizio).Ticks); checkCNCAlarms(); } @@ -1473,6 +1468,7 @@ namespace MTC_Adapter { allarmiCNC = new CMSCncLib.Focas1.ODBALMMSG2(); } +#endif parentForm.dataMonitor = sb.ToString();