Merge branch 'release/UpdateInterclaysMixOxFe01'
This commit is contained in:
+75
-60
@@ -652,91 +652,106 @@ namespace IOB_WIN_NEXT.Iob
|
||||
* bitmap MAPO
|
||||
* B0: POWER_ON
|
||||
* B1: RUN
|
||||
* B2: pzCount
|
||||
* B2: pzCount -- non usato
|
||||
* B3: allarme
|
||||
* B4: manuale
|
||||
* B4: manuale -- non usato
|
||||
* B5: carico SILOS
|
||||
* B6: carico AUTOBOTTE
|
||||
----------------------------------------------------- */
|
||||
// bit 0 (poweron) imposto a 1 SE pingo...
|
||||
B_input = testPingMachine == IPStatus.Success ? 1 : 0;
|
||||
|
||||
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);
|
||||
// in primis test ping!
|
||||
bool pingOk = testPingMachine == IPStatus.Success;
|
||||
if (pingOk)
|
||||
{
|
||||
// versione pre 2023: controllo SOLO ping...
|
||||
//// bit 0 (poweron) imposto a 1 SE pingo...
|
||||
//B_input = testPingMachine == IPStatus.Success ? 1 : 0;
|
||||
|
||||
// RUN se CIO_bit 0.01 è RUN FILTRO...
|
||||
if ((caricoAutobotte || caricoSilos))
|
||||
{
|
||||
// SE HO carico silos OPPURE carico autobotte --> RUN
|
||||
B_input += (1 << 1);
|
||||
}
|
||||
// ERROR generale (CORREGGERE!)
|
||||
if (hasError)
|
||||
{
|
||||
B_input += (1 << 3);
|
||||
}
|
||||
// recupero i bit! check poweron = aux inseriti
|
||||
bool runAux = ((memReadCIO_IN[0] & (1 << 0)) != 0);
|
||||
// check lavora = filtro ON (DEVE ANDARE ma VIENE RILEVATO DOPO, POTREBBE andare da
|
||||
// solo x scaricare...)
|
||||
bool runFiltro = ((memReadCIO_IN[0] & (1 << 1)) != 0);
|
||||
// check carico silos/autobotte
|
||||
bool caricoSilos = ((memReadCIO_IN[55] & (1 << 2)) != 0);
|
||||
bool caricoAutobotte = ((memReadCIO_IN[50] & (1 << 2)) != 0);
|
||||
|
||||
// carico SILOS
|
||||
if (caricoSilos)
|
||||
{
|
||||
B_input += (1 << 5);
|
||||
}
|
||||
// carico AUTOBOTTE
|
||||
if (caricoAutobotte)
|
||||
{
|
||||
B_input += (1 << 6);
|
||||
}
|
||||
// Costruzione HEX B_input
|
||||
|
||||
// procedo SOLO SE è enabled IOB
|
||||
if (IobOnline)
|
||||
{
|
||||
try
|
||||
// RUN se CIO_bit 0.00 è POWER ON...
|
||||
B_input = runAux ? 1 : 0;
|
||||
// RUN se CIO_bit 0.01 è RUN FILTRO...
|
||||
if (runFiltro || caricoAutobotte || caricoSilos)
|
||||
{
|
||||
currODL = utils.callUrl(urlGetCurrODL);
|
||||
// solo SE HO un ODL...
|
||||
if (string.IsNullOrEmpty(currODL) || currODL == "0")
|
||||
// SE HO carico silos OPPURE carico autobotte --> RUN
|
||||
B_input += (1 << 1);
|
||||
}
|
||||
// ERROR generale (CORREGGERE!)
|
||||
if (hasError)
|
||||
{
|
||||
B_input += (1 << 3);
|
||||
}
|
||||
|
||||
// carico SILOS
|
||||
if (caricoSilos)
|
||||
{
|
||||
B_input += (1 << 5);
|
||||
}
|
||||
// carico AUTOBOTTE
|
||||
if (caricoAutobotte)
|
||||
{
|
||||
B_input += (1 << 6);
|
||||
}
|
||||
|
||||
// procedo SOLO SE è enabled IOB
|
||||
if (IobOnline)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (periodicLog)
|
||||
currODL = utils.callUrl(urlGetCurrODL);
|
||||
// solo SE HO un ODL...
|
||||
if (string.IsNullOrEmpty(currODL) || currODL == "0")
|
||||
{
|
||||
lgInfo(string.Format("OMRON | Lettura ODL andata a vuoto: currODL: {0}", currODL));
|
||||
if (periodicLog)
|
||||
{
|
||||
lgInfo(string.Format("OMRON | Lettura ODL andata a vuoto: currODL: {0}", currODL));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// se variato o scaduto timeout log...
|
||||
if (periodicLog || (currIdxODL.ToString() != currODL))
|
||||
{
|
||||
lgInfo(string.Format("OMRON | Lettura ODL, currODL: {0} --> currIdxODL prec: {1}", currODL, currIdxODL));
|
||||
}
|
||||
// provo a salvare nuovo ODL
|
||||
int.TryParse(currODL, out currIdxODL);
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception exc)
|
||||
{
|
||||
// se variato o scaduto timeout log...
|
||||
if (periodicLog || (currIdxODL.ToString() != currODL))
|
||||
if (DateTime.Now.Subtract(lastWarnODL).TotalSeconds > 15)
|
||||
{
|
||||
lgInfo(string.Format("OMRON | Lettura ODL, currODL: {0} --> currIdxODL prec: {1}", currODL, currIdxODL));
|
||||
lgError(exc, "Errore in fase di chiamata URL x ODL corrente | URL chiamato: {0}", urlGetCurrODL);
|
||||
lastWarnODL = DateTime.Now;
|
||||
}
|
||||
// provo a salvare nuovo ODL
|
||||
int.TryParse(currODL, out currIdxODL);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
else
|
||||
{
|
||||
if (DateTime.Now.Subtract(lastWarnODL).TotalSeconds > 15)
|
||||
// imposto currODL a vuoto!
|
||||
currODL = "";
|
||||
if (periodicLog)
|
||||
{
|
||||
lgError(exc, "Errore in fase di chiamata URL x ODL corrente | URL chiamato: {0}", urlGetCurrODL);
|
||||
lastWarnODL = DateTime.Now;
|
||||
lgInfo($"Omron | Lettura ODL non effettuata: IobOnline: {IobOnline} | currODL impostato a vuoto");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// imposto currODL a vuoto!
|
||||
currODL = "";
|
||||
if (periodicLog)
|
||||
// log opzionale!
|
||||
if (verboseLog)
|
||||
{
|
||||
lgInfo($"Omron | Lettura ODL non effettuata: IobOnline: {IobOnline} | currODL impostato a vuoto");
|
||||
lgInfo(string.Format("Trasformazione B_input: {0}", B_input));
|
||||
}
|
||||
}
|
||||
// log opzionale!
|
||||
if (verboseLog)
|
||||
{
|
||||
lgInfo(string.Format("Trasformazione B_input: {0}", B_input));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user