Files
Mapo-IOB-WIN/IOB-WIN/IobConfiguration.cs
T
2020-11-25 16:35:02 +01:00

246 lines
7.9 KiB
C#

using IOB_UT;
using System;
using System.Collections.Generic;
namespace IOB_WIN
{
/// <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>
/// 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>
/// Nome file di INI
/// </summary>
public string iniFileName { get; set; } = "";
/// <summary>
/// Valore MAX per countdown segnali blinking
/// </summary>
public int MAX_COUNTER_BLINK { get; set; } = 10;
/// <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", "/IOB/enabled/", "/sendReboot.aspx?idxMacchina=", "/IOB/getCurrOdlStart/");
/// <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";
#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="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="CMD_FORCLE_SPLIT_ODL_">Comando x forzare split ODL</param>
public serverMapo(string MPIP_, string MPURL_ = "/MP/IO", string CMDBASE_ = "/IOB/input/", string CMDFLOG_ = "/IOB/flog/", 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/")
{
if (!string.IsNullOrEmpty(MPIP_))
{
MPIP = MPIP_.Replace("http://", ""); // tolgo http...
}
MPURL = MPURL_;
CMDBASE = CMDBASE_;
CMDFLOG = CMDFLOG_;
if (!string.IsNullOrEmpty(CMDBASE_))
{
CMDBASE_JSON = CMDBASE_.Replace("input", "evListJson");
}
if (!string.IsNullOrEmpty(CMDFLOG_))
{
CMDFLOG_JSON = CMDFLOG_.Replace("flog", "flogJson");
}
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 FLUSSSO generico - salvataggio parametri extra sistema MAPO
/// </summary>
public string CMDFLOG { get; set; } = "";
/// <summary>
/// comando base x LOG di FLUSSSO generico - salvataggio parametri extra sistema MAPO in modalità JSON payload come lista
/// </summary>
public string CMDFLOG_JSON { get; set; } = "";
/// <summary>
/// comando base x comando reboot
/// </summary>
public string CMDREBO { get; set; } = "";
/// <summary>
/// Indirizzo IP server
/// </summary>
public string MPIP { get; set; } = "";
/// <summary>
/// URL Base del server applicativo
/// </summary>
public string MPURL { get; set; } = "";
#endregion Public Properties
}
}