FIX MTC status RUN..

This commit is contained in:
Samuele E. Locatelli
2019-11-21 18:54:27 +01:00
parent ae62044cbd
commit c9ac71baf6
2 changed files with 122 additions and 37 deletions
+121 -36
View File
@@ -305,6 +305,28 @@ namespace IOB_WIN
string answ = $"{tipo}_{id}";
return answ;
}
/// <summary>
/// Verifica / Salva valore generico (NON SAMPLE)
/// </summary>
/// <param name="newValue"></param>
/// <returns></returns>
protected bool checkSaveItem(MTConnectStreams.DataItem newValue)
{
bool answ = false;
if (newValue != null)
{
// verifico in memoria se ho l'oggetto condition ed il suo valore..
if (dataItemMem.ContainsKey(newValue.DataItemId))
{
// salvo sempre!
dataItemMem[newValue.DataItemId].value = newValue.CDATA;
dataItemMem[newValue.DataItemId].valueTimestamp = newValue.Timestamp;
answ = true;
}
}
return answ;
}
/// <summary>
/// Verifica / Salva valore SAMPLE e restitusice SE sia variato (e quindi da inviare...)
/// </summary>
@@ -388,7 +410,12 @@ namespace IOB_WIN
descr = itemTranslation("C", dataItem.DataItemId);
sVal = $"CONDITION: {dataItem.Timestamp.ToString()} | descr: {descr} | Name: {dataItem.Name} | Val: {dataItem.CDATA}";
lgInfo(sVal);
accodaFLog(sVal, qEncodeFLog(descr, dataItem.CDATA));
// verifico se salvare
bool changed = checkSaveItem(dataItem);
if (changed)
{
accodaFLog(sVal, qEncodeFLog(descr, dataItem.CDATA));
}
// devo accodare ed inviare nella coda ALARMS (che POI salva in document MongoDB anche ultimi 3 minuti di FluxLog...) !!!FARE!!!
}
}
@@ -403,7 +430,12 @@ namespace IOB_WIN
descr = itemTranslation("E", dataItem.DataItemId);
sVal = $"EVENT: {dataItem.Timestamp.ToString()} | descr: {descr} | Name: {dataItem.Name} | Val: {dataItem.CDATA}";
lgInfo(sVal);
accodaFLog(sVal, qEncodeFLog(descr, dataItem.CDATA));
// verifico se salvare
bool changed = checkSaveItem(dataItem);
if (changed)
{
accodaFLog(sVal, qEncodeFLog(descr, dataItem.CDATA));
}
}
}
catch
@@ -587,17 +619,6 @@ namespace IOB_WIN
currDispData.semIn = Semaforo.SV;
#if false
// effettuo TUTTE le letture
MTC_ref.ReadWords(MTCFinsTCP.Net.PlcMemory.CIO, 0, 60, out memReadCIO_IN);
MTC_ref.ReadWords(MTCFinsTCP.Net.PlcMemory.CIO, 100, 10, out memReadCIO_OUT);
//MTC_ref.ReadWords(MTCFinsTCP.Net.PlcMemory.DM, 0, 8, out memReadDM);
//MTC_ref.ReadWords(MTCFinsTCP.Net.PlcMemory.WR, 0, 8, out memReadWR);
lastCountCNC = pesoRilevato;
#endif
// decodifica e gestione
decodeToBaseBitmap();
reportRawInput(ref currDispData);
@@ -636,40 +657,104 @@ namespace IOB_WIN
* B2: pzCount
* B3: allarme
* B4: manuale
* B5: carico SILOS
* B6: carico AUTOBOTTE
*
*
*
* E_Path_01_RUN_MODE
* public enum MtcRunMode
* {
* UNDEFINED = 0,
* AUTOMATIC,
* EDIT,
* MANUAL_DATA_INPUT,
* MANUAL,
* SEMI_AUTO
* }
*
*
* E_Path_01_EXE_MODE
* /// <summary>
* /// ENUM degli stati EXE del path MTC
* /// </summary>
* public enum MtcExeMode
* {
* UNDEFINED = 0,
* ACTIVE,
* READY,
* STOPPED,
* FEED_HOLD,
* OPTIONAL_STOP,
* PROGRAM_STOPPED,
* PROGRAM_COMPLETED
* }
*
*
* LAVORA SOLO SE
* Path_01_EXE_MODE = ACTIVE
* Path_01_RUN_MODE = AUTOMATIC
* ST_Abilitaz_Abrasivo = ACTIVE
* ST_Getto_On = ACTIVE
* ST_UnOp_01_Status = ACTIVE
*
----------------------------------------------------- */
// bit 0 (poweron) imposto a 1 SE pingo...
B_input = testPing == IPStatus.Success ? 1 : 0;
#if false
bool caricoSilos = ((memReadCIO_IN[55] & (1 << 2)) != 0);
bool caricoAutobotte = ((memReadCIO_IN[50] & (1 << 2)) != 0);
// filtro DEVE ANDARE ma VIENE RILEVATO DOPO, POTREBEB andare da solo x scaricare...
bool runFiltro = ((memReadCIO_IN[0] & (1 << 1)) != 0);
// RUN se CIO_bit 0.01 è RUN FILTRO...
if ((caricoAutobotte || caricoSilos))
// variabili appoggio...
bool hasError = false;
string currExe = "";
string currRun = "";
string currUnOpStatus = "";
try
{
// SE HO carico silos OPPURE carico autobotte --> RUN
B_input += (1 << 1);
var exeMode = dataItemMem["Path_01_EXE_MODE"];
currExe = exeMode.value;
}
// ERROR generale (CORREGGERE!)
catch
{ }
try
{
var runMode = dataItemMem["Path_01_RUN_MODE"];
currRun = runMode.value;
}
catch
{ }
try
{
var UnOp_Status = dataItemMem["ST_UnOp_01_Status"];
currUnOpStatus = UnOp_Status.value;
}
catch
{ }
// controllo lavora...
if (currRun == "AUTOMATIC")
{
if (currExe == "ACTIVE")
{
if (currUnOpStatus == "ACTIVE")
{
// RUN = LAVORA!
B_input += (1 << 1);
}
}
}
else
{
// se ho run mode != auto --> manual
B_input += (1 << 4);
}
// se ho almeno 1 allarme --> ALARM!
if (hasError)
{
B_input += (1 << 3);
}
// carico SILOS
if (caricoSilos)
{
B_input += (1 << 5);
}
// carico AUTOBOTTE
if (caricoAutobotte)
{
B_input += (1 << 6);
}
#if false
// process ODL e contapezzi
string currODL = "";
Vendored
+1 -1
View File
@@ -16,7 +16,7 @@ pipeline {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
withEnv(['NEXT_BUILD_NUMBER=537']) {
withEnv(['NEXT_BUILD_NUMBER=538']) {
// env.versionNumber = VersionNumber(versionNumberString : '2.5.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
env.versionNumber = VersionNumber(versionNumberString : '2.5.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.APP_NAME = 'MAPO-IOB-WIN'