using MapoSDK;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace IOB_UT_NEXT
{
///
/// Classe gestione configurazione parametri di base x configuraizone estesa (es MTConnect, OPC-UA, ...)
///
public class BaseParamConf
{
#region Public Properties
///
/// Struttura dati x check condizione LAVORA / Green
///
public List condWork { get; set; } = new List();
///
/// Elenco items FILTRATI da invio come dynData --> FluxLog (events o samples)
///
public List fluxLogVeto { get; set; } = new List();
///
/// Array degli elementi di traduzione item
///
public Dictionary itemTranslation { get; set; } = new Dictionary();
///
/// Nome variabile x EmergencyStop
///
public string keyEStop { get; set; } = "";
///
/// Nome variabile x pezzi FATTI
///
public string keyPartCount { get; set; } = "";
///
/// Nome variabile x Codice Articolo
///
public string keyPartId { get; set; } = "";
///
/// Nome variabile x pezzi RICHIESTI
///
public string keyPartReq { get; set; } = "";
///
/// Nome variabile x NOME PROGRAMMA
///
public string keyProgName { get; set; } = "";
///
/// Nome variabile x RunMode
///
public string keyRunMode { get; set; } = "";
///
/// Dictionary dei nomi da cercare come "endsWith" a cui applicare la soglia indicata
///
public Dictionary paramsEndThresh { get; set; } = new Dictionary();
///
/// Indica se il ping sia un criterio valido x determinare powerON impianto
///
public bool pingAsPowerOn { get; set; } = true;
#endregion Public Properties
}
///
/// Classe gestione configurazione parametri di base x allarmi
///
public class BaseAlarmConf
{
///
/// Descrizione area allarmi
///
public string description { get; set; } = "";
///
/// Tipo di dato
///
[JsonConverter(typeof(StringEnumConverter))]
public plcDataType tipoMem { get; set; } = plcDataType.Boolean;
///
/// Nome "assoluto" della posizione nell'area di memoria (anche diverso da indice)
///
public string memAddr { get; set; } = "";
///
/// Indice nell'area di memoria (da valore iniziale = 0)
///
public int index { get; set; } = 0;
///
/// Size in byte
///
public int size { get; set; } = 0;
///
/// Elenco allarmi configurati x la bitmap
///
public List messages { get; set; } = new List();
///
/// Array dei valori allarme correnti
///
public int[] alarmsState { get; set; }
}
///
/// Classe per rappresentare oggetti chaive/valore target x controlo condizioni multiple
///
public class diCheckCondition
{
#region Public Properties
///
/// nome variabile
///
public string keyName { get; set; } = "";
///
/// valore target per esito richeisto
///
public string targetValue { get; set; } = "";
#endregion Public Properties
}
///
/// Classe per rappresentare una lista di oggetti chaive/valore target x controlo condizioni multiple + indicazione modalità di controllo (AND/OR/...)
///
public class diCheckCondSetup
{
#region Public Properties
///
/// Elenco condizioni
///
public List checkList { get; set; } = new List();
///
/// Modalità verifica condizioni
///
public boolCheckMode checkMode { get; set; } = boolCheckMode.AND;
#endregion Public Properties
}
///
/// Classe gestione configurazione parametri specifici MTC da BaseParamConf
///
public class MtcParamConf : BaseParamConf
{
#region Public Properties
///
/// Struttura dati x check condizione PowerOn
///
public diCheckCondition condPowerOn { get; set; } = new diCheckCondition();
#endregion Public Properties
}
///
/// Classe gestione configurazione parametri specifici OPC-UA da BaseParamConf
///
public class OpcUaParamConf : BaseParamConf
{
#region Public Properties
///
/// Identificativo nodo iniziale
///
public string BrowseFullVal { get; set; } = "ns=2;s=Scalar_Static";
///
/// Indice NS da cui fare il browse dei file
///
public ushort BrowseNSIndex { get; set; } = 4;
///
/// ID del nodo da cui partire x il browse di identificazione nodi iniziale
///
public uint BrowseValue { get; set; } = 5001;
///
/// Struttura dati x check condizione Contapezzi Abilitato (se vuoto = sempre abilitato)
///
public diCheckCondSetup condCountEnabled { get; set; } = new diCheckCondSetup();
///
/// Struttura dati x check condizione Errore
///
public diCheckCondSetup condError { get; set; } = new diCheckCondSetup();
///
/// Struttura dati x check condizione Emergenza
///
public diCheckCondSetup condEStop { get; set; } = new diCheckCondSetup();
///
/// Struttura dati x check condizione Manual
///
public diCheckCondSetup condManual { get; set; } = new diCheckCondSetup();
///
/// Struttura dati x check condizione PowerOn
///
public diCheckCondSetup condPowerOn { get; set; } = new diCheckCondSetup();
///
/// Struttura dati x check condizione READY
///
public diCheckCondSetup condReady { get; set; } = new diCheckCondSetup();
///
/// Struttura dati x check condizione WarmUp - CoolDown
///
public diCheckCondSetup condWarmUpCoolDown { get; set; } = new diCheckCondSetup();
///
/// Aree di memoria lettura
///
public Dictionary mMapRead { get; set; } = new Dictionary();
///
/// Aree di memoria scrittura
///
public Dictionary mMapWrite { get; set; } = new Dictionary();
#endregion Public Properties
}
}