diff --git a/IOB-WIN/DATA/CONF/SIMUL_01.ini b/IOB-WIN/DATA/CONF/SIMUL_01.ini
index 2b12f1a9..2209bd80 100644
--- a/IOB-WIN/DATA/CONF/SIMUL_01.ini
+++ b/IOB-WIN/DATA/CONF/SIMUL_01.ini
@@ -21,15 +21,20 @@ CMDENABLED=/IOB/enabled/
CMDADV1=?valore=
CMDREBO=/sendReboot.aspx?idxMacchina=
-[MEMORY]
+[MEMORY]
[BLINK]
MAX_COUNTER_BLINK = 15
BLINK_FILT=0
[OPTPAR]
-;PZCOUNT_MODE=STD.[PAR/MEM].info|BIT.indice
+;PZCOUNT_MODE=STD.[PAR/MEM].info|BIT.indice
PZCOUNT_MODE=BIT
+; per il simulatore: 50|1 = WAIT 50, DURATION 1 con riferimento al PERIODO base (PER_BASE, default 1 secondo)
+PER_BASE=1
+SIM_BIT2=10|1
+SIM_BIT3=100|2
+SIM_BIT4=25|2
[BRANCH]
NAME=master
\ No newline at end of file
diff --git a/IOB-WIN/IobGeneric.cs b/IOB-WIN/IobGeneric.cs
index 1d64df1b..8a08629c 100644
--- a/IOB-WIN/IobGeneric.cs
+++ b/IOB-WIN/IobGeneric.cs
@@ -647,6 +647,7 @@ namespace IOB_WIN
bool showDebugData = false;
if (ciclo == gatherCycle.VHF)
{
+ processVHF();
}
// processing dati memoria (lettura, filtraggio, enqueque)
else if (ciclo == gatherCycle.HF)
@@ -1663,6 +1664,13 @@ namespace IOB_WIN
}
}
}
+ ///
+ /// Classe fittizia in caso di processing task in VHF
+ ///
+ public virtual void processVHF()
+ {
+ }
+
///
/// Classe fittizia in caso di processing GLOBALE di tutto in 1 solo colpo...
///
diff --git a/IOB-WIN/IobSimula.cs b/IOB-WIN/IobSimula.cs
index d0d4bbaf..d16ed0cb 100644
--- a/IOB-WIN/IobSimula.cs
+++ b/IOB-WIN/IobSimula.cs
@@ -3,9 +3,43 @@ using System.Collections.Generic;
namespace IOB_WIN
{
+ ///
+ /// Configuraizone eventi da simulare
+ ///
+ public class simPar
+ {
+ ///
+ /// Attesa per evento
+ ///
+ public int wait = 10;
+ ///
+ /// Durata dell'evento
+ ///
+ public int duration = 1;
+ ///
+ /// DateTime ultimo evento
+ ///
+ public DateTime lastEv = DateTime.Now;
+ }
+
public class IobSimula : IobGeneric
{
- protected int periodoSec = 7;
+ ///
+ /// periodo base del simulatore (in secondi)
+ ///
+ protected int periodoSec = 1;
+ ///
+ /// Parametri simulazione oscillazione bit 3
+ ///
+ protected simPar bit3;
+ ///
+ /// Parametri simulazione oscillazione bit 4
+ ///
+ protected simPar bit4;
+ ///
+ /// ultimo controllo decremento eventi
+ ///
+ protected DateTime lastEvCheck;
///
/// estende l'init della classe base...
///
@@ -17,6 +51,43 @@ namespace IOB_WIN
pzCountDelay = utils.CRI("pzCountDelay");
lastPzCountSend = DateTime.Now;
lastWarnODL = DateTime.Now;
+ lastEvCheck = DateTime.Now;
+ // sistemo parametri x simulazione...
+ if (cIobConf.optPar.Count > 0)
+ {
+ if (cIobConf.optPar["PER_BASE"] != "")
+ {
+ int.TryParse(cIobConf.optPar["PER_BASE"], out periodoSec);
+ }
+ bit3 = setupSimPar("SIM_BIT3");
+ bit4 = setupSimPar("SIM_BIT4");
+ }
+ }
+ ///
+ /// Setup aprametri di simulazione per BIT indicato
+ ///
+ ///
+ private simPar setupSimPar(string keyName)
+ {
+ simPar answ = new simPar();
+ if (cIobConf.optPar.Count > 0)
+ {
+ if (cIobConf.optPar.ContainsKey(keyName))
+ {
+ string fullVal = cIobConf.optPar[keyName];
+ if (fullVal != "" && fullVal.IndexOf("|") > 0)
+ {
+ string[] param = fullVal.Split('|');
+ int.TryParse(param[0], out answ.wait);
+ int.TryParse(param[1], out answ.duration);
+ // aggiongo disturbo...
+ Random rnd = new Random();
+ int noise = rnd.Next(1, answ.wait / 10);
+ answ.wait += noise;
+ }
+ }
+ }
+ return answ;
}
public override void tryConnect()
@@ -58,7 +129,19 @@ namespace IOB_WIN
decodeToBaseBitmap();
decodeOtherData();
}
-
+ ///
+ /// Processo contatori eventi...
+ ///
+ public override void processVHF()
+ {
+ if (lastEvCheck.AddSeconds(periodoSec) < DateTime.Now)
+ {
+ // decremento contatore ultimo evento
+ bit3.wait--;
+ bit4.wait--;
+ lastEvCheck = DateTime.Now;
+ }
+ }
///
/// Effettua decodifica aree memoria alla bitmap usata x MAPO
///
@@ -73,14 +156,38 @@ namespace IOB_WIN
* B2: pzCount
* B3: allarme
* B4: manuale
- * B5: emergenza
- * B6: error prog
- * B7: auto mode
+ * B5: emergenza
----------------------------------------------------- */
+ // di base macchina in RUN
B_input = 3;
+ if (bit3.wait <= 0)
+ {
+ // segnalo BIT
+ B_input = 9;
+ // decremento duration
+ bit3.duration--;
+ // controllo se sia scaduta la duration... in quel caso reset...
+ if (bit3.duration <= 0)
+ {
+ bit3 = setupSimPar("SIM_BIT3");
+ }
+ }
+ else if (bit4.wait <= 0)
+ {
+ // segnalo BIT
+ B_input = 17;
+ // decremento duration
+ bit4.duration--;
+ // controllo se sia scaduta la duration... in quel caso reset...
+ if (bit4.duration <= 0)
+ {
+ bit4 = setupSimPar("SIM_BIT4");
+ }
+ }
+#if false
// ogni periodo_sec x 2 invio un segnale allarme = B3
if ((DateTime.Now.Second % (periodoSec * 2)) == 0)
{
@@ -90,7 +197,8 @@ namespace IOB_WIN
else if ((DateTime.Now.Second % periodoSec) == 0)
{
B_input = 17;
- }
+ }
+#endif
// CONTROLLO INVIO SOLO SE รจ in stato "3"...
if (B_input == 3)
{
diff --git a/Jenkinsfile b/Jenkinsfile
index 41099ac1..3e0e724d 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -16,7 +16,7 @@ pipeline {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
- withEnv(['NEXT_BUILD_NUMBER=329']) {
+ withEnv(['NEXT_BUILD_NUMBER=330']) {
// env.versionNumber = VersionNumber(versionNumberString : '2.1.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
env.versionNumber = VersionNumber(versionNumberString : '2.1.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.APP_NAME = 'MAPO-IOB-WIN'