continuo scrittura procedura x lettura in blocco dati UT SIEMENS
This commit is contained in:
@@ -906,7 +906,40 @@ Namespace CNC
|
||||
Public Speed As Single
|
||||
|
||||
End Structure
|
||||
''' <summary>
|
||||
''' Struttura dati UT
|
||||
''' </summary>
|
||||
Public Structure UtData
|
||||
''' <summary>
|
||||
''' Vettore elenco UT (DB254.DBI280)
|
||||
''' </summary>
|
||||
Public elencoUtMem As UShort()
|
||||
''' <summary>
|
||||
''' Tabella UT (DB253.DBI2500)
|
||||
''' </summary>
|
||||
Public tabUt_UT As UShort()
|
||||
''' <summary>
|
||||
''' Tabella IdFamigliaUt (DB253.DBI2900)
|
||||
''' </summary>
|
||||
Public tabIdFamUt As UShort()
|
||||
''' <summary>
|
||||
''' Tabella Famiglie Utensili (DB253.DBI100)
|
||||
''' </summary>
|
||||
Public tabFamUt As UShort()
|
||||
''' <summary>
|
||||
''' Tabella TIPO Vita Residua Famiglie Utensili (DB253.DBI1900)
|
||||
''' </summary>
|
||||
Public tabTipoVitaRes As UShort()
|
||||
''' <summary>
|
||||
''' Tabella Vita Residua Famiglie Utensili (DB253.DBI4300)
|
||||
''' </summary>
|
||||
Public tabVitaRes As UShort()
|
||||
|
||||
End Structure
|
||||
''' <summary>
|
||||
''' Restituisce tutti i dati assi insieme
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public Function getAllAxisPos() As AxData()
|
||||
' RIFERIMENTO:
|
||||
' txt Giuseppe
|
||||
@@ -947,6 +980,71 @@ Namespace CNC
|
||||
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' recupera (e formatta) tutti i dati riferiti alle tabelle della gestione UT
|
||||
''' </summary>
|
||||
''' <param name="numVal"></param>
|
||||
''' <returns></returns>
|
||||
Public Function getAllUtData(ByVal numVal As Short) As UtData
|
||||
' RIFERIMENTO:
|
||||
' txt Giuseppe
|
||||
|
||||
ReDim itemRead(5)
|
||||
itemRead(0) = New Item("DB254.DBI280:[" & numVal & "]") 'elencoUtMem
|
||||
itemRead(1) = New Item("DB253.DBI2500:[" & numVal & "]") 'tabUt_UT
|
||||
itemRead(2) = New Item("DB253.DBI2900:[" & numVal & "]") 'IdFamigliaUt
|
||||
itemRead(3) = New Item("DB253.DBI100:[" & numVal & "]") 'tabFamUt
|
||||
itemRead(4) = New Item("DB253.DBI1900:[" & numVal & "]") 'tabTipoVitaRes
|
||||
itemRead(5) = New Item("DB253.DBI4300:[" & numVal & "]") 'tabVitaRes
|
||||
|
||||
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
|
||||
|
||||
' variabili di appoggio
|
||||
Dim datiUT As New UtData
|
||||
Dim _elencoUtMem(numVal) As UShort
|
||||
Dim _tabUt_UT(numVal) As UShort
|
||||
Dim _tabIdFamUt(numVal) As UShort
|
||||
Dim _tabFamUt(numVal) As UShort
|
||||
Dim _tabTipoVitaRes(numVal) As UShort
|
||||
Dim _tabVitaRes(numVal) As UShort
|
||||
|
||||
' faccio copia valori!
|
||||
For i As Integer = 0 To numVal
|
||||
'_elencoUtMem(i) = itemRead(0).Value(i)
|
||||
_elencoUtMem(i) = UIntegerToSingle(itemRead(0).Value(i))
|
||||
Next i
|
||||
For i As Integer = 0 To numVal
|
||||
_tabUt_UT(i) = itemRead(1).Value(i)
|
||||
'_tabUt_UT(i) = UIntegerToSingle(itemRead(1).Value(i))
|
||||
Next i
|
||||
For i As Integer = 0 To numVal
|
||||
_tabIdFamUt(i) = itemRead(2).Value(i)
|
||||
'_tabIdFamUt(i).Load = UIntegerToSingle(itemRead(2).Value(i))
|
||||
Next i
|
||||
' !!!FARE!!!
|
||||
|
||||
' copio in oggetto OUT...
|
||||
datiUT.elencoUtMem = _elencoUtMem
|
||||
datiUT.tabUt_UT = _tabUt_UT
|
||||
datiUT.tabFamUt = _tabFamUt
|
||||
datiUT.tabIdFamUt = _tabIdFamUt
|
||||
datiUT.tabTipoVitaRes = _tabTipoVitaRes
|
||||
datiUT.tabVitaRes = _tabVitaRes
|
||||
|
||||
' rendo i dati!
|
||||
Return datiUT
|
||||
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
|
||||
@@ -3624,7 +3624,7 @@ namespace MTC_Adapter
|
||||
// altre variabili
|
||||
ushort[] idUtMontato = new ushort[maxNumOp];
|
||||
ushort[] idFamUt = new ushort[maxNumOp];
|
||||
ushort[] idTipoVitaUt = new ushort[maxNumOp];
|
||||
int[] idTipoVitaUt = new int[maxNumOp];
|
||||
uint[] valVitaUtRes = new uint[maxNumOp];
|
||||
ushort[] tabUt = new ushort[maxMemAddr];
|
||||
ushort[] tabFamUt = new ushort[maxMemAddr];
|
||||
@@ -3640,10 +3640,12 @@ namespace MTC_Adapter
|
||||
for (int i = 0; i < maxNumOp; i++)
|
||||
{
|
||||
idUtMontato[i] = BitConverter.ToUInt16(elencoUtMem, 2 * i);
|
||||
#if false
|
||||
if (hasBigEndian)
|
||||
{
|
||||
idUtMontato[i] = Endian.SwapUInt16(idUtMontato[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// step 2a: leggo vettore memoria dei maxMemAddr(200) UT in Tabella Utensili
|
||||
@@ -3652,10 +3654,12 @@ namespace MTC_Adapter
|
||||
for (int i = 0; i < maxMemAddr; i++)
|
||||
{
|
||||
tabUt[i] = BitConverter.ToUInt16(tabUt_UT, 2 * i);
|
||||
#if false
|
||||
if (hasBigEndian)
|
||||
{
|
||||
tabUt[i] = Endian.SwapUInt16(tabUt[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
// step 2b: devo cercare l'UT di ogni UnOp nella Tabella Utensili
|
||||
for (int i = 0; i < maxNumOp; i++)
|
||||
@@ -3672,10 +3676,12 @@ namespace MTC_Adapter
|
||||
memIndex = getDatiUt_step2b(ref int16Mem, j);
|
||||
// step 2b: leggo puntualmente la FamUt dal suo indice...
|
||||
idFamUt[i] = BitConverter.ToUInt16(int16Mem, 0);
|
||||
#if false
|
||||
if (hasBigEndian)
|
||||
{
|
||||
idFamUt[i] = Endian.SwapUInt16(idFamUt[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
@@ -3688,10 +3694,12 @@ namespace MTC_Adapter
|
||||
for (int i = 0; i < maxMemAddr; i++)
|
||||
{
|
||||
tabFamUt[i] = BitConverter.ToUInt16(tabFam_FamUt, 2 * i);
|
||||
#if false
|
||||
if (hasBigEndian)
|
||||
{
|
||||
tabFamUt[i] = Endian.SwapUInt16(tabFamUt[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
// step 3b: devo cercare la famiglia dell'UT di ogni UnOp nella Tabella Famiglie
|
||||
for (int i = 0; i < maxNumOp; i++)
|
||||
@@ -3708,16 +3716,19 @@ namespace MTC_Adapter
|
||||
memIndex = getDatiUt_step3b(ref int8Mem, j);
|
||||
// step 3b: leggo puntualmente il TIPO DI vita UT dal suo indice...
|
||||
idTipoVitaUt[i] = int8Mem;
|
||||
if (hasBigEndian)
|
||||
{
|
||||
idTipoVitaUt[i] = Endian.SwapUInt16(idTipoVitaUt[i]);
|
||||
}
|
||||
#if false
|
||||
// non serve: 8 bit...
|
||||
//if (hasBigEndian)
|
||||
//{
|
||||
// idTipoVitaUt[i] = Endian.SwapUInt16(idTipoVitaUt[i]);
|
||||
//}
|
||||
#endif
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// step 4: recupero la vita residua dell'utente
|
||||
// step 4: recupero la vita residua dell'utensile
|
||||
for (int i = 0; i < maxNumOp; i++)
|
||||
{
|
||||
// poiché potrei trovarlo replicato dopo la prima volta che lo trovo evito di ricontrollare...
|
||||
@@ -3732,10 +3743,12 @@ namespace MTC_Adapter
|
||||
memIndex = getDatiUt_step4(ref int32Mem, j);
|
||||
// leggo puntualmente valore della vita ut residua da indice utensile...
|
||||
valVitaUtRes[i] = BitConverter.ToUInt32(int32Mem, 0);
|
||||
#if false
|
||||
if (hasBigEndian)
|
||||
{
|
||||
valVitaUtRes[i] = Endian.SwapUInt32(valVitaUtRes[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -894,6 +894,7 @@ namespace MTC_Adapter
|
||||
/// <returns></returns>
|
||||
public override int getDatiUt_step1(ref byte[] elencoUtMem)
|
||||
{
|
||||
// faccio un unica chiamata in blocco di TUTTE le aree e le salvo in variabili locali siemens...
|
||||
// DB254.DBI280
|
||||
int memIndex = 280;
|
||||
inizio = DateTime.Now;
|
||||
@@ -902,6 +903,8 @@ namespace MTC_Adapter
|
||||
return memIndex;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override void getPath()
|
||||
{
|
||||
base.getPath();
|
||||
|
||||
Reference in New Issue
Block a user