From 7fc0009a052ac4ffa25429977f4f058e19bc4fdb Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Fri, 7 Apr 2017 17:00:19 +0200 Subject: [PATCH] riportato a messaggi ed esteso uso messaggi... --- MTC_Adapter/MTC_Adapter/AdapterESA.cs | 11 +-- MTC_Adapter/MTC_Adapter/AdapterGeneric.cs | 98 +++++++++++++---------- 2 files changed, 61 insertions(+), 48 deletions(-) diff --git a/MTC_Adapter/MTC_Adapter/AdapterESA.cs b/MTC_Adapter/MTC_Adapter/AdapterESA.cs index 53169a6..1ae26c5 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterESA.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterESA.cs @@ -329,6 +329,7 @@ namespace MTC_Adapter string pathExeMode = ""; string pathRunMode = ""; string ProgAreaRun = ""; + int ProgAreaRunCode = 0; bool isFeedHold = false; bool isActive = false; bool isReady = false; @@ -495,7 +496,8 @@ namespace MTC_Adapter } else if (mapIOT_Byte[i].varName.StartsWith("IOT_EXEC_A_")) { - ProgAreaRun = ""; + ProgAreaRun = "OFF"; + ProgAreaRunCode = 0; // recupero NUMERO try { @@ -504,11 +506,9 @@ namespace MTC_Adapter if (((StFlag8)currByte).HasFlag((StFlag8)Math.Pow(2, bitNum))) { ProgAreaRun = "ON"; + ProgAreaRunCode = 1; } - else - { - ProgAreaRun = "OFF"; - } + vettMemArea[numero - 1].mMemAreaRunning.Code = ProgAreaRunCode.ToString(); vettMemArea[numero - 1].mMemAreaRunning.Value = ProgAreaRun; } catch (Exception exc) @@ -970,6 +970,7 @@ namespace MTC_Adapter // trimmo! valString = valString.Trim(); // salvo + vettMemArea[j].mMemAreaProgName.Code = j.ToString(); vettMemArea[j].mMemAreaProgName.Value = valString; // aggiungo nomi programmi... sb.AppendLine(string.Format("{0}: {1}", mapIOT_String[j].varName, valString)); diff --git a/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs b/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs index b63b7e9..fcd9d3c 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs @@ -157,11 +157,11 @@ namespace MTC_Adapter /// /// Programma caricato /// - public Event mMemAreaProgName; + public MTConnect.Message mMemAreaProgName; /// /// Programma Running (in esecuzione) - ON/OFF /// - public Event mMemAreaRunning; + public MTConnect.Message mMemAreaRunning; /// /// Num esecuzioni programma /// @@ -179,8 +179,8 @@ namespace MTC_Adapter ident = baseElem.ident; dataRefList = baseElem.dataRefList; - mMemAreaProgName = new Event(string.Format("{0}_PROG_NAME", ident)); - mMemAreaRunning = new Event(string.Format("{0}_RUNNING", ident)); + mMemAreaProgName = new MTConnect.Message(string.Format("{0}_PROG_NAME", ident)); + mMemAreaRunning = new MTConnect.Message(string.Format("{0}_RUNNING", ident)); mMemAreaProgNumExe = new Event(string.Format("{0}_NUM_EXE", ident)); mMemAreaProgNumRep = new Event(string.Format("{0}_NUM_REP", ident)); } @@ -193,7 +193,7 @@ namespace MTC_Adapter /// /// Tipo Path (LAVOR/ASSERV) /// - public MTConnect.Event mPathType; + public MTConnect.Message mPathType; /// /// Cod Particolare su Path /// @@ -205,15 +205,15 @@ namespace MTC_Adapter /// /// Codici M sul PATH /// - public MTConnect.Event mPathCodM; + public MTConnect.Message mPathCodM; /// /// Codici S sul PATH /// - public MTConnect.Event mPathCodS; + public MTConnect.Message mPathCodS; /// /// Codici T sul PATH /// - public MTConnect.Event mPathCodT; + public MTConnect.Message mPathCodT; /// /// Modalità RUN del PATH: AUTO/EDIT/MDI/JOG/JOGINC/REF/HANDLE /// @@ -277,11 +277,11 @@ namespace MTC_Adapter /// /// Stato dei codici G attivi /// - public Event mPathCodG_Act; + public MTConnect.Message mPathCodG_Act; /// /// Stato dei SubMode attivi /// - public Event mPathSubMode; + public MTConnect.Message mPathSubMode; /// /// Allarmi CNC del PATH /// @@ -309,20 +309,20 @@ namespace MTC_Adapter mPathPosActJ = new Sample(string.Format("{0}_PosActJ", ident)); mPathPosActK = new Sample(string.Format("{0}_PosActK", ident)); // aggiunta x revisione 2016.05.05 - mPathType = new Event(string.Format("{0}_Type", ident)); + mPathType = new MTConnect.Message(string.Format("{0}_Type", ident)); mPathPartId = new Event(string.Format("{0}_PartId", ident)); mPathPartCount = new Event(string.Format("{0}_PZ_TOT", ident)); - mPathCodM = new Event(string.Format("{0}_Cod_M", ident)); - mPathCodS = new Event(string.Format("{0}_Cod_S", ident)); - mPathCodT = new Event(string.Format("{0}_Cod_T", ident)); + mPathCodM = new MTConnect.Message(string.Format("{0}_Cod_M", ident)); + mPathCodS = new MTConnect.Message(string.Format("{0}_Cod_S", ident)); + mPathCodT = new MTConnect.Message(string.Format("{0}_Cod_T", ident)); mPathRunMode = new Event(string.Format("{0}_RUN_MODE", ident)); mPathExeMode = new Event(string.Format("{0}_EXE_MODE", ident)); mPathCurrProg = new Event(string.Format("{0}_CurrProg", ident)); mPathCurrArea = new Event(string.Format("{0}_CurrArea", ident)); mPathCurrProgRowNum = new Event(string.Format("{0}_CurrProg_RowNum", ident)); mPathActiveAxes = new Event(string.Format("{0}_ActiveAxes", ident)); - mPathCodG_Act = new Event(string.Format("{0}_CodG_Act", ident)); - mPathSubMode = new Event(string.Format("{0}_SubMode", ident)); + mPathCodG_Act = new MTConnect.Message(string.Format("{0}_CodG_Act", ident)); + mPathSubMode = new MTConnect.Message(string.Format("{0}_SubMode", ident)); mPathAlarmCNC = new Condition(string.Format("{0}_AlarmCNC", ident)); mPathAlarmPLC = new Condition(string.Format("{0}_AlarmPLC", ident)); } @@ -355,7 +355,7 @@ namespace MTC_Adapter /// 2 : "Stroke [n]" /// 3 : "Distance [m]" ([ft] se la macchina è impostata in pollici) /// - public Event mUnOpVitaResType; + public MTConnect.Message mUnOpVitaResType; /// /// valore speed /// @@ -393,7 +393,7 @@ namespace MTC_Adapter mUnOpSpeedOverr = new Sample(string.Format("{0}_SpeedOverr", ident)); mUnOpLoad = new Sample(string.Format("{0}_Load", ident)); mUnOpAccTime = new Sample(string.Format("{0}_AccTime", ident)); - mUnOpVitaResType = new Event(string.Format("{0}_VitaResType", ident)); + mUnOpVitaResType = new MTConnect.Message(string.Format("{0}_VitaResType", ident)); mUnOpKRev = new Sample(string.Format("{0}_KRev", ident)); } } @@ -405,11 +405,11 @@ namespace MTC_Adapter /// /// Processo di appartenenza /// - public Event mAxMainProc; + public MTConnect.Message mAxMainProc; /// /// Bit se sia master (=1) o slave (=0) /// - public Event mAxIsMaster; + public MTConnect.Message mAxIsMaster; /// /// ID del master /// @@ -506,8 +506,8 @@ namespace MTC_Adapter } // valori standard - mAxMainProc = new Event(string.Format("{0}_MainProc", ident)); - mAxIsMaster = new Event(string.Format("{0}_IsMast", ident)); + mAxMainProc = new MTConnect.Message(string.Format("{0}_MainProc", ident)); + mAxIsMaster = new MTConnect.Message(string.Format("{0}_IsMast", ident)); mAxMastId = new Event(string.Format("{0}_MastId", ident)); mAxDir = new Event(string.Format("{0}_Dir", ident)); mAxLoad = new Sample(string.Format("{0}_Load", ident)); @@ -902,26 +902,6 @@ namespace MTC_Adapter /// Stato protezioni (0/1, off/on) /// public Event mProtectionStatus = new Event("PROTECTION_STATUS"); - /// - /// modalità funzionale - /// - public Event mFunctionalMode = new Event("FUNCT_MODE"); - /// - /// Azioni operatore (Start/Stop/reset) - /// - public Event mUserAction = new Event("USER_ACTION"); - /// - /// Testing macchina - /// - public Event mTestingData = new Event("TESTING_DATA"); - /// - /// Strobe rilevati ma non qualificati - /// - public Event mUnkStrobe = new Event("UNK_STROBE"); - /// - /// Status rilevati ma non qualificati - /// - public Event mUnkStatus = new Event("UNK_STATUS"); #endregion @@ -935,6 +915,26 @@ namespace MTC_Adapter #region Messages + /// + /// modalità funzionale + /// + public MTConnect.Message mFunctionalMode = new MTConnect.Message("FUNCT_MODE"); + /// + /// Azioni operatore (Start/Stop/reset) + /// + public MTConnect.Message mUserAction = new MTConnect.Message("USER_ACTION"); + /// + /// Testing macchina + /// + public MTConnect.Message mTestingData = new MTConnect.Message("TESTING_DATA"); + /// + /// Strobe rilevati ma non qualificati + /// + public MTConnect.Message mUnkStrobe = new MTConnect.Message("UNK_STROBE"); + /// + /// Status rilevati ma non qualificati + /// + public MTConnect.Message mUnkStatus = new MTConnect.Message("UNK_STATUS"); /// /// Messaggi generali /// @@ -984,7 +984,6 @@ namespace MTC_Adapter mAdapter.AddDataItem(mAvail); mAvail.Value = "AVAILABLE"; mMessage.Value = ""; - mMessage.Code = ""; // assets mAdapter.AddDataItem(mAssetChg); @@ -1731,14 +1730,27 @@ namespace MTC_Adapter if (codiceM != "") { vettPath[i].mPathCodM.Value = string.Format("[M{0}]", codiceM); +#if false + mMessage.Code = string.Format("[M{0}]", codiceM); + mMessage.Value = string.Format("[M{0}]", codiceM); +#endif } if (codiceS != "") { vettPath[i].mPathCodS.Value = string.Format("[S{0}]", codiceS); +#if false + mMessage.Code = string.Format("[S{0}]", codiceS); + mMessage.Value = string.Format("[S{0}]", codiceS); + +#endif } if (codiceT != "") { vettPath[i].mPathCodT.Value = string.Format("[T{0}]", codiceT); +#if false + mMessage.Code = string.Format("[T{0}]", codiceT); + mMessage.Value = string.Format("[T{0}]", codiceT); +#endif } } }