Aggiunta modifiche x IcoelSoap e generalizzazione invii vari

This commit is contained in:
Samuele Locatelli
2022-05-21 12:26:53 +02:00
parent 682a486252
commit 5afee5d823
6 changed files with 245 additions and 18 deletions
+29 -16
View File
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace IOB_UT_NEXT
{
@@ -11,7 +8,7 @@ namespace IOB_UT_NEXT
public enum boolCheckMode
{
/// <summary>
/// AND: tutte vere -> true
/// AND: tutte vere -&gt; true
/// </summary>
AND = 0,
@@ -21,17 +18,6 @@ namespace IOB_UT_NEXT
OR
}
/// <summary>
/// Modalità gestione setup macchina
/// </summary>
public enum MachineSetupMode
{
ND=0,
// Modalità Mecolpress (3 parametri IN, se variati --> porto a 1 la variabile di controllo)
MECOLPRESS = 1
}
/// <summary>
/// Elenco MODI CNC
/// </summary>
@@ -182,6 +168,17 @@ namespace IOB_UT_NEXT
VLF
}
/// <summary>
/// Modalità gestione setup macchina
/// </summary>
public enum MachineSetupMode
{
ND = 0,
// Modalità Mecolpress (3 parametri IN, se variati --> porto a 1 la variabile di controllo)
MECOLPRESS = 1
}
/// <summary>
/// StFlag32: set di 32 bit (4 word) contente semaforo di variabili
/// </summary>
@@ -396,7 +393,7 @@ namespace IOB_UT_NEXT
SIEMENS_APROCHIM,
/// <summary>
/// Adapter SIEMENS, interfaccia versione VIPA @2001
/// Adapter SIEMENS, interfaccia versione VIPA @2001
/// </summary>
SIEMENS_AT2001,
@@ -510,4 +507,20 @@ namespace IOB_UT_NEXT
/// </summary>
ULog
}
/// <summary>
/// Tipologia dato RAW da trasmettere/ricevere (derivare da MapoSdk e togliere qui)
/// </summary>
public enum rawDataType
{
ND = 0,
/// <summary>
/// Icoel: Batch info
/// </summary>
IcoelBatch,
/// <summary>
/// Icoel: Variety + layout info relative
/// </summary>
IcoelVarInfo
}
}
+2 -2
View File
@@ -1132,7 +1132,7 @@ namespace IOB_WIN_NEXT
tipoIob = tipoScelto,
optPar = optParRead,
versIOB = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(),
codIOB = CurrIOB,
codIOB = fIni.ReadString("IOB", "IOB_NAME", CurrIOB),
cncIpAddr = fIni.ReadString("CNC", "IP", "::1"),
cncPort = fIni.ReadString("CNC", "PORT", "0"),
iniFileName = iniConfFile,
@@ -1280,7 +1280,7 @@ namespace IOB_WIN_NEXT
iobObj = new IobOpcUaOmronIcoel(this, IOBConf);
start.Enabled = true;
break;
case tipoAdapter.PingWatchdog:
iobObj = new IobPing(this, IOBConf);
start.Enabled = true;
@@ -3,6 +3,7 @@
;Centro di lavoro OpcUa
CNCTYPE=OpcUaOmronIcoel
PING_MS_TIMEOUT=500
IOB_NAME=GIACO_ICOEL
[MACHINE]
VENDOR=ICOEL
@@ -0,0 +1,72 @@
;Configurazione IOB-WIN
[IOB]
;WebService SOAP x sizer
CNCTYPE=IcoelSoap
PING_MS_TIMEOUT=500
IOB_NAME=GIACO_ICOEL
[MACHINE]
VENDOR=ICOEL
MODEL=Impianto Ciliegie Turi
[CNC]
IP=192.168.137.50
PORT=8001
GETPRGNAME=false
[SERVER]
MPIP=http://192.168.1.14
MPURL=/MP/IO
CMDBASE=/IOB/input/
CMDFLOG=/IOB/flog/
CMDALIVE=/IOB
CMDENABLED=/IOB/enabled/
CMDADV1=?valore=
CMDREBO=/sendReboot.aspx?idxMacchina=
[MEMORY]
ADDR_READ=DB9999.DBB0
ADDR_WRITE=DB9999.DBB0
SIZE_READ=0
SIZE_WRITE=0
;BIT0=CONN
;BIT1=DB60.DBB1
;BIT2=PZCOUNT.STD.DB700.DBW22
;BIT3=DB60.DBB3
;BIT4=DB60.DBB4
[BLINK]
;MAX_COUNTER_BLINK = 30
MAX_COUNTER_BLINK = 15
;bit0 = 0
;bit1 = 0
;bit2 = 1
;bit3 = 1
;bit4 = 1
;bit5 = 0
;bit6 = 0
;bit7 = 0
BLINK_FILT=0
;BLINK_FILT=28
[OPTPAR]
AUTO_CHANGE_ODL=false
CHANGE_ODL_MODE=TIME
CHANGE_ODL_HOURS=24
CHANGE_ODL_IDLE_MIN=5
PZCOUNT_MODE=Icoel
DISABLE_PZCOUNT=FALSE
ENABLE_SEND_PZC_BLOCK=TRUE
MIN_SEND_PZC_BLOCK=0
MAX_SEND_PZC_BLOCK=100
ENABLE_DYN_DATA=FALSE
FORCE_DYN_DATA=TRUE
ENABLE_DATA_FILTER=TRUE
ENABLE_CLI_RESTART=TRUE
; conf parametri memoria READ/WRITE
OPC_PARAM_CONF=GIACO_ICOEL_001.json
[BRANCH]
NAME=master
+60
View File
@@ -3426,6 +3426,58 @@ namespace IOB_WIN_NEXT
}
}
/// <summary>
/// Accumula in coda i valori RawData logga...
/// </summary>
/// <param name="sendObj">Dictionary pronto x invio</param>
public void accodaRawData(Dictionary<IOB_UT_NEXT.rawDataType, string> sendObj)
{
//
/*--------------------------------
* nuova gestione coda dictionary
* fixme todo da fare !!!
*
* - conterrà tanti dictionary, con key data-ora accodamento
* - i dati vanno poi "scodati" dal + vecchio ed inviati a MP/IO
* - mostra un sunto delle info da inviare
* - accodamento vero e proprio
* - verifica (opzionale) coda massima x gestire roundRobin ultimi eventi
* - trace della coda
* - counter invio??? valutare se c'è dataora e poi sono da salvare su MongoDb / Redis
*
* */
#if false
// mostro dati variati letti...
displayOtherData(val);
// --> accodo (valore già formattato)!
QueueFLog.Enqueue(encodedVal);
// se abilitato controllo coda FLog (superiore a 0...)
if (maxQueueFLog > 0)
{
// se ho una coda superiore a max ammesso
if (QueueFLog.Count > maxQueueFLog)
{
// elimino valori iniziali fino a tornare al max ammesso...
while (QueueFLog.Count > maxQueueFLog)
{
string currVal = "";
QueueFLog.TryDequeue(out currVal);
lgInfo($"Eliminazione da coda FLog per superamento maxLengh: {currVal}");
}
}
}
// loggo!
lgTrace(string.Format("[QUEUE-FLOG] {0}", encodedVal));
counterFLog++;
if (counterFLog > 9999)
{
counterFLog = 0;
}
#endif
}
/// <summary>
/// Accoda (visualizzando in cima allo stack) la nuova stringa di output per area OTHER DATA
/// </summary>
@@ -3833,6 +3885,7 @@ namespace IOB_WIN_NEXT
}
else if (ciclo == gatherCycle.LF)
{
processCustomTaskLF();
processOtherCounters();
processProgram();
// verifico se devo gestire cambio ODL in modo automatico
@@ -3920,6 +3973,13 @@ namespace IOB_WIN_NEXT
raiseRefresh(currDispData);
}
/// <summary>
/// Effettua processing CUSTOM x l'IOB corrente (ed invia ad IO)
/// (task svolto tipicamente ogni 5 sec se base timer 10ms, vedere app.config)
/// </summary>
public virtual void processCustomTaskLF()
{ }
/// <summary>
/// Recupera eventuali allarmi CNC...
/// </summary>
+81
View File
@@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EgwProxy.Icoel;
using Newtonsoft.Json;
namespace IOB_WIN_NEXT
{
@@ -11,6 +13,7 @@ namespace IOB_WIN_NEXT
/// </summary>
public class IobIcoelSoap : IobGeneric
{
protected Connector IcoelSizer { get; set; } = null!;
/// <summary>
/// Costruttore dell'IOB Icoel SOAP
/// </summary>
@@ -18,6 +21,84 @@ namespace IOB_WIN_NEXT
/// <param name="IOBConf">Configurazione IOB per avvio</param>
public IobIcoelSoap(AdapterForm caller, IobConfiguration IOBConf) : base(caller, IOBConf)
{
/* --------------------------------------
* todo's
* --------------------------------------
* - init obj comunicazione da conf e nuget
* - test comunicazione
* - estensione IOB come OPT_PAR di OVERRIDE (x inviare dati di un unico iOB da più IOB programs)
* - gestione processCustomTaskLF
* - x lettura dei 2 batch correnti (sx/dx)
* - calcolo abtch in corso/chiusi da date inizio/fine
* - trasmettere a MP/IO risultato valutazioni
* - gestione executeTasks
* - task di invio batch configurato in coda
* - task di recupero info anagrafiche (grower, variety, layout,...)
* - contapezzi (SE ha senso con sizer oppure saltare)
*
*
*/
IcoelSizer = new Connector(IOBConf.cncIpAddr, IOBConf.cncPort);
}
/// <summary>
/// Effettua processing CUSTOM x Icoel:
/// - recupera elenco batch delle 2 linee
/// - invia al sistema
/// </summary>
public override void processCustomTaskLF()
{
var currBatch = IcoelSizer.GetCurrentBatch();
if (currBatch != null)
{
// serializzo ed invio al sistema il risultato
string rawData = JsonConvert.SerializeObject(currBatch);
// invio come tipo "IcoelBatch"
Dictionary<IOB_UT_NEXT.rawDataType, string> sendObj = new Dictionary<IOB_UT_NEXT.rawDataType, string>();
sendObj.Add(IOB_UT_NEXT.rawDataType.IcoelBatch, rawData);
//accodo per invio...
accodaRawData(sendObj);
}
}
/// <summary>
/// recupera le variety ed i rispettivi layout e li invia al sistema MP/IO
/// </summary>
protected void refreshVarietyData()
{
///determina se recuperare SOLO varietà attive o tutte
bool soloAttive = false;
var varList = IcoelSizer.GetVarietyList(soloAttive);
var varietyData = IcoelSizer.GetLayoutForVarietyList(varList);
}
/// <summary>
/// Implementazione custom esecuzione task specifici
/// </summary>
/// <param name="task2exe"></param>
/// <returns></returns>
public override Dictionary<string, string> executeTasks(Dictionary<string, string> task2exe)
{
/*---------------------------------------
* fixme todo fare !!!
* gestione execute task SPECIFICI x il sizer:
* - recupero anagrafice variety/layout (attivi)
* - recupero grower
* - invio batch da accodare
* - recupero dati da sizer (OVE disponibili)
* - recupero batch corrente (modalità force/resync?)
*
*---------------------------------------*/
return base.executeTasks(task2exe);
}
}
}