prima chiamata a librerie (ok feed...)

This commit is contained in:
Samuele E. Locatelli
2017-04-20 17:18:24 +02:00
parent 796947b089
commit beeac57868
3 changed files with 53 additions and 49 deletions
@@ -914,7 +914,18 @@ Namespace CNC
szReturn = ""
Return False 'assenza errori
End Function
#Region "area chiamate IOT (dummy/overridden)"
''' <summary>
''' Chiama GenNcInfo x ottenere dati base del NC
''' </summary>
''' <param name="NcInfo"></param>
''' <returns></returns>
Public Overridable Function O_GetNcInfo1(ByRef NcInfo As OPENcontrol.GETINFO1DATA) As Boolean
Return True
End Function
#End Region
End Class
@@ -135,8 +135,6 @@ Namespace CNC
_bConnected = False
End Sub
''' <summary>
''' Legge le memorie di configurazione dal cn
''' </summary>
@@ -680,8 +678,6 @@ Retry: nRetry += 1
End Try
End Function
''' <summary>
''' Legge o scrive Length and Radius Offset da tabella Utensili CN
''' </summary>
@@ -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:
+10 -14
View File
@@ -161,10 +161,9 @@ namespace MTC_Adapter
}
/// <summary>
/// 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)
/// </summary>
protected CMSCncLib.Focas1.ODBDY2_1 allDynData;
protected CMSCncLib.OPENcontrol.GETINFO1DATA allNcData;
/// <summary>
/// Vettore degli allarmi CNC attivi
/// </summary>
@@ -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();