completata revisione metodi gestione UT e decodifica (da testare!!!)
This commit is contained in:
@@ -598,7 +598,6 @@ namespace MTC_Adapter
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public class AdapterGeneric
|
||||
{
|
||||
/// <summary>
|
||||
@@ -834,7 +833,10 @@ namespace MTC_Adapter
|
||||
/// Determina se sia encessario convertire valori little/big endian (SIEMENS=true, OSAI=FALSE)
|
||||
/// </summary>
|
||||
public bool hasBigEndian = false;
|
||||
|
||||
/// <summary>
|
||||
/// dimensione massima vettore memorie UT
|
||||
/// </summary>
|
||||
public short numMemUt = 200;
|
||||
/// <summary>
|
||||
/// adapter globale
|
||||
/// </summary>
|
||||
@@ -3616,7 +3618,7 @@ namespace MTC_Adapter
|
||||
public virtual void getDatiUt(int maxNumOp)
|
||||
{
|
||||
// variabili "Indice" utensile e famiglia da decodificare + utils
|
||||
int maxMemAddr = 200;
|
||||
int maxMemAddr = numMemUt;
|
||||
byte[] elencoUtMem = new byte[2 * maxNumOp];
|
||||
byte[] tabUt_UT = new byte[2 * maxMemAddr];
|
||||
byte[] tabFam_FamUt = new byte[2 * maxMemAddr];
|
||||
|
||||
@@ -39,6 +39,10 @@ namespace MTC_Adapter
|
||||
/// Area di memoria base x dati TESTE (DB254)
|
||||
/// </summary>
|
||||
protected int baseMemUO = 254;
|
||||
/// <summary>
|
||||
/// Oggetto appoggio memorie dati UT
|
||||
/// </summary>
|
||||
protected SIEMENS.UtData ValUT;
|
||||
|
||||
/// <summary>
|
||||
/// wrapper chiamata lettura/scrittura SINGOLO BYTE...
|
||||
@@ -822,12 +826,19 @@ namespace MTC_Adapter
|
||||
/// <returns></returns>
|
||||
public override int getDatiUt_step4(ref byte[] int32Mem, int j)
|
||||
{
|
||||
// restituisco dati richiesti...
|
||||
int memIndex = 4300 + 4 * j;
|
||||
Buffer.BlockCopy(ValUT.tabVitaRes, j, int32Mem, 0, int32Mem.Length);
|
||||
return memIndex;
|
||||
|
||||
#if false
|
||||
// DB253.DBI4300
|
||||
int memIndex = 4300 + 4 * j;
|
||||
inizio = DateTime.Now;
|
||||
SIEMENSMemRW_Byte(R, baseMemUT, memIndex, ref int32Mem);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TabUT-VitaRes", int32Mem.Length * 4), DateTime.Now.Subtract(inizio).Ticks);
|
||||
return memIndex;
|
||||
return memIndex;
|
||||
#endif
|
||||
}
|
||||
/// <summary>
|
||||
/// Procedura di processing lettura memoria x DatiUt - Step 3b
|
||||
@@ -837,12 +848,19 @@ namespace MTC_Adapter
|
||||
/// <returns></returns>
|
||||
public override int getDatiUt_step3b(ref byte int8Mem, int j)
|
||||
{
|
||||
// restituisco dati richiesti...
|
||||
int memIndex = 1900 + 1 * j;
|
||||
int8Mem = BitConverter.GetBytes(ValUT.tabTipoVitaRes[j])[0];
|
||||
return memIndex;
|
||||
|
||||
#if false
|
||||
// DB253.DBI1900
|
||||
int memIndex = 1900 + 1 * j;
|
||||
inizio = DateTime.Now;
|
||||
SIEMENSMemRW_Byte(R, baseMemUT, memIndex, ref int8Mem);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TabUT-FamUT", 1), DateTime.Now.Subtract(inizio).Ticks);
|
||||
return memIndex;
|
||||
return memIndex;
|
||||
#endif
|
||||
}
|
||||
/// <summary>
|
||||
/// Procedura di processing lettura memoria x DatiUt - Step 3a
|
||||
@@ -851,12 +869,19 @@ namespace MTC_Adapter
|
||||
/// <returns></returns>
|
||||
public override int getDatiUt_step3a(ref byte[] tabFam_FamUt)
|
||||
{
|
||||
// restituisco dati richiesti...
|
||||
int memIndex = 100;
|
||||
Buffer.BlockCopy(ValUT.tabFamUt, 0, tabFam_FamUt, 0, tabFam_FamUt.Length);
|
||||
return memIndex;
|
||||
|
||||
#if false
|
||||
// DB253.DBI100
|
||||
int memIndex = 100;
|
||||
inizio = DateTime.Now;
|
||||
SIEMENSMemRW_Byte(R, baseMemUT, memIndex, ref tabFam_FamUt);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TabFamUT-FamUT", tabFam_FamUt.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
return memIndex;
|
||||
return memIndex;
|
||||
#endif
|
||||
}
|
||||
/// <summary>
|
||||
/// Procedura di processing lettura memoria x DatiUt - Step 2b
|
||||
@@ -866,12 +891,19 @@ namespace MTC_Adapter
|
||||
/// <returns></returns>
|
||||
public override int getDatiUt_step2b(ref byte[] int16Mem, int j)
|
||||
{
|
||||
// restituisco dati richiesti...
|
||||
int memIndex = 2900 + 2 * j;
|
||||
Buffer.BlockCopy(ValUT.tabIdFamUt, j, int16Mem, 0, int16Mem.Length);
|
||||
return memIndex;
|
||||
|
||||
#if false
|
||||
// DB253.DBI2900
|
||||
int memIndex = 2900 + 2 * j;
|
||||
inizio = DateTime.Now;
|
||||
SIEMENSMemRW_Byte(R, baseMemUT, memIndex, ref int16Mem);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TabUT-FamUT", int16Mem.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
return memIndex;
|
||||
return memIndex;
|
||||
#endif
|
||||
}
|
||||
/// <summary>
|
||||
/// Procedura di processing lettura memoria x DatiUt - Step 2a
|
||||
@@ -880,12 +912,19 @@ namespace MTC_Adapter
|
||||
/// <returns></returns>
|
||||
public override int getDatiUt_step2a(ref byte[] tabUt_UT)
|
||||
{
|
||||
// restituisco dati richiesti...
|
||||
int memIndex = 2500;
|
||||
Buffer.BlockCopy(ValUT.tabUt_UT, 0, tabUt_UT, 0, tabUt_UT.Length);
|
||||
return memIndex;
|
||||
|
||||
#if false
|
||||
// DB253.DBI2500
|
||||
int memIndex = 2500;
|
||||
inizio = DateTime.Now;
|
||||
SIEMENSMemRW_Byte(R, baseMemUT, memIndex, ref tabUt_UT);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TabUT-UT", tabUt_UT.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
return memIndex;
|
||||
return memIndex;
|
||||
#endif
|
||||
}
|
||||
/// <summary>
|
||||
/// Procedura di processing lettura memoria x DatiUt - Step 1
|
||||
@@ -894,13 +933,24 @@ 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...
|
||||
// faccio un unica chiamata in blocco di TUTTE le aree che riguardano gli UT e le salvo in variabili locali siemens...
|
||||
inizio = DateTime.Now;
|
||||
ValUT = SIEMENS_ref.getAllUtData(numMemUt);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-UT_ALL", numMemUt * 6 * 2), DateTime.Now.Subtract(inizio).Ticks);
|
||||
|
||||
// restituisco dati richiesti...
|
||||
int memIndex = 280;
|
||||
Buffer.BlockCopy(ValUT.elencoUtMem, 0, elencoUtMem, 0, elencoUtMem.Length);
|
||||
return memIndex;
|
||||
|
||||
#if false
|
||||
// DB254.DBI280
|
||||
int memIndex = 280;
|
||||
inizio = DateTime.Now;
|
||||
SIEMENSMemRW_Byte(R, baseMemUO, memIndex, ref elencoUtMem);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-NUMUT", elencoUtMem.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
return memIndex;
|
||||
return memIndex;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -996,7 +1046,9 @@ namespace MTC_Adapter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override gestione caricamento dati assi
|
||||
/// </summary>
|
||||
public override void getAxis()
|
||||
{
|
||||
// mostro assi in DataMonitor......
|
||||
@@ -1008,10 +1060,10 @@ namespace MTC_Adapter
|
||||
string tipoAsse = "";
|
||||
string direzione = "";
|
||||
|
||||
// recupero in blocco dati assi...
|
||||
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);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-AXIS_ALL", ValAssi.Length * 4 * 2), DateTime.Now.Subtract(inizio).Ticks);
|
||||
|
||||
|
||||
for (int i = 0; i < currAdpConf.nAxis; i++)
|
||||
@@ -1021,25 +1073,16 @@ namespace MTC_Adapter
|
||||
{
|
||||
// popolo valori... ipotesi MILLESIMI di mm... CONVERSIONE BigEndianness
|
||||
newPos = ValAssi[i].PosAct;
|
||||
vettAxis[i].mAxLoad.Value = ValAssi[i].Load;
|
||||
//vettAxis[i].mAxFeedAct.Value= ValAssi[i].Speed;
|
||||
#if false
|
||||
newPos = axisPosFloat[i];// axisPosData[i] / 1000;
|
||||
#endif
|
||||
|
||||
// manca LOAD assi
|
||||
#if false
|
||||
vettAxis[i].mAxLoad.Value = (double)(valLoad.data) / Math.Pow(10, valLoad.dec);
|
||||
newPos = (double)(valPos.abs.data) / Math.Pow(10, valPos.abs.dec);
|
||||
#endif
|
||||
vettAxis[i].mAxPosAct.Value = newPos;
|
||||
vettAxis[i].mAxLoad.Value = ValAssi[i].Load;
|
||||
|
||||
// manca pos TGT...
|
||||
#if false
|
||||
vettAxis[i].mAxPosTgt.Value = newPos + (double)(valPos.dist.data) / Math.Pow(10, valPos.dist.dec);
|
||||
|
||||
#endif
|
||||
// imposto feed "generale" per asse... si potrebbe usare velocità del singolo asse... !!!FARE!!! verificare
|
||||
vettAxis[i].mAxFeedAct.Value = FeedRate;
|
||||
//vettAxis[i].mAxFeedAct.Value= ValAssi[i].Speed;
|
||||
vettAxis[i].mAxFeedOver.Value = FeedRateOver;
|
||||
|
||||
// verifica pos TGT... NON E' orrettamente letta lato area memoria...
|
||||
vettAxis[i].mAxPosTgt.Value = ValAssi[i].PosTgt;
|
||||
|
||||
// calcolo distanza e salvo valore...
|
||||
distPerc = newPos - prevPosAxis[i];
|
||||
@@ -1065,29 +1108,24 @@ namespace MTC_Adapter
|
||||
{
|
||||
direzione = (newDir > 0) ? "CLOCKWISE" : "COUNTER_CLOCKWISE";
|
||||
}
|
||||
|
||||
// imposto direzione
|
||||
vettAxis[i].mAxDir.Value = direzione;
|
||||
|
||||
|
||||
if (utils.CRB("verbose"))
|
||||
{
|
||||
sb.AppendLine(string.Format("Asse {0}: PosAct:{1:N3}, ToGo:{2:N3}{3} | {4}", i, newPos, 0, "-", direzione));
|
||||
//sb.AppendLine(string.Format("Asse {0}: PosAct:{1:N3}, ToGo:{2:N3}{3} | {4}", valPos.abs.name, (double)(valPos.abs.data) / Math.Pow(10, valPos.abs.dec), valPos.dist.name, (double)(valPos.dist.data) / Math.Pow(10, valPos.dist.dec), direzione));
|
||||
}
|
||||
|
||||
// salvo valori vettore prec...
|
||||
prevPosAxis[i] = newPos;
|
||||
prevDirAxis[i] = newDir;
|
||||
|
||||
// altri valori NON gestiti
|
||||
//vettAxis[i].mAxMainProc.Value = AxData.AxisMainProc;
|
||||
//vettAxis[i].mAxIsMaster.Value = AxData.AxisIsMaster;
|
||||
//vettAxis[i].mAxMastId.Value = AxData.AxisMastId;
|
||||
vettAxis[i].mAxFeedOver.Value = FeedRateOver;
|
||||
//vettAxis[i].mAxAccelAct.Value = AxData.AxisAccel;
|
||||
//vettAxis[i].mAxBattery.Value = AxData.AxisBattery;
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -1095,11 +1133,6 @@ namespace MTC_Adapter
|
||||
}
|
||||
}
|
||||
|
||||
#if false
|
||||
inizio = DateTime.Now;
|
||||
CMSCncLib.Focas1.ODBSVLOAD loadAssi = SIEMENS_ref.getAllAxisLoad();
|
||||
if (utils.CRB("recTime")) TimingData.addResult("R-AXIS_LOAD", DateTime.Now.Subtract(inizio).Ticks);
|
||||
#endif
|
||||
parentForm.dataMonitor_3 += sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,3 +26,22 @@ DB241.dbd0 --> CMD_ACT (p412), dove actToolBasePos =pos act, mentre cmdToolBaseP
|
||||
|
||||
|
||||
|
||||
Elenco assi (16 + 2 mandrini...)
|
||||
TAB[0]="X1"
|
||||
TAB[1]="Y1"
|
||||
TAB[2]="Z1"
|
||||
TAB[3]="A1"
|
||||
TAB[4]="C1"
|
||||
TAB[5]="U1"
|
||||
TAB[6]=""
|
||||
TAB[7]=""
|
||||
TAB[8]=""
|
||||
TAB[9]="X2"
|
||||
TAB[10]="Y2"
|
||||
TAB[11]="Z2"
|
||||
TAB[12]="A2"
|
||||
TAB[13]="C2"
|
||||
TAB[14]="U2"
|
||||
TAB[15]=""
|
||||
TAB[16]="SP1"
|
||||
TAB[17]="SP2"
|
||||
Reference in New Issue
Block a user