unificata gestione FANUC/OSAI x lettura load/speed/speedOverride delel UnOp

This commit is contained in:
Samuele E. Locatelli
2017-05-09 12:02:24 +02:00
parent 58e29ac786
commit 752fa4b63e
3 changed files with 33 additions and 57 deletions
+2 -32
View File
@@ -1124,8 +1124,6 @@ namespace MTC_Adapter
/// </summary>
public override void getUnOp()
{
base.getUnOp();
// leggo in blocco tutte le speed da memoria...
int memIndex = 3140;
// buffer memoria 60 byte... speed (16bit 2 * 20) + load (8bit 1 * 20) visto che sono 20 teste max
@@ -1134,36 +1132,8 @@ namespace MTC_Adapter
inizio = DateTime.Now;
FanucMemRW(R, FANUC.MemType.D, memIndex, ref unOpSpeedMem);
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-SPEED_UNOP", unOpSpeedMem.Length), DateTime.Now.Subtract(inizio).Ticks);
// NON VA: RICHIEDE OPZIONE... The extended driver/library function is necessary.
#if false
// recupero vettore load spindle...
inizio = DateTime.Now;
CMSCncLib.Focas1.ODBSPN spindleVect = FANUC_ref.getSpindleLoad();
if (utils.CRB("recTime")) TimingData.addResult("R-SpindleLoad", DateTime.Now.Subtract(inizio).Ticks);
#endif
StringBuilder sb = new StringBuilder();
int numUnOp = currAdpConf.nUnOp;
// cicl su path x leggere le velocità dell'UnOp
for (int i = 0; i < numUnOp; i++)
{
// leggo valore Codice
SpeedRate = BitConverter.ToUInt16(unOpSpeedMem, 2 * i);
// leggo 41° byte = indice 40 + 2*i x le var del carico UnOp
UnOpLoad = unOpSpeedMem[40 + i];
//vettUnOp[i].mUnOpNumCU.Value = uoData.UnOpNumCU;
//vettUnOp[i].mUnOpStatus.Value = uoData.UnOpStatus;
//vettUnOp[i].mUnOpAccTime.Value = uoData.UnOpAccTime;
sb.AppendLine(string.Format("SpeedRate UnOp_{0}: {1} rpm", i + 1, SpeedRate));
sb.AppendLine(string.Format("Load UnOp_{0}: {1}", i + 1, UnOpLoad));
}
parentForm.dataMonitor_1 += sb.ToString();
procUnOp(unOpSpeedMem);
}
/// <summary>
/// Procedura di processing lettura memoria x DatiUt - Step 4
+30
View File
@@ -2005,13 +2005,43 @@ namespace MTC_Adapter
/// </summary>
public virtual void getUnOp()
{
#if false
// cicl su UnOp
for (int i = 0; i < currAdpConf.nUnOp; i++)
{
vettUnOp[i].mUnOpSpeed.Value = SpeedRate;
vettUnOp[i].mUnOpSpeedOverr.Value = SpeedRateOver;
vettUnOp[i].mUnOpLoad.Value = UnOpLoad;
}
#endif
}
/// <summary>
/// Processing dati UnOp
/// </summary>
/// <param name="unOpSpeedMem"></param>
public void procUnOp(byte[] unOpSpeedMem)
{
StringBuilder sb = new StringBuilder();
int numUnOp = currAdpConf.nUnOp;
// cicl su path x leggere le velocità dell'UnOp
for (int i = 0; i < numUnOp; i++)
{
// leggo valore Codice
SpeedRate = BitConverter.ToUInt16(unOpSpeedMem, 2 * i);
// leggo 41° byte = indice 40 + 2*i x le var del carico UnOp
UnOpLoad = unOpSpeedMem[40 + i];
vettUnOp[i].mUnOpSpeed.Value = SpeedRate;
vettUnOp[i].mUnOpLoad.Value = UnOpLoad;
vettUnOp[i].mUnOpSpeedOverr.Value = SpeedRateOver;
sb.AppendLine(string.Format("UnOp_{0}: SpeedRate {1} rpm | Load {2}", i + 1, SpeedRate, UnOpLoad));
}
parentForm.dataMonitor_2 += sb.ToString();
}
/// <summary>
/// recupero dati ASSI
+1 -25
View File
@@ -1371,8 +1371,6 @@ namespace MTC_Adapter
/// </summary>
public override void getUnOp()
{
// NON uso il metodo base!!!!
// leggo in blocco tutte le speed da memoria...
int memIndex = 2950;
// buffer memoria 60 byte... speed (16bit 2 * 20) + load (8bit 1 * 20) visto che sono 20 teste max
@@ -1384,29 +1382,7 @@ namespace MTC_Adapter
// travaso in modalità byte...
Buffer.BlockCopy(unOpSpeedMemW, 0, unOpSpeedMem, 0, unOpSpeedMem.Length);
StringBuilder sb = new StringBuilder();
int numUnOp = currAdpConf.nUnOp;
// cicl su path x leggere le velocità dell'UnOp
for (int i = 0; i < numUnOp; i++)
{
// leggo valore Codice
SpeedRate = BitConverter.ToUInt16(unOpSpeedMem, 2 * i);
// leggo 41° byte = indice 40 + 2*i x le var del carico UnOp
UnOpLoad = unOpSpeedMem[40 + i];
vettUnOp[i].mUnOpSpeed.Value = SpeedRate;
vettUnOp[i].mUnOpLoad.Value = UnOpLoad;
vettUnOp[i].mUnOpSpeedOverr.Value = SpeedRateOver;
sb.AppendLine(string.Format("UnOp_{0}: SpeedRate {1} rpm | Load {2}", i + 1, SpeedRate, UnOpLoad));
}
parentForm.dataMonitor_2 += sb.ToString();
procUnOp(unOpSpeedMem);
}
/// <summary>