diff --git a/IOB-UT-NEXT/Config/Base/AlarmDto.cs b/IOB-UT-NEXT/Config/Base/AlarmDto.cs new file mode 100644 index 00000000..deb05245 --- /dev/null +++ b/IOB-UT-NEXT/Config/Base/AlarmDto.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static IOB_UT_NEXT.BaseAlarmConf; + +namespace IOB_UT_NEXT.Config.Base +{ + public class AlarmDto + { + /// + /// Livello minimo allarmi da considerare x invio + /// + public AlarmLevel alarmLevelMin = AlarmLevel.Alarm; + + /// + /// Struttura allarmi mappati + /// + public List AlarmMaps = new List(); + + /// + /// Tipo di allarmi gestiti + /// rif: BaseAlarmConf.AlarmBlockType.[Bitmap/ActiveList] + /// + public AlarmBlockType alarmType = AlarmBlockType.Bitmap; + + } +} diff --git a/IOB-UT-NEXT/Config/Base/CmdUriDto.cs b/IOB-UT-NEXT/Config/Base/CmdUriDto.cs new file mode 100644 index 00000000..4cdd3eca --- /dev/null +++ b/IOB-UT-NEXT/Config/Base/CmdUriDto.cs @@ -0,0 +1,85 @@ +using System.Collections.Generic; +using System.Linq; + +namespace IOB_UT_NEXT.Config.Base +{ + /// + /// Set comandi URI x chiamate server + /// + public class CmdUriDto + { + #region Public Constructors + + /// + /// Init classe gestione comandi + /// + /// + public CmdUriDto(string baseURI) + { + BaseUri = baseURI; + } + + #endregion Public Constructors + + #region Public Properties + + /// + /// comando base x USER LOG - salvataggio parametri extra sistema MAPO + /// + public string ULog { get; set; } = "IOB/ulog/"; + + /// + /// comando base x USER LOG - salvataggio parametri extra sistema MAPO in modalità JSON + /// payload come lista + /// + public string ULogJson { get; set; } = "IOB/ulogJson/"; + + #endregion Public Properties + + #region Public Methods + + /// + /// Recupera path/URI comando richiesto (SE disponibile) senno default + /// + /// + /// + public string GetCommand(string key) + { + // default ad implicito... + string answ = $"{BaseUri}/{key}/"; + if (CurrSetup.ContainsKey(key)) + { + answ = CurrSetup[key]; + } + return answ; + } + + public Dictionary StdCommands() + { + CurrSetup = new Dictionary(); + CurrSetup.Add("Alive", "IOB"); + CurrSetup.Add("Base", "IOB/input/"); + CurrSetup.Add("BaseJson", "IOB/evListJson/"); + CurrSetup.Add("RawTransfJson", "IOB/rawTransfJson/"); + CurrSetup.Add("Enabled", "IOB/enabled/"); + CurrSetup.Add("Flog", "IOB/flog/"); + CurrSetup.Add("FlogJson", "IOB/flogJson/"); + CurrSetup.Add("ForcleSplitOdl", "IOB/forceSplitOdlFull/"); + CurrSetup.Add("IdleTime", "IOB/getIdlePeriod/"); + CurrSetup.Add("OdlStarted", "IOB/getCurrOdlStart/"); + CurrSetup.Add("Reboot", "IOB/sendReboot.aspx?idxMacchina=/"); + // riordino + CurrSetup = CurrSetup.OrderBy(x => x.Key).ToDictionary(x => x.Key, x => x.Value); + return CurrSetup; + } + + #endregion Public Methods + + #region Protected Properties + + protected string BaseUri { get; set; } = "IOB"; + protected Dictionary CurrSetup { get; set; } = new Dictionary(); + + #endregion Protected Properties + } +} \ No newline at end of file diff --git a/IOB-UT-NEXT/Config/Base/ConnectionDto.cs b/IOB-UT-NEXT/Config/Base/ConnectionDto.cs new file mode 100644 index 00000000..8e3cae3f --- /dev/null +++ b/IOB-UT-NEXT/Config/Base/ConnectionDto.cs @@ -0,0 +1,30 @@ +using IOB_UT_NEXT.Config.Special; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IOB_UT_NEXT.Config.Base +{ + /// + /// Definizione parametri Macchina / CN / PLC + /// + public class ConnectionDto + { + /// + /// Indirizzo Ip del CNC Controllato + /// + public string IpAddr { get; set; } = "127.0.0.1"; + + /// + /// Porta del CNC Controllato + /// + public string Port { get; set; } = "0"; + + /// + /// Timeout test PING + /// + public int pingMsTimeout { get; set; } = 500; + } +} diff --git a/IOB-UT-NEXT/Config/Base/CustomerDto.cs b/IOB-UT-NEXT/Config/Base/CustomerDto.cs new file mode 100644 index 00000000..59c6695b --- /dev/null +++ b/IOB-UT-NEXT/Config/Base/CustomerDto.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IOB_UT_NEXT.Config.Base +{ + /// + /// Dati relativi al cliente + /// + public class CustomerDto + { + } +} diff --git a/IOB-UT-NEXT/Config/Base/DeviceDto.cs b/IOB-UT-NEXT/Config/Base/DeviceDto.cs new file mode 100644 index 00000000..6cda9736 --- /dev/null +++ b/IOB-UT-NEXT/Config/Base/DeviceDto.cs @@ -0,0 +1,45 @@ +using IOB_UT_NEXT.Config.Special; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IOB_UT_NEXT.Config.Base +{ + /// + /// Dati espliciti relativi al device di riferimento + /// + public class DeviceDto + { + /// + /// Costruttore + /// + public string Vendor { get; set; } = "ACME"; + + /// + /// Codice modello + /// + public string Model { get; set; } = "NONE"; + + /// + /// Dati configurazione CNC + /// + public ConnectionDto ConnectConf { get; set; } = new ConnectionDto(); + + /// + /// Configurazione SignalLUT con regole decodifica valori (es FANUC/Siemens con BIT0...BIT7...) + /// + public Dictionary SignalLUT { get; set; } = new Dictionary(); + + /// + /// Configurazione specifica FANUC (se applicabile) + /// + public FanucDto FanucConf { get; set; } + + /// + /// Configurazione specifica Siemens (se applicabile) + /// + public SiemensDto SiemensConf { get; set; } + } +} diff --git a/IOB-UT-NEXT/Config/Base/DossiersDto.cs b/IOB-UT-NEXT/Config/Base/DossiersDto.cs new file mode 100644 index 00000000..0edf858f --- /dev/null +++ b/IOB-UT-NEXT/Config/Base/DossiersDto.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IOB_UT_NEXT.Config.Base +{ + /// + /// Configurazione specifica per gestione Dossiers + /// (es Baglietto - TravelLift Cimolai) + /// + public class DossiersDto + { + } +} diff --git a/IOB-UT-NEXT/Config/Base/InputSignalDto.cs b/IOB-UT-NEXT/Config/Base/InputSignalDto.cs new file mode 100644 index 00000000..379a5d83 --- /dev/null +++ b/IOB-UT-NEXT/Config/Base/InputSignalDto.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IOB_UT_NEXT.Config.Base +{ + /// + /// Configurazioni specifiche per segnali ingresso (tipicamente gestione blink) + /// + public class InputSignalDto + { + /// + /// Maschera di filtro blink, INT corrispondente ai BIT da filtrare, ad es + /// 11111111 = 255 + /// 00010110 = 22 + /// 00000111 = 7 + /// + public int BlinkFilterMask { get; set; } = 0; + + /// + /// Numero di cicli per cui effettuare il mascheramento dei valori (sul fronte di discesa) + /// + public int BlinkMaxCounter { get; set; } = 10; + + } +} diff --git a/IOB-UT-NEXT/Config/Base/IobDto.cs b/IOB-UT-NEXT/Config/Base/IobDto.cs new file mode 100644 index 00000000..e8ea27dc --- /dev/null +++ b/IOB-UT-NEXT/Config/Base/IobDto.cs @@ -0,0 +1,61 @@ +using IOB_UT_NEXT.Config.Special; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IOB_UT_NEXT.Config.Base +{ + /// + /// Info specifice all'IOB + /// + public class IobDto + { + /// + /// Nome file di configurazione + /// + public string ConfFileName { get; set; } = ""; + + /// + /// Tipo Adapter specifico (implementazione) + /// + public tipoAdapter IobType { get; set; } = tipoAdapter.ND; + + /// + /// Codice Cliente/Installazione + /// + public string Customer { get; set; } = "SteamWare"; + + /// + /// Codice univoco IOB + /// + public string CodIOB { get; set; } = "ND"; + + /// + /// Valore minimo (delta) in sec x considerare variazioni info + /// + public int MinDeltaSec { get; set; } = 5; + + /// + /// Abilita salvataggio coda eventi su redis (ritentiva) + /// + public bool EnableRedisQueue { get; set; } = true; + + /// + /// Indica che sono disabilitati i Task2Exe (tipicamente gestione scrittura verso PLC) + /// + public bool DisableExeTask { get; set; } = false; + + /// + /// Indica che sono disabilitate le fasi controllo stato/semafori (tipicamente x impianti + /// con PLC "suddivisi", PLC + HMI) + /// + public bool DisableStateCh { get; set; } = false; + + /// + /// Versione software IOB + /// + public string ReleaseVers { get; set; } = "0.0.0.0"; + } +} diff --git a/IOB-UT-NEXT/Config/Base/IobManDto.cs b/IOB-UT-NEXT/Config/Base/IobManDto.cs new file mode 100644 index 00000000..4872c381 --- /dev/null +++ b/IOB-UT-NEXT/Config/Base/IobManDto.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IOB_UT_NEXT.Config.Base +{ + /// + /// Setup comunicazione con IOB-MAN tramite REDIS + /// + public class IobManDto + { + + /// + /// Minimo delta in sec x considerare variazioni informazioni inviate ad IOB-MAN via redis + /// + public int MinDeltaSec { get; set; } = 2; + } +} diff --git a/IOB-UT-NEXT/Config/Base/OdlDto.cs b/IOB-UT-NEXT/Config/Base/OdlDto.cs new file mode 100644 index 00000000..d8c09c39 --- /dev/null +++ b/IOB-UT-NEXT/Config/Base/OdlDto.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IOB_UT_NEXT.Config.Base +{ + /// + /// Parametri specifici gestione ODL: + /// - AutoOdl + /// - Split + /// + public class OdlDto + { + /// + /// Gestione automatica del cambio ODL + /// + public bool AutoChangeOdl { get; set; } = false; + + /// + /// Modalità di esecuzione del cambio ODL automatico: + /// - SIMUL + /// - DAILY + /// - ... + /// + public string ChangeOdlMode { get; set; } = ""; + + /// + /// Numero di ore di durata minima (ODL corrente) prima di eseguire una richiesta di cambio ODL automatico + /// + public int ChangeOdlHours { get; set; } = 24; + + /// + /// Durata minima in minuti dello stato idle prima di eseguire una richiesta di cambio ODL + /// Serve ad evitare un cambio ODL mentre la amcchina è in RUN + /// + public int ChangeOdlIdleMin { get; set; } = 0; + + } +} diff --git a/IOB-UT-NEXT/Config/Base/ServerMapoDto.cs b/IOB-UT-NEXT/Config/Base/ServerMapoDto.cs new file mode 100644 index 00000000..90641b06 --- /dev/null +++ b/IOB-UT-NEXT/Config/Base/ServerMapoDto.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IOB_UT_NEXT.Config.Base +{ + public class ServerMapoDto + { + /// + /// Indica il metodo di trasporto http/https + /// + public string Transport { get; set; } = "http"; + + /// + /// Indirizzo IP server + /// + public string IpAddr { get; set; } = "127.0.0.1"; + + /// + /// URL Base del server applicativo + /// + public string BaseAppUrl { get; set; } = "/MP/IO/"; + + /// + /// Dizionario comandi configurati + /// + public Dictionary Commands { get; set; } = new CmdUriDto("IOB").StdCommands(); + + /// + /// Installazione di riferimento + /// + public string ClientInstall { get; set; } = "SW"; + + } +} diff --git a/IOB-UT-NEXT/Config/Base/TCDataDto.cs b/IOB-UT-NEXT/Config/Base/TCDataDto.cs new file mode 100644 index 00000000..b289f200 --- /dev/null +++ b/IOB-UT-NEXT/Config/Base/TCDataDto.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IOB_UT_NEXT.Config.Base +{ + /// + /// Classe gestione parametri legati a gestioen TCDataConf + /// + public class TCDataDto + { + /// + /// Fattore Lambda (innovazione) per calcolo EWMA valore TCiclo corrente + /// + public double Lambda { get; set; } = 0.4; + + /// + /// Fattore massimo ammesso di delay x il TCiclo + /// + public double MaxDelayFactor { get; set; } = 1.2; + + /// + /// Incremento massimo pezzi per cui fare calcolo del tempociclo attuale + /// + public double MaxIncrPz { get; set; } = 2; + + } +} diff --git a/IOB-UT-NEXT/Config/EnumConf.cs b/IOB-UT-NEXT/Config/EnumConf.cs new file mode 100644 index 00000000..1cbfeb43 --- /dev/null +++ b/IOB-UT-NEXT/Config/EnumConf.cs @@ -0,0 +1,398 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IOB_UT_NEXT.Config +{ + public class EnumConf + { + + /// + /// Macro tipologia sistema di comunicazione (macro-adapter) + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ComLayer + { + ND = 0, + Db, + Dll, + File, + ModBus, + Network, + Serial + } + +#if false + /// + /// Tipologia di adapters ammessi + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AdapterType + { + /// + /// Adapter SIMULAZIONE + /// + SIMULA, + + /// + /// Adapter Beckhoff + /// + BECKHOFF, + + /// + /// Adapter Beckhoff x CPA (selezionatrici ex Jetco) + /// + BECKHOFF_CPA, + + /// + /// adapter FANUC + /// + FANUC, + + /// + /// File Based exchange generic adapter + /// + FILE_GEN, + + /// + /// File Based exchange Euromap63 + /// + FILE_EUROM63, + + ///// + ///// File Based exchange SCM Xylog + ///// + //FILE_XYLOG, + + /// + /// File Based Log file analisys per Soitaab + /// + FILE_SOITAAB, + + /// + /// Gestione sync FTP + /// + FTP, + + /// + /// Adapter KAWASAKI e-controller + /// + KAWASAKI, + + /// + /// Adapter Icoel per DB (barcode, tracciatura, produzione,...) + /// + IcoelDb, + + /// + /// Adapter Icoel per WS SOAP (sizer) + /// + IcoelSoap, + + /// + /// Adapter non specificato + /// + ND, + + /// + /// Adapter MITSUBISHI con EZCnc lib + /// + MITSUBISHI, + + /// + /// Adapter ModBus TCP generico + /// + MODBUS_TCP, + + /// + /// Adapter ModBus TCP versione Cedax (Giacovelli) + /// + MODBUS_TCP_CEDAX, + + /// + /// Adapter ModBus TCP versione Centerfrigo (Giacovelli) + /// + MODBUS_TCP_CENTERFRIGO, + + /// + /// Adapter modbus (+ file) x FIMAT (Tenditalia) + /// + MODBUS_TCP_FIMAT, + + /// + /// Adapter ModBus TCP versione HAM (Pizzaferri) + /// + MODBUS_TCP_HAM, + + /// + /// Adapter ModBus TCP versione HELPI (Cererie Finassi) + /// + MODBUS_TCP_HELPI, + + /// + /// Adapter Modubus TCP versione IMAX Aeromacchine (Jetco) + /// + MODBUS_TCP_IMAS_AEROMEC, + + /// + /// Adapter Modubus TCP versione Rimor (IMI Remosa) + /// + MODBUS_TCP_RIMOR, + + /// + /// Adapter Modubus TCP versione Saim (Giacovelli) + /// + MODBUS_TCP_SAIM, + + /// + /// Adapter Modubus TCP versione Zetapack (Giacovelli) + /// + MODBUS_TCP_ZETAPACK, + + /// + /// Adapter MTConnect + /// + MTConnect, + + /// + /// Adapter OMRON + /// + OMRON, + + /// + /// Adapter OPC-UA + /// + OpcUa, + + /// + /// Adapter OPC-UA CMS + /// + OpcUaCMS, + + /// + /// Adapter OPC-UA per Ewon + /// + OpcUaEwon, + + /// + /// Adapter OPC-UA per Ewon x Adige (BLM) / STIL + /// + OpcUaEwonAdige, + + /// + /// Adapter OPC-UA per Ewon x BLM / Mecart + /// + OpcUaEwonBLM, + + /// + /// Adapter OPC-UA per Ewon x Monti / Tenditalia + /// + OpcUaEwonMonti, + + /// + /// Adapter OPC-UA per Ewon x Mecolpress (BLM) / STIL + /// + OpcUaEwonMecolpress, + + /// + /// Adapter OPC-UA per KeepWare + /// + OpcUaKwp, + + /// + /// Adapter OPC-UA per KeepWare, UnitechRama + /// + OpcUaKwpRama, + + /// + /// Adapter OPC-UA per IMAS Aeromec / Jetco + /// + OpcUaImasAeromec, + + /// + /// Adapter MBH (es Cimolai) + /// + OpcUaMBH, + + /// + /// Adapter MBH implementazione Cimolai x travel lift + /// + OpcUaMBHCimolai, + + /// + /// Adapter OMRON (es ICOEL) + /// + OpcUaOmron, + + /// + /// Implementaizone OMRON specifica x ICOEL + /// + OpcUaOmronIcoel, + + /// + /// Adapter OPC-UA SCM + /// + OpcUaSCM, + + /// + /// Adapter OPC-UA Siemens generico + /// + OpcUaSiemens, + + /// + /// Adapter OPC-UA Siemens OMP + /// + OpcUaSiemensOMP, + + /// + /// Adapter OPC-UA Siemens Rama + /// + OpcUaSiemensRama, + + /// + /// Adapter OPC-UA Ulma (packaging, Giacovelli) + /// + OpcUaUlma, + + /// + /// Adapter OSAI CNDEX (Cndex) + /// + OSAI_CNDEX, + + /// + /// Adapter OSAI OPEN (ws) + /// + OSAI_OPEN, + + /// + /// Adapter OSAI VB6 + /// + OSAI_VB6, + + /// + /// Adapter tipo watchdog via ping (per impianti spenti e non rilevati) + /// + PingWatchdog, + + /// + /// Adapter REST (base) + /// + REST, + + /// + /// Adapter REST Citizen + /// + REST_CITIZEN, + + /// + /// Shelly's Device (tipicamente PM series) + /// + Shelly, + + /// + /// Adapter SIEMENS + /// + SIEMENS, + + /// + /// Adapter SIEMENS, interfaccia versione APROCHIM (filtro liquidi rettifiche) + /// + SIEMENS_APROCHIM, + + /// + /// Adapter SIEMENS, interfaccia versione VIPA @2001 + /// + SIEMENS_AT2001, + + /// + /// Adapter SIEMENS, interfaccia versione FAPE (punzonatrici) vers 2018 + /// + SIEMENS_FAPE, + + /// + /// Adapter SIEMENS, interfaccia versione FAPE (punzonatrici) vers 2024 + /// + SIEMENS_FAPE_2, + + /// + /// Adapter SIEMENS, interfaccia versione COMECA (impianti gestione GNL) + /// + SIEMENS_COMECA, + + /// + /// Adapter SIEMENS, interfaccia versione COMUR (dentatrice) + /// + SIEMENS_COMUR, + + /// + /// Adapter SIEMENS, interfaccia versione COSMAP (transfer smerigliatrice donati) + /// + SIEMENS_COSMAP, + + /// + /// Adapter SIEMENS, interfaccia versione INGENIA (Valvital, Automazione) + /// + SIEMENS_INGENIA, + + /// + /// Adapter SIEMENS, interfaccia versione LASCO (Valvital, Pressa Bilancere) + /// + SIEMENS_LASCO, + + /// + /// Adapter SIEMENS, interfaccia versione NWSE (Giacovelli, impianto filtrazione NWS) + /// + SIEMENS_NWSE, + + /// + /// Adapter SIEMENS, interfaccia versione PRESSOIL + CEI (Valvital, Pressa Idraulica) + /// + SIEMENS_PRESSOIL_CEI, + + /// + /// Adapter SIEMENS, interfaccia verisone RobotService (Donati, smerigliatrici) + /// + SIEMENS_ROBOTSERVICE, + + /// + /// Adapter SIEMENS, interfaccia versione SAET (Valvital, forni / tempra) + /// + SIEMENS_SAET, + + /// + /// Adapter SIEMENS, interfaccia versione SIMEC (Valvital, taglio) + /// + SIEMENS_SIMEC, + + /// + /// Adapter SIEMENS, interfaccia versione Torri + /// + SIEMENS_TORRI, + + /// + /// Adapter SOAP x bilance Gomba + /// + SOAP_GOMBA, + + /// + /// Adapter basato su DB scambio Microsoft SqlServer, macchine LANTEK + /// + SQLSERVER_LANTEK, + + /// + /// Adapter basato su DB scambio Microsoft SqlServer, macchine PAMA + /// + SQLSERVER_PAMA, + + /// + /// Metodi di WPS WebPageScraping (es x compressori Atlas Copco) + /// + WPS + } +#endif + } +} diff --git a/IOB-UT-NEXT/Config/IobConfTree.cs b/IOB-UT-NEXT/Config/IobConfTree.cs new file mode 100644 index 00000000..34d77b84 --- /dev/null +++ b/IOB-UT-NEXT/Config/IobConfTree.cs @@ -0,0 +1,445 @@ +using Newtonsoft.Json; +using YamlDotNet.Serialization.NamingConventions; +using YamlDotNet.Serialization; +using NLog; +using System.IO; +using System; +using static IOB_UT_NEXT.Config.EnumConf; +using System.Collections.Generic; +using System.Linq; +using IOB_UT_NEXT.Config; +using IOB_UT_NEXT.Config.Base; +using IOB_UT_NEXT.Config.Special; + +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace IOB_UT_NEXT.Config +{ + /// + /// Albero configurazione globale IOB in formato serializable + /// + [Serializable] + public class IobConfTree + { + /// + /// Init classe configurazione + /// + public IobConfTree() + { + Log = LogManager.GetCurrentClassLogger(); + } + + /// + /// Init classe configurazione da file + /// + public IobConfTree(string confFilePath) + { + Log = LogManager.GetCurrentClassLogger(); + if (File.Exists(confFilePath)) + { + IobConfTree newConfObj = new IobConfTree(); + // verifico TIPO file... + string fileExt = Path.GetExtension(confFilePath); + string fileName = Path.GetFileName(confFilePath); + string rawData = File.ReadAllText(confFilePath); + if (!string.IsNullOrEmpty(rawData)) + { + // leggo in base al tipo... + switch (fileExt) + { + case "yaml": + case "yml": + var deserializer = new DeserializerBuilder() + .WithNamingConvention(CamelCaseNamingConvention.Instance) + .Build(); + try + { + newConfObj = deserializer.Deserialize(rawData); + } + catch (Exception exc) + { + //lgError($"Eccezione in LoadFromYaml{Environment.NewLine}{exc}"); + } + break; + default: + break; + } + if (newConfObj != null) + { + // ora copio in oggetto corrente... + IobConf = newConfObj.IobConf; + DeviceConf = newConfObj.DeviceConf; + ProcInputConf = newConfObj.ProcInputConf; + OptParConf = newConfObj.OptParConf; + MapoMesConf = newConfObj.MapoMesConf; + SpecialConf = newConfObj.SpecialConf; + TCDataConf = newConfObj.TCDataConf; + ActionConf = newConfObj.ActionConf; + // sovrascrivo filename + IobConf.ConfFileName = fileName; + } + } + } + } + + /// + /// Restituisce un oggetto di conf leggendo INI ed effettuando conversione + /// + /// + /// + public static IobConfTree LoadFromINI(string iniFilePath) + { + IobConfTree newConfObj = new IobConfTree(); + try + { + // leggo file INI + IniFile fIni = new IniFile(iniFilePath); + string codIob = Path.GetFileNameWithoutExtension(iniFilePath); + + // Dati generali (vendor, modello...) + newConfObj.IobConf = new IobDto() + { + CodIOB = fIni.ReadString("IOB", "IOB_NAME", codIob), + ConfFileName = Path.GetFileName(iniFilePath), + Customer = fIni.ReadString("TAGS", "Customer", "EgalWare"), + DisableExeTask = bool.Parse(fIni.ReadString("IOB", "DIS_EXE_TASK", "false")), + DisableStateCh = bool.Parse(fIni.ReadString("IOB", "DIS_STATE_CH", "false")), + EnableRedisQueue = bool.Parse(fIni.ReadString("IOB", "EnableRedisQueue", "false")), + MinDeltaSec = fIni.ReadInteger("IOB", "MinDeltaSec", 6), + ReleaseVers = $"{System.Reflection.Assembly.GetExecutingAssembly().GetName().Version}" + }; + // tipo adapter// verifico tipo adapter + try + { + newConfObj.IobConf.IobType = (tipoAdapter)Enum.Parse(typeof(tipoAdapter), fIni.ReadString("IOB", "CNCTYPE", "ND")); + } + catch (Exception exc) + { + newConfObj.IobConf.IobType = tipoAdapter.ND; + string rawVal = fIni.ReadString("IOB", "CNCTYPE", "DEMO"); + newConfObj.lgError($"Eccezione in conversione tipo adapter: richiesto {rawVal} | tipo non codificato...{Environment.NewLine}{exc}"); + } + + + newConfObj.DeviceConf = new DeviceDto() + { + Vendor = fIni.ReadString("MACHINE", "VENDOR", "STEAMWARE"), + Model = fIni.ReadString("MACHINE", "MODEL", "ND"), + ConnectConf = new ConnectionDto() + { + pingMsTimeout = fIni.ReadInteger("IOB", "PING_MS_TIMEOUT", 500), + IpAddr = fIni.ReadString("CNC", "IP", "::1"), + Port = fIni.ReadString("CNC", "PORT", "0") + } + }; + // parametri opzionali Memory + string[] memSection = fIni.ReadSection("MEMORY"); + // in primis SE ho qualcosa... + if (memSection != null && memSection.Count() > 0) + { + // trasformo in array... + Dictionary memDict = new Dictionary(); + foreach (var item in memSection) + { + // verifica preliminare NON sia commento (inizia per ";") + if (!item.StartsWith(";")) + { + var KVP = item.Split('='); + memDict.Add(KVP[0], KVP[1]); + } + } + // ora se ho qualcosa proseguo... + if (memDict.Count() > 0) + { + // cerco dati x popolare SignalLUT + foreach (var item in memDict.Where(x => x.Key.StartsWith("BIT"))) + { + if (newConfObj.DeviceConf.SignalLUT.ContainsKey(item.Key)) + { + newConfObj.DeviceConf.SignalLUT[item.Key] = item.Value; + } + else + { + newConfObj.DeviceConf.SignalLUT.Add(item.Key, item.Value); + } + } + // cerco dati specifici x popolare l'area Fanuc + if (memDict.Where(x => x.Key.StartsWith("AREA") || x.Key.StartsWith("PAR")).Count() > 0) + { + // init fanuc... + newConfObj.DeviceConf.FanucConf = new FanucDto(); + // inizio setup prendendo quelli con valori addrSize + foreach (var item in memDict.Where(x => x.Key.EndsWith("SIZE"))) + { + int addrSize = 0; + int.TryParse(item.Value, out addrSize); + // salvo solo quelli con valori addrSize > 0 + if (addrSize > 0) + { + string mId = item.Key.Replace("_SIZE", ""); + // cerco record inizio + var valStart = memDict.Where(x => x.Key == item.Key.Replace("_SIZE", "_START")).Select(x => x.Value).FirstOrDefault(); + if (!string.IsNullOrEmpty(valStart)) + { + int addrStart = 0; + int.TryParse(valStart, out addrStart); + var memArea = new Mem.MemAreaDto() { + AddressStart = addrStart, + AddressSize = addrSize }; + newConfObj.DeviceConf.FanucConf.MemConf.Add(mId, memArea); + } + } + } + } + } + } + + // parametri opzionali Siemens + if (!string.IsNullOrEmpty(fIni.ReadString("CNC", "CPUTYPE", ""))) + { + newConfObj.DeviceConf.SiemensConf = new SiemensDto(); + newConfObj.DeviceConf.SiemensConf.CpuType = fIni.ReadString("CNC", "CPUTYPE", ""); + newConfObj.DeviceConf.SiemensConf.Rack = (short)fIni.ReadInteger("CNC", "RACK", 0); + newConfObj.DeviceConf.SiemensConf.Slot = (short)fIni.ReadInteger("CNC", "SLOT", 0); + } + + + + // BLINK + newConfObj.ProcInputConf.BlinkMaxCounter = Convert.ToInt32(fIni.ReadString("BLINK", "MAX_COUNTER_BLINK", "1")); + newConfObj.ProcInputConf.BlinkFilterMask = Convert.ToInt32(fIni.ReadString("BLINK", "BLINK_FILT", "0")); + newConfObj.TCDataConf.MaxDelayFactor = Convert.ToDouble(fIni.ReadString("OPTPAR", "TC_MAX_TC_FACTOR", "1.2").Replace(".", ",")); + newConfObj.TCDataConf.Lambda = Convert.ToDouble(fIni.ReadString("OPTPAR", "TC_LAMBDA", "0.5").Replace(".", ",")); + newConfObj.TCDataConf.MaxIncrPz = Convert.ToDouble(fIni.ReadString("OPTPAR", "TC_MAX_INCR", "5").Replace(".", ",")); + + // Server + string[] serverSection = fIni.ReadSection("SERVER"); + // trasformo in array... + Dictionary servDict = new Dictionary(); + foreach (var item in serverSection) + { + var KVP = item.Split('='); + servDict.Add(KVP[0], KVP[1]); + } + // processo array appena acquisito + if (servDict.ContainsKey("MPIP")) + { +#if false + string MpIp = fIni.ReadString("SERVER", "MPIP", "::1"); +#endif + string MpIp = servDict["MPIP"]; + if (!string.IsNullOrEmpty(MpIp)) + { + newConfObj.MapoMesConf.Transport = MpIp.StartsWith("https://") ? "https" : "http"; + newConfObj.MapoMesConf.IpAddr = MpIp.Replace($"{newConfObj.MapoMesConf.Transport}://", ""); // tolgo http/https... + } + } + + // Altro + newConfObj.IobManConf.MinDeltaSec = fIni.ReadInteger("IOB", "MinDeltaSec", 6); + + // OptParConf + Dictionary optParRead = new Dictionary(); + string[] optParRows = fIni.ReadSection("OPTPAR"); + if (optParRows.Length > 0) + { + try + { + string[] kvp; + foreach (var item in optParRows) + { + kvp = item.Split('='); + optParRead.Add(kvp[0], kvp[1]); + } + newConfObj.lgDebug($"Caricati {optParRead.Count} parametri opzionali da OPTPAR"); + } + catch (Exception exc) + { + newConfObj.lgError(string.Format("EXCEPTION in fase di lettura OPTPAR: {0}{1}", Environment.NewLine, exc)); + } + } + // riordino alfabeticamente + optParRead = optParRead.OrderBy(x => x.Key).ToDictionary(x => x.Key, x => x.Value); + newConfObj.OptParConf = optParRead; + } + catch + { } + return newConfObj; + } + + #region Logging + + /// + /// oggetto logging + /// + protected Logger Log;// = LogManager.GetCurrentClassLogger(); + + /// + /// Effettua logging DEBUG corretto impostanto anche la variabile IOB prima di scrivere... + /// + /// + protected void lgDebug(string txt2log) + { + Log.Factory.Configuration.Variables["codIOB"] = IobConf.CodIOB; + Log.Debug(txt2log); + } + + /// + /// Effettua logging ERROR corretto impostanto anche la variabile IOB prima di scrivere... + /// + /// + protected void lgError(string txt2log) + { + if (!string.IsNullOrEmpty(txt2log)) + { + Log.Factory.Configuration.Variables["codIOB"] = IobConf.CodIOB; + Log.Error(txt2log); + } + } + + /// + /// Effettua logging INFO corretto impostanto anche la variabile IOB prima di scrivere... + /// + /// + protected void lgInfo(string txt2log) + { + Log.Factory.Configuration.Variables["codIOB"] = IobConf.CodIOB; + Log.Info(txt2log); + } + + /// + /// Effettua logging TRACE corretto impostanto anche la variabile IOB prima di scrivere... + /// + /// + protected void lgTrace(string txt2log) + { + Log.Factory.Configuration.Variables["codIOB"] = IobConf.CodIOB; + Log.Trace(txt2log); + } + + #endregion + + + /// + /// Info specifiche del programma IOB + /// + public IobDto IobConf { get; set; } = new IobDto(); + + /// + /// Info relative al device interconnesso + /// + public DeviceDto DeviceConf { get; set; } = new DeviceDto(); + + /// + /// Parametri server Mapo MES + /// + public ServerMapoDto MapoMesConf { get; set; } = new ServerMapoDto(); + + /// + /// Setup info verso IOB-MAN + /// + public IobManDto IobManConf { get; set; } = new IobManDto(); + + /// + /// Setup processing dati in ingresso (es: blink segnali) + /// + public InputSignalDto ProcInputConf { get; set; } = new InputSignalDto(); + + /// + /// Dati relativi ai parametri gestione tempo ciclo + /// + public TCDataDto TCDataConf { get; set; } = new TCDataDto(); + + /// + /// Configurazione speciale/opzionale per tipo IOB + /// + public SpecializedDto SpecialConf { get; set; } + + /// + /// Configurazione speciale comportamenti IOB (es setup) + /// + public ActionDto ActionConf { get; set; } + + /// + /// Dizionario dei parametri opzionali + /// + public Dictionary OptParConf { get; set; } = new Dictionary(); + + /// + /// Dizionario delle chiavi opz da dizionario + /// + public Dictionary OptKVP { get; set; } = new Dictionary(); + + + #region Metodi Serializzazione + + /// + /// Restituisce conf serializzata in formato JSON + /// + /// + /// + public string GetJson() + { + string rawdata = JsonConvert.SerializeObject(this, Formatting.Indented); + return rawdata; + } + /// + /// Restituisce conf serializzata in formato YAML + /// + /// + /// + public string GetYaml() + { + // opzioni alternative: PascalCaseNamingConvention (iniziale masiucola) o lowerCaseNamingConvention + var serializer = new SerializerBuilder() + .WithNamingConvention(CamelCaseNamingConvention.Instance) + .Build(); + var rawdata = serializer.Serialize(this); + return rawdata; + } + + #endregion + + #region Metodi Load/Save + + /// + /// Scrive conf serializzata in formato JSON + /// + /// + /// + public bool SaveJson(string filePath) + { + bool answ = false; + try + { + string rawdata = GetJson(); + File.WriteAllText(filePath, rawdata); + answ = true; + } + catch + { } + return answ; + } + /// + /// Scrive conf serializzata in formato YAML + /// + /// + /// + public bool SaveYaml(string filePath) + { + bool answ = false; + try + { + var rawdata = GetYaml(); + File.WriteAllText(filePath, rawdata); + answ = true; + } + catch + { } + return answ; + } + + #endregion + } +} \ No newline at end of file diff --git a/IOB-UT-NEXT/Config/Mem/MemArea.cs b/IOB-UT-NEXT/Config/Mem/MemArea.cs new file mode 100644 index 00000000..28a7ba0e --- /dev/null +++ b/IOB-UT-NEXT/Config/Mem/MemArea.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IOB_UT_NEXT.Config.Mem +{ + public class MemAreaDto + { + + /// + /// Indirizzo inizio area da acquisire + /// + public int AddressStart { get; set; } = 0; + + /// + /// Dimensione del set di indirizzi da recuperare + /// + public int AddressSize { get; set; } = 0; + } +} diff --git a/IOB-UT-NEXT/Config/Special/ActionDto.cs b/IOB-UT-NEXT/Config/Special/ActionDto.cs new file mode 100644 index 00000000..d417c6b4 --- /dev/null +++ b/IOB-UT-NEXT/Config/Special/ActionDto.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IOB_UT_NEXT.Config.Special +{ + /// + /// Configurazione speciale comportamento IOB + /// + public class ActionDto + { + /// + /// Configurazione speciale azioni in fase di setup + /// + public MachineSetupConf SetupConf { get; set; } + } +} diff --git a/IOB-UT-NEXT/Config/Special/FanucDto.cs b/IOB-UT-NEXT/Config/Special/FanucDto.cs new file mode 100644 index 00000000..36c035c8 --- /dev/null +++ b/IOB-UT-NEXT/Config/Special/FanucDto.cs @@ -0,0 +1,20 @@ +using IOB_UT_NEXT.Config.Mem; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IOB_UT_NEXT.Config.Special +{ + /// + /// Configurazione specifica memoria per FANUC + /// + public class FanucDto + { + /// + /// Conf aree di memoria da gestire + /// + public Dictionary MemConf { get; set; } = new Dictionary(); + } +} diff --git a/IOB-UT-NEXT/Config/Special/SiemensDto.cs b/IOB-UT-NEXT/Config/Special/SiemensDto.cs new file mode 100644 index 00000000..ac945cbf --- /dev/null +++ b/IOB-UT-NEXT/Config/Special/SiemensDto.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IOB_UT_NEXT.Config.Special +{ + public class SiemensDto + { + /// + /// TipoCPU (es: 1500, 1200, 300) + /// + public string CpuType { get; set; } = "ND"; + + /// + /// Rack (Siemens S7) + /// + public short Rack { get; set; } = 0; + + /// + /// Slot (Siemens S7) + /// + public short Slot { get; set; } = 0; + } +} diff --git a/IOB-UT-NEXT/Config/Special/SpecializedDto.cs b/IOB-UT-NEXT/Config/Special/SpecializedDto.cs new file mode 100644 index 00000000..87e4f1d1 --- /dev/null +++ b/IOB-UT-NEXT/Config/Special/SpecializedDto.cs @@ -0,0 +1,41 @@ +using IOB_UT_NEXT.Config.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IOB_UT_NEXT.Config.Special +{ + /// + /// Area setup speciale/specializzato per singola tipologia IOB, opzionale + /// + public class SpecializedDto + { + /// + /// Struttura memoria PLC x lettura/scrittura + /// + public plcMemMapExt MemMap { get; set; } + + /// + /// Configurazione specifica OPC-UA + /// + public MtcParamConf MtcConf { get; set; } + + /// + /// Configurazione specifica OPC-UA + /// + public OpcUaParamConf OpcUaConf { get; set; } + + /// + /// Configurazione specifica OPC-UA + /// + public RestParamConf RestConf { get; set; } + + /// + /// Configurazione allarmi + /// + public AlarmDto AlarmConf { get; set; } + + } +} diff --git a/IOB-UT-NEXT/Enums.cs b/IOB-UT-NEXT/Enums.cs index 345c3a0e..76c48ac4 100644 --- a/IOB-UT-NEXT/Enums.cs +++ b/IOB-UT-NEXT/Enums.cs @@ -574,6 +574,11 @@ namespace IOB_UT_NEXT /// REST_CITIZEN, + /// + /// Shelly's Device (tipicamente PM series) + /// + Shelly, + /// /// Adapter SIEMENS /// diff --git a/IOB-UT-NEXT/IOB-UT-NEXT.csproj b/IOB-UT-NEXT/IOB-UT-NEXT.csproj index 0c5e647d..04c97eac 100644 --- a/IOB-UT-NEXT/IOB-UT-NEXT.csproj +++ b/IOB-UT-NEXT/IOB-UT-NEXT.csproj @@ -146,14 +146,35 @@ + + ..\packages\YamlDotNet.16.3.0\lib\netstandard2.0\YamlDotNet.dll + + + + + + + + + + + + + + + + + + + @@ -172,7 +193,6 @@ - @@ -189,5 +209,6 @@ + \ No newline at end of file diff --git a/IOB-UT-NEXT/packages.config b/IOB-UT-NEXT/packages.config index c65e0bfe..f981e84b 100644 --- a/IOB-UT-NEXT/packages.config +++ b/IOB-UT-NEXT/packages.config @@ -24,4 +24,5 @@ + \ No newline at end of file diff --git a/IOB-WIN-FORM/AdapterForm.cs b/IOB-WIN-FORM/AdapterForm.cs index 69b917d2..c43c1002 100644 --- a/IOB-WIN-FORM/AdapterForm.cs +++ b/IOB-WIN-FORM/AdapterForm.cs @@ -1,4 +1,5 @@ using IOB_UT_NEXT; +using IOB_UT_NEXT.Config; using MapoSDK; using Newtonsoft.Json; using NLog; @@ -11,6 +12,9 @@ using System.IO; using System.Linq; using System.Threading; using System.Windows.Forms; +using YamlDotNet.Core; +using YamlDotNet.Serialization; +using YamlDotNet.Serialization.NamingConventions; namespace IOB_WIN_FORM { @@ -83,7 +87,14 @@ namespace IOB_WIN_FORM { try { - loadIniFile(defConfFilePath); + if (File.Exists(defConfFilePathYaml)) + { + loadYamlFile(defConfFilePathYaml); + } + else + { + loadIniFile(defConfFilePath); + } lgInfo("INI LOADED"); } catch (Exception exc) @@ -415,7 +426,28 @@ namespace IOB_WIN_FORM { get { - return string.Format(@"{0}\{1}.ini", utils.confDir, CurrIOB); + return Path.Combine(utils.confDir, $"{CurrIOB}.ini"); + } + } + + /// + /// File configurazione yaml (completo) se presente + /// + public string defConfFilePathYaml + { + get + { + return Path.Combine(utils.confDir, $"{CurrIOB}.yaml"); + } + } + /// + /// File configurazione json (completo) se presente + /// + public string defConfFilePathJson + { + get + { + return Path.Combine(utils.confDir, $"{CurrIOB}.json"); } } @@ -1615,7 +1647,7 @@ namespace IOB_WIN_FORM private void loadIniFile(string iniConfFile) { // out di cosa faccio... - displayTaskAndLog($"[STARTUP] Loading iniConfFile: {iniConfFile}"); + displayTaskAndLog($"[STARTUP] Loading yamlConfFile: {iniConfFile}"); // leggo file IniFile fIni = new IniFile(iniConfFile); @@ -1690,6 +1722,112 @@ namespace IOB_WIN_FORM string confJson = JsonConvert.SerializeObject(IOBConf, Formatting.Indented); string path = fileMover.GetExecutingDirectoryName(); // Directory.GetCurrentDirectory(); string fileName = Path.GetFileName(iniConfFile).Replace(".ini", ".iob"); + string dirPath = Path.Combine(path, "DATA", IOBConf.serverData.ClientInstall); + string fullPath = Path.Combine(dirPath, fileName); + // verifica directory + baseUtils.checkDir(dirPath); + // salvataggio + File.WriteAllText(fullPath, confJson); + + // preparazione file conf con nuovo formato e salvataggio... + IobConfTree newConf = IobConfTree.LoadFromINI(iniConfFile); + newConf.IobConf.ConfFileName = newConf.IobConf.ConfFileName.Replace("iob", "yaml"); + // salvo anche yaml... + newConf.SaveYaml(fullPath.Replace("iob", "yaml")); + + loadIobType(); + // avvio macchina con adapter specificato... + if (utils.CRB("autoStartOnLoad")) + { + displayTaskAndLog("Auto Starting...", true); + // avvio! + avviaAdapter(chkForceDequeue.Checked); + displayTaskAndLog("Auto Started!", true); + } + } + + /// + /// Carica file yaml della configurazione richiesta + /// + /// + private void loadYamlFile(string yamlConfFile) + { + // out di cosa faccio... + displayTaskAndLog($"[STARTUP] Loading yamlConfFile: {yamlConfFile}"); + // leggo file + IniFile fIni = new IniFile(yamlConfFile); + + // leggo vendor e modello... + curVendor = fIni.ReadString("MACHINE", "VENDOR", "ACME"); + curModel = fIni.ReadString("MACHINE", "MODEL", "NONE"); + // verifico tipo adapter + try + { + tipoScelto = (tipoAdapter)Enum.Parse(typeof(tipoAdapter), fIni.ReadString("IOB", "CNCTYPE", "DEMO")); + } + catch (Exception exc) + { + string rawVal = fIni.ReadString("IOB", "CNCTYPE", "DEMO"); + lgError($"Eccezione in conversione tipo adapter: richiesto {rawVal} | tipo non codificato...{Environment.NewLine}{exc}"); + tipoScelto = tipoAdapter.ND; + } + // carivo vettore parametri opzionai + Dictionary optParRead = new Dictionary(); + string[] optParRows = fIni.ReadSection("OPTPAR"); + if (optParRows.Length > 0) + { + try + { + string[] kvp; + foreach (var item in optParRows) + { + kvp = item.Split('='); + optParRead.Add(kvp[0], kvp[1]); + } + lgDebug($"Caricati {optParRead.Count} parametri opzionali da OPTPAR"); + } + catch (Exception exc) + { + lgError(string.Format("EXCEPTION in fase di lettura OPTPAR: {0}{1}", Environment.NewLine, exc)); + } + } + var appVers = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; + // inizializzio conf IOB + IOBConf = new IobConfiguration + { + pingMsTimeout = fIni.ReadInteger("IOB", "PING_MS_TIMEOUT", 500), + vendor = curVendor, + model = curModel, + tipoIob = tipoScelto, + optPar = optParRead, + versIOB = $"{appVers}", + codIOB = fIni.ReadString("IOB", "IOB_NAME", CurrIOB), + EnableRedisQueue = bool.Parse(fIni.ReadString("IOB", "EnableRedisQueue", "false")), + disableExeTask = bool.Parse(fIni.ReadString("IOB", "DIS_EXE_TASK", "false")), + disableStateCh = bool.Parse(fIni.ReadString("IOB", "DIS_STATE_CH", "false")), + filenameIOB = CurrIOB, + minDeltaSec = fIni.ReadInteger("IOB", "MinDeltaSec", 6), + cncIpAddr = fIni.ReadString("CNC", "IP", "::1"), + cncPingAddr = fIni.ReadString("CNC", "PING_IP", fIni.ReadString("CNC", "IP", "::1")), + cncPort = fIni.ReadString("CNC", "PORT", "0"), + iniFileName = yamlConfFile, + cpuType = fIni.ReadString("CNC", "CPUTYPE", ""), + rack = (short)fIni.ReadInteger("CNC", "RACK", 0), + slot = (short)fIni.ReadInteger("CNC", "SLOT", 0), + serverData = new serverMapo(fIni.ReadString("SERVER", "MPIP", "::1"), fIni.ReadString("SERVER", "MPURL", "/MP/IO"), fIni.ReadString("SERVER", "CMDBASE", "/IOB/input/"), fIni.ReadString("SERVER", "CMDFLOG", "/IOB/flog/"), fIni.ReadString("SERVER", "CMDULOG", "/IOB/ulog/"), fIni.ReadString("SERVER", "CMDALIVE", "/"), fIni.ReadString("SERVER", "CMDENABLED", "/"), fIni.ReadString("SERVER", "CMDREBO", "/"), fIni.ReadString("SERVER", "CMD_ODL_STARTED", "/IOB/getCurrOdlStart/"), fIni.ReadString("SERVER", "CLI_INST", "SW_CLI"), fIni.ReadString("SERVER", "CMD_FORCLE_SPLIT_ODL", "/IOB/forceSplitOdlFull/"), fIni.ReadString("SERVER", "CMD_IDLE_TIME", "/IOB/getIdlePeriod/"), fIni.ReadString("SERVER", "CMDRAWTRANSF", "/IOB/rawTransfJson/")), + MAX_COUNTER_BLINK = Convert.ToInt32(fIni.ReadString("BLINK", "MAX_COUNTER_BLINK", "1")), + BLINK_FILT = Convert.ToInt32(fIni.ReadString("BLINK", "BLINK_FILT", "0")), + TCMaxDelayFactor = Convert.ToDouble(fIni.ReadString("OPTPAR", "TC_MAX_TC_FACTOR", "1.2").Replace(".", ",")), + TCLambda = Convert.ToDouble(fIni.ReadString("OPTPAR", "TC_LAMBDA", "0.5").Replace(".", ",")), + TCMaxIncrPz = Convert.ToDouble(fIni.ReadString("OPTPAR", "TC_MAX_INCR", "5").Replace(".", ",")), + waitRecMSec = Convert.ToInt32(fIni.ReadString("OPTPAR", "WAIT_REC_MSEC", "90000")) + }; + lgDebug($"Creato IOBConf!"); + + // salvo serializzando json... nella folder x Cliente oppure Vendor_Model + string confJson = JsonConvert.SerializeObject(IOBConf, Formatting.Indented); + string path = fileMover.GetExecutingDirectoryName(); // Directory.GetCurrentDirectory(); + string fileName = Path.GetFileName(yamlConfFile).Replace(".ini", ".iob"); string dirPath = $"{path}\\DATA\\{IOBConf.serverData.ClientInstall}"; string fullPath = $"{dirPath}\\{fileName}"; // verifica directory @@ -1708,6 +1846,7 @@ namespace IOB_WIN_FORM } } + /// /// Verifica se il log di un dato errore sia permesso /// diff --git a/IOB-WIN-FORM/IOB-WIN-FORM.csproj b/IOB-WIN-FORM/IOB-WIN-FORM.csproj index d6a75213..76866aa4 100644 --- a/IOB-WIN-FORM/IOB-WIN-FORM.csproj +++ b/IOB-WIN-FORM/IOB-WIN-FORM.csproj @@ -69,6 +69,9 @@ + + ..\packages\YamlDotNet.16.3.0\lib\netstandard2.0\YamlDotNet.dll + diff --git a/IOB-WIN-FORM/Iob/Generic.cs b/IOB-WIN-FORM/Iob/Generic.cs index a92a5337..076a4f54 100644 --- a/IOB-WIN-FORM/Iob/Generic.cs +++ b/IOB-WIN-FORM/Iob/Generic.cs @@ -4407,7 +4407,7 @@ namespace IOB_WIN_FORM.Iob protected int currSendErrors = 0; /// - /// Tempo di attesa in minuti x lettura contapezzi standard (da .ini / OptPar) + /// Tempo di attesa in minuti x lettura contapezzi standard (da .ini / OptParConf) /// protected double delayMinReadPzCount = 0; diff --git a/IOB-WIN-FORM/app.config b/IOB-WIN-FORM/app.config index aecb7c71..d6177bc3 100644 --- a/IOB-WIN-FORM/app.config +++ b/IOB-WIN-FORM/app.config @@ -6,7 +6,7 @@ - + diff --git a/IOB-WIN-FORM/packages.config b/IOB-WIN-FORM/packages.config index 528cac80..4b8d84a5 100644 --- a/IOB-WIN-FORM/packages.config +++ b/IOB-WIN-FORM/packages.config @@ -7,4 +7,5 @@ + \ No newline at end of file diff --git a/IOB-WIN-SHELLY.sln b/IOB-WIN-SHELLY.sln index 2afa8dce..8611425e 100644 --- a/IOB-WIN-SHELLY.sln +++ b/IOB-WIN-SHELLY.sln @@ -14,8 +14,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IOB-UT-NEXT", "IOB-UT-NEXT\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IOB-WIN-FORM", "IOB-WIN-FORM\IOB-WIN-FORM.csproj", "{9BA331BB-9BF1-40E0-AC03-74B43D73A097}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IOB-WIN-PING", "IOB-WIN-PING\IOB-WIN-PING.csproj", "{6ADF1E82-124C-489C-99EF-A857C933D362}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IOB-WIN-SHELLY", "IOB-WIN-SHELLY\IOB-WIN-SHELLY.csproj", "{7642AEAD-7A35-45A6-8761-81D97CD8905C}" EndProject Global @@ -63,18 +61,6 @@ Global {9BA331BB-9BF1-40E0-AC03-74B43D73A097}.Remote_DEBUG|Any CPU.Build.0 = Debug|Any CPU {9BA331BB-9BF1-40E0-AC03-74B43D73A097}.Remote_DEBUG|x86.ActiveCfg = Release|Any CPU {9BA331BB-9BF1-40E0-AC03-74B43D73A097}.Remote_DEBUG|x86.Build.0 = Release|Any CPU - {6ADF1E82-124C-489C-99EF-A857C933D362}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6ADF1E82-124C-489C-99EF-A857C933D362}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6ADF1E82-124C-489C-99EF-A857C933D362}.Debug|x86.ActiveCfg = Debug|Any CPU - {6ADF1E82-124C-489C-99EF-A857C933D362}.Debug|x86.Build.0 = Debug|Any CPU - {6ADF1E82-124C-489C-99EF-A857C933D362}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6ADF1E82-124C-489C-99EF-A857C933D362}.Release|Any CPU.Build.0 = Release|Any CPU - {6ADF1E82-124C-489C-99EF-A857C933D362}.Release|x86.ActiveCfg = Release|Any CPU - {6ADF1E82-124C-489C-99EF-A857C933D362}.Release|x86.Build.0 = Release|Any CPU - {6ADF1E82-124C-489C-99EF-A857C933D362}.Remote_DEBUG|Any CPU.ActiveCfg = Release|Any CPU - {6ADF1E82-124C-489C-99EF-A857C933D362}.Remote_DEBUG|Any CPU.Build.0 = Release|Any CPU - {6ADF1E82-124C-489C-99EF-A857C933D362}.Remote_DEBUG|x86.ActiveCfg = Release|Any CPU - {6ADF1E82-124C-489C-99EF-A857C933D362}.Remote_DEBUG|x86.Build.0 = Release|Any CPU {7642AEAD-7A35-45A6-8761-81D97CD8905C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7642AEAD-7A35-45A6-8761-81D97CD8905C}.Debug|Any CPU.Build.0 = Debug|Any CPU {7642AEAD-7A35-45A6-8761-81D97CD8905C}.Debug|x86.ActiveCfg = Debug|Any CPU diff --git a/IOB-WIN-SHELLY/AdapterFormNext.cs b/IOB-WIN-SHELLY/AdapterFormNext.cs index fa3128f7..4cc7a00f 100644 --- a/IOB-WIN-SHELLY/AdapterFormNext.cs +++ b/IOB-WIN-SHELLY/AdapterFormNext.cs @@ -28,8 +28,8 @@ namespace IOB_WIN_SHELLY switch (tipoScelto) { - case tipoAdapter.PingWatchdog: - iobObj = new IOB_WIN_FORM.Iob.PingWatchDog(this, IOBConf); + case tipoAdapter.Shelly: + iobObj = new IOB_WIN_SHELLY.Iob.ShellyClient(this, IOBConf); btnStart.Enabled = true; break; diff --git a/IOB-WIN-SHELLY/App.config b/IOB-WIN-SHELLY/App.config index 29b5255d..e518e50c 100644 --- a/IOB-WIN-SHELLY/App.config +++ b/IOB-WIN-SHELLY/App.config @@ -108,15 +108,20 @@ - + + - - + + + + + + @@ -125,38 +130,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -166,8 +139,24 @@ - - + + + + + + + + + + + + + + + + + + diff --git a/IOB-WIN-SHELLY/DATA/CONF/SHELLY_01.ini b/IOB-WIN-SHELLY/DATA/CONF/SHELLY_01.ini index 08975356..24224cf3 100644 --- a/IOB-WIN-SHELLY/DATA/CONF/SHELLY_01.ini +++ b/IOB-WIN-SHELLY/DATA/CONF/SHELLY_01.ini @@ -1,17 +1,17 @@ ;Configurazione IOB-WIN [IOB] -CNCTYPE=SIMULA +CNCTYPE=Shelly PING_MS_TIMEOUT=500 MinDeltaSec=5 EnableRedisQueue=true ;IOB_NAME=TFT_RAMA_001 [MACHINE] -VENDOR=STEAMWARE -MODEL=DEMO_SIMULATOR +VENDOR=Shelly +MODEL=Shelly1PM [CNC] -IP=127.0.0.1 +IP=10.74.81.71 PORT=0000 [SERVER] @@ -27,7 +27,7 @@ CMD_ODL_STARTED=/IOB/getCurrOdlStart/ CMD_FORCLE_SPLIT_ODL=/IOB/forceSplitOdlFull/ CMD_IDLE_TIME=/IOB/getIdlePeriod/ -[MEMORY] +[MEMORY] [BLINK] MAX_COUNTER_BLINK = 15 @@ -51,34 +51,9 @@ 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=81|1 -; indica simulazione registro scarti -SIM_RS=161|1 -; indica simulazione dichiarazioni (note) utente -SIM_DICH=261|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 @@ -90,25 +65,13 @@ 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 +SHELLY_PARAM=SIMUL_01.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 diff --git a/IOB-WIN-SHELLY/DATA/CONF/SHELLY_01.json b/IOB-WIN-SHELLY/DATA/CONF/SHELLY_01.json index d2895eb1..0e0a1deb 100644 --- a/IOB-WIN-SHELLY/DATA/CONF/SHELLY_01.json +++ b/IOB-WIN-SHELLY/DATA/CONF/SHELLY_01.json @@ -1,410 +1,47 @@ { "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", + "Tot_Energy": { + "name": "Tot_Energy", + "description": "Energya totale impiegata", "tipoMem": "Real", - "minVal": 18, - "maxVal": 24, + "minVal": 0, + "maxVal": 999999999, + "unit": "KWh", + "displOrdinal": 1 + }, + "RT_Power": { + "name": "RT_Power", + "description": "Potenza Istantanea", + "tipoMem": "Real", + "minVal": 0, + "maxVal": 999999, + "unit": "W", + "displOrdinal": 2 + }, + "RT_Voltage": { + "name": "RT_Voltage", + "description": "Tensione Istantanea", + "tipoMem": "Real", + "minVal": 0, + "maxVal": 1000, + "unit": "V", + "displOrdinal": 3 + }, + "RT_Current": { + "name": "RT_Current", + "description": "Corrente Istantanea", + "tipoMem": "Real", + "minVal": 0, + "maxVal": 200, + "unit": "A", "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" + "fluxLogResendPeriod": 15 } } \ 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 78114c3e..4e0520d9 100644 --- a/IOB-WIN-SHELLY/IOB-WIN-SHELLY.csproj +++ b/IOB-WIN-SHELLY/IOB-WIN-SHELLY.csproj @@ -113,6 +113,9 @@ + + ..\packages\YamlDotNet.16.3.0\lib\netstandard2.0\YamlDotNet.dll + @@ -192,6 +195,7 @@ Designer + true PreserveNewest @@ -223,4 +227,23 @@ + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/IOB-WIN-SHELLY/Iob/ShellyClient.cs b/IOB-WIN-SHELLY/Iob/ShellyClient.cs index 6a18359d..fe4dd156 100644 --- a/IOB-WIN-SHELLY/Iob/ShellyClient.cs +++ b/IOB-WIN-SHELLY/Iob/ShellyClient.cs @@ -56,10 +56,10 @@ namespace IOB_WIN_SHELLY.Iob // fix coda ping PingQueue = new DataQueue("000", "PingQueue", false); // carico conf specifica steps FTP - string ftpConfFile = getOptPar("FTP_PARAM"); - if (!string.IsNullOrEmpty(ftpConfFile)) + string shellyConfFile = getOptPar("SHELLY_PARAM"); + if (!string.IsNullOrEmpty(shellyConfFile)) { - loadFtpConfFile(ftpConfFile); + loadFtpConfFile(shellyConfFile); #if false // mi calcolo ed imposto la ftpClientMan + Remote BaseDir... string actKey = "RemoteDir"; diff --git a/IOB-WIN-SHELLY/packages.config b/IOB-WIN-SHELLY/packages.config index 721e45af..f1fc55b6 100644 --- a/IOB-WIN-SHELLY/packages.config +++ b/IOB-WIN-SHELLY/packages.config @@ -26,4 +26,5 @@ + \ No newline at end of file