Update componenti controllo ODL e sendPzCount + fix gestione MBus con veto task2exe in richiesta
This commit is contained in:
@@ -200,6 +200,7 @@ namespace IOB_UT_NEXT.Config
|
||||
ResetCountMinPre = fIni.ReadInteger("OPTPAR", "RESET_COUNT_PRE", 1),
|
||||
// e reset a zero...
|
||||
ResetCountMaxPost = fIni.ReadInteger("OPTPAR", "RESET_COUNT_POST", 0),
|
||||
VetoCheckOdlSec = fIni.ReadInteger("OPTPAR", "VETO_CHECK_ODL_SEC", 10)
|
||||
};
|
||||
exclOptPar.Add("AUTO_CHANGE_ODL");
|
||||
exclOptPar.Add("CHANGE_ODL_MODE");
|
||||
@@ -209,6 +210,7 @@ namespace IOB_UT_NEXT.Config
|
||||
exclOptPar.Add("DISABLE_ODL");
|
||||
exclOptPar.Add("RESET_COUNT_PRE");
|
||||
exclOptPar.Add("RESET_COUNT_POST");
|
||||
exclOptPar.Add("VETO_CHECK_ODL_SEC");
|
||||
|
||||
// gestione FluxLog
|
||||
float globDBand = 1;
|
||||
|
||||
@@ -16,6 +16,7 @@ using System.Security.Policy;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using YamlDotNet.Core.Tokens;
|
||||
|
||||
namespace IOB_UT_NEXT
|
||||
{
|
||||
@@ -60,12 +61,12 @@ namespace IOB_UT_NEXT
|
||||
get
|
||||
{
|
||||
// parto dal dato std di veto per pauseSendMSec
|
||||
int answ = CRI("pauseSendMSec");
|
||||
// aggiungo NOISE... +/- 50%
|
||||
int value = CRI("pauseSendMSec");
|
||||
Random rnd = new Random();
|
||||
int noise = rnd.Next(1, answ / 2);
|
||||
answ += noise - (answ / 4);
|
||||
return answ;
|
||||
// NextDouble() ∈ [0.0, 1.0) → fattore ∈ [-1.0, 1.0)
|
||||
double factor = rnd.NextDouble() * 2.0 - 1.0;
|
||||
// ±10%
|
||||
return (int)(value * (1.0 + 0.10 * factor));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1133,7 +1134,6 @@ namespace IOB_UT_NEXT
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -34,3 +34,4 @@ CLI_INST=SteamWareSim
|
||||
STARTLIST=SIMUL_01
|
||||
|
||||
MAXCNC=10
|
||||
|
||||
|
||||
@@ -5663,13 +5663,6 @@ namespace IOB_WIN_FORM.Iob
|
||||
{
|
||||
// deserializzo...
|
||||
JobTaskData jobTask = JsonConvert.DeserializeObject<JobTaskData>(rawJob);
|
||||
#if false
|
||||
// loggo tutti i task done...
|
||||
foreach (var item in jobTask.TaskList)
|
||||
{
|
||||
sendToTaskWatch(item.Key, item.Value, jobTask.CodTav);
|
||||
}
|
||||
#endif
|
||||
// ora chiamo la cancellazione dei task eseguiti...
|
||||
var taskDict = JobTaskData.TaskDict(jobTask.RawData);
|
||||
foreach (var item in taskDict)
|
||||
|
||||
@@ -4048,20 +4048,20 @@ namespace IOB_WIN_FORM.Iob
|
||||
if (currentAlive)
|
||||
{
|
||||
lgInfo("SERVER ONLINE");
|
||||
dtVetoPing = DateTime.Now.AddMilliseconds(baseUtils.nextPauseSendMSec * 5);
|
||||
dtVetoPing = DateTime.Now.AddMilliseconds(baseUtils.nextPauseSendMSec * 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
lgError("SERVER OFFLINE");
|
||||
// Veto standard per server offline
|
||||
dtVetoPing = DateTime.Now.AddMilliseconds(baseUtils.nextPauseSendMSec * 10);
|
||||
dtVetoPing = DateTime.Now.AddMilliseconds(baseUtils.nextPauseSendMSec * 20);
|
||||
utils.dtVetoSend = dtVetoPing;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Se lo stato è invariato (es. era online e resta online), allunghiamo il prossimo controllo
|
||||
dtVetoPing = DateTime.Now.AddMilliseconds(baseUtils.nextPauseSendMSec * 20);
|
||||
dtVetoPing = DateTime.Now.AddMilliseconds(baseUtils.nextPauseSendMSec * 30);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace IOB_WIN_FORM
|
||||
if (answ)
|
||||
{
|
||||
lgInfo("SERVER ONLINE");
|
||||
utils.dtVetoPing = DateTime.Now.AddMilliseconds(baseUtils.nextPauseSendMSec * 2);
|
||||
utils.dtVetoPing = DateTime.Now.AddMilliseconds(baseUtils.nextPauseSendMSec * 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -149,7 +149,7 @@ namespace IOB_WIN_FORM
|
||||
else
|
||||
{
|
||||
// allungo periodo controllo...
|
||||
utils.dtVetoPing = DateTime.Now.AddMilliseconds(baseUtils.nextPauseSendMSec * 5);
|
||||
utils.dtVetoPing = DateTime.Now.AddMilliseconds(baseUtils.nextPauseSendMSec * 10);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -158,7 +158,7 @@ namespace IOB_WIN_FORM
|
||||
utils.MPIO_Online = false;
|
||||
updateComStats(0, 0, false);
|
||||
// imposto veto a 10 volte reinvio dati standard...
|
||||
utils.dtVetoPing = DateTime.Now.AddMilliseconds(baseUtils.nextPauseSendMSec * 10);
|
||||
utils.dtVetoPing = DateTime.Now.AddMilliseconds(baseUtils.nextPauseSendMSec * 20);
|
||||
utils.dtVetoSend = utils.dtVetoPing;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,3 +20,4 @@ CLI_INST=SteamWareSim
|
||||
STARTLIST=FTP_SONATEST
|
||||
|
||||
MAXCNC=10
|
||||
|
||||
|
||||
@@ -27,3 +27,4 @@ STARTLIST=3024
|
||||
;STARTLIST=LVF652
|
||||
|
||||
MAXCNC=10
|
||||
|
||||
|
||||
@@ -34,3 +34,4 @@ STARTLIST=3026
|
||||
;STARTLIST=SIMUL_01
|
||||
|
||||
MAXCNC=10
|
||||
|
||||
|
||||
@@ -20,3 +20,4 @@ STARTLIST=SIMUL_08
|
||||
;STARTLIST=3023-PING,3024-PING
|
||||
|
||||
MAXCNC=10
|
||||
|
||||
|
||||
@@ -41,3 +41,4 @@ CLI_INST=SteamWareSim
|
||||
STARTLIST=SIMUL_01
|
||||
|
||||
MAXCNC=10
|
||||
|
||||
|
||||
@@ -181,19 +181,21 @@ namespace IOB_WIN_SIEMENS.IobSiemens
|
||||
// registro contapezzi
|
||||
lgInfo($"contapezziPLC SIEMENS: {contapezziPLC} | contapezziIOB {contapezziIOB}");
|
||||
}
|
||||
|
||||
// invio a server contapezzi (aggiornato)
|
||||
string retVal = utils.callUrl(urlSetPzCount + contapezziIOB.ToString());
|
||||
// verifica se tutto OK
|
||||
if (retVal != contapezziIOB.ToString())
|
||||
if (needRefreshPzCount)
|
||||
{
|
||||
// errore salvataggio contapezzi
|
||||
lgInfo($"Errore salvataggio Contapezzi SIEMENS: contapezziPLC {contapezziPLC} | contapezziIOB {contapezziIOB} | risposta: {retVal}");
|
||||
// rileggo il counter pezzi da server
|
||||
pzCntReload(true);
|
||||
// invio a server contapezzi (aggiornato)
|
||||
string retVal = utils.callUrl(urlSetPzCount + contapezziIOB.ToString());
|
||||
// verifica se tutto OK
|
||||
if (retVal != contapezziIOB.ToString())
|
||||
{
|
||||
// errore salvataggio contapezzi
|
||||
lgInfo($"Errore salvataggio Contapezzi SIEMENS: contapezziPLC {contapezziPLC} | contapezziIOB {contapezziIOB} | risposta: {retVal}");
|
||||
// rileggo il counter pezzi da server
|
||||
pzCntReload(true);
|
||||
}
|
||||
// resetto timer...
|
||||
lastPzCountSend = DateTime.Now;
|
||||
}
|
||||
// resetto timer...
|
||||
lastPzCountSend = DateTime.Now;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -286,18 +286,21 @@ namespace IOB_WIN_SIEMENS.IobSiemens
|
||||
lgInfo($"contapezziPLC SIEMENS: {contapezziPLC} | contapezziIOB {contapezziIOB}");
|
||||
}
|
||||
|
||||
// invio a server contapezzi (aggiornato)
|
||||
string retVal = utils.callUrl(urlSetPzCount + contapezziIOB.ToString());
|
||||
// verifica se tutto OK
|
||||
if (retVal != contapezziIOB.ToString())
|
||||
if (needRefreshPzCount)
|
||||
{
|
||||
// errore salvataggio contapezzi
|
||||
lgInfo($"Errore salvataggio Contapezzi SIEMENS: contapezziPLC {contapezziPLC} | contapezziIOB {contapezziIOB} | risposta: {retVal}");
|
||||
// rileggo il counter pezzi da server
|
||||
pzCntReload(true);
|
||||
// invio a server contapezzi (aggiornato)
|
||||
string retVal = utils.callUrl(urlSetPzCount + contapezziIOB.ToString());
|
||||
// verifica se tutto OK
|
||||
if (retVal != contapezziIOB.ToString())
|
||||
{
|
||||
// errore salvataggio contapezzi
|
||||
lgInfo($"Errore salvataggio Contapezzi SIEMENS: contapezziPLC {contapezziPLC} | contapezziIOB {contapezziIOB} | risposta: {retVal}");
|
||||
// rileggo il counter pezzi da server
|
||||
pzCntReload(true);
|
||||
}
|
||||
// resetto timer...
|
||||
lastPzCountSend = DateTime.Now;
|
||||
}
|
||||
// resetto timer...
|
||||
lastPzCountSend = DateTime.Now;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -417,36 +417,28 @@ namespace IOB_WIN_SIEMENS.IobSiemens
|
||||
lgInfo($"contapezziPLC SIEMENST-TORRI: {contapezziPLC} | contapezziIOB {contapezziIOB}");
|
||||
}
|
||||
|
||||
// Salvo il contapezzi della macchina
|
||||
retVal = utils.CallUrlGet(urlSetPzCount + contapezziIOB.ToString());
|
||||
// verifica se tutto OK, ovvero conferma i pezzi inviati
|
||||
if (retVal != contapezziIOB.ToString())
|
||||
if (needRefreshPzCount)
|
||||
{
|
||||
// errore salvataggio contapezzi
|
||||
lgInfo($"Errore salvataggio contapezziPLC SIEMENST-TORRI: {contapezziPLC} | contapezziIOB {contapezziIOB} | Valore tornato: {retVal}");
|
||||
// rileggo il counter pezzi da server
|
||||
pzCntReload(true);
|
||||
// Salvo il contapezzi della macchina
|
||||
retVal = utils.CallUrlGet(urlSetPzCount + contapezziIOB.ToString());
|
||||
// verifica se tutto OK, ovvero conferma i pezzi inviati
|
||||
if (retVal != contapezziIOB.ToString())
|
||||
{
|
||||
// errore salvataggio contapezzi
|
||||
lgInfo($"Errore salvataggio contapezziPLC SIEMENST-TORRI: {contapezziPLC} | contapezziIOB {contapezziIOB} | Valore tornato: {retVal}");
|
||||
// rileggo il counter pezzi da server
|
||||
pzCntReload(true);
|
||||
}
|
||||
// resetto timer...
|
||||
lastPzCountSend = DateTime.Now;
|
||||
|
||||
// verifico se variato contapezzi... e se passato ritardo minimo...
|
||||
if ((contapezziPLC - contapezziIOB) > minSendPzCountBlock)
|
||||
{
|
||||
trySendPzCountBlock();
|
||||
}
|
||||
}
|
||||
|
||||
// verifico se variato contapezzi... e se passato ritardo minimo...
|
||||
if ((contapezziPLC - contapezziIOB) > minSendPzCountBlock)
|
||||
{
|
||||
trySendPzCountBlock();
|
||||
}
|
||||
|
||||
// invio a server contapezzi (aggiornato)
|
||||
retVal = utils.CallUrlGet(urlSetPzCount + contapezziIOB.ToString());
|
||||
// verifica se tutto OK
|
||||
if (retVal != contapezziIOB.ToString())
|
||||
{
|
||||
// errore salvataggio contapezzi
|
||||
lgInfo($"Errore salvataggio Contapezzi SIEMENS-TORRI: contapezziPLC {contapezziPLC} | contapezziIOB {contapezziIOB} | risposta: {retVal}");
|
||||
// rileggo il counter pezzi da server
|
||||
pzCntReload(true);
|
||||
}
|
||||
|
||||
// resetto timer...
|
||||
lastPzCountSend = DateTime.Now;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -24,3 +24,4 @@ STARTLIST=3018
|
||||
;STARTLIST=SIMUL_06
|
||||
|
||||
MAXCNC=10
|
||||
|
||||
|
||||
Reference in New Issue
Block a user