corretta la lettura posizione assi con oggetto "itemRead" a blocco...
This commit is contained in:
@@ -888,41 +888,63 @@ Namespace CNC
|
||||
|
||||
#Region "Funzioni specifiche IOT"
|
||||
|
||||
Public Function getAllAxisPos() As Drive()
|
||||
''' <summary>
|
||||
''' Struttura dati asse
|
||||
''' </summary>
|
||||
Public Structure AxData
|
||||
''' <summary>
|
||||
''' Carico Asse
|
||||
''' </summary>
|
||||
Public Load As Single
|
||||
''' <summary>
|
||||
''' posizione attuale asse
|
||||
''' </summary>
|
||||
Public PosAct As Single
|
||||
''' <summary>
|
||||
''' Velocità asse
|
||||
''' </summary>
|
||||
Public Speed As Single
|
||||
|
||||
End Structure
|
||||
|
||||
Public Function getAllAxisPos() As AxData()
|
||||
' RIFERIMENTO:
|
||||
' SinumerikOperate_net.pdf, pag 222
|
||||
|
||||
'Dim nPathIdx As Integer
|
||||
'Dim nNumAxisRead As Integer
|
||||
'Dim nReturn As Integer
|
||||
|
||||
Dim posizAssi As Drive()
|
||||
|
||||
Dim m_SelectedDrive As Drive
|
||||
Dim m_DrivesList As Drive()
|
||||
|
||||
posizAssi = m_DriveSVC.ListDrives()
|
||||
|
||||
'm_SelectedDrive = m_DrivesList(0)
|
||||
' txt Giuseppe
|
||||
|
||||
|
||||
ReDim itemRead(2)
|
||||
itemRead(0) = New Item("DB241.DBD0:[16]") 'Posizione attuale
|
||||
itemRead(1) = New Item("DB254.DBW140:[20]") 'Speed effettiva
|
||||
itemRead(2) = New Item("DB254.DBB180:[20]") 'Carico effettivo
|
||||
|
||||
''leggo il numero del processo attivo
|
||||
'nPathIdx = GetActivePath()
|
||||
''leggo num max assi dal cn
|
||||
'nNumAxisRead = Focas1.MAX_AXIS
|
||||
Do
|
||||
Try
|
||||
m_DataSvcRW.Read(itemRead)
|
||||
Exit Do
|
||||
Catch ex As DataSvcBusyException
|
||||
Debug.Print(ex.Message)
|
||||
Catch ex As DataSvcException
|
||||
Throw New CmsNcException("ERR GetStaticData CNC.SIEMENS DataSvcException", ex)
|
||||
End Try
|
||||
Loop
|
||||
|
||||
'If Is30Series Then
|
||||
Dim datiAssi(20) As AxData
|
||||
|
||||
' ' leggo tutto!!!
|
||||
' nReturn = Focas1.cnc_rdposition(nLibHandle(nPathIdx), -1, nNumAxisRead, posizAssi)
|
||||
' faccio copia valori! ...posizione
|
||||
For i As Integer = 0 To 15
|
||||
'datiAssi(i).PosAct = itemRead(0).Value(i)
|
||||
datiAssi(i).PosAct = UIntegerToSingle(itemRead(0).Value(i))
|
||||
Next i
|
||||
For i As Integer = 0 To 19
|
||||
datiAssi(i).Speed = itemRead(1).Value(i)
|
||||
'datiAssi(i).Speed = UIntegerToSingle(itemRead(1).Value(i))
|
||||
Next i
|
||||
For i As Integer = 0 To 19
|
||||
datiAssi(i).Load = itemRead(2).Value(i)
|
||||
'datiAssi(i).Load = UIntegerToSingle(itemRead(2).Value(i))
|
||||
Next i
|
||||
|
||||
' If F_CheckRetError_Cnc(nReturn, "cnc_rdposition RefreshAxisPosition CNC.FANUC.CMS_CncLib") Then
|
||||
' Throw New CmsNcException("ERR cnc_rdposition RefreshAxisPosition CNC.FANUC.CMS_CncLib")
|
||||
' End If
|
||||
'End If
|
||||
|
||||
Return posizAssi
|
||||
Return datiAssi
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
@@ -534,7 +534,7 @@ namespace MTC
|
||||
public int UnOpLoad;
|
||||
public int UnOpAccTime;
|
||||
}
|
||||
|
||||
|
||||
public struct AxisData
|
||||
{
|
||||
public int AxisSel;
|
||||
|
||||
@@ -1009,14 +1009,18 @@ namespace MTC_Adapter
|
||||
|
||||
int memIndex = 0;
|
||||
inizio = DateTime.Now;
|
||||
|
||||
// !!!FARE!!! leggere un MACRO blocco di dati (multi) x dati assi....
|
||||
|
||||
// MODIFICA: leggo float direttamente x posizione assi...
|
||||
float[] axisPosFloat = new float[axisPosData.Length];
|
||||
SIEMENSMemRW_Float(R, baseMemAx, memIndex, ref axisPosFloat);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-AXIS_POS", MemBlockTop.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
|
||||
|
||||
inizio = DateTime.Now;
|
||||
// !!!FARE!!! test lettura di TUTTI i dati assi....
|
||||
SIEMENS.AxData[] ValAssi = SIEMENS_ref.getAllAxisPos();
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-AXIS_ALL", ValAssi.Length * 3 * 2), DateTime.Now.Subtract(inizio).Ticks);
|
||||
|
||||
|
||||
for (int i = 0; i < currAdpConf.nAxis; i++)
|
||||
{
|
||||
// per sicurezza try-catch
|
||||
|
||||
Reference in New Issue
Block a user