From fa976dd2bbedbeaeb43b570e8344906e5806e252 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 23 Jan 2026 10:22:00 +0100 Subject: [PATCH] Update IOB BASE: - aggiunto InitializeAsync - gestione override x ogni IOB --- IOB-WIN-FANUC/AdapterFormNext.cs | 6 +- IOB-WIN-FANUC/Iob/Fanuc.cs | 9 +- IOB-WIN-FILE/AdapterFormNext.cs | 6 +- IOB-WIN-FORM/AdapterForm.cs | 28 +- IOB-WIN-FORM/Iob/Generic.Protected.cs | 4 + IOB-WIN-FORM/Iob/Generic.Public.cs | 18 +- IOB-WIN-FORM/Iob/Simula.cs | 37 +-- IOB-WIN-FORM/MainForm.cs | 44 +-- IOB-WIN-FTP/AdapterFormNext.cs | 6 +- IOB-WIN-FTP/Iob/Ftp.cs | 9 +- IOB-WIN-KAWASAKI/AdapterFormNext.cs | 7 +- IOB-WIN-MBUS/AdapterFormNext.cs | 6 +- IOB-WIN-MITSUBISHI/AdapterFormNext.cs | 6 +- IOB-WIN-MTC/AdapterFormNext.cs | 6 +- IOB-WIN-OMRON/AdapterFormNext.cs | 6 +- IOB-WIN-OPC-UA/AdapterFormNext.cs | 6 +- IOB-WIN-OSAI/AdapterFormNext.cs | 6 +- IOB-WIN-PING/AdapterFormNext.cs | 6 +- IOB-WIN-SHELLY/AdapterFormNext.cs | 6 +- IOB-WIN-SHELLY/DATA/CONF/MAIN.ini | 2 +- IOB-WIN-SHELLY/DATA/CONF/SIMUL_01.ini | 120 ++++++++ IOB-WIN-SHELLY/DATA/CONF/SIMUL_01.json | 410 +++++++++++++++++++++++++ IOB-WIN-SHELLY/IOB-WIN-SHELLY.csproj | 6 + IOB-WIN-SHELLY/Iob/ShellyClientGen1.cs | 6 +- IOB-WIN-SHELLY/Iob/ShellyClientGen2.cs | 6 +- IOB-WIN-SIEMENS/AdapterFormNext.cs | 6 +- IOB-WIN-SQL/AdapterFormNext.cs | 6 +- IOB-WIN-WPS/AdapterFormNext.cs | 6 +- IOB-WIN-WS/AdapterFormNext.cs | 6 +- 29 files changed, 714 insertions(+), 82 deletions(-) create mode 100644 IOB-WIN-SHELLY/DATA/CONF/SIMUL_01.ini create mode 100644 IOB-WIN-SHELLY/DATA/CONF/SIMUL_01.json diff --git a/IOB-WIN-FANUC/AdapterFormNext.cs b/IOB-WIN-FANUC/AdapterFormNext.cs index ac43a3d5..7c87d43c 100644 --- a/IOB-WIN-FANUC/AdapterFormNext.cs +++ b/IOB-WIN-FANUC/AdapterFormNext.cs @@ -27,7 +27,7 @@ namespace IOB_WIN_FANUC /// /// carica IOB richiesto /// - protected override void loadIobType() + protected override async Task loadIobType() { if (IOBConfFull != null) { @@ -45,6 +45,10 @@ namespace IOB_WIN_FANUC btnStart.Enabled = false; break; } + if (!await iobInitAsync()) + { + return; + } UpdateDisplTypeIobSel(); } } diff --git a/IOB-WIN-FANUC/Iob/Fanuc.cs b/IOB-WIN-FANUC/Iob/Fanuc.cs index 7509a647..9dc5f255 100644 --- a/IOB-WIN-FANUC/Iob/Fanuc.cs +++ b/IOB-WIN-FANUC/Iob/Fanuc.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using System.Net; using System.Net.NetworkInformation; +using System.Threading.Tasks; namespace IOB_WIN_FANUC.Iob { @@ -110,8 +111,6 @@ namespace IOB_WIN_FANUC.Iob pzCntReload(true); // refresh associazione Macchina - IOB SendM2IOB(); - // invio altri dati accessori... - SendMachineConf(); // per adesso imposto lettura fanuc == contapezzi (poi farà vera lettura...) contapezziPLC = contapezziIOB; } @@ -136,6 +135,12 @@ namespace IOB_WIN_FANUC.Iob lgInfo("End init Adapter FANUC"); } + public override async Task InitializeAsync() + { + // invio altri dati accessori... + await SendMachineConfAsync(); + } + /// /// Formatta area x memorie Fanuc da conf caricata /// diff --git a/IOB-WIN-FILE/AdapterFormNext.cs b/IOB-WIN-FILE/AdapterFormNext.cs index a1ce019f..ef7f1c3e 100644 --- a/IOB-WIN-FILE/AdapterFormNext.cs +++ b/IOB-WIN-FILE/AdapterFormNext.cs @@ -21,7 +21,7 @@ namespace IOB_WIN_FILE /// /// carica IOB richiesto /// - protected override void loadIobType() + protected override async Task loadIobType() { if (IOBConfFull != null) { @@ -49,6 +49,10 @@ namespace IOB_WIN_FILE btnStart.Enabled = false; break; } + if (!await iobInitAsync()) + { + return; + } UpdateDisplTypeIobSel(); } } diff --git a/IOB-WIN-FORM/AdapterForm.cs b/IOB-WIN-FORM/AdapterForm.cs index b8d31816..57215aa3 100644 --- a/IOB-WIN-FORM/AdapterForm.cs +++ b/IOB-WIN-FORM/AdapterForm.cs @@ -1140,7 +1140,7 @@ namespace IOB_WIN_FORM /// /// carica IOB richiesto /// - protected virtual void loadIobType() + protected virtual async Task loadIobType() { if (IOBConfFull != null) { @@ -1152,10 +1152,36 @@ namespace IOB_WIN_FORM start.Enabled = false; break; } + if (!await iobInitAsync()) + { + return; + } UpdateDisplTypeIobSel(); } } + /// + /// Esegue logica di init async x IOB + /// + /// + protected async Task iobInitAsync() + { + try + { + this.Cursor = Cursors.WaitCursor; + await iobObj.InitializeAsync(); + this.Cursor = Cursors.Default; + } + catch (Exception ex) + { + lgError($"Inizializzazione fallita per {tipoScelto}: {ex.Message}"); + iobObj = null; // Evitiamo di usare un oggetto malfunzionante + return false; + } + + return true; + } + /// /// Init form (grafica) con helper x testi e varie /// diff --git a/IOB-WIN-FORM/Iob/Generic.Protected.cs b/IOB-WIN-FORM/Iob/Generic.Protected.cs index c4c26b2b..31018f68 100644 --- a/IOB-WIN-FORM/Iob/Generic.Protected.cs +++ b/IOB-WIN-FORM/Iob/Generic.Protected.cs @@ -2309,6 +2309,10 @@ namespace IOB_WIN_FORM.Iob { } + /// + /// Ponte esecuzione processi asunc + /// + /// protected virtual bool ProcessFileImport() { bool fatto = false; diff --git a/IOB-WIN-FORM/Iob/Generic.Public.cs b/IOB-WIN-FORM/Iob/Generic.Public.cs index e5506eb9..23ef7a22 100644 --- a/IOB-WIN-FORM/Iob/Generic.Public.cs +++ b/IOB-WIN-FORM/Iob/Generic.Public.cs @@ -41,9 +41,11 @@ namespace IOB_WIN_FORM.Iob /// inizializzo l'oggetto sulla form SULLA BASE DEL FILE DI CONFIGURAZIONE letto /// /// Form chiamante - /// Configurazione (v 4.x) + /// Configurazione (v 4.x) public Generic(AdapterForm caller, IobConfTree IobConfNew) { + // salvo il form chiamante + parentForm = caller; if (IobConfNew != null) { // salvo configurazione... @@ -58,8 +60,6 @@ namespace IOB_WIN_FORM.Iob // initi oggetto TCMan tcMan = new TCMan(IobConfNew.TCDataConf.Lambda, IobConfNew.TCDataConf.MaxDelayFactor, IobConfNew.TCDataConf.MaxIncrPz); - // salvo il form chiamante - parentForm = caller; lastConnectTry = DateTime.Now; @@ -100,6 +100,16 @@ namespace IOB_WIN_FORM.Iob } } + /// + /// Area init asincrono (fare override async!o) + /// + /// + public virtual Task InitializeAsync() + { + // da usare per implementare logiche di init specifiche + return Task.CompletedTask; + } + #endregion Public Constructors #region Public Events @@ -2549,7 +2559,7 @@ namespace IOB_WIN_FORM.Iob /// /// /// - public async Task < Dictionary> ProcessTask(Dictionary task2exe, string codTav) + public async Task> ProcessTask(Dictionary task2exe, string codTav) { Dictionary taskDone = new Dictionary(); Dictionary task2Add = new Dictionary(); diff --git a/IOB-WIN-FORM/Iob/Simula.cs b/IOB-WIN-FORM/Iob/Simula.cs index 131823c8..4ffb032f 100644 --- a/IOB-WIN-FORM/Iob/Simula.cs +++ b/IOB-WIN-FORM/Iob/Simula.cs @@ -156,6 +156,18 @@ namespace IOB_WIN_FORM.Iob } } + /// + /// Caricamento conf specifica in async + /// + /// + public override async Task InitializeAsync() + { + await Simula_Load(DateTime.Now); + // attendo altri 500ms + await Task.Delay(500); + } + + #endregion Public Constructors #region Public Methods @@ -957,27 +969,6 @@ namespace IOB_WIN_FORM.Iob /// protected override void ProcessDataSync() { -#if false - try - { - // fixme todo: test scrittura file csv... - var taskGet = iobGetDataFromServer(); - var taskWrite = iobWriteLocalCSV(); - var taskSend = iobSendFTP(""); - // richiesta check autoODL - ProcessAutoOdlAsync(); - // richiesta generazione quotidiana dossiers - ProcessAutoDossier(); - // effettua gestione import file... - ProcessFileImportAsync(); - // effettua process ritorno ricette - ProcessRecipeFileRetAsync(); - } - catch (Exception exc) - { - lgError($"Eccezione in processDataSync:{Environment.NewLine}{exc}"); - } -#endif try { // "Ponte" sincrono -> asincrono @@ -999,7 +990,9 @@ namespace IOB_WIN_FORM.Iob // ProcessAutoDossier (se è sincrono) lo chiamiamo qui o fuori ProcessAutoDossier(); - }).GetAwaiter().GetResult(); // Blocca qui finché tutto il gruppo è completo + }) + .GetAwaiter() + .GetResult(); // Blocca qui finché tutto il gruppo è completo } catch (Exception exc) { diff --git a/IOB-WIN-FORM/MainForm.cs b/IOB-WIN-FORM/MainForm.cs index c8d80e04..a24fafe8 100644 --- a/IOB-WIN-FORM/MainForm.cs +++ b/IOB-WIN-FORM/MainForm.cs @@ -903,26 +903,19 @@ namespace IOB_WIN_FORM } } - private void downloadIOBConfToolStripMenuItem_Click(object sender, EventArgs e) + private async void downloadIOBConfToolStripMenuItem_Click(object sender, EventArgs e) { try { - // PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione - Task.Run(async () => - { - displayTaskAndLog("Attesa chiusura Adapters"); - await Task.Delay(100); - // fermo gli IOB - closeAllChild(); - await Task.Delay(100); - // download da su server di TUTTI i file CONF delle IOB - doConfDownload(); - // riavvio gli IOB - await Task.Delay(100); - startAdapters(); - }) - .GetAwaiter() - .GetResult(); + displayTaskAndLog("Attesa chiusura Adapters"); + // fermo gli IOB + closeAllChild(); + await Task.Delay(200); + // download da su server di TUTTI i file CONF delle IOB + doConfDownload(); + await Task.Delay(100); + // riavvio gli IOB + startAdapters(); } catch (Exception exc) { @@ -1097,24 +1090,11 @@ namespace IOB_WIN_FORM } } - private void restartALLAdaptersToolStripMenuItem_Click(object sender, EventArgs e) + private async void restartALLAdaptersToolStripMenuItem_Click(object sender, EventArgs e) { // chiudo closeAllChild(); - try - { - // PONTE SYNC/ASYNC: Ora sw.Stop() aspetterà la fine reale dell'operazione - Task.Run(async () => - { - await Task.Delay(1000); - }) - .GetAwaiter() - .GetResult(); - } - catch (Exception ex) - { - lgError($"Errore in restartALLAdaptersToolStripMenuItem_Click{Environment.NewLine}{ex.Message}"); - } + await Task.Delay(100); // riapro startAdapters(); } diff --git a/IOB-WIN-FTP/AdapterFormNext.cs b/IOB-WIN-FTP/AdapterFormNext.cs index 78d223bd..68bf98e0 100644 --- a/IOB-WIN-FTP/AdapterFormNext.cs +++ b/IOB-WIN-FTP/AdapterFormNext.cs @@ -21,7 +21,7 @@ namespace IOB_WIN_FTP /// /// carica IOB richiesto /// - protected override void loadIobType() + protected override async Task loadIobType() { if (IOBConfFull != null) { @@ -39,6 +39,10 @@ namespace IOB_WIN_FTP btnStart.Enabled = false; break; } + if (!await iobInitAsync()) + { + return; + } UpdateDisplTypeIobSel(); } } diff --git a/IOB-WIN-FTP/Iob/Ftp.cs b/IOB-WIN-FTP/Iob/Ftp.cs index 9b8f3efb..03e180b5 100644 --- a/IOB-WIN-FTP/Iob/Ftp.cs +++ b/IOB-WIN-FTP/Iob/Ftp.cs @@ -9,6 +9,7 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Net.NetworkInformation; +using System.Threading.Tasks; namespace IOB_WIN_FTP.Iob { @@ -87,8 +88,6 @@ namespace IOB_WIN_FTP.Iob } } forceMemMap(); - // invio conf macchina all'inizio - SendMachineConf(); } #endregion Public Constructors @@ -270,6 +269,12 @@ namespace IOB_WIN_FTP.Iob return taskDone; } + public override async Task InitializeAsync() + { + // invio conf macchina all'inizio + await SendMachineConfAsync(); + } + /// /// Effettua processing CUSTOM x FTP: /// - prende ogni conf specifica diff --git a/IOB-WIN-KAWASAKI/AdapterFormNext.cs b/IOB-WIN-KAWASAKI/AdapterFormNext.cs index 9d77762d..e8409bd1 100644 --- a/IOB-WIN-KAWASAKI/AdapterFormNext.cs +++ b/IOB-WIN-KAWASAKI/AdapterFormNext.cs @@ -1,4 +1,5 @@ using IOB_UT_NEXT; +using System.Threading.Tasks; namespace IOB_WIN_KAWASAKI { @@ -15,7 +16,7 @@ namespace IOB_WIN_KAWASAKI /// /// carica IOB richiesto /// - protected override void loadIobType() + protected override async Task loadIobType() { if (IOBConfFull != null) { @@ -34,6 +35,10 @@ namespace IOB_WIN_KAWASAKI btnStart.Enabled = false; break; } + if (!await iobInitAsync()) + { + return; + } UpdateDisplTypeIobSel(); } } diff --git a/IOB-WIN-MBUS/AdapterFormNext.cs b/IOB-WIN-MBUS/AdapterFormNext.cs index 76245878..dd47d40e 100644 --- a/IOB-WIN-MBUS/AdapterFormNext.cs +++ b/IOB-WIN-MBUS/AdapterFormNext.cs @@ -21,7 +21,7 @@ namespace IOB_WIN_MBUS /// /// carica IOB richiesto /// - protected override void loadIobType() + protected override async Task loadIobType() { if (IOBConfFull != null) { @@ -90,6 +90,10 @@ namespace IOB_WIN_MBUS btnStart.Enabled = false; break; } + if (!await iobInitAsync()) + { + return; + } UpdateDisplTypeIobSel(); } } diff --git a/IOB-WIN-MITSUBISHI/AdapterFormNext.cs b/IOB-WIN-MITSUBISHI/AdapterFormNext.cs index 9cdf4e25..5baa8629 100644 --- a/IOB-WIN-MITSUBISHI/AdapterFormNext.cs +++ b/IOB-WIN-MITSUBISHI/AdapterFormNext.cs @@ -21,7 +21,7 @@ namespace IOB_WIN_MITSUBISHI /// /// carica IOB richiesto /// - protected override void loadIobType() + protected override async Task loadIobType() { if (IOBConfFull != null) { @@ -39,6 +39,10 @@ namespace IOB_WIN_MITSUBISHI btnStart.Enabled = false; break; } + if (!await iobInitAsync()) + { + return; + } UpdateDisplTypeIobSel(); } } diff --git a/IOB-WIN-MTC/AdapterFormNext.cs b/IOB-WIN-MTC/AdapterFormNext.cs index e0645a8f..bde01970 100644 --- a/IOB-WIN-MTC/AdapterFormNext.cs +++ b/IOB-WIN-MTC/AdapterFormNext.cs @@ -21,7 +21,7 @@ namespace IOB_WIN_MTC /// /// carica IOB richiesto /// - protected override void loadIobType() + protected override async Task loadIobType() { if (IOBConfFull != null) { @@ -39,6 +39,10 @@ namespace IOB_WIN_MTC btnStart.Enabled = false; break; } + if (!await iobInitAsync()) + { + return; + } UpdateDisplTypeIobSel(); } } diff --git a/IOB-WIN-OMRON/AdapterFormNext.cs b/IOB-WIN-OMRON/AdapterFormNext.cs index 98d4a08e..d750bffb 100644 --- a/IOB-WIN-OMRON/AdapterFormNext.cs +++ b/IOB-WIN-OMRON/AdapterFormNext.cs @@ -21,7 +21,7 @@ namespace IOB_WIN_OMRON /// /// carica IOB richiesto /// - protected override void loadIobType() + protected override async Task loadIobType() { if (IOBConfFull != null) { @@ -40,6 +40,10 @@ namespace IOB_WIN_OMRON btnStart.Enabled = false; break; } + if (!await iobInitAsync()) + { + return; + } UpdateDisplTypeIobSel(); } } diff --git a/IOB-WIN-OPC-UA/AdapterFormNext.cs b/IOB-WIN-OPC-UA/AdapterFormNext.cs index 2a550f93..136a90fd 100644 --- a/IOB-WIN-OPC-UA/AdapterFormNext.cs +++ b/IOB-WIN-OPC-UA/AdapterFormNext.cs @@ -21,7 +21,7 @@ namespace IOB_WIN_OPC_UA /// /// carica IOB richiesto /// - protected override void loadIobType() + protected override async Task loadIobType() { if (IOBConfFull != null) { @@ -136,6 +136,10 @@ namespace IOB_WIN_OPC_UA btnStart.Enabled = false; break; } + if (!await iobInitAsync()) + { + return; + } UpdateDisplTypeIobSel(); } } diff --git a/IOB-WIN-OSAI/AdapterFormNext.cs b/IOB-WIN-OSAI/AdapterFormNext.cs index d27a0043..ba25aeca 100644 --- a/IOB-WIN-OSAI/AdapterFormNext.cs +++ b/IOB-WIN-OSAI/AdapterFormNext.cs @@ -21,7 +21,7 @@ namespace IOB_WIN_OSAI /// /// carica IOB richiesto /// - protected override void loadIobType() + protected override async Task loadIobType() { if (IOBConfFull != null) { @@ -42,6 +42,10 @@ namespace IOB_WIN_OSAI btnStart.Enabled = false; break; } + if (!await iobInitAsync()) + { + return; + } UpdateDisplTypeIobSel(); } } diff --git a/IOB-WIN-PING/AdapterFormNext.cs b/IOB-WIN-PING/AdapterFormNext.cs index 8bb1d773..a1e0c080 100644 --- a/IOB-WIN-PING/AdapterFormNext.cs +++ b/IOB-WIN-PING/AdapterFormNext.cs @@ -27,7 +27,7 @@ namespace IOB_WIN_SHELLY /// /// carica IOB richiesto /// - protected override void loadIobType() + protected override async Task loadIobType() { if (IOBConfFull != null) { @@ -45,6 +45,10 @@ namespace IOB_WIN_SHELLY btnStart.Enabled = false; break; } + if (!await iobInitAsync()) + { + return; + } UpdateDisplTypeIobSel(); } } diff --git a/IOB-WIN-SHELLY/AdapterFormNext.cs b/IOB-WIN-SHELLY/AdapterFormNext.cs index 2d095067..4abe0436 100644 --- a/IOB-WIN-SHELLY/AdapterFormNext.cs +++ b/IOB-WIN-SHELLY/AdapterFormNext.cs @@ -27,7 +27,7 @@ namespace IOB_WIN_SHELLY /// /// carica IOB richiesto /// - protected override void loadIobType() + protected override async Task loadIobType() { if (IOBConfFull != null) { @@ -51,6 +51,10 @@ namespace IOB_WIN_SHELLY btnStart.Enabled = false; break; } + if (!await iobInitAsync()) + { + return; + } UpdateDisplTypeIobSel(); } } diff --git a/IOB-WIN-SHELLY/DATA/CONF/MAIN.ini b/IOB-WIN-SHELLY/DATA/CONF/MAIN.ini index 6d969ab3..68993cad 100644 --- a/IOB-WIN-SHELLY/DATA/CONF/MAIN.ini +++ b/IOB-WIN-SHELLY/DATA/CONF/MAIN.ini @@ -20,9 +20,9 @@ CLI_INST=SteamWareSim ;STARTLIST=SIMUL_01 ;STARTLIST=SHELLY_01 ;STARTLIST=SHELLY_Pro3EM -STARTLIST=SIMUL_03_SHELLY ;STARTLIST=SIMUL_04_SHELLY ;STARTLIST=SIMUL_05_SHELLY ;STARTLIST=i727_SHELLY +STARTLIST=SIMUL_03_SHELLY MAXCNC=10 \ No newline at end of file diff --git a/IOB-WIN-SHELLY/DATA/CONF/SIMUL_01.ini b/IOB-WIN-SHELLY/DATA/CONF/SIMUL_01.ini new file mode 100644 index 00000000..6001e3cf --- /dev/null +++ b/IOB-WIN-SHELLY/DATA/CONF/SIMUL_01.ini @@ -0,0 +1,120 @@ +;Configurazione IOB-WIN +[IOB] +CNCTYPE=SIMULA +PING_MS_TIMEOUT=500 +MinDeltaSec=5 +EnableRedisQueue=true +;IOB_NAME=TFT_RAMA_001 + +[MACHINE] +VENDOR=STEAMWARE +MODEL=DEMO_SIMULATOR + +[CNC] +IP=127.0.0.1 +PORT=0000 + +[SERVER] +MPIP=http://10.74.82.218 +MPURL=/MP/IO +CMDBASE=/IOB/input/ +CMDFLOG=/IOB/flog/ +CMDALIVE=/IOB +CMDENABLED=/IOB/enabled/ +CMDADV1=?valore= +CMDREBO=/sendReboot.aspx?idxMacchina= +CMD_ODL_STARTED=/IOB/getCurrOdlStart/ +CMD_FORCLE_SPLIT_ODL=/IOB/forceSplitOdlFull/ +CMD_IDLE_TIME=/IOB/getIdlePeriod/ + +[MEMORY] + +[BLINK] +MAX_COUNTER_BLINK = 15 +BLINK_FILT=0 + +[OPTPAR] +DISABLE_SEND_WDST=TRUE +AUTO_CHANGE_ODL=true +AUTO_SNAPSHOT_DOSSIER=true +CHANGE_ODL_HOURS=24 +CHANGE_ODL_IDLE_MIN=0 +CHANGE_ODL_MODE=SIMUL +; gestione custom timer +timerIntMs=100 +;PZCOUNT_MODE=STD.[PAR/MEM].info|BIT.indice +PZCOUNT_MODE=BIT +ENABLE_PZ_RESET=TRUE +;gestione invio pezzi in blocco +ENABLE_SEND_PZC_BLOCK=TRUE +MIN_SEND_PZC_BLOCK=0 +MAX_SEND_PZC_BLOCK=100 +; gestione cambio ODL automatico (minuti minimi durata) +MIN_DURATA_ODL=960 +; per il simulatore: 50|1 = WAIT 50, DURATION 1 con riferimento al PERIODO base (PER_BASE in ms, default 10 secondi) +PER_BASE=10100 +SIM_PZCNT=5|1 +SIM_ALARM=100|10 +SIM_MANU=50|6 +; indica gestione e simulazione bit 5 --> slow +SIM_SLOW=3600|20 +; indica gestione e simulazione bit 6 --> warmup/cooldown +SIM_WUCD=8000|20 +; indica gestione e simulazione bit 7 --> emergenza +SIM_EMRG=4000|10 +; indica simulazione delle funzionalità power ON/ OFF +SIM_POW_ON_OFF=true +T_ON=7 +T_OFF=22 +; indica simulazione controlli utente +SIM_RC=641|1 +; indica simulazione registro scarti +SIM_RS=461|1 +; indica simulazione dichiarazioni (note) utente +SIM_DICH=761|1 +; indica matricola opr simulata +SIM_MATR_OPR=1 + +; test x datasync... +DATA_SYNC_AT_START=true +; test sim dossiers tipo Kepware +SIM_KWP=true + +; gestione DynData simulati +ENABLE_DYN_DATA=TRUE +FORCE_DYN_DATA=TRUE +NEW_DYN_DATA=TRUE +; indica parametri gestione TcMan +TC_MAX_TC_FACTOR=3.9 +TC_LAMBDA=0.4 +TC_MAX_INCR=5 +MAX_PZ_INCR_PERC=1000 +; conf parametri memoria READ/WRITE +PARAM_CONF=SIMUL_01.json +ALARM_CONF=SIMUL_01_alarm.json +;test gestione logfile (eg: soitaab) +EnabelPodlManFull=true +CodGruppoIob=STEAMWARE-SIM-FASE-01 +; invio flux alla lettura file +sendFluxOnRead=true + +;conf test FTP +FTP_SERVER=ftp.steamware.net +FTP_USER=testftpuser +FTP_PWD=we4reFromB3rghem! +FTP_CERT= +FTP_SKIP=TRUE +FTP_LOC_DIR=temp\csv +FTP_REM_DIR= +CSV_ADD_HEADER=true + + +[BRANCH] +NAME=master + +; Tags manuali +[TAGS] +Customer=Steamware +HostOS=WIN +HostName=IOB-WIN-SIMULA +HostAddr=10.74.82.76 diff --git a/IOB-WIN-SHELLY/DATA/CONF/SIMUL_01.json b/IOB-WIN-SHELLY/DATA/CONF/SIMUL_01.json new file mode 100644 index 00000000..d2895eb1 --- /dev/null +++ b/IOB-WIN-SHELLY/DATA/CONF/SIMUL_01.json @@ -0,0 +1,410 @@ +{ + "mMapWrite": { + "setArt": { + "name": "setArt", + "description": "Articolo", + "memAddr": "DB150.DBB12", + "tipoMem": "String", + "index": 12, + "size": 20, + "displOrdinal": 1 + }, + "setArtNum": { + "name": "setArtNum", + "description": "# Num Articolo", + "memAddr": "DB150.DBB112", + "tipoMem": "Int", + "index": 112, + "size": 4, + "displOrdinal": 1 + }, + "setComm": { + "name": "setComm", + "description": "Commessa", + "memAddr": "DB150.DBB32", + "tipoMem": "String", + "index": 32, + "size": 20, + "displOrdinal": 2 + }, + "setCommNum": { + "name": "setCommNum", + "description": "# NumCommessa", + "memAddr": "DB150.DBB132", + "tipoMem": "Int", + "index": 132, + "size": 4, + "displOrdinal": 2 + }, + "setPzComm": { + "name": "setPzComm", + "description": "Qta Richiesta", + "memAddr": "DB150.DBB8", + "tipoMem": "Int", + "index": 8, + "size": 4, + "displOrdinal": 3 + }, + "forceSetPzCount": { + "name": "forceSetPzCount", + "description": "Imposta Qta", + "memAddr": "DB150.DBB8", + "tipoMem": "Int", + "index": 8, + "size": 4, + "displOrdinal": 11 + }, + //"OPC_Set Point.Chain Spped": { + // "name": "OPC_Set Point.Chain Spped", + // "description": "Chain Spped", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Chain Spped", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Top Overfeeding": { + // "name": "OPC_Set Point.Top Overfeeding", + // "description": "Top Overfeeding", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Top Overfeeding", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Bottom Overfeeding": { + // "name": "OPC_Set Point.Bottom Overfeeding", + // "description": "Bottom Overfeeding", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Bottom Overfeeding", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Width Master": { + // "name": "OPC_Set Point.Width Master", + // "description": "Width Master", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Width Master", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Thermoset Time": { + // "name": "OPC_Set Point.Thermoset Time", + // "description": "Thermoset Time", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Thermoset Time", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Thermoset Temperature": { + // "name": "OPC_Set Point.Thermoset Temperature", + // "description": "Thermoset Temperature", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Thermoset Temperature", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Take Off Overfeeding": { + // "name": "OPC_Set Point.Take Off Overfeeding", + // "description": "Take Off Overfeeding", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Take Off Overfeeding", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Small Roller Overfeeding": { + // "name": "OPC_Set Point.Small Roller Overfeeding", + // "description": "Small Roller Overfeeding", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Small Roller Overfeeding", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Scroll Roller Overfeeding": { + // "name": "OPC_Set Point.Scroll Roller Overfeeding", + // "description": "Scroll Roller Overfeeding", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Scroll Roller Overfeeding", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Right Whell Overfeeding": { + // "name": "OPC_Set Point.Right Whell Overfeeding", + // "description": "Right Whell Overfeeding", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Right Whell Overfeeding", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Plaiter Overfeeding": { + // "name": "OPC_Set Point.Plaiter Overfeeding", + // "description": "Plaiter Overfeeding", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Plaiter Overfeeding", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Load cell Weight": { + // "name": "OPC_Set Point.Load cell Weight", + // "description": "Load cell Weight", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Load cell Weight", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Left Wheel Overfeeding": { + // "name": "OPC_Set Point.Left Wheel Overfeeding", + // "description": "Left Wheel Overfeeding", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Left Wheel Overfeeding", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Fan 105A Speed": { + // "name": "OPC_Set Point.Fan 105A Speed", + // "description": "Fan 105A Speed", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Fan 105A Speed", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Fan 105 Speed": { + // "name": "OPC_Set Point.Fan 105 Speed", + // "description": "Fan 105 Speed", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Fan 105 Speed", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Fan 103A Speed": { + // "name": "OPC_Set Point.Fan 103A Speed", + // "description": "Fan 103A Speed", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Fan 103A Speed", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Fan 103 Speed": { + // "name": "OPC_Set Point.Fan 103 Speed", + // "description": "Fan 103 Speed", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Fan 103 Speed", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Fan 101A Speed": { + // "name": "OPC_Set Point.Fan 101A Speed", + // "description": "Fan 101A Speed", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Fan 101A Speed", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Fan 101 Speed": { + // "name": "OPC_Set Point.Fan 101 Speed", + // "description": "Fan 101 Speed", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Fan 101 Speed", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Exhaust Fan 1 Speed": { + // "name": "OPC_Set Point.Exhaust Fan 1 Speed", + // "description": "Exhaust Fan 1 Speed", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Exhaust Fan 1 Speed", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Differentiation Spindle 5": { + // "name": "OPC_Set Point.Differentiation Spindle 5", + // "description": "Differentiation Spindle 5", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Differentiation Spindle 5", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Differentiation Spindle 4": { + // "name": "OPC_Set Point.Differentiation Spindle 4", + // "description": "Differentiation Spindle 4", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Differentiation Spindle 4", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Differentiation Spindle 3": { + // "name": "OPC_Set Point.Differentiation Spindle 3", + // "description": "Differentiation Spindle 3", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Differentiation Spindle 3", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Differentiation Spindle 2": { + // "name": "OPC_Set Point.Differentiation Spindle 2", + // "description": "Differentiation Spindle 2", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Differentiation Spindle 2", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Differentiation Spindle 1": { + // "name": "OPC_Set Point.Differentiation Spindle 1", + // "description": "Differentiation Spindle 1", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Differentiation Spindle 1", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Cooling Cell 1 Speed": { + // "name": "OPC_Set Point.Cooling Cell 1 Speed", + // "description": "Cooling Cell 1 Speed", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Cooling Cell 1 Speed", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Burner 6 Temperature": { + // "name": "OPC_Set Point.Burner 6 Temperature", + // "description": "Burner 6 Temperature", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Burner 6 Temperature", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Burner 5 Temperature": { + // "name": "OPC_Set Point.Burner 5 Temperature", + // "description": "Burner 5 Temperature", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Burner 5 Temperature", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Burner 4 Temperature": { + // "name": "OPC_Set Point.Burner 4 Temperature", + // "description": "Burner 4 Temperature", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Burner 4 Temperature", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Burner 3 Temperature": { + // "name": "OPC_Set Point.Burner 3 Temperature", + // "description": "Burner 3 Temperature", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Burner 3 Temperature", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Burner 2 Temperature": { + // "name": "OPC_Set Point.Burner 2 Temperature", + // "description": "Burner 2 Temperature", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Burner 2 Temperature", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Burner 1 Temperature": { + // "name": "OPC_Set Point.Burner 1 Temperature", + // "description": "Burner 1 Temperature", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Burner 1 Temperature", + // "index": 0, + // "size": 0 + //}, + //"OPC_Set Point.Air Humidity Preset Esa 1": { + // "name": "OPC_Set Point.Air Humidity Preset Esa 1", + // "description": "Air Humidity Preset Esa 1", + // "tipoMem": "String", + // "memAddr": "ns=2;s=RamosaETN21.RamosaCJ2.Recipe.Air Humidity Preset Esa 1", + // "index": 0, + // "size": 0 + //} + }, + "mMapRead": { + "TEMP_01": { + "name": "TEMP_01", + "description": "Temperatura 01", + "tipoMem": "Real", + "minVal": 18, + "maxVal": 24, + "displOrdinal": 4 + }, + "POWER_01": { + "name": "POWER_01", + "description": "Potenza impianto", + "tipoMem": "Int", + "minVal": 40, + "maxVal": 80, + "displOrdinal": 5 + }, + "FEED_OVER": { + "name": "FEED_OVER", + "description": "FEED override", + "tipoMem": "Int", + "minVal": 0, + "maxVal": 100, + "displOrdinal": 6 + }, + "RAPID_OVER": { + "name": "RAPID_OVER", + "description": "RAPID override", + "tipoMem": "Int", + "minVal": 50, + "maxVal": 120, + "displOrdinal": 7 + }, + "POS_X": { + "name": "POS_X", + "description": "Asse X", + "tipoMem": "Int", + "minVal": -2000, + "maxVal": 2000, + "displOrdinal": 8 + }, + "POS_Y": { + "name": "POS_Y", + "description": "Asse Y", + "tipoMem": "Int", + "minVal": 0, + "maxVal": 2000, + "displOrdinal": 9 + }, + "POS_Z": { + "name": "POS_Z", + "description": "Asse Z", + "tipoMem": "Int", + "minVal": 0, + "maxVal": 1500, + "displOrdinal": 10 + } + }, + "optKVP": { + "fluxLogReduce": true, + "fluxLogRedDeadBand": 1.5, + "fluxLogResendPeriod": 15, + "hasRecipe": true, + "maxPodlQty": 530, + "useLocalRecipe": true, + "path-locBase": "C:\\MesData\\", + "path-00-Arch": "ArchivioRicette\\FIMAT", + "path-01-Temp": "01-Temp\\FIMAT", + "path-02-Sent": "02-Inviate\\FIMAT", + "path-03-Recv": "03-Ricevute\\FIMAT", + "path-04-remReq": "Y:\\", + "path-05-remExe": "C:\\MesData\\Remote\\Dosed", + "path-06-remRec": "R:\\", + "path-outReport": "C:\\MesData\\Report", + "path-confSetup": "C:\\MesData\\Setup\\setupConsumi.json", + "replace-": "{{PODL}}", + "replace-": "Kg{{Qty}} | {{Note}}" + }, //, + //"BaseKeyTranslate": "ns=2;s=RamosaETN21.RamosaCJ2", + //"RecipeKeyTranslate": { + // "Present Value.General Fan": "Recipe.Chain Spped", + // "Present Value.Bottom Overfeeding": "Recipe.Bottom Overfeeding", + // "Present Value.Top Overfeeding": "Recipe.Top Overfeeding" + //} + "mMapWriteLink": { + "setArt": "setArtNum", + "setComm": "setCommNum" + } +} \ No newline at end of file diff --git a/IOB-WIN-SHELLY/IOB-WIN-SHELLY.csproj b/IOB-WIN-SHELLY/IOB-WIN-SHELLY.csproj index 88f85290..522771f4 100644 --- a/IOB-WIN-SHELLY/IOB-WIN-SHELLY.csproj +++ b/IOB-WIN-SHELLY/IOB-WIN-SHELLY.csproj @@ -176,6 +176,12 @@ Always + + Always + + + Always + Always diff --git a/IOB-WIN-SHELLY/Iob/ShellyClientGen1.cs b/IOB-WIN-SHELLY/Iob/ShellyClientGen1.cs index 426d037c..68bf4da1 100644 --- a/IOB-WIN-SHELLY/Iob/ShellyClientGen1.cs +++ b/IOB-WIN-SHELLY/Iob/ShellyClientGen1.cs @@ -68,8 +68,12 @@ namespace IOB_WIN_SHELLY.Iob shellyCli = new Shelly1PmClient(new HttpClient(), options); + } + + public override async Task InitializeAsync() + { // invio conf macchina all'inizio - SendMachineConf(); + await SendMachineConfAsync(); } #endregion Public Constructors diff --git a/IOB-WIN-SHELLY/Iob/ShellyClientGen2.cs b/IOB-WIN-SHELLY/Iob/ShellyClientGen2.cs index 8e0ae611..2ee2301a 100644 --- a/IOB-WIN-SHELLY/Iob/ShellyClientGen2.cs +++ b/IOB-WIN-SHELLY/Iob/ShellyClientGen2.cs @@ -69,8 +69,12 @@ namespace IOB_WIN_SHELLY.Iob shellyCli = new ShellyPro3EmClient(new HttpClient(), options); + } + + public override async Task InitializeAsync() + { // invio conf macchina all'inizio - SendMachineConf(); + await SendMachineConfAsync(); } #endregion Public Constructors diff --git a/IOB-WIN-SIEMENS/AdapterFormNext.cs b/IOB-WIN-SIEMENS/AdapterFormNext.cs index 008f6d7a..451a7522 100644 --- a/IOB-WIN-SIEMENS/AdapterFormNext.cs +++ b/IOB-WIN-SIEMENS/AdapterFormNext.cs @@ -21,7 +21,7 @@ namespace IOB_WIN_SIEMENS /// /// carica IOB richiesto /// - protected override void loadIobType() + protected override async Task loadIobType() { if (IOBConfFull != null) { @@ -115,6 +115,10 @@ namespace IOB_WIN_SIEMENS btnStart.Enabled = false; break; } + if (!await iobInitAsync()) + { + return; + } UpdateDisplTypeIobSel(); } } diff --git a/IOB-WIN-SQL/AdapterFormNext.cs b/IOB-WIN-SQL/AdapterFormNext.cs index df29a87d..87193152 100644 --- a/IOB-WIN-SQL/AdapterFormNext.cs +++ b/IOB-WIN-SQL/AdapterFormNext.cs @@ -21,7 +21,7 @@ namespace IOB_WIN_SQL /// /// carica IOB richiesto /// - protected override void loadIobType() + protected override async Task loadIobType() { if (IOBConfFull != null) { @@ -54,6 +54,10 @@ namespace IOB_WIN_SQL btnStart.Enabled = false; break; } + if (!await iobInitAsync()) + { + return; + } UpdateDisplTypeIobSel(); } } diff --git a/IOB-WIN-WPS/AdapterFormNext.cs b/IOB-WIN-WPS/AdapterFormNext.cs index e019f072..0dda2278 100644 --- a/IOB-WIN-WPS/AdapterFormNext.cs +++ b/IOB-WIN-WPS/AdapterFormNext.cs @@ -21,7 +21,7 @@ namespace IOB_WIN_WPS /// /// carica IOB richiesto /// - protected override void loadIobType() + protected override async Task loadIobType() { if (IOBConfFull != null) { @@ -40,6 +40,10 @@ namespace IOB_WIN_WPS btnStart.Enabled = false; break; } + if (!await iobInitAsync()) + { + return; + } UpdateDisplTypeIobSel(); } } diff --git a/IOB-WIN-WS/AdapterFormNext.cs b/IOB-WIN-WS/AdapterFormNext.cs index 3f005aac..b51673e6 100644 --- a/IOB-WIN-WS/AdapterFormNext.cs +++ b/IOB-WIN-WS/AdapterFormNext.cs @@ -21,7 +21,7 @@ namespace IOB_WIN_WS /// /// carica IOB richiesto /// - protected override void loadIobType() + protected override async Task loadIobType() { if (IOBConfFull != null) { @@ -60,6 +60,10 @@ namespace IOB_WIN_WS btnStart.Enabled = false; break; } + if (!await iobInitAsync()) + { + return; + } UpdateDisplTypeIobSel(); } }