diff --git a/IOB-WIN-NEXT/Iob/Fanuc.cs b/IOB-WIN-NEXT/Iob/Fanuc.cs
index faa5715e..3f615473 100644
--- a/IOB-WIN-NEXT/Iob/Fanuc.cs
+++ b/IOB-WIN-NEXT/Iob/Fanuc.cs
@@ -280,7 +280,7 @@ namespace IOB_WIN_NEXT.Iob
}
else
{
- lgError($"Error | memAddr: {memAddr} | rVal: {rVal} | newVal: {newVal}");
+ lgError($"Error | memName: {memAddr} | rVal: {rVal} | newVal: {newVal}");
}
}
else
@@ -332,7 +332,7 @@ namespace IOB_WIN_NEXT.Iob
}
else
{
- lgError($"Error | memAddr: {memAddr} | rVal: {rVal} | newVal: {newVal}");
+ lgError($"Error | memName: {memAddr} | rVal: {rVal} | newVal: {newVal}");
}
}
else
@@ -516,7 +516,7 @@ namespace IOB_WIN_NEXT.Iob
{
string actf = answ.actf.ToString();
string acts = answ.acts.ToString();
- //string numAlarm = memAddr.alarm.ToString();
+ //string numAlarm = memName.alarm.ToString();
// preparo i singoli valori dell'array...
//outVal.Add("DYNDATA", string.Format("{0}#{1}#{2}", actf, acts, numAlarm));
outVal.Add("DYNDATA", string.Format("FEED {0}#SPEED_RPM {1}", actf, acts));
@@ -618,7 +618,7 @@ namespace IOB_WIN_NEXT.Iob
string series = new string(answ.series);
string version = new string(answ.version);
string axes = new string(answ.axes);
- //short addInfo = memAddr.addinfo;
+ //short addInfo = memName.addinfo;
short max_axis = answ.max_axis;
// preparo i singoli valori dell'array...
outVal.Add("SYSINFO", string.Format("{0}#{1}#{2}#{3}#{4}#{5}", cnc_type, mt_type, series, version, axes, max_axis));
@@ -691,7 +691,7 @@ namespace IOB_WIN_NEXT.Iob
// 2022.05.23 gestione MACRO da testare (Jetco)
else if (memAddr.StartsWith("MACRO."))
{
- lgTrace($"Decodifica memoria MACRO | memAddr: {memAddr}");
+ lgTrace($"Decodifica memoria MACRO | memName: {memAddr}");
// recupero parametro...
int.TryParse(memAddr.Replace("MACRO.", ""), out cntAddr);
// processo parametro
@@ -844,32 +844,74 @@ namespace IOB_WIN_NEXT.Iob
// controllo di AVERE parametri opzionali x conteggi vari
if (cIobConf.optPar.Count > 0)
{
+ // gestione con ricerca in memoria Write / optPar...
+ if (string.IsNullOrEmpty(memAddrPzReq))
+ {
+ lgTrace("PzCount disabilitato | NO memConf.Write | NO optPar");
+ }
+ else
+ {
+ sendOptVal(memNamePzReq, contapezziPLC);
+ }
+ if (string.IsNullOrEmpty(memAddrArt))
+ {
+ lgTrace("Articolo disabilitato | NO memConf.Write | NO optPar");
+ }
+ else
+ {
+ sendOptVal(memNameArt, getValByMemAddr(memAddrArt));
+ }
+ if (string.IsNullOrEmpty(memAddrCom))
+ {
+ lgTrace("Commessa disabilitata | NO memConf.Write | NO optPar");
+ }
+ else
+ {
+ sendOptVal(memNameCom, getValByMemAddr(memAddrCom));
+ }
+ if (string.IsNullOrEmpty(memAddrPzCnt))
+ {
+ lgTrace("PzCount disabilitato | NO memConf.Write | NO optPar");
+ }
+ else
+ {
+ sendOptVal(memNamePzCnt, getValByMemAddr(memAddrPzCnt));
+ }
+ if (string.IsNullOrEmpty(memAddrPzCntTot))
+ {
+ lgTrace("PzCntTOT disabilitato | NO memConf.Write | NO optPar");
+ }
+ else
+ {
+ sendOptVal(memNamePzCntTot, getValByMemAddr(memAddrPzCntTot));
+ }
+ if (string.IsNullOrEmpty(memAddrCaden))
+ {
+ lgTrace("Cadenza disabilitata | NO memConf.Write | NO optPar");
+ }
+ else
+ {
+ sendOptVal(memNameCaden, getValByMemAddr(memAddrCaden));
+ }
+#if false
+
string newVal = "";
- // rifare con gestione nuova memoria da Write/optPar...
-
-
// controllo SE salvare contapezzo
if (!string.IsNullOrEmpty(getOptPar("PZCOUNT_MODE")))
{
sendOptVal("PZ_COUNT", contapezziPLC);
}
- // controllo SE devo gestire contatore pezzi REQUESTED (lanciati)
- if (!string.IsNullOrEmpty(getOptPar("PZREQ_MODE")))
- {
- newVal = getValByParam("PZREQ_MODE");
- sendOptVal("PZ_REQ", newVal);
- }
// controllo SE devo gestire contatore PEZZI TOTALI
if (!string.IsNullOrEmpty(getOptPar("PZGTOT_MODE")))
{
newVal = getValByParam("PZGTOT_MODE");
sendOptVal("PZ_GTOT", newVal);
}
- // controllo SE devo gestire contatore CADENZA (secondi ciclo rilevati)
- if (!string.IsNullOrEmpty(getOptPar("PZCAD_MODE")))
+ // controllo SE devo gestire contatore pezzi REQUESTED (lanciati)
+ if (!string.IsNullOrEmpty(getOptPar("PZREQ_MODE")))
{
- newVal = getValByParam("PZCAD_MODE");
- sendOptVal("CICLE_CAD", newVal);
+ newVal = getValByParam("PZREQ_MODE");
+ sendOptVal("PZ_REQ", newVal);
}
// controllo se sia gestito NumArt
if (!string.IsNullOrEmpty(getOptPar("SET_NUM_ART")))
@@ -883,6 +925,13 @@ namespace IOB_WIN_NEXT.Iob
newVal = getValByParam("SET_NUM_COM");
sendOptVal("SET_NUM_COM", newVal);
}
+ // controllo SE devo gestire contatore CADENZA (secondi ciclo rilevati)
+ if (!string.IsNullOrEmpty(getOptPar("PZCAD_MODE")))
+ {
+ newVal = getValByParam("PZCAD_MODE");
+ sendOptVal("CICLE_CAD", newVal);
+ }
+#endif
}
}
catch (Exception exc)
@@ -1135,97 +1184,6 @@ namespace IOB_WIN_NEXT.Iob
}
}
- private string memAddrArt
- {
- get
- {
- string memAddr = "";
- if (memMap != null && memMap.mMapWrite != null)
- {
- //cerco in primis modalità NUM altrimenti standard...
- if (memMap.mMapWrite.ContainsKey("setArtNum"))
- {
- memAddr = memMap.mMapWrite["setArtNum"].memAddr;
- }
- // se vuoto provo altra alternativa...
- if (string.IsNullOrEmpty(memAddr) && memMap.mMapWrite.ContainsKey("setArt"))
- {
- memAddr = memMap.mMapWrite["setArt"].memAddr;
- }
- }
- // se non trovato... leggo da OPT_PAR
- if (string.IsNullOrEmpty(memAddr))
- {
- memAddr = getOptPar("SET_NUM_ART");
- }
- // bonifica variabile da definizione STD iniziale...
- if (memAddr.StartsWith("STD"))
- {
- memAddr = memAddr.Replace("STD.", "");
- }
- return memAddr;
- }
- }
-
- private string memAddrCom
- {
- get
- {
- string memAddr = "";
- if (memMap != null && memMap.mMapWrite != null)
- {
- //cerco in primis modalità NUM altrimenti standard...
- if (memMap.mMapWrite.ContainsKey("setCommNum"))
- {
- memAddr = memMap.mMapWrite["setCommNum"].memAddr;
- }
- // se vuoto provo altra alternativa...
- if (string.IsNullOrEmpty(memAddr) && memMap.mMapWrite.ContainsKey("setComm"))
- {
- memAddr = memMap.mMapWrite["setComm"].memAddr;
- }
- }
- // se non trovato... leggo da OPT_PAR
- if (string.IsNullOrEmpty(memAddr))
- {
- memAddr = getOptPar("SET_NUM_COM");
- }
- // bonifica variabile da definizione STD iniziale...
- if (memAddr.StartsWith("STD"))
- {
- memAddr = memAddr.Replace("STD.", "");
- }
- return memAddr;
- }
- }
-
- private string memAddrPzReq
- {
- get
- {
- string memAddr = "";
- if (memMap != null && memMap.mMapWrite != null)
- {
- //cerco in primis modalità NUM altrimenti standard...
- if (memMap.mMapWrite.ContainsKey("setPzComm"))
- {
- memAddr = memMap.mMapWrite["setPzComm"].memAddr;
- }
- }
- // se non trovato... leggo da OPT_PAR
- if (string.IsNullOrEmpty(memAddr))
- {
- memAddr = getOptPar("PZREQ_MODE");
- }
- // bonifica variabile da definizione STD iniziale...
- if (memAddr.StartsWith("STD"))
- {
- memAddr = memAddr.Replace("STD.", "");
- }
- return memAddr;
- }
- }
-
///
/// Effettua impostazione del valore numerico ARTICOLO (specifico FANUC)
///
@@ -1234,7 +1192,7 @@ namespace IOB_WIN_NEXT.Iob
{
bool answ = false;
string memAddr = memAddrArt;
- lgTrace($"INIT setNumArt | memAddr: {memAddr}");
+ lgTrace($"INIT setNumArt | memName: {memAddr}");
if (cIobConf.optPar.Count > 0 && !string.IsNullOrEmpty(memAddr))
{
// scrivo valore richiesto in area configurata
@@ -1251,12 +1209,12 @@ namespace IOB_WIN_NEXT.Iob
{
cntAddr = 9999;
}
- lgTrace($"MACRO | ART Write 01 | memAddr: {memAddr} | idx: {cntAddr}");
+ lgTrace($"MACRO | ART Write 01 | memName: {memAddr} | idx: {cntAddr}");
// processo SET contapezzi (lavorati)
stopwatch.Restart();
Int16 valInt16 = (Int16)valReq;
answ = FANUC_ref.F_RW_Macro_Short(true, cntAddr, ref valInt16);
- lgTrace($"MACRO | ART Write 02 | memAddr: {memAddr} | valReq: {valReq} | valInt16: {valInt16}");
+ lgTrace($"MACRO | ART Write 02 | memName: {memAddr} | valReq: {valReq} | valInt16: {valInt16}");
if (utils.CRB("recTime"))
{
TimingData.addResult(cIobConf.codIOB, "MACRO-SHORT", stopwatch.ElapsedTicks);
@@ -1282,10 +1240,10 @@ namespace IOB_WIN_NEXT.Iob
bool answ = false;
// verifico quale modalità sia richiesta
string memAddr = memAddrCom;
- lgTrace($"INIT setNumCom | memAddr: {memAddr}");
+ lgTrace($"INIT setNumCom | memName: {memAddr}");
if (cIobConf.optPar.Count > 0 && !string.IsNullOrEmpty(memAddr))
{
- lgTrace($"setNumCom | memAddr: {memAddr} | valReq: {valReq}");
+ lgTrace($"setNumCom | memName: {memAddr} | valReq: {valReq}");
// scrivo valore richiesto in area configurata
try
{
@@ -1300,12 +1258,12 @@ namespace IOB_WIN_NEXT.Iob
{
cntAddr = 9999;
}
- lgTrace($"MACRO | Com Write 01 | memAddr: {memAddr} | idx: {cntAddr}");
+ lgTrace($"MACRO | Com Write 01 | memName: {memAddr} | idx: {cntAddr}");
// processo SET contapezzi (lavorati)
stopwatch.Restart();
Int16 valInt16 = (Int16)valReq;
FANUC_ref.F_RW_Macro_Short(true, cntAddr, ref valInt16);
- lgTrace($"MACRO | Com Write 02 | memAddr: {memAddr} | valReq: {valReq} | valInt16: {valInt16}");
+ lgTrace($"MACRO | Com Write 02 | memName: {memAddr} | valReq: {valReq} | valInt16: {valInt16}");
if (utils.CRB("recTime"))
{
TimingData.addResult(cIobConf.codIOB, "MACRO-SHORT", stopwatch.ElapsedTicks);
@@ -1337,10 +1295,10 @@ namespace IOB_WIN_NEXT.Iob
try
{
#if false
- string memAddr = getOptPar("PZREQ_MODE");
+ string memAddr = getOptPar("PZREQ_MODE");
#endif
string memAddr = memAddrPzReq;
- lgTrace($"INIT setPzComm | memAddr: {memAddr}");
+ lgTrace($"INIT setPzComm | memName: {memAddr}");
// contapezzi ATTUALE
if (!string.IsNullOrEmpty(memAddr))
{
@@ -1381,12 +1339,12 @@ namespace IOB_WIN_NEXT.Iob
{
cntAddr = 9999;
}
- lgTrace($"MACRO | Pz Write 01 | memAddr: {memAddr} | idx: {cntAddr}");
+ lgTrace($"MACRO | Pz Write 01 | memName: {memAddr} | idx: {cntAddr}");
// processo SET contapezzi (lavorati)
stopwatch.Restart();
Int16 valInt16 = (Int16)pzReq;
FANUC_ref.F_RW_Macro_Short(true, cntAddr, ref valInt16);
- lgTrace($"MACRO | Com Write 02 | memAddr: {memAddr} | pzReq: {pzReq} | valInt16: {valInt16}");
+ lgTrace($"MACRO | Com Write 02 | memName: {memAddr} | pzReq: {pzReq} | valInt16: {valInt16}");
if (utils.CRB("recTime"))
{
TimingData.addResult(cIobConf.codIOB, "MACRO-SHORT", stopwatch.ElapsedTicks);
@@ -1688,6 +1646,322 @@ namespace IOB_WIN_NEXT.Iob
#endregion Protected Methods
+ #region Private Properties
+
+ private string memAddrArt
+ {
+ get
+ {
+ string memAddr = "";
+ if (memMap != null && memMap.mMapWrite != null)
+ {
+ //cerco in primis modalità NUM altrimenti standard...
+ if (memMap.mMapWrite.ContainsKey("setArtNum"))
+ {
+ memAddr = memMap.mMapWrite["setArtNum"].memAddr;
+ }
+ // se vuoto provo altra alternativa...
+ if (string.IsNullOrEmpty(memAddr) && memMap.mMapWrite.ContainsKey("setArt"))
+ {
+ memAddr = memMap.mMapWrite["setArt"].memAddr;
+ }
+ }
+ // se non trovato... leggo da OPT_PAR
+ if (string.IsNullOrEmpty(memAddr))
+ {
+ memAddr = getOptPar("SET_NUM_ART");
+ }
+ // bonifica variabile da definizione STD iniziale...
+ if (memAddr.StartsWith("STD"))
+ {
+ memAddr = memAddr.Replace("STD.", "");
+ }
+ return memAddr;
+ }
+ }
+
+ private string memAddrCom
+ {
+ get
+ {
+ string memAddr = "";
+ if (memMap != null && memMap.mMapWrite != null)
+ {
+ //cerco in primis modalità NUM altrimenti standard...
+ if (memMap.mMapWrite.ContainsKey("setCommNum"))
+ {
+ memAddr = memMap.mMapWrite["setCommNum"].memAddr;
+ }
+ // se vuoto provo altra alternativa...
+ if (string.IsNullOrEmpty(memAddr) && memMap.mMapWrite.ContainsKey("setComm"))
+ {
+ memAddr = memMap.mMapWrite["setComm"].memAddr;
+ }
+ }
+ // se non trovato... leggo da OPT_PAR
+ if (string.IsNullOrEmpty(memAddr))
+ {
+ memAddr = getOptPar("SET_NUM_COM");
+ }
+ // bonifica variabile da definizione STD iniziale...
+ if (memAddr.StartsWith("STD"))
+ {
+ memAddr = memAddr.Replace("STD.", "");
+ }
+ return memAddr;
+ }
+ }
+
+ private string memAddrPzReq
+ {
+ get
+ {
+ string memAddr = "";
+ if (memMap != null && memMap.mMapWrite != null)
+ {
+ //cerco in primis modalità NUM altrimenti standard...
+ if (memMap.mMapWrite.ContainsKey("setPzComm"))
+ {
+ memAddr = memMap.mMapWrite["setPzComm"].memAddr;
+ }
+ }
+ // se non trovato... leggo da OPT_PAR
+ if (string.IsNullOrEmpty(memAddr))
+ {
+ memAddr = getOptPar("PZREQ_MODE");
+ }
+ // bonifica variabile da definizione STD iniziale...
+ if (memAddr.StartsWith("STD"))
+ {
+ memAddr = memAddr.Replace("STD.", "");
+ }
+ return memAddr;
+ }
+ }
+ private string memAddrPzCnt
+ {
+ get
+ {
+ string memAddr = "";
+ if (memMap != null && memMap.mMapWrite != null)
+ {
+ //cerco in primis modalità NUM altrimenti standard...
+ if (memMap.mMapWrite.ContainsKey("ContatoreParziale"))
+ {
+ memAddr = memMap.mMapWrite["ContatoreParziale"].memAddr;
+ }
+ }
+ // se non trovato... leggo da OPT_PAR
+ if (string.IsNullOrEmpty(memAddr))
+ {
+ memAddr = getOptPar("PZCOUNT_MODE");
+ }
+ // bonifica variabile da definizione STD iniziale...
+ if (memAddr.StartsWith("STD"))
+ {
+ memAddr = memAddr.Replace("STD.", "");
+ }
+ return memAddr;
+ }
+ }
+ private string memAddrPzCntTot
+ {
+ get
+ {
+ string memAddr = "";
+ if (memMap != null && memMap.mMapWrite != null)
+ {
+ //cerco in primis modalità NUM altrimenti standard...
+ if (memMap.mMapWrite.ContainsKey("ContatoreAssoluto"))
+ {
+ memAddr = memMap.mMapWrite["ContatoreAssoluto"].memAddr;
+ }
+ }
+ // se non trovato... leggo da OPT_PAR
+ if (string.IsNullOrEmpty(memAddr))
+ {
+ memAddr = getOptPar("PZGTOT_MODE");
+ }
+ // bonifica variabile da definizione STD iniziale...
+ if (memAddr.StartsWith("STD"))
+ {
+ memAddr = memAddr.Replace("STD.", "");
+ }
+ return memAddr;
+ }
+ }
+
+ private string memAddrCaden
+ {
+ get
+ {
+ string memAddr = "";
+ if (memMap != null && memMap.mMapWrite != null)
+ {
+ //cerco in primis modalità NUM altrimenti standard...
+ if (memMap.mMapWrite.ContainsKey("Cadenza"))
+ {
+ memAddr = memMap.mMapWrite["Cadenza"].memAddr;
+ }
+ }
+ // se non trovato... leggo da OPT_PAR
+ if (string.IsNullOrEmpty(memAddr))
+ {
+ memAddr = getOptPar("PZCAD_MODE");
+ }
+ // bonifica variabile da definizione STD iniziale...
+ if (memAddr.StartsWith("STD"))
+ {
+ memAddr = memAddr.Replace("STD.", "");
+ }
+ return memAddr;
+ }
+ }
+
+ private string memNameArt
+ {
+ get
+ {
+ string memName = "";
+ if (memMap != null && memMap.mMapWrite != null)
+ {
+ //cerco in primis modalità NUM altrimenti standard...
+ if (memMap.mMapWrite.ContainsKey("setArtNum"))
+ {
+ memName = "setArtNum";
+ }
+ // se vuoto provo altra alternativa...
+ if (string.IsNullOrEmpty(memName) && memMap.mMapWrite.ContainsKey("setArt"))
+ {
+ memName = "setArt";
+ }
+ }
+ // se non trovato... leggo da OPT_PAR
+ if (string.IsNullOrEmpty(memName))
+ {
+ memName = "PZ_COUNT";
+ }
+ return memName;
+ }
+ }
+
+ private string memNameCom
+ {
+ get
+ {
+ string memName = "";
+ if (memMap != null && memMap.mMapWrite != null)
+ {
+ //cerco in primis modalità NUM altrimenti standard...
+ if (memMap.mMapWrite.ContainsKey("setCommNum"))
+ {
+ memName = "setCommNum";
+ }
+ // se vuoto provo altra alternativa...
+ if (string.IsNullOrEmpty(memName) && memMap.mMapWrite.ContainsKey("setComm"))
+ {
+ memName = "setComm";
+ }
+ }
+ // se non trovato... leggo da OPT_PAR
+ if (string.IsNullOrEmpty(memName))
+ {
+ memName = "SET_NUM_COM";
+ }
+ return memName;
+ }
+ }
+
+ private string memNamePzReq
+ {
+ get
+ {
+ string memName = "";
+ if (memMap != null && memMap.mMapWrite != null)
+ {
+ //cerco in primis modalità NUM altrimenti standard...
+ if (memMap.mMapWrite.ContainsKey("setPzComm"))
+ {
+ memName = "setPzComm";
+ }
+ }
+ // se non trovato... leggo da OPT_PAR
+ if (string.IsNullOrEmpty(memName))
+ {
+ memName = "PZ_REQ";
+ }
+ return memName;
+ }
+ }
+
+ private string memNamePzCnt
+ {
+ get
+ {
+ string memName = "";
+ if (memMap != null && memMap.mMapWrite != null)
+ {
+ //cerco in primis modalità NUM altrimenti standard...
+ if (memMap.mMapWrite.ContainsKey("ContatoreParziale"))
+ {
+ memName = "ContatoreParziale";
+ }
+ }
+ // se non trovato... leggo da OPT_PAR
+ if (string.IsNullOrEmpty(memName))
+ {
+ memName = "PZCOUNT_MODE";
+ }
+ return memName;
+ }
+ }
+
+ private string memNamePzCntTot
+ {
+ get
+ {
+ string memName = "";
+ if (memMap != null && memMap.mMapWrite != null)
+ {
+ //cerco in primis modalità NUM altrimenti standard...
+ if (memMap.mMapWrite.ContainsKey("ContatoreAssoluto"))
+ {
+ memName = "ContatoreAssoluto";
+ }
+ }
+ // se non trovato... leggo da OPT_PAR
+ if (string.IsNullOrEmpty(memName))
+ {
+ memName = "PZGTOT_MODE";
+ }
+ return memName;
+ }
+ }
+
+ private string memNameCaden
+ {
+ get
+ {
+ string memName = "";
+ if (memMap != null && memMap.mMapWrite != null)
+ {
+ //cerco in primis modalità NUM altrimenti standard...
+ if (memMap.mMapWrite.ContainsKey("Cadenza"))
+ {
+ memName = "Cadenza";
+ }
+ }
+ // se non trovato... leggo da OPT_PAR
+ if (string.IsNullOrEmpty(memName))
+ {
+ memName = "CICLE_CAD";
+ }
+ return memName;
+ }
+ }
+
+ #endregion Private Properties
+
#region Private Methods
///
@@ -2048,6 +2322,118 @@ namespace IOB_WIN_NEXT.Iob
utils.WritePlain(mappaValori, nomeFile);
}
+ ///
+ /// Recupera il valore INT dal nome del parametro per successivo processing
+ ///
+ ///
+ ///
+ private string getValByMemAddr(string memAddr)
+ {
+ string answ = "";
+ // verifico quale modalità sia richiesta: STD (6711) oppure BIT (Custom, con indicazione area)
+ if (memAddr.StartsWith("STD"))
+ {
+ // inizio verifica area memoria/parametro levando prima parte codice
+ memAddr = memAddr.Replace("STD.", "");
+ // var di appoggio
+ int cntAddr = 0;
+ object outputVal = new object();
+ // verifico se si tratta di lettura parametro... formato tipo STD.PAR.6711
+ if (memAddr.StartsWith("PAR."))
+ {
+ // recupero parametro...
+ int.TryParse(memAddr.Replace("PAR.", ""), out cntAddr);
+ // processo parametro
+ stopwatch.Restart();
+ FANUC_ref.F_RW_Param_Integer(false, cntAddr, 3, ref outputVal);
+ if (utils.CRB("recTime"))
+ {
+ TimingData.addResult(cIobConf.codIOB, string.Format("R{0}-PAR", 4), stopwatch.ElapsedTicks);
+ }
+ // salvo valore
+ answ = outputVal.ToString();
+ }
+ // 2022.05.23 gestione MACRO da testare (Jetco)
+ else if (memAddr.StartsWith("MACRO."))
+ {
+ double macroVal = 0;
+ // recupero parametro...
+ int.TryParse(memAddr.Replace("MACRO.", ""), out cntAddr);
+ lgTrace($"MACRO | Read 01 | memName: {memAddr} | idx: {cntAddr} | macroVal: {macroVal}");
+ // processo parametro
+ stopwatch.Restart();
+ FANUC_ref.F_Read_macro(cntAddr, ref macroVal);
+ if (utils.CRB("recTime"))
+ {
+ TimingData.addResult(cIobConf.codIOB, "R-MACRO", stopwatch.ElapsedTicks);
+ }
+ // salvo valore
+ answ = macroVal.ToString();
+ lgTrace($"MACRO | Read 02 | memName: {memAddr} | idx: {cntAddr} | macroVal: {macroVal}");
+ }
+ // altrimenti se legge da area memoria specifica leggo da li... formto tipo STD.D.1604.DW
+ else
+ {
+ memAddressFanuc areaCounter = new memAddressFanuc(memAddr);
+
+ if (isVerboseLog)
+ {
+ lgInfo("getValByParam [0] area memoria: {0}.{1}.{2}", areaCounter.mType, areaCounter.mPos, areaCounter.vType);
+ }
+
+ // leggo!
+ stopwatch.Restart();
+ // switch x tipo dati --> tipo lettura... e salvo ultimo conteggio rilevato
+ switch (areaCounter.vType)
+ {
+ case "B":
+ byte valB = 0;
+ FANUC_ref.F_RW_Byte(false, areaCounter.mType, areaCounter.mPos, ref valB);
+ outputVal = valB;
+ break;
+
+ case "D":
+ ushort valW = 0;
+ FANUC_ref.F_RW_Word(false, areaCounter.mType, areaCounter.mPos, ref valW);
+ outputVal = valW;
+ break;
+
+ case "DW":
+ uint valDW = 0;
+ FANUC_ref.F_RW_DWord(false, areaCounter.mType, areaCounter.mPos, ref valDW);
+ if (isVerboseLog)
+ {
+ lgInfo("[1] valDW PAR: {0}", valDW);
+ }
+
+ outputVal = valDW;
+ if (isVerboseLog)
+ {
+ lgInfo("[2] outputVal PAR: {0}", outputVal);
+ }
+
+ break;
+
+ default:
+ break;
+ }
+ if (utils.CRB("recTime"))
+ {
+ TimingData.addResult(cIobConf.codIOB, string.Format("R-{0}.{1}.{2}", areaCounter.mType, areaCounter.mPos, areaCounter.vType), stopwatch.ElapsedTicks);
+ }
+
+ // salvo...
+ answ = outputVal.ToString();
+ if (isVerboseLog)
+ {
+ lgInfo($"[3] Mem letta: {memAddr} | {answ}");
+ }
+ }
+ stopwatch.Stop();
+ }
+ return answ;
+ }
+
///
/// Recupera il valore INT dal nome del parametro per successivo processing
///
@@ -2157,7 +2543,7 @@ namespace IOB_WIN_NEXT.Iob
}
}
stopwatch.Stop();
- }
+ }
#endif
string memAddr = getOptPar(varName);
string answ = getValByMemAddr(memAddr);
@@ -2167,117 +2553,6 @@ namespace IOB_WIN_NEXT.Iob
}
return answ;
}
- ///
- /// Recupera il valore INT dal nome del parametro per successivo processing
- ///
- ///
- ///
- private string getValByMemAddr(string memAddr)
- {
- string answ = "";
- // verifico quale modalità sia richiesta: STD (6711) oppure BIT (Custom, con indicazione area)
- if (memAddr.StartsWith("STD"))
- {
- // inizio verifica area memoria/parametro levando prima parte codice
- memAddr = memAddr.Replace("STD.", "");
- // var di appoggio
- int cntAddr = 0;
- object outputVal = new object();
- // verifico se si tratta di lettura parametro... formato tipo STD.PAR.6711
- if (memAddr.StartsWith("PAR."))
- {
- // recupero parametro...
- int.TryParse(memAddr.Replace("PAR.", ""), out cntAddr);
- // processo parametro
- stopwatch.Restart();
- FANUC_ref.F_RW_Param_Integer(false, cntAddr, 3, ref outputVal);
- if (utils.CRB("recTime"))
- {
- TimingData.addResult(cIobConf.codIOB, string.Format("R{0}-PAR", 4), stopwatch.ElapsedTicks);
- }
- // salvo valore
- answ = outputVal.ToString();
- }
- // 2022.05.23 gestione MACRO da testare (Jetco)
- else if (memAddr.StartsWith("MACRO."))
- {
- double macroVal = 0;
- // recupero parametro...
- int.TryParse(memAddr.Replace("MACRO.", ""), out cntAddr);
- lgTrace($"MACRO | Read 01 | memAddr: {memAddr} | idx: {cntAddr} | macroVal: {macroVal}");
- // processo parametro
- stopwatch.Restart();
- FANUC_ref.F_Read_macro(cntAddr, ref macroVal);
- if (utils.CRB("recTime"))
- {
- TimingData.addResult(cIobConf.codIOB, "R-MACRO", stopwatch.ElapsedTicks);
- }
- // salvo valore
- answ = macroVal.ToString();
- lgTrace($"MACRO | Read 02 | memAddr: {memAddr} | idx: {cntAddr} | macroVal: {macroVal}");
- }
- // altrimenti se legge da area memoria specifica leggo da li... formto tipo STD.D.1604.DW
- else
- {
- memAddressFanuc areaCounter = new memAddressFanuc(memAddr);
-
- if (isVerboseLog)
- {
- lgInfo("getValByParam [0] area memoria: {0}.{1}.{2}", areaCounter.mType, areaCounter.mPos, areaCounter.vType);
- }
-
- // leggo!
- stopwatch.Restart();
- // switch x tipo dati --> tipo lettura... e salvo ultimo conteggio rilevato
- switch (areaCounter.vType)
- {
- case "B":
- byte valB = 0;
- FANUC_ref.F_RW_Byte(false, areaCounter.mType, areaCounter.mPos, ref valB);
- outputVal = valB;
- break;
-
- case "D":
- ushort valW = 0;
- FANUC_ref.F_RW_Word(false, areaCounter.mType, areaCounter.mPos, ref valW);
- outputVal = valW;
- break;
-
- case "DW":
- uint valDW = 0;
- FANUC_ref.F_RW_DWord(false, areaCounter.mType, areaCounter.mPos, ref valDW);
- if (isVerboseLog)
- {
- lgInfo("[1] valDW PAR: {0}", valDW);
- }
-
- outputVal = valDW;
- if (isVerboseLog)
- {
- lgInfo("[2] outputVal PAR: {0}", outputVal);
- }
-
- break;
-
- default:
- break;
- }
- if (utils.CRB("recTime"))
- {
- TimingData.addResult(cIobConf.codIOB, string.Format("R-{0}.{1}.{2}", areaCounter.mType, areaCounter.mPos, areaCounter.vType), stopwatch.ElapsedTicks);
- }
-
- // salvo...
- answ = outputVal.ToString();
- if (isVerboseLog)
- {
- lgInfo($"[3] Mem letta: {memAddr} | {answ}");
- }
- }
- stopwatch.Stop();
- }
- return answ;
- }
#endregion Private Methods
}