update con gestione degli RTCounters (contatori liberi) DA PROVARE!!!

This commit is contained in:
Samuele E. Locatelli
2018-10-01 18:33:36 +02:00
parent 99b137a8ad
commit 80de7b7b7d
4 changed files with 88 additions and 5 deletions
Vendored
+1 -1
View File
@@ -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'
+79 -3
View File
@@ -912,9 +912,13 @@ namespace SCMA
public uint[] currNumCambiUt;
/// <summary>
/// Vettore ATTUALE dei contatori GENERICI
/// Vettore ATTUALE dei contatori GENERICI MONOTORI CRESCENTI
/// </summary>
public uint[] currCounters;
/// <summary>
/// Vettore ATTUALE dei contatori GENERICI LIBERI
/// </summary>
public uint[] currRTCounters;
/// <summary>
/// Vettore ATTUALE dei contatori del numero movimenti Slitta Magazzino
@@ -1002,9 +1006,13 @@ namespace SCMA
public sampleVect[] istNumCambiUt;
/// <summary>
/// Vettore ISTANTANEO dei contatori generici
/// Vettore ISTANTANEO dei contatori generici MONOTONI CRESCENTI
/// </summary>
public sampleVect[] istCounters;
/// <summary>
/// Vettore ISTANTANEO dei contatori generici LIBERI
/// </summary>
public sampleVect[] istRTCounters;
/// <summary>
/// Vettore ISTANTANEO dei contatori del numero movimenti Slitta Magazzino
@@ -1229,10 +1237,15 @@ namespace SCMA
#region Gestione contatori & obj specifici (Events & Samples)
/// <summary>
/// Vettore conters (EVENT)
/// Vettore conters monotoni crescenti - EVENT
/// </summary>
public List<string> elCounter;
/// <summary>
/// Vettore conters realtime (liberi) - EVENT
/// </summary>
public List<string> elRTCounter;
/// <summary>
/// Vettore status (EVENT)
/// </summary>
@@ -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<string>();
elRTCounter = new List<string>();
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;
+8 -1
View File
@@ -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
BIN
View File
Binary file not shown.