Completo riorganizzazione preliminare classe IobConfTree nuova x gestione IOB-WIN

This commit is contained in:
Samuele Locatelli
2025-02-12 18:12:01 +01:00
parent 5458ffbf77
commit 0f7461f377
10 changed files with 167 additions and 131 deletions
@@ -1,12 +1,12 @@
using System.Collections.Generic;
using System.Linq;
namespace EgwConf.Iob
namespace EgwConf.Iob.Base
{
/// <summary>
/// Set comandi URI x chiamate server
/// </summary>
public class CmdUri
public class CmdUriDto
{
#region Public Constructors
@@ -14,7 +14,7 @@ namespace EgwConf.Iob
/// Init classe gestione comandi
/// </summary>
/// <param name="baseURI"></param>
public CmdUri(string baseURI)
public CmdUriDto(string baseURI)
{
BaseUri = baseURI;
}
@@ -39,7 +39,7 @@ namespace EgwConf.Iob
#region Public Methods
/// <summary>
/// Recupera path/URI comando richiesto (SE disponibile)
/// Recupera path/URI comando richiesto (SE disponibile) senno default
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
@@ -81,65 +81,5 @@ namespace EgwConf.Iob
protected Dictionary<string, string> CurrSetup { get; set; } = new Dictionary<string, string>();
#endregion Protected Properties
#if false
/// <summary>
/// comando base x check ALIVE
/// </summary>
public string Alive { get; set; } = "IOB";
/// <summary>
/// Comando base x INPUT
/// </summary>
public string Base { get; set; } = "IOB/input/";
/// <summary>
/// comando base x INPUT in modalità JSON payload come lista
/// </summary>
public string BaseJson { get; set; } = "IOB/evListJson/";
/// <summary>
/// comando base x Raw Transf LOG - salvataggio valori generici in modalità JSON payload
/// come lista
/// </summary>
public string RawTransfJson { get; set; } = "IOB/rawTransfJson/";
/// <summary>
/// comando base x check ENABLED
/// </summary>
public string Enabled { get; set; } = "IOB/enabled/";
/// <summary>
/// comando base x LOG di FLUSSO generico - salvataggio parametri extra sistema MAPO
/// </summary>
public string Flog { get; set; } = "IOB/flog/";
/// <summary>
/// comando base x LOG di FLUSSO generico - salvataggio parametri extra sistema MAPO in
/// modalità JSON payload come lista
/// </summary>
public string FlogJson { get; set; } = "IOB/flogJson/";
/// <summary>
/// Comando base x ForceSplitODL (check avvio ODL)
/// </summary>
public string ForcleSplitOdl { get; set; } = "IOB/forceSplitOdlFull/";
/// <summary>
/// comando base x check IDLE time IOB
/// </summary>
public string IdleTime { get; set; } = "IOB/getIdlePeriod/";
/// <summary>
/// comando base x check avvio ODL
/// </summary>
public string OdlStarted { get; set; } = "IOB/getCurrOdlStart/";
/// <summary>
/// comando base x comando reboot
/// </summary>
public string Reboot { get; set; } = "sendReboot.aspx?idxMacchina=";
#endif
}
}
@@ -1,19 +1,17 @@
using System;
using EgwConf.Iob.Special;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwConf.Iob
namespace EgwConf.Iob.Base
{
public class CncConf
/// <summary>
/// Definizione parametri Macchina / CN / PLC
/// </summary>
public class ConnectParamsDto
{
/// <summary>
/// Init classe default
/// </summary>
public CncConf()
{ }
/// <summary>
/// Indirizzo Ip del CNC Controllato
/// </summary>
@@ -30,18 +28,8 @@ namespace EgwConf.Iob
public int pingMsTimeout { get; set; } = 500;
/// <summary>
/// TipoCPU (es: Siemens)
/// Configurazione specifica Siemens (se applicabile)
/// </summary>
public string CpuType { get; set; } = "ND";
/// <summary>
/// Rack (Siemens S7)
/// </summary>
public short Rack { get; set; } = 0;
/// <summary>
/// Slot (Siemens S7)
/// </summary>
public short Slot { get; set; } = 0;
public SiemensDto SiemensCpu { get; set; }
}
}
@@ -4,9 +4,12 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwConf.Iob
namespace EgwConf.Iob.Base
{
public class InputSignalProcess
/// <summary>
/// Configurazioni specifiche per segnali ingresso (tipicamente gestione blink)
/// </summary>
public class InputSignalDto
{
/// <summary>
/// Maschera di filtro blink, INT corrispondente ai BIT da filtrare, ad es
@@ -4,12 +4,12 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwConf.Iob
namespace EgwConf.Iob.Base
{
/// <summary>
/// Classe setup comunicazione server REDIS
/// Classe setup comunicazione server REDIS per comunicazione con IOB-MAN
/// </summary>
public class RedisPub
public class IobManDto
{
/// <summary>
@@ -4,9 +4,9 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwConf.Iob
namespace EgwConf.Iob.Base
{
public class ServerMapo
public class ServerMapoDto
{
/// <summary>
/// Indica il metodo di trasporto http/https
@@ -26,8 +26,7 @@ namespace EgwConf.Iob
/// <summary>
/// Dizionario comandi configurati
/// </summary>
public Dictionary<string, string> Commands { get; set; } = new CmdUri("IOB").StdCommands();
//public CmdUri Commands { get; set; } = new CmdUri();
public Dictionary<string, string> Commands { get; set; } = new CmdUriDto("IOB").StdCommands();
/// <summary>
/// Installazione di riferimento
@@ -4,12 +4,12 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwConf.Iob
namespace EgwConf.Iob.Base
{
/// <summary>
/// Classe gestione parametri legati a gestioen TempoCiclo
/// </summary>
public class TCData
public class TCDataDto
{
/// <summary>
/// Fattore Lambda (innovazione) per calcolo EWMA valore TCiclo corrente
+8 -6
View File
@@ -52,19 +52,21 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="BlinkSignal.cs" />
<Compile Include="CmdUri.cs" />
<Compile Include="CncConf.cs" />
<Compile Include="Base\InputSignalDto.cs" />
<Compile Include="Base\CmdUriDto.cs" />
<Compile Include="Base\ConnectParamsDto.cs" />
<Compile Include="EnumConf.cs" />
<Compile Include="IniFile.cs" />
<Compile Include="IobConfTree.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RedisPub.cs" />
<Compile Include="ServerMapo.cs" />
<Compile Include="TCData.cs" />
<Compile Include="Base\IobManDto.cs" />
<Compile Include="Base\ServerMapoDto.cs" />
<Compile Include="Special\SiemensDto.cs" />
<Compile Include="Base\TCDataDto.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+91 -19
View File
@@ -18,20 +18,12 @@ namespace EgwConf.Iob
public enum ComLayer
{
ND = 0,
Beckhoff,
Fanuc,
Db,
Dll,
File,
SqlServer,
IobPi,
Kawasaki,
ModBus,
MtConnect,
Omron,
OpcUa,
Osai,
Ping,
Siemens,
WPS
Network,
Serial
}
/// <summary>
@@ -40,11 +32,6 @@ namespace EgwConf.Iob
[JsonConverter(typeof(StringEnumConverter))]
public enum AdapterType
{
/// <summary>
/// Adapter non specificato
/// </summary>
ND = 0,
/// <summary>
/// Adapter SIMULAZIONE
/// </summary>
@@ -80,6 +67,16 @@ namespace EgwConf.Iob
///// </summary>
//FILE_XYLOG,
/// <summary>
/// File Based Log file analisys per Soitaab
/// </summary>
FILE_SOITAAB,
/// <summary>
/// Gestione sync FTP
/// </summary>
FTP,
/// <summary>
/// Adapter KAWASAKI e-controller
/// </summary>
@@ -95,6 +92,16 @@ namespace EgwConf.Iob
/// </summary>
IcoelSoap,
/// <summary>
/// Adapter non specificato
/// </summary>
ND,
/// <summary>
/// Adapter MITSUBISHI con EZCnc lib
/// </summary>
MITSUBISHI,
/// <summary>
/// Adapter ModBus TCP generico
/// </summary>
@@ -110,6 +117,11 @@ namespace EgwConf.Iob
/// </summary>
MODBUS_TCP_CENTERFRIGO,
/// <summary>
/// Adapter modbus (+ file) x FIMAT (Tenditalia)
/// </summary>
MODBUS_TCP_FIMAT,
/// <summary>
/// Adapter ModBus TCP versione HAM (Pizzaferri)
/// </summary>
@@ -125,6 +137,11 @@ namespace EgwConf.Iob
/// </summary>
MODBUS_TCP_IMAS_AEROMEC,
/// <summary>
/// Adapter Modubus TCP versione Rimor (IMI Remosa)
/// </summary>
MODBUS_TCP_RIMOR,
/// <summary>
/// Adapter Modubus TCP versione Saim (Giacovelli)
/// </summary>
@@ -160,6 +177,11 @@ namespace EgwConf.Iob
/// </summary>
OpcUaEwon,
/// <summary>
/// Adapter OPC-UA per Ewon x Adige (BLM) / STIL
/// </summary>
OpcUaEwonAdige,
/// <summary>
/// Adapter OPC-UA per Ewon x BLM / Mecart
/// </summary>
@@ -171,10 +193,20 @@ namespace EgwConf.Iob
OpcUaEwonMonti,
/// <summary>
/// Adapter OPC-UA per Ewon x Mecolpress / Stil
/// Adapter OPC-UA per Ewon x Mecolpress (BLM) / STIL
/// </summary>
OpcUaEwonMecolpress,
/// <summary>
/// Adapter OPC-UA per KeepWare
/// </summary>
OpcUaKwp,
/// <summary>
/// Adapter OPC-UA per KeepWare, UnitechRama
/// </summary>
OpcUaKwpRama,
/// <summary>
/// Adapter OPC-UA per IMAS Aeromec / Jetco
/// </summary>
@@ -215,6 +247,11 @@ namespace EgwConf.Iob
/// </summary>
OpcUaSiemensOMP,
/// <summary>
/// Adapter OPC-UA Siemens Rama
/// </summary>
OpcUaSiemensRama,
/// <summary>
/// Adapter OPC-UA Ulma (packaging, Giacovelli)
/// </summary>
@@ -240,6 +277,21 @@ namespace EgwConf.Iob
/// </summary>
PingWatchdog,
/// <summary>
/// Adapter REST (base)
/// </summary>
REST,
/// <summary>
/// Adapter REST Citizen
/// </summary>
REST_CITIZEN,
/// <summary>
/// Shelly's Device (tipicamente PM series)
/// </summary>
Shelly,
/// <summary>
/// Adapter SIEMENS
/// </summary>
@@ -256,10 +308,15 @@ namespace EgwConf.Iob
SIEMENS_AT2001,
/// <summary>
/// Adapter SIEMENS, interfaccia versione FAPE (punzonatrici)
/// Adapter SIEMENS, interfaccia versione FAPE (punzonatrici) vers 2018
/// </summary>
SIEMENS_FAPE,
/// <summary>
/// Adapter SIEMENS, interfaccia versione FAPE (punzonatrici) vers 2024
/// </summary>
SIEMENS_FAPE_2,
/// <summary>
/// Adapter SIEMENS, interfaccia versione COMECA (impianti gestione GNL)
/// </summary>
@@ -315,6 +372,21 @@ namespace EgwConf.Iob
/// </summary>
SIEMENS_TORRI,
/// <summary>
/// Adapter SOAP x bilance Gomba
/// </summary>
SOAP_GOMBA,
/// <summary>
/// Adapter basato su DB scambio Microsoft SqlServer, macchine LANTEK
/// </summary>
SQLSERVER_LANTEK,
/// <summary>
/// Adapter basato su DB scambio Microsoft SqlServer, macchine PAMA
/// </summary>
SQLSERVER_PAMA,
/// <summary>
/// Metodi di WPS WebPageScraping (es x compressori Atlas Copco)
/// </summary>
+16 -10
View File
@@ -7,6 +7,7 @@ using System;
using static EgwConf.Iob.EnumConf;
using System.Collections.Generic;
using System.Linq;
using EgwConf.Iob.Base;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
@@ -66,9 +67,13 @@ namespace EgwConf.Iob
newConfObj.CncData.pingMsTimeout = fIni.ReadInteger("IOB", "PING_MS_TIMEOUT", 500);
newConfObj.CncData.IpAddr = fIni.ReadString("CNC", "IP", "::1");
newConfObj.CncData.Port = fIni.ReadString("CNC", "PORT", "0");
newConfObj.CncData.CpuType = fIni.ReadString("CNC", "CPUTYPE", "");
newConfObj.CncData.Rack = (short)fIni.ReadInteger("CNC", "RACK", 0);
newConfObj.CncData.Slot = (short)fIni.ReadInteger("CNC", "SLOT", 0);
if (!string.IsNullOrEmpty(fIni.ReadString("CNC", "CPUTYPE", "")))
{
newConfObj.CncData.SiemensCpu = new Special.SiemensDto();
newConfObj.CncData.SiemensCpu.CpuType = fIni.ReadString("CNC", "CPUTYPE", "");
newConfObj.CncData.SiemensCpu.Rack = (short)fIni.ReadInteger("CNC", "RACK", 0);
newConfObj.CncData.SiemensCpu.Slot = (short)fIni.ReadInteger("CNC", "SLOT", 0);
}
// BLINK
newConfObj.InputDataProc.BlinkMaxCounter = Convert.ToInt32(fIni.ReadString("BLINK", "MAX_COUNTER_BLINK", "1"));
@@ -84,7 +89,7 @@ namespace EgwConf.Iob
newConfObj.ServerMES.Transport = MpIp.StartsWith("https://") ? "https" : "http";
newConfObj.ServerMES.IpAddr = MpIp.Replace($"{newConfObj.ServerMES.Transport}://", ""); // tolgo http/https...
}
// Altro (versione, ...)
newConfObj.ReleaseVers = $"{System.Reflection.Assembly.GetExecutingAssembly().GetName().Version}";
newConfObj.IobManConf.MinDeltaSec = fIni.ReadInteger("IOB", "MinDeltaSec", 6);
@@ -195,7 +200,7 @@ namespace EgwConf.Iob
public string ConfFileName { get; set; } = "";
/// <summary>
/// TIpologia generale dell'adapter
/// Tipologia generale dell'adapter
/// </summary>
public ComLayer GeneralCom { get; set; } = ComLayer.ND;
@@ -207,27 +212,27 @@ namespace EgwConf.Iob
/// <summary>
/// Setup server MP da chiamare
/// </summary>
public ServerMapo ServerMES { get; set; } = new ServerMapo();
public ServerMapoDto ServerMES { get; set; } = new ServerMapoDto();
/// <summary>
/// Setup info verso IOB-MAN
/// </summary>
public RedisPub IobManConf { get; set; } = new RedisPub();
public IobManDto IobManConf { get; set; } = new IobManDto();
/// <summary>
/// Dati configurazione CNC
/// </summary>
public CncConf CncData { get; set; } = new CncConf();
public ConnectParamsDto CncData { get; set; } = new ConnectParamsDto();
/// <summary>
/// Setup processing dati in ingresso (es: blink segnali)
/// </summary>
public InputSignalProcess InputDataProc { get; set; } = new InputSignalProcess();
public InputSignalDto InputDataProc { get; set; } = new InputSignalDto();
/// <summary>
/// Dati relativi ai parametri gestione tempo ciclo
/// </summary>
public TCData TempoCiclo { get; set; } = new TCData();
public TCDataDto TempoCiclo { get; set; } = new TCDataDto();
/// <summary>
/// Dizionario dei parametri opzionali
@@ -258,6 +263,7 @@ namespace EgwConf.Iob
/// <returns></returns>
public string GetYaml()
{
// opzioni alternative: PascalCaseNamingConvention (iniziale masiucola) o lowerCaseNamingConvention
var serializer = new SerializerBuilder()
.WithNamingConvention(CamelCaseNamingConvention.Instance)
.Build();
+26
View File
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwConf.Iob.Special
{
public class SiemensDto
{
/// <summary>
/// TipoCPU (es: 1500, 1200, 300)
/// </summary>
public string CpuType { get; set; } = "ND";
/// <summary>
/// Rack (Siemens S7)
/// </summary>
public short Rack { get; set; } = 0;
/// <summary>
/// Slot (Siemens S7)
/// </summary>
public short Slot { get; set; } = 0;
}
}