322 lines
11 KiB
C#
322 lines
11 KiB
C#
using IOB_UT_NEXT;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace IOB_WIN_NEXT
|
|
{
|
|
/// <summary>
|
|
/// This Configuration class is basically just a set of properties with a couple of static
|
|
/// methods to manage the serialization to and deserialization from a simple XML file.
|
|
///
|
|
/// ref: http://www.cambiaresearch.com/articles/33/how-can-i-easily-manage-an-xml-configuration-file-in-dotnet
|
|
/// </summary>
|
|
[Serializable]
|
|
public class IobConfiguration
|
|
{
|
|
#region Public Constructors
|
|
|
|
/// <summary>
|
|
/// Avvio configurazione DUMMY
|
|
/// </summary>
|
|
public IobConfiguration()
|
|
{
|
|
}
|
|
|
|
#endregion Public Constructors
|
|
|
|
#region Public Properties
|
|
|
|
/// <summary>
|
|
/// Valore intero corrispondente ai BIT da filtrare x blinking
|
|
/// </summary>
|
|
public int BLINK_FILT { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Indirizzo Ip del CNC Controllato
|
|
/// </summary>
|
|
public string cncIpAddr { get; set; } = "127.0.0.1";
|
|
|
|
/// <summary>
|
|
/// Indirizzo Ip per PING dell'impianto (se NON valorizzato usa cncIpAddr x ping)
|
|
/// </summary>
|
|
public string cncPingAddr { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Porta del CNC Controllato
|
|
/// </summary>
|
|
public string cncPort { get; set; } = "0";
|
|
|
|
/// <summary>
|
|
/// Codice univoco IOB
|
|
/// </summary>
|
|
public string codIOB { get; set; } = "ND";
|
|
|
|
/// <summary>
|
|
/// TipoCPU (es: Siemens)
|
|
/// </summary>
|
|
public string cpuType { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Indica che sono disabilitati i Task2Exe (tipicamente gestione scrittura verso PLC)
|
|
/// </summary>
|
|
public bool disableExeTask { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// Indica che sono disabilitate le fasi controllo stato/semafori (tipicamente x impianti
|
|
/// con PLC "suddivisi", PLC + HMI)
|
|
/// </summary>
|
|
public bool disableStateCh { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// Indica se le code vadano gestite su redis o meno
|
|
/// </summary>
|
|
public bool EnableRedisQueue { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// Nome del file IOB di avvio (REDIS - MAN)
|
|
/// </summary>
|
|
public string filenameIOB { get; set; } = "ND";
|
|
|
|
/// <summary>
|
|
/// Nome file di INI
|
|
/// </summary>
|
|
public string iniFileName { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Array degli elementi di traduzione item
|
|
/// </summary>
|
|
public Dictionary<string, string> itemTranslation { get; set; } = new Dictionary<string, string>();
|
|
|
|
/// <summary>
|
|
/// Valore MAX per countdown segnali blinking
|
|
/// </summary>
|
|
public int MAX_COUNTER_BLINK { get; set; } = 10;
|
|
|
|
/// <summary>
|
|
/// Minimo delta in sec x considerare variazioni info
|
|
/// </summary>
|
|
public int minDeltaSec { get; set; } = 2;
|
|
|
|
/// <summary>
|
|
/// Modello della macchina
|
|
/// </summary>
|
|
public string model { get; set; } = "ND";
|
|
|
|
/// <summary>
|
|
/// Dizionario dei parametri opzionali
|
|
/// </summary>
|
|
public Dictionary<string, string> optPar { get; set; } = new Dictionary<string, string>();
|
|
|
|
/// <summary>
|
|
/// Timeout test PING
|
|
/// </summary>
|
|
public int pingMsTimeout { get; set; } = 500;
|
|
|
|
/// <summary>
|
|
/// Rack (Siemens S7)
|
|
/// </summary>
|
|
public short rack { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Dati di conf del server MoonPro cui comunicare
|
|
/// </summary>
|
|
public serverMapo serverData { get; set; } = new serverMapo("127.0.0.1", "/", "/IOB/input/", "/IOB/flog/", "/IOB/ulog/", "/IOB", "/IOB/enabled/", "/sendReboot.aspx?idxMacchina=", "/IOB/getCurrOdlStart/", "SteamWare", "/IOB/forceSplitOdlFull", "/IOB/getIdlePeriod", "/IOB/rawTransfJson");
|
|
|
|
/// <summary>
|
|
/// Slot (Siemens S7)
|
|
/// </summary>
|
|
public short slot { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// Fattore lambda (innovazione) per calcolo EWMA valore TCiclo corrente
|
|
/// </summary>
|
|
public double TCLambda { get; set; } = 0.4;
|
|
|
|
/// <summary>
|
|
/// Fattore massimo ammesso di delay x il TCiclo
|
|
/// </summary>
|
|
public double TCMaxDelayFactor { get; set; } = 1.2;
|
|
|
|
/// <summary>
|
|
/// Incremento amssimo pezzi per cui fare calcolo del tempociclo attuale
|
|
/// </summary>
|
|
public double TCMaxIncrPz { get; set; } = 2;
|
|
|
|
/// <summary>
|
|
/// Tipologia dell'adapter/CNC Controllato
|
|
/// </summary>
|
|
public tipoAdapter tipoIob { get; set; } = tipoAdapter.SIMULA;
|
|
|
|
/// <summary>
|
|
/// Vendor della macchina
|
|
/// </summary>
|
|
public string vendor { get; set; } = "ND";
|
|
|
|
/// <summary>
|
|
/// Versione IOB
|
|
/// </summary>
|
|
public string versIOB { get; set; } = "0";
|
|
|
|
/// <summary>
|
|
/// Attesa riconnessione standard
|
|
/// </summary>
|
|
public int waitRecMSec { get; set; } = 59000;
|
|
|
|
#endregion Public Properties
|
|
}
|
|
|
|
/// <summary>
|
|
/// Dati conf server MAPO
|
|
/// </summary>
|
|
[Serializable]
|
|
public class serverMapo
|
|
{
|
|
#region Public Constructors
|
|
|
|
/// <summary>
|
|
/// Parametri configurazione server MoonPro cui inviare dati
|
|
/// </summary>
|
|
/// <param name="MPIP_">Indirizzo IP del server MoonPro</param>
|
|
/// <param name="MPURL_">URL Base server applicativo</param>
|
|
/// <param name="CMDBASE_">Comando x invio INPUT</param>
|
|
/// <param name="CMDFLOG_">Comando x invio LOG per FLUSSO generico</param>
|
|
/// <param name="CMDULOG_">Comando x invio USER LOG</param>
|
|
/// <param name="CMDALIVE_">Comando x check alive</param>
|
|
/// <param name="CMDENABLED_">Comando x check abilitato</param>
|
|
/// <param name="CMDREBO_">Comando x reboot</param>
|
|
/// <param name="CMD_ODL_STARTED_">Comando x check data avvio ODL</param>
|
|
/// <param name="CLI_INST_">Installazione</param>
|
|
/// <param name="CMD_FORCLE_SPLIT_ODL_">Comando x forzare split ODL</param>
|
|
/// <param name="CMD_IDLE_TIME_">URL calcolo idle time</param>
|
|
/// <param name="CMDRAWTRANSFJSON_">Url invio raw transf</param>
|
|
public serverMapo(string MPIP_, string MPURL_ = "/MP/IO", string CMDBASE_ = "/IOB/input/", string CMDFLOG_ = "/IOB/flog/", string CMDULOG_ = "/IOB/ulog/", string CMDALIVE_ = "IOB", string CMDENABLED_ = "/IOB/enabled/", string CMDREBO_ = "/sendReboot.aspx?idxMacchina=", string CMD_ODL_STARTED_ = "/IOB/getCurrOdlStart/", string CLI_INST_ = "SteamWare", string CMD_FORCLE_SPLIT_ODL_ = "/IOB/forceSplitOdlFull/", string CMD_IDLE_TIME_ = "/IOB/getIdlePeriod/", string CMDRAWTRANSFJSON_ = "/IOB/rawTransfJson/")
|
|
{
|
|
if (!string.IsNullOrEmpty(MPIP_))
|
|
{
|
|
if (MPIP_.StartsWith("https://"))
|
|
{
|
|
TRANSP = "https";
|
|
}
|
|
MPIP = MPIP_.Replace($"{TRANSP}://", ""); // tolgo http/https...
|
|
}
|
|
MPURL = MPURL_;
|
|
CMDBASE = CMDBASE_;
|
|
CMDFLOG = CMDFLOG_;
|
|
CMDRAWTRANSF_JSON = CMDRAWTRANSFJSON_;
|
|
CMDULOG = CMDULOG_;
|
|
if (!string.IsNullOrEmpty(CMDBASE_))
|
|
{
|
|
CMDBASE_JSON = CMDBASE_.Replace("input", "evListJson");
|
|
}
|
|
if (!string.IsNullOrEmpty(CMDFLOG_))
|
|
{
|
|
CMDFLOG_JSON = CMDFLOG_.Replace("flog", "flogJson");
|
|
}
|
|
if (!string.IsNullOrEmpty(CMDULOG_))
|
|
{
|
|
CMDULOG_JSON = CMDULOG_.Replace("ulog", "ulogJson");
|
|
}
|
|
CMDALIVE = CMDALIVE_;
|
|
CMDENABLED = CMDENABLED_;
|
|
CMDREBO = CMDREBO_;
|
|
CMD_ODL_STARTED = CMD_ODL_STARTED_;
|
|
CMD_FORCLE_SPLIT_ODL = CMD_FORCLE_SPLIT_ODL_;
|
|
CMD_IDLE_TIME = CMD_IDLE_TIME_;
|
|
ClientInstall = CLI_INST_;
|
|
}
|
|
|
|
#endregion Public Constructors
|
|
|
|
#region Public Properties
|
|
|
|
/// <summary>
|
|
/// Installazione di riferimento
|
|
/// </summary>
|
|
public string ClientInstall { get; set; } = "SW";
|
|
|
|
/// <summary>
|
|
/// comando base x check avvio ODL
|
|
/// </summary>
|
|
public string CMD_FORCLE_SPLIT_ODL { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// comando base x check IDLE time IOB
|
|
/// </summary>
|
|
public string CMD_IDLE_TIME { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// comando base x check avvio ODL
|
|
/// </summary>
|
|
public string CMD_ODL_STARTED { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// comando base x check ALIVE
|
|
/// </summary>
|
|
public string CMDALIVE { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// comando base x INPUT
|
|
/// </summary>
|
|
public string CMDBASE { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// comando base x INPUT in modalità JSON payload come lista
|
|
/// </summary>
|
|
public string CMDBASE_JSON { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// comando base x check ENABLED
|
|
/// </summary>
|
|
public string CMDENABLED { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// comando base x LOG di FLUSSO generico - salvataggio parametri extra sistema MAPO
|
|
/// </summary>
|
|
public string CMDFLOG { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// comando base x LOG di FLUSSO generico - salvataggio parametri extra sistema MAPO in
|
|
/// modalità JSON payload come lista
|
|
/// </summary>
|
|
public string CMDFLOG_JSON { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// comando base x Raw Transf LOG - salvataggio valori generici in modalità JSON payload
|
|
/// come lista
|
|
/// </summary>
|
|
public string CMDRAWTRANSF_JSON { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// comando base x comando reboot
|
|
/// </summary>
|
|
public string CMDREBO { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// comando base x USER LOG - salvataggio parametri extra sistema MAPO
|
|
/// </summary>
|
|
public string CMDULOG { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// comando base x USER LOG - salvataggio parametri extra sistema MAPO in modalità JSON
|
|
/// payload come lista
|
|
/// </summary>
|
|
public string CMDULOG_JSON { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Indirizzo IP server
|
|
/// </summary>
|
|
public string MPIP { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// URL Base del server applicativo
|
|
/// </summary>
|
|
public string MPURL { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Indica il metodo di trasporto http/https
|
|
/// </summary>
|
|
public string TRANSP { get; set; } = "http";
|
|
|
|
#endregion Public Properties
|
|
}
|
|
} |