diff --git a/MTC_Adapter/MTC_Adapter/AdapterESA.cs b/MTC_Adapter/MTC_Adapter/AdapterESA.cs index f896ffa..85e2f32 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterESA.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterESA.cs @@ -245,9 +245,11 @@ namespace MTC_Adapter if (utils.CRB("verbose")) lg.Info("step 01: impostato INI File {0}", iniPath); loadOtherFile(); - + + parentForm.commPlcActive = true; //ncDevice = new thdNcEsaGvKvara(EsaIni, mapIOT_Byte.Length, mapIOT_Word.Length, mapIOT_DWord.Length, 255); // impostato a 255 byte (char) FISSO x la parte stringa... mapIOT_String.Length); ncDevice = new thdNcEsaGvKvara(EsaIni, numByte, numWord, numDWord, numString); // impostato a 255 byte (char) FISSO x la parte stringa... mapIOT_String.Length); + parentForm.commPlcActive = false; if (utils.CRB("verbose")) lg.Info("step 02: avviato thdNcEsaGvKvara da INI File {0}", iniPath); @@ -315,9 +317,11 @@ namespace MTC_Adapter if (connectionOk) { // leggo TUTTO il blocco di memoria + parentForm.commPlcActive = true; inizio = DateTime.Now; ncDevice.ReadBufferByte(); if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-PLC_IOT-Byte", ncDevice.PLC_MemoryAreaIOT_Byte.Length), DateTime.Now.Subtract(inizio).Ticks); + parentForm.commPlcActive = false; } else { @@ -582,9 +586,11 @@ namespace MTC_Adapter if (connectionOk) { // leggo TUTTO il blocco di memoria + parentForm.commPlcActive = true; inizio = DateTime.Now; ncDevice.ReadBufferWord(); if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-PLC_IOT-Word", ncDevice.PLC_MemoryAreaIOT_Word.Length), DateTime.Now.Subtract(inizio).Ticks); + parentForm.commPlcActive = false; } else { @@ -779,9 +785,11 @@ namespace MTC_Adapter if (connectionOk) { // leggo TUTTO il blocco di memoria + parentForm.commPlcActive = true; inizio = DateTime.Now; ncDevice.ReadBufferDWord(); if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-PLC_IOT-DWord", ncDevice.PLC_MemoryAreaIOT_DWord.Length), DateTime.Now.Subtract(inizio).Ticks); + parentForm.commPlcActive = false; } else { @@ -942,9 +950,11 @@ namespace MTC_Adapter if (connectionOk) { // leggo TUTTO il blocco di memoria + parentForm.commPlcActive = true; inizio = DateTime.Now; ncDevice.ReadBufferString(); if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-PLC_IOT-DWord", ncDevice.PLC_MemoryAreaIOT_DWord.Length), DateTime.Now.Subtract(inizio).Ticks); + parentForm.commPlcActive = false; } else { diff --git a/MTC_Adapter/MTC_Adapter/AdapterFanuc.cs b/MTC_Adapter/MTC_Adapter/AdapterFanuc.cs index deecc84..7d4ca93 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterFanuc.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterFanuc.cs @@ -30,11 +30,13 @@ namespace MTC_Adapter { try { + parentForm.commPlcActive = true; answ = FANUC_ref.F_RW_Byte(bWrite, MemType, memIndex, ref Value); } catch { } } + parentForm.commPlcActive = false; return answ; } /// @@ -52,11 +54,13 @@ namespace MTC_Adapter { try { + parentForm.commPlcActive = true; answ = FANUC_ref.F_RW_Byte(bWrite, MemType, memIndex, ref Value); } catch { } } + parentForm.commPlcActive = false; return answ; } @@ -79,7 +83,9 @@ namespace MTC_Adapter { lg.Info("Start init Adapter FANUC all'IP {0}", utils.CRS("ipPLC")); + parentForm.commPlcActive = true; Runtime.CreateNC(CNC.NcType.FANUC, utils.CRS("ipPLC")); + parentForm.commPlcActive = false; // inizializzo posizioni assi... prevPosAxis = new double[adpConf.nAxis]; @@ -130,7 +136,9 @@ namespace MTC_Adapter string szStatusConnection = ""; try { + parentForm.commPlcActive = true; FANUC_ref.Connect(ref szStatusConnection); + parentForm.commPlcActive = false; lg.Info("szStatusConnection: " + szStatusConnection); connectionOk = true; // refresh stato allarmi!!! @@ -770,9 +778,11 @@ namespace MTC_Adapter sb1.AppendLine(string.Format("POWER {0}: | EmStop:{1:N3} | ProcSel: {2}", mPower.Value, mEStop.Value, mProcSel.Value)); // leggo dati globali... + parentForm.commPlcActive = true; inizio = DateTime.Now; allDynData = FANUC_ref.getAllDynData(); if (utils.CRB("recTime")) TimingData.addResult("R-ALL-DYN-DATA", DateTime.Now.Subtract(inizio).Ticks); + parentForm.commPlcActive = false; FeedRate = allDynData.actf; @@ -798,9 +808,11 @@ namespace MTC_Adapter { sb1.AppendLine(string.Format("Allarmi CNC: {0}", allDynData.alarm)); + parentForm.commPlcActive = true; inizio = DateTime.Now; allarmiCNC = FANUC_ref.getCncAlarm(); if (utils.CRB("recTime")) TimingData.addResult("R-CNC-ALARMS", DateTime.Now.Subtract(inizio).Ticks); + parentForm.commPlcActive = false; checkCNCAlarms(); } else @@ -1000,9 +1012,11 @@ namespace MTC_Adapter base.getPath(); // recupero vettore generale G MODE + parentForm.commPlcActive = true; inizio = DateTime.Now; CMSCncLib.Focas1.ODBGCD vettGCodes = FANUC_ref.getPathGCodeMod(); if (utils.CRB("recTime")) TimingData.addResult("R-GCodModal", DateTime.Now.Subtract(inizio).Ticks); + parentForm.commPlcActive = false; string GCodAttivi = ""; GCodAttivi += string.Format("[{0}]", vettGCodes.gcd0.code); @@ -1034,17 +1048,21 @@ namespace MTC_Adapter GCodAttivi += string.Format("[{0}]", vettGCodes.gcd26.code); GCodAttivi += string.Format("[{0}]", vettGCodes.gcd27.code); + parentForm.commPlcActive = true; inizio = DateTime.Now; vettGCodes = FANUC_ref.getPathGCode1Shot(); + parentForm.commPlcActive = false; if (utils.CRB("recTime")) TimingData.addResult("R-GCodOneShot", DateTime.Now.Subtract(inizio).Ticks); if (vettGCodes.gcd0.flag > 0) GCodAttivi += string.Format("[{0}]", vettGCodes.gcd0.code); if (vettGCodes.gcd1.flag > 0) GCodAttivi += string.Format("[{0}]", vettGCodes.gcd1.code); if (vettGCodes.gcd2.flag > 0) GCodAttivi += string.Format("[{0}]", vettGCodes.gcd2.code); if (vettGCodes.gcd3.flag > 0) GCodAttivi += string.Format("[{0}]", vettGCodes.gcd3.code); + parentForm.commPlcActive = true; inizio = DateTime.Now; CMSCncLib.Focas1.ODB5AXMAN vettTTCoord = FANUC_ref.getPathTTCoord(); if (utils.CRB("recTime")) TimingData.addResult("R-TTCoord", DateTime.Now.Subtract(inizio).Ticks); + parentForm.commPlcActive = false; // ciclo su path StringBuilder sb_2; @@ -1088,6 +1106,7 @@ namespace MTC_Adapter // mostro assi in DataMonitor...... StringBuilder sb = new StringBuilder(); + parentForm.commPlcActive = true; inizio = DateTime.Now; CMSCncLib.Focas1.ODBPOS posAssi = FANUC_ref.getAllAxisPos(); if (utils.CRB("recTime")) TimingData.addResult("R-AXIS_POS", DateTime.Now.Subtract(inizio).Ticks); @@ -1095,6 +1114,7 @@ namespace MTC_Adapter inizio = DateTime.Now; CMSCncLib.Focas1.ODBSVLOAD loadAssi = FANUC_ref.getAllAxisLoad(); if (utils.CRB("recTime")) TimingData.addResult("R-AXIS_LOAD", DateTime.Now.Subtract(inizio).Ticks); + parentForm.commPlcActive = false; CMSCncLib.Focas1.LOADELM valLoad = new CMSCncLib.Focas1.LOADELM(); CMSCncLib.Focas1.POSELMALL valPos = new CMSCncLib.Focas1.POSELMALL();