diff --git a/Jenkinsfile b/Jenkinsfile index 7c13bfb..79a355c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,7 +15,7 @@ pipeline { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=323']) { + withEnv(['NEXT_BUILD_NUMBER=324']) { // env.versionNumber = VersionNumber(versionNumberString : '2.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '2.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'SCMA' diff --git a/MTC_Adapter/SCMA/AdapterGeneric.cs b/MTC_Adapter/SCMA/AdapterGeneric.cs index 42a0cad..f168614 100644 --- a/MTC_Adapter/SCMA/AdapterGeneric.cs +++ b/MTC_Adapter/SCMA/AdapterGeneric.cs @@ -912,9 +912,13 @@ namespace SCMA public uint[] currNumCambiUt; /// - /// Vettore ATTUALE dei contatori GENERICI + /// Vettore ATTUALE dei contatori GENERICI MONOTORI CRESCENTI /// public uint[] currCounters; + /// + /// Vettore ATTUALE dei contatori GENERICI LIBERI + /// + public uint[] currRTCounters; /// /// Vettore ATTUALE dei contatori del numero movimenti Slitta Magazzino @@ -1002,9 +1006,13 @@ namespace SCMA public sampleVect[] istNumCambiUt; /// - /// Vettore ISTANTANEO dei contatori generici + /// Vettore ISTANTANEO dei contatori generici MONOTONI CRESCENTI /// public sampleVect[] istCounters; + /// + /// Vettore ISTANTANEO dei contatori generici LIBERI + /// + public sampleVect[] istRTCounters; /// /// Vettore ISTANTANEO dei contatori del numero movimenti Slitta Magazzino @@ -1229,10 +1237,15 @@ namespace SCMA #region Gestione contatori & obj specifici (Events & Samples) /// - /// Vettore conters (EVENT) + /// Vettore conters monotoni crescenti - EVENT /// public List elCounter; + /// + /// Vettore conters realtime (liberi) - EVENT + /// + public List elRTCounter; + /// /// Vettore status (EVENT) /// @@ -1446,6 +1459,7 @@ namespace SCMA int totRighe = 0; int numCounters = 0; + int numRTCounters = 0; string fileName = string.Format(@"{0}\{1}", utils.confDir, utils.CRS("CounterListFilePath")); string linea; totRighe = File.ReadLines(fileName).Count(); @@ -1466,6 +1480,10 @@ namespace SCMA { numCounters++; } + else if (maintData[numRiga].varName.StartsWith("RTCounter_")) + { + numRTCounters++; + } numRiga++; } } @@ -1480,9 +1498,13 @@ namespace SCMA } elCounter = new List(); + elRTCounter = new List(); currCounters = new uint[numCounters]; + currRTCounters = new uint[numRTCounters]; istCounters = new sampleVect[numCounters]; + istRTCounters = new sampleVect[numRTCounters]; int idx = 0; + int idxRT = 0; foreach (otherData item in maintData) { if (item.varName.StartsWith("Counter_")) @@ -1492,6 +1514,13 @@ namespace SCMA istCounters[idx] = new sampleVect(); idx++; } + else if (item.varName.StartsWith("RTCounter_")) + { + elRTCounter.Add(item.varName); + currGateway.addItemNodeByType(item.varName, itemType.Event); + istRTCounters[idxRT] = new sampleVect(); + idxRT++; + } } if (utils.CRB("verbose")) { @@ -3821,6 +3850,20 @@ namespace SCMA istCounters[numero - 1].addValue(DateTime.Now, Convert.ToInt32(tabDatiMtz[i])); } } + else if (maintData[i].varName.StartsWith("RTCounter_")) + { + try + { + numero = Convert.ToInt32(maintData[i].varName.Replace("RTCounter_", "")); + } + catch + { + } + if (numero > 0 && istRTCounters.Length >= numero) + { + istRTCounters[numero - 1].addValue(DateTime.Now, Convert.ToInt32(tabDatiMtz[i])); + } + } else if (maintData[i].varName.StartsWith("Path_")) { if (maintData[i].varName.EndsWith("_PZ_TOT")) @@ -4614,6 +4657,7 @@ namespace SCMA uint valore = 0; StringBuilder sb = new StringBuilder(); string cKey = ""; + // processo i counter MONOTONI CRESCENTI for (int i = 0; i < elCounter.Count; i++) { // nome counter @@ -4645,6 +4689,38 @@ namespace SCMA } sb.AppendLine(currGateway.getItemNode(cKey).ToString().Replace("|", " | ")); } + // processo i counter ASSOLUTI + for (int i = 0; i < elRTCounter.Count; i++) + { + // nome counter + cKey = string.Format("RTCounter_{0:000}", i + 1); + // procedo solo SE HO FINESTRA VALIDA... + if (istRTCounters[i].vcValid) + { + valore = Convert.ToUInt32(istRTCounters[i].vcMedian); + if (valore >= currRTCounters[i]) + { + delta = valore - currRTCounters[i]; + // controllo delta < 50% max... + if (delta < uint.MaxValue / 2) + { + //processo comunque sempre... + updateValUInt(i, valore, "RTCounter_{0:000}"); + // passo valore totale all'adapter + currGateway.updateItemNodeValue(cKey, valore); + // controllo valore riferimento... + if (delta > 0) + { + // segnalo necessità salvataggio! + needSave = true; + } + } + } + // ...aggiorno valore riferimento... + currRTCounters[i] = valore; + } + sb.AppendLine(currGateway.getItemNode(cKey).ToString().Replace("|", " | ")); + } // salvo su maschera... parentForm.dataMonitor_2 += sb.ToString(); return needSave; diff --git a/README.md b/README.md index a2b1fc9..a17aa79 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,12 @@ Ovvero In questo file sono indicate tutte le variabili di tipo contatore (da far gestire come ritentive all'adapter) che si vogliono rilevare. Il sistema **NON E' TOTALMENTE LIBERO*- (ci sono vincoli di nomenclatura) e vengono restituiti degli EVENTS con un nome identico all'originale -in particolare, nel seguente esempio TUTTE le variabili sono gestite "ad hoc" tranne il generico Counter_xxx che invece è libero +in particolare, nel seguente esempio TUTTE le variabili sono gestite "ad hoc" tranne i generici: + +- Counter_xxx: è libero e rappresenta un contatore MONOTONO CRESCENTE, come un conta-km NON azzerabile (i valori pososno solo aumentare, se si "riporta indietro riprende ad aggiungere a partire dal valore ridotto) +- RTCounter_xxx: è libero e rappresenta un contatore REALTIME intero qualsiasi (permette di apssare anche dati che salgono e scendono, ad es un contapezzi secondario) + +elenco di esempio: 001|ACC_TIME |HOURS 002|ACC_TIME_WORK |HOURS @@ -233,6 +238,8 @@ in particolare, nel seguente esempio TUTTE le variabili sono gestite "ad hoc" tr 032|Counter_001 |COUNT 033|Counter_002 |COUNT 034|Counter_003 |COUNT + 035|RTCounter_001 |COUNT + 036|RTCounter_002 |COUNT Ovvero diff --git a/README.pdf b/README.pdf index 5ccf4c0..8081490 100644 Binary files a/README.pdf and b/README.pdf differ