using IOB_UT;
using System;
using System.Collections.Generic;
namespace IOB_WIN
{
///
/// 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
///
[Serializable]
public class IobConfiguration
{
#region Public Constructors
///
/// Avvio configurazione DUMMY
///
public IobConfiguration()
{
}
#endregion Public Constructors
#region Public Properties
///
/// Valore intero corrispondente ai BIT da filtrare x blinking
///
public int BLINK_FILT { get; set; } = 0;
///
/// Indirizzo Ip del CNC Controllato
///
public string cncIpAddr { get; set; } = "127.0.0.1";
///
/// Porta del CNC Controllato
///
public string cncPort { get; set; } = "0";
///
/// Codice univoco IOB
///
public string codIOB { get; set; } = "ND";
///
/// TipoCPU (es: Siemens)
///
public string cpuType { get; set; } = "";
///
/// Nome file di INI
///
public string iniFileName { get; set; } = "";
///
/// Valore MAX per countdown segnali blinking
///
public int MAX_COUNTER_BLINK { get; set; } = 10;
///
/// Modello della macchina
///
public string model { get; set; } = "ND";
///
/// Dizionario dei parametri opzionali
///
public Dictionary optPar { get; set; } = new Dictionary();
///
/// Timeout test PING
///
public int pingMsTimeout { get; set; } = 500;
///
/// Rack (Siemens S7)
///
public short rack { get; set; } = 0;
///
/// Dati di conf del server MoonPro cui comunicare
///
public serverMapo serverData { get; set; } = new serverMapo("127.0.0.1", "/", "/IOB/input/", "/IOB/flog/", "/IOB", "/IOB/enabled/", "/sendReboot.aspx?idxMacchina=", "/IOB/getCurrOdlStart/");
///
/// Slot (Siemens S7)
///
public short slot { get; set; } = 0;
///
/// Fattore lambda (innovazione) per calcolo EWMA valore TCiclo corrente
///
public double TCLambda { get; set; } = 0.4;
///
/// Fattore massimo ammesso di delay x il TCiclo
///
public double TCMaxDelayFactor { get; set; } = 1.2;
///
/// Incremento amssimo pezzi per cui fare calcolo del tempociclo attuale
///
public double TCMaxIncrPz { get; set; } = 2;
///
/// Tipologia dell'adapter/CNC Controllato
///
public tipoAdapter tipoIob { get; set; } = tipoAdapter.SIMULA;
///
/// Vendor della macchina
///
public string vendor { get; set; } = "ND";
///
/// Versione IOB
///
public string versIOB { get; set; } = "0";
#endregion Public Properties
}
///
/// Dati conf server MAPO
///
[Serializable]
public class serverMapo
{
#region Public Constructors
///
/// Parametri configurazione server MoonPro cui inviare dati
///
/// Indirizzo IP del server MoonPro
/// URL Base server applicativo
/// Comando x invio INPUT
/// Comando x invio LOG per FLUSSO generico
/// Comando x check alive
/// Comando x check abilitato
/// Comando x reboot
/// Comando x check data avvio ODL
/// Comando x forzare split ODL
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
///
/// Installazione di riferimento
///
public string ClientInstall { get; set; } = "SW";
///
/// comando base x check avvio ODL
///
public string CMD_FORCLE_SPLIT_ODL { get; set; } = "";
///
/// comando base x check IDLE time IOB
///
public string CMD_IDLE_TIME { get; set; } = "";
///
/// comando base x check avvio ODL
///
public string CMD_ODL_STARTED { get; set; } = "";
///
/// comando base x check ALIVE
///
public string CMDALIVE { get; set; } = "";
///
/// comando base x INPUT
///
public string CMDBASE { get; set; } = "";
///
/// comando base x INPUT in modalità JSON payload come lista
///
public string CMDBASE_JSON { get; set; } = "";
///
/// comando base x check ENABLED
///
public string CMDENABLED { get; set; } = "";
///
/// comando base x LOG di FLUSSSO generico - salvataggio parametri extra sistema MAPO
///
public string CMDFLOG { get; set; } = "";
///
/// comando base x LOG di FLUSSSO generico - salvataggio parametri extra sistema MAPO in modalità JSON payload come lista
///
public string CMDFLOG_JSON { get; set; } = "";
///
/// comando base x comando reboot
///
public string CMDREBO { get; set; } = "";
///
/// Indirizzo IP server
///
public string MPIP { get; set; } = "";
///
/// URL Base del server applicativo
///
public string MPURL { get; set; } = "";
#endregion Public Properties
}
}