Implementazione gestione VitaUT x OSAI (da testare con veri prog)
This commit is contained in:
@@ -2439,6 +2439,211 @@ namespace MTC_Adapter
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// procedura di lettura (multistep) dati da memoria x caricare dati utensile
|
||||
/// </summary>
|
||||
/// <param name="maxNumOp">num max di teste da recuperare</param>
|
||||
public virtual void getDatiUt(int maxNumOp)
|
||||
{
|
||||
// variabili "Indice" utensile e famiglia da decodificare + utils
|
||||
int maxMemAddr = 200;
|
||||
byte[] elencoUtMem = new byte[2 * maxNumOp];
|
||||
byte[] tabUt_UT = new byte[2 * maxMemAddr];
|
||||
byte[] tabFam_FamUt = new byte[2 * maxMemAddr];
|
||||
|
||||
// altre variabili
|
||||
int[] idUtMontato = new int[maxNumOp];
|
||||
int[] idFamUt = new int[maxNumOp];
|
||||
int[] idTipoVitaUt = new int[maxNumOp];
|
||||
int[] valVitaUtRes = new int[maxNumOp];
|
||||
int[] tabUt = new int[maxMemAddr];
|
||||
int[] tabFamUt = new int[maxMemAddr];
|
||||
int memIndex = 0;
|
||||
byte[] int32Mem = new byte[4];
|
||||
byte[] int16Mem = new byte[2];
|
||||
byte int8Mem = new byte();
|
||||
|
||||
// step 1: lettura ID dell'utensile x ogni testa... leggo area memoria degli UT montati
|
||||
memIndex = getDatiUt_step1(ref elencoUtMem);
|
||||
// decodifica da byte a int16 dell'ID Utensile
|
||||
for (int i = 0; i < maxNumOp; i++)
|
||||
{
|
||||
idUtMontato[i] = BitConverter.ToUInt16(elencoUtMem, 2 * i);
|
||||
}
|
||||
|
||||
// step 2a: leggo vettore memoria dei maxMemAddr(200) UT in Tabella Utensili
|
||||
memIndex = getDatiUt_step2a(ref tabUt_UT);
|
||||
// decodifico TUTTI i maxMemAddr utensili
|
||||
for (int i = 0; i < maxMemAddr; i++)
|
||||
{
|
||||
tabUt[i] = BitConverter.ToUInt16(tabUt_UT, 2 * i);
|
||||
}
|
||||
// step 2b: devo cercare l'UT di ogni UnOp nella Tabella Utensili
|
||||
for (int i = 0; i < maxNumOp; i++)
|
||||
{
|
||||
// spazzo la tab Utensili x cercare quelli delle UnOp...
|
||||
for (int j = 0; j < maxMemAddr; j++)
|
||||
{
|
||||
// controllo, se l'id utensile è quello dell'attuale UnOp...
|
||||
if (tabUt[j] == idUtMontato[i])
|
||||
{
|
||||
// leggo FamUt puntuale..
|
||||
memIndex = getDatiUt_step2b(ref int16Mem, j);
|
||||
// step 2b: leggo puntualmente la FamUt dal suo indice...
|
||||
idFamUt[i] = BitConverter.ToUInt16(int16Mem, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// step 3a: leggo vettore memoria dei maxMemAddr(200) FamUT in Tabella Famiglie Utensili (x ricavare unità misura vita)
|
||||
memIndex = getDatiUt_step3a(ref tabFam_FamUt);
|
||||
// decodifico TUTTI i maxMemAddr utensili
|
||||
for (int i = 0; i < maxMemAddr; i++)
|
||||
{
|
||||
tabFamUt[i] = BitConverter.ToUInt16(tabFam_FamUt, 2 * i);
|
||||
}
|
||||
// step 3b: devo cercare la famiglia dell'UT di ogni UnOp nella Tabella Famiglie
|
||||
for (int i = 0; i < maxNumOp; i++)
|
||||
{
|
||||
// poiché potrei trovarlo replicato dopo la prima volta che lo trovo evito di ricontrollare...
|
||||
bool found = false;
|
||||
// spazzo la tab Utensili x cercare quelli delle UnOp...
|
||||
for (int j = 0; j < maxMemAddr; j++)
|
||||
{
|
||||
// controllo, se l'id utensile è quello dell'attuale UnOp...
|
||||
if (tabFamUt[j] == idFamUt[i] && !found)
|
||||
{
|
||||
// leggo FamUt puntuale..
|
||||
memIndex = getDatiUt_step3b(ref int8Mem, j);
|
||||
// step 3b: leggo puntualmente il TIPO DI vita UT dal suo indice...
|
||||
idTipoVitaUt[i] = int8Mem;
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// step 4: recupero la vita residua dell'utente
|
||||
for (int i = 0; i < maxNumOp; i++)
|
||||
{
|
||||
// spazzo la tab Utensili x cercare quelli delle UnOp...
|
||||
for (int j = 0; j < maxMemAddr; j++)
|
||||
{
|
||||
// controllo, se l'id utensile è quello dell'attuale UnOp...
|
||||
if (tabUt[j] == idUtMontato[i])
|
||||
{
|
||||
// leggo FamUt puntuale..
|
||||
memIndex = getDatiUt_step4(ref int32Mem, j);
|
||||
// leggo puntualmente valore della vita ut residua da indice utensile...
|
||||
valVitaUtRes[i] = BitConverter.ToInt32(int32Mem, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// salvo in adapter vita UT residua...
|
||||
for (int i = 0; i < maxNumOp; i++)
|
||||
{
|
||||
vettUnOp[i].mUnOpToolId.Value = idUtMontato[i];
|
||||
vettUnOp[i].mUnOpVitaRes.Value = valVitaUtRes[i];
|
||||
// decodifico valore tipo VitaRes...
|
||||
string tipoVitaRes = "ND";
|
||||
switch (idTipoVitaUt[i])
|
||||
{
|
||||
case 1:
|
||||
tipoVitaRes = "Time";
|
||||
break;
|
||||
case 2:
|
||||
tipoVitaRes = "Stroke";
|
||||
break;
|
||||
case 3:
|
||||
tipoVitaRes = "Distance";
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
vettUnOp[i].mUnOpVitaResType.Value = tipoVitaRes;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Procedura di processing lettura memoria x DatiUt - Step 4
|
||||
/// </summary>
|
||||
/// <param name="int32Mem"></param>
|
||||
/// <param name="j"></param>
|
||||
/// <returns></returns>
|
||||
public virtual int getDatiUt_step4(ref byte[] int32Mem, int j)
|
||||
{
|
||||
int memIndex = 13100 + 4 * j;
|
||||
//inizio = DateTime.Now;
|
||||
//OsaiMemRW(R, FANUC.MemType.D, memIndex, ref int32Mem);
|
||||
//if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TabUT-VitaRes", int32Mem.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
return memIndex;
|
||||
}
|
||||
/// <summary>
|
||||
/// Procedura di processing lettura memoria x DatiUt - Step 3b
|
||||
/// </summary>
|
||||
/// <param name="int8Mem"></param>
|
||||
/// <param name="j"></param>
|
||||
/// <returns></returns>
|
||||
public virtual int getDatiUt_step3b(ref byte int8Mem, int j)
|
||||
{
|
||||
int memIndex = 10700 + 1 * j;
|
||||
//inizio = DateTime.Now;
|
||||
//OsaiMemRW(R, FANUC.MemType.D, memIndex, ref int8Mem);
|
||||
//if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TabUT-FamUT", 8), DateTime.Now.Subtract(inizio).Ticks);
|
||||
return memIndex;
|
||||
}
|
||||
/// <summary>
|
||||
/// Procedura di processing lettura memoria x DatiUt - Step 3a
|
||||
/// </summary>
|
||||
/// <param name="tabFam_FamUt"></param>
|
||||
/// <returns></returns>
|
||||
public virtual int getDatiUt_step3a(ref byte[] tabFam_FamUt)
|
||||
{
|
||||
int memIndex = 8900;
|
||||
//inizio = DateTime.Now;
|
||||
//OsaiMemRW(R, FANUC.MemType.D, 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;
|
||||
}
|
||||
/// <summary>
|
||||
/// Procedura di processing lettura memoria x DatiUt - Step 2b
|
||||
/// </summary>
|
||||
/// <param name="int16Mem"></param>
|
||||
/// <param name="j"></param>
|
||||
/// <returns></returns>
|
||||
public virtual int getDatiUt_step2b(ref byte[] int16Mem, int j)
|
||||
{
|
||||
int memIndex = 11700 + 2 * j;
|
||||
//inizio = DateTime.Now;
|
||||
//OsaiMemRW(R, FANUC.MemType.D, memIndex, ref int16Mem);
|
||||
//if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TabUT-FamUT", int16Mem.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
return memIndex;
|
||||
}
|
||||
/// <summary>
|
||||
/// Procedura di processing lettura memoria x DatiUt - Step 2a
|
||||
/// </summary>
|
||||
/// <param name="tabUt_UT"></param>
|
||||
/// <returns></returns>
|
||||
public virtual int getDatiUt_step2a(ref byte[] tabUt_UT)
|
||||
{
|
||||
int memIndex = 11300;
|
||||
//inizio = DateTime.Now;
|
||||
//OsaiMemRW(R, FANUC.MemType.D, 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;
|
||||
}
|
||||
/// <summary>
|
||||
/// Procedura di processing lettura memoria x DatiUt - Step 1
|
||||
/// </summary>
|
||||
/// <param name="elencoUtMem"></param>
|
||||
/// <returns></returns>
|
||||
public virtual int getDatiUt_step1(ref byte[] elencoUtMem)
|
||||
{
|
||||
int memIndex = 2960;
|
||||
//inizio = DateTime.Now;
|
||||
//OsaiMemRW(R, FANUC.MemType.D, memIndex, ref elencoUtMem);
|
||||
//if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-NUMUT", elencoUtMem.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
return memIndex;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -1096,7 +1096,7 @@ namespace MTC_Adapter
|
||||
reloadDataFromFile();
|
||||
|
||||
// area gestione dati utensili... in base al num max di UnOp recupero i dati utensile... PROCEDURA AD HOC!!!
|
||||
getDatiUt_Osai(currAdpConf.nUnOp);
|
||||
getDatiUt(currAdpConf.nUnOp);
|
||||
}
|
||||
/// <summary>
|
||||
/// Gestione lettura dati manutenzione
|
||||
@@ -1143,10 +1143,11 @@ namespace MTC_Adapter
|
||||
parentForm.dataMonitor_3 = "";
|
||||
|
||||
// accodo dati path in DataMonitor......
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb1 = new StringBuilder();
|
||||
StringBuilder sb2 = new StringBuilder();
|
||||
|
||||
// dati base...
|
||||
sb.AppendLine(string.Format("POWER {0}: | EmStop:{1:N3} | ProcSel: {2}", mPower.Value, mEStop.Value, mProcSel.Value));
|
||||
sb1.AppendLine(string.Format("POWER {0}: | EmStop:{1:N3} | ProcSel: {2}", mPower.Value, mEStop.Value, mProcSel.Value));
|
||||
|
||||
// leggo dati globali...
|
||||
inizio = DateTime.Now;
|
||||
@@ -1165,26 +1166,26 @@ namespace MTC_Adapter
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-PathData", PathData_mem.Length * 2), DateTime.Now.Subtract(inizio).Ticks);
|
||||
|
||||
// inizio indicando feed...
|
||||
sb.AppendLine(string.Format("FeedRate: {0} mm/min", FeedRate));
|
||||
sb.AppendLine(string.Format("SpeedRate: {0} mm/min", SpeedRate));
|
||||
sb1.AppendLine(string.Format("FeedRate: {0} mm/min", FeedRate));
|
||||
sb1.AppendLine(string.Format("SpeedRate: {0} mm/min", SpeedRate));
|
||||
|
||||
// 2017.04.20: recupero OVER per Jog/Feed/Rapid/Spindle x i path multipli (qui cablati 1-2)
|
||||
ushort[] currPathData = new ushort[7];
|
||||
// processo ora i dai dei path... di sicuro il primo
|
||||
Array.Copy(PathData_mem, 0, currPathData, 0, 7);
|
||||
procPathOverride(0, currPathData, ref sb);
|
||||
procPathOverride(0, currPathData, ref sb1);
|
||||
//...e se c'è pure il secondo...
|
||||
if (currAdpConf.nPath > 1)
|
||||
{
|
||||
Array.Copy(PathData_mem, 7, currPathData, 0, 7);
|
||||
// anche il secondo!
|
||||
procPathOverride(1, currPathData, ref sb);
|
||||
procPathOverride(1, currPathData, ref sb1);
|
||||
}
|
||||
|
||||
// se ho allarmi li accodo...
|
||||
if (allNcData.lastncerror != 0)
|
||||
{
|
||||
sb.AppendLine(string.Format("Allarmi CNC: {0}", allNcData.lastncerror));
|
||||
sb1.AppendLine(string.Format("Allarmi CNC: {0}", allNcData.lastncerror));
|
||||
|
||||
inizio = DateTime.Now;
|
||||
OSAI_ref.O_ReadCurrentErrorMsg(ref allarmiCNC);
|
||||
@@ -1204,7 +1205,14 @@ namespace MTC_Adapter
|
||||
allarmiCNC = new CMSCncLib.OPENcontrol.MSGERROR();
|
||||
}
|
||||
|
||||
parentForm.dataMonitor_1 = sb.ToString();
|
||||
// accodo dati base!
|
||||
parentForm.dataMonitor_1 = sb1.ToString();
|
||||
// accodo dati UT...
|
||||
for (int i = 0; i < currAdpConf.nUnOp; i++)
|
||||
{
|
||||
sb2.AppendLine(string.Format("UT: ToolId {0} | VitaRes {1} | TipoVita {2} ", vettUnOp[i].mUnOpToolId.Value, vettUnOp[i].mUnOpVitaRes.Value, vettUnOp[i].mUnOpVitaResType.Value));
|
||||
}
|
||||
parentForm.dataMonitor_2 = sb2.ToString();
|
||||
|
||||
// gestisco lettura dati manutenzione da PLC...
|
||||
getMtzDataFromPlc();
|
||||
@@ -1402,148 +1410,91 @@ namespace MTC_Adapter
|
||||
parentForm.dataMonitor += sb.ToString();
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// procedura di lettura (Multipla) dati da memoria x caricare dati utensile
|
||||
/// Procedura di processing lettura memoria x DatiUt - Step 4
|
||||
/// </summary>
|
||||
/// <param name="maxNumOp">num max di teste da recuperare</param>
|
||||
private void getDatiUt_Osai(int maxNumOp)
|
||||
/// <param name="int32Mem"></param>
|
||||
/// <param name="j"></param>
|
||||
/// <returns></returns>
|
||||
public override int getDatiUt_step4(ref byte[] int32Mem, int j)
|
||||
{
|
||||
#if false
|
||||
// variabili "Indice" utensile e famiglia da decodificare + utils
|
||||
int maxMemAddr = 200;
|
||||
int[] idUtMontato = new int[maxNumOp];
|
||||
int[] idFamUt = new int[maxNumOp];
|
||||
int[] idTipoVitaUt = new int[maxNumOp];
|
||||
int[] valVitaUtRes = new int[maxNumOp];
|
||||
int[] tabUt = new int[maxMemAddr];
|
||||
int[] tabFamUt = new int[maxMemAddr];
|
||||
int memIndex = 0;
|
||||
byte[] int32Mem = new byte[4];
|
||||
byte[] int16Mem = new byte[2];
|
||||
byte int8Mem = new byte();
|
||||
|
||||
// step 1: lettura ID dell'utensile x ogni testa...
|
||||
byte[] elencoUtMem = new byte[2 * maxNumOp];
|
||||
// leggo area memoria degli UT montati
|
||||
memIndex = 2960;
|
||||
int memIndex = 6200 + 2 * j;
|
||||
inizio = DateTime.Now;
|
||||
OsaiMemRW(R, FANUC.MemType.D, memIndex, ref elencoUtMem);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-NUMUT", elencoUtMem.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
// decodifica da byte a int16 dell'ID Utensile
|
||||
for (int i = 0; i < maxNumOp; i++)
|
||||
{
|
||||
idUtMontato[i] = BitConverter.ToUInt16(elencoUtMem, 2 * i);
|
||||
}
|
||||
|
||||
// step 2a: leggo vettore memoria dei maxMemAddr(200) UT in Tabella Utensili
|
||||
memIndex = 11300;
|
||||
byte[] tabUt_UT = new byte[2 * maxMemAddr];
|
||||
OsaiMemRW_Byte(R, OSAI.MemTypeWord.MW_CODE, memIndex, 0, ref int32Mem);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TabUT-VitaRes", int32Mem.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
return memIndex;
|
||||
}
|
||||
/// <summary>
|
||||
/// Procedura di processing lettura memoria x DatiUt - Step 3b
|
||||
/// </summary>
|
||||
/// <param name="int8Mem"></param>
|
||||
/// <param name="j"></param>
|
||||
/// <returns></returns>
|
||||
public override int getDatiUt_step3b(ref byte int8Mem, int j)
|
||||
{
|
||||
int memIndex = 5000 + 1 * j / 2; // dovrebeb leggere correttamente solo 1 byte...
|
||||
byte[] byteMtrx = new byte[1];
|
||||
int resto = 0;
|
||||
Math.DivRem(j, 2, out resto);
|
||||
inizio = DateTime.Now;
|
||||
OsaiMemRW(R, FANUC.MemType.D, memIndex, ref tabUt_UT);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TabUT-UT", tabUt_UT.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
// decodifico TUTTI i maxMemAddr utensili
|
||||
for (int i = 0; i < maxMemAddr; i++)
|
||||
{
|
||||
tabUt[i] = BitConverter.ToUInt16(tabUt_UT, 2 * i);
|
||||
}
|
||||
// step 2a: devo cercare l'UT di ogni UnOp nella Tabella Utensili
|
||||
for (int i = 0; i < maxNumOp; i++)
|
||||
{
|
||||
// spazzo la tab Utensili x cercare quelli delle UnOp...
|
||||
for (int j = 0; j < maxMemAddr; j++)
|
||||
{
|
||||
// controllo, se l'id utensile è quello dell'attuale UnOp...
|
||||
if (tabUt[j] == idUtMontato[i])
|
||||
{
|
||||
// leggo FamUt puntuale..
|
||||
memIndex = 11700 + 2 * j;
|
||||
inizio = DateTime.Now;
|
||||
OsaiMemRW(R, FANUC.MemType.D, memIndex, ref int16Mem);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TabUT-FamUT", int16Mem.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
// step 2b: leggo puntualmente la FamUt dal suo indice...
|
||||
idFamUt[i] = BitConverter.ToUInt16(int16Mem, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// step 3: leggo vettore memoria dei maxMemAddr(200) FamUT in Tabella Famiglie Utensili (x ricavare unità misura vita)
|
||||
memIndex = 8900;
|
||||
byte[] tabFam_FamUt = new byte[2 * maxMemAddr];
|
||||
OsaiMemRW_Byte(R, OSAI.MemTypeWord.MW_CODE, memIndex, resto, ref byteMtrx);
|
||||
int8Mem = byteMtrx[0];
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TabUT-FamUT", 8), DateTime.Now.Subtract(inizio).Ticks);
|
||||
return memIndex;
|
||||
}
|
||||
/// <summary>
|
||||
/// Procedura di processing lettura memoria x DatiUt - Step 3a
|
||||
/// </summary>
|
||||
/// <param name="tabFam_FamUt"></param>
|
||||
/// <returns></returns>
|
||||
public override int getDatiUt_step3a(ref byte[] tabFam_FamUt)
|
||||
{
|
||||
int memIndex = 4100;
|
||||
inizio = DateTime.Now;
|
||||
OsaiMemRW(R, FANUC.MemType.D, memIndex, ref tabFam_FamUt);
|
||||
OsaiMemRW_Byte(R, OSAI.MemTypeWord.MW_CODE, memIndex, 0, ref tabFam_FamUt);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TabFamUT-FamUT", tabFam_FamUt.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
// decodifico TUTTI i maxMemAddr utensili
|
||||
for (int i = 0; i < maxMemAddr; i++)
|
||||
{
|
||||
tabFamUt[i] = BitConverter.ToUInt16(tabFam_FamUt, 2 * i);
|
||||
}
|
||||
// step 3a: devo cercare la famiglia dell'UT di ogni UnOp nella Tabella Famiglie
|
||||
for (int i = 0; i < maxNumOp; i++)
|
||||
{
|
||||
// poiché potrei trovarlo replicato dopo la prima volta che lo trovo evito di ricontrollare...
|
||||
bool found = false;
|
||||
// spazzo la tab Utensili x cercare quelli delle UnOp...
|
||||
for (int j = 0; j < maxMemAddr; j++)
|
||||
{
|
||||
// controllo, se l'id utensile è quello dell'attuale UnOp...
|
||||
if (tabFamUt[j] == idFamUt[i] && !found)
|
||||
{
|
||||
// leggo FamUt puntuale..
|
||||
memIndex = 10700 + 1 * j;
|
||||
inizio = DateTime.Now;
|
||||
OsaiMemRW(R, FANUC.MemType.D, memIndex, ref int8Mem);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TabUT-FamUT", 8), DateTime.Now.Subtract(inizio).Ticks);
|
||||
// step 3b: leggo puntualmente il TIPO DI vita UT dal suo indice...
|
||||
idTipoVitaUt[i] = int8Mem;
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// step 4: recupero la vita residua dell'utente
|
||||
for (int i = 0; i < maxNumOp; i++)
|
||||
{
|
||||
// spazzo la tab Utensili x cercare quelli delle UnOp...
|
||||
for (int j = 0; j < maxMemAddr; j++)
|
||||
{
|
||||
// controllo, se l'id utensile è quello dell'attuale UnOp...
|
||||
if (tabUt[j] == idUtMontato[i])
|
||||
{
|
||||
// leggo FamUt puntuale..
|
||||
memIndex = 13100 + 4 * j;
|
||||
inizio = DateTime.Now;
|
||||
OsaiMemRW(R, FANUC.MemType.D, memIndex, ref int32Mem);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TabUT-VitaRes", int32Mem.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
// leggo puntualmente valore della vita ut residua da indice utensile...
|
||||
valVitaUtRes[i] = BitConverter.ToInt32(int32Mem, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// salvo in adapter vita UT residua...
|
||||
for (int i = 0; i < maxNumOp; i++)
|
||||
{
|
||||
vettUnOp[i].mUnOpToolId.Value = idUtMontato[i];
|
||||
vettUnOp[i].mUnOpVitaRes.Value = valVitaUtRes[i];
|
||||
// decodifico valore tipo VitaRes...
|
||||
string tipoVitaRes = "ND";
|
||||
switch (idTipoVitaUt[i])
|
||||
{
|
||||
case 1:
|
||||
tipoVitaRes = "Time";
|
||||
break;
|
||||
case 2:
|
||||
tipoVitaRes = "Stroke";
|
||||
break;
|
||||
case 3:
|
||||
tipoVitaRes = "Distance";
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
vettUnOp[i].mUnOpVitaResType.Value = tipoVitaRes;
|
||||
}
|
||||
#endif
|
||||
return memIndex;
|
||||
}
|
||||
/// <summary>
|
||||
/// Procedura di processing lettura memoria x DatiUt - Step 2b
|
||||
/// </summary>
|
||||
/// <param name="int16Mem"></param>
|
||||
/// <param name="j"></param>
|
||||
/// <returns></returns>
|
||||
public override int getDatiUt_step2b(ref byte[] int16Mem, int j)
|
||||
{
|
||||
int memIndex = 5500 + j;
|
||||
inizio = DateTime.Now;
|
||||
OsaiMemRW_Byte(R, OSAI.MemTypeWord.MW_CODE, memIndex, 0, ref int16Mem);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-TabUT-FamUT", int16Mem.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
return memIndex;
|
||||
}
|
||||
/// <summary>
|
||||
/// Procedura di processing lettura memoria x DatiUt - Step 2a
|
||||
/// </summary>
|
||||
/// <param name="tabUt_UT"></param>
|
||||
/// <returns></returns>
|
||||
public override int getDatiUt_step2a(ref byte[] tabUt_UT)
|
||||
{
|
||||
int memIndex = 5300;
|
||||
inizio = DateTime.Now;
|
||||
OsaiMemRW_Byte(R, OSAI.MemTypeWord.MW_CODE, memIndex, 0, 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;
|
||||
}
|
||||
/// <summary>
|
||||
/// Procedura di processing lettura memoria x DatiUt - Step 1
|
||||
/// </summary>
|
||||
/// <param name="elencoUtMem"></param>
|
||||
/// <returns></returns>
|
||||
public override int getDatiUt_step1(ref byte[] elencoUtMem)
|
||||
{
|
||||
int memIndex = 3020;
|
||||
inizio = DateTime.Now;
|
||||
OsaiMemRW_Byte(R, OSAI.MemTypeWord.MW_CODE, memIndex, 0, ref elencoUtMem);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-NUMUT", elencoUtMem.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
return memIndex;
|
||||
}
|
||||
|
||||
public override void getPath()
|
||||
@@ -1577,6 +1528,7 @@ namespace MTC_Adapter
|
||||
|
||||
#endif
|
||||
|
||||
// NON ci sono nella documentazione metodi x recuperare posizione PuntaUtensile, verificare con Andrea...
|
||||
#if false
|
||||
|
||||
inizio = DateTime.Now;
|
||||
@@ -1637,7 +1589,7 @@ namespace MTC_Adapter
|
||||
OSAI_ref.getAllAxisPos(2, ref posAssi);
|
||||
if (utils.CRB("recTime")) TimingData.addResult("R-AXIS_POS", DateTime.Now.Subtract(inizio).Ticks);
|
||||
|
||||
// NON c'è LOAD assi...
|
||||
// NON c'è LOAD assi... verificare con Andrea
|
||||
#if false
|
||||
inizio = DateTime.Now;
|
||||
CMSCncLib.Focas1.ODBSVLOAD loadAssi = OSAI_ref.getAllAxisLoad();
|
||||
|
||||
Reference in New Issue
Block a user