Merge branch 'SDK' into develop
This commit is contained in:
@@ -49,11 +49,19 @@
|
||||
<Compile Include="..\VersGen\MoonPro.cs">
|
||||
<Link>MoonPro.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="alarm.cs" />
|
||||
<Compile Include="dataConf.cs" />
|
||||
<Compile Include="Enums.cs" />
|
||||
<Compile Include="events.cs" />
|
||||
<Compile Include="fileEmbed.cs" />
|
||||
<Compile Include="flog.cs" />
|
||||
<Compile Include="GlobalSuppressions.cs" />
|
||||
<Compile Include="Objects.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="MSDK_utils.cs" />
|
||||
<Compile Include="samples.cs" />
|
||||
<Compile Include="stats.cs" />
|
||||
<Compile Include="ulog.cs" />
|
||||
<Compile Include="WebClientWT.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
|
||||
@@ -144,269 +144,6 @@ namespace MapoSDK
|
||||
#endregion Public Methods
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Definizione allarme
|
||||
/// </summary>
|
||||
public class alarmData
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Codice univoco
|
||||
/// </summary>
|
||||
public string code { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Descrizione
|
||||
/// </summary>
|
||||
public string description { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Severity (0....1000, minimo...massimo)
|
||||
/// </summary>
|
||||
public int severity { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Definizione classe evento allarme
|
||||
/// </summary>
|
||||
public class alarmEvent
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Lista delle condizioni di allarme attive ad inizio evento
|
||||
/// </summary>
|
||||
public List<alarmData> activeConditions { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Elenco dei dati di tipo FluxLog nei minuti antecedenti l'evento
|
||||
/// </summary>
|
||||
public List<rawData> blackBoxData { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Data riferimento campione in formato YMD = yyyyMMdd
|
||||
/// </summary>
|
||||
public int dateYMD { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Data-Ora inizio evento
|
||||
/// </summary>
|
||||
public DateTime ended { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Data-Ora inizio evento
|
||||
/// </summary>
|
||||
public DateTime started { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Contatore incrementale univoco annuale (per chiave yyyy.n)
|
||||
/// </summary>
|
||||
public int yCounter { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Anno di riferimento allarme (per chiave yyyy.n)
|
||||
/// </summary>
|
||||
public int yCurr { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Definizione classe evento allarme
|
||||
/// </summary>
|
||||
public class alarmStats
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Durata media annuale allarmi
|
||||
/// </summary>
|
||||
public double avgDuration
|
||||
{
|
||||
get
|
||||
{
|
||||
double answ = 0;
|
||||
try
|
||||
{
|
||||
answ = totalDuration / yCounter;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Valore cumulato complessivo degli allarmi registrati
|
||||
/// </summary>
|
||||
public double totalDuration { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Valore Contatore univoco annuale raggiunto yyyy.n
|
||||
/// </summary>
|
||||
public int yCounter { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Anno riferimento
|
||||
/// </summary>
|
||||
public int year { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Struttura conf tipo dati
|
||||
/// </summary>
|
||||
public class dataConf
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// DESCRIZIONE parametro
|
||||
/// </summary>
|
||||
public string description { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Fattore per eventuale divisione (es leggo 1234 --> 12,34 con factor=100)
|
||||
/// </summary>
|
||||
public int factor { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Indice nell'area di memoria (da valore iniziale = 0)
|
||||
/// </summary>
|
||||
public int index { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Valore massimo ammesso (ove usato, es simulazione)
|
||||
/// </summary>
|
||||
public int maxVal { get; set; } = 9999;
|
||||
|
||||
/// <summary>
|
||||
/// Nome "assoluto" della posizione nell'area di memoria (anche diverso da indice)
|
||||
/// </summary>
|
||||
public string memAddr { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Valore minimo ammesso (ove usato, es simulazione)
|
||||
/// </summary>
|
||||
public int minVal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// NOME parametro
|
||||
/// </summary>
|
||||
public string name { get; set; } = "none";
|
||||
|
||||
/// <summary>
|
||||
/// Size in byte
|
||||
/// </summary>
|
||||
public int size { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Tipo di dato
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public plcDataType tipoMem { get; set; } = plcDataType.Int;
|
||||
|
||||
/// <summary>
|
||||
/// Unità di misura del parametro
|
||||
/// </summary>
|
||||
public string unit { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Valore parametro (come stringa, decimali con ",", default VUOTO), poi LETTO da PLC (o appena scritto)
|
||||
/// </summary>
|
||||
public string value { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Struttura conf tipo dati
|
||||
/// </summary>
|
||||
public class dataConfTSVC : dataConf
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Tipo di funzione da applicare al dato
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public VC_func func { get; set; } = VC_func.MAX;
|
||||
|
||||
/// <summary>
|
||||
/// Periodo campionamento
|
||||
/// </summary>
|
||||
public int period { get; set; } = 60;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tracciato InputEvents in formato JSON valido
|
||||
/// Derivato da input realtime valore=3&dtEve=20181206180600000&dtCurr=20181206180600000&cnt=999
|
||||
/// </summary>
|
||||
public class evData
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Contatore incrementale x riordino invio (opzionale)
|
||||
/// </summary>
|
||||
public int cnt { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// DataOra corrente della trasmissione
|
||||
/// </summary>
|
||||
public DateTime dtCurr { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// DataOra evento
|
||||
/// </summary>
|
||||
public DateTime dtEve { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Valore del dato di flusso registrato
|
||||
/// </summary>
|
||||
public string valore { get; set; } = "-";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Singolo dettaglio evento
|
||||
/// </summary>
|
||||
public class EventDetail
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Nome evento
|
||||
/// </summary>
|
||||
public string what { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Data di riferimento
|
||||
/// </summary>
|
||||
public DateTime when { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Array valori tipo evData inviati come JSon
|
||||
/// </summary>
|
||||
public class evJsonPayload
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public List<evData> eventList { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe x inviare messaggi di tipo esecuzione di una generica esecuzione
|
||||
/// </summary>
|
||||
@@ -428,123 +165,6 @@ namespace MapoSDK
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
public class fileEmbed
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Array di file da inviare
|
||||
/// </summary>
|
||||
public List<smallFile> fileList { get; set; } = new List<smallFile>();
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tracciato FluxLog in formato JSON valido
|
||||
/// </summary>
|
||||
public class flogData : evData
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// nome del flusso
|
||||
/// </summary>
|
||||
public string flux { get; set; } = "ND";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Array valori tipo flogData inviati come JSon
|
||||
/// </summary>
|
||||
public class flogJsonPayload
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public List<flogData> fluxData { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Tracciato UserLog in formato JSON valido
|
||||
/// </summary>
|
||||
public class ulogData : evData
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Nome del flusso (RC/RS/DI)
|
||||
/// </summary>
|
||||
public string flux { get; set; } = "DI";
|
||||
/// <summary>
|
||||
/// Operatore di riferimento
|
||||
/// </summary>
|
||||
public int matrOpr { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// [OPZIONALE] label = causale scarto / tagCode
|
||||
/// </summary>
|
||||
public string label { get; set; } = "";
|
||||
/// <summary>
|
||||
/// [OPZIONALE] valNum = esitoOk (0/1) / Quantità di scarto associata
|
||||
/// </summary>
|
||||
public int valNum { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Array valori tipo flogData inviati come JSon
|
||||
/// </summary>
|
||||
public class ulogJsonPayload
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public List<ulogData> fluxData { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raccolta dati di storici sintetici per Macchina e Variabile
|
||||
/// </summary>
|
||||
public class histData
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Data riferimento campione in formato YMD = yyyyMMdd
|
||||
/// </summary>
|
||||
public int dateYMD { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Macchina
|
||||
/// </summary>
|
||||
public string macName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Periodo di aggregazione di riferimento
|
||||
/// </summary>
|
||||
//[JsonConverter(typeof(StringEnumConverter))]
|
||||
public timeWindow period { get; set; } = timeWindow.day;
|
||||
|
||||
/// <summary>
|
||||
/// Statistiche raccolte nel periodo
|
||||
/// </summary>
|
||||
public List<varStats> stats { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Tipo di valore registrato (internamente è string)
|
||||
/// </summary>
|
||||
//[JsonConverter(typeof(StringEnumConverter))]
|
||||
public plcDataType varType { get; set; } = plcDataType.Int;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dati resoconto IOB
|
||||
/// </summary>
|
||||
@@ -760,9 +380,6 @@ namespace MapoSDK
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Struttura conf memorie PLC (inizialmente SIEMENS)
|
||||
/// </summary>
|
||||
@@ -808,81 +425,6 @@ namespace MapoSDK
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raccolta dati di storici raw per Macchina e Variabile
|
||||
/// </summary>
|
||||
public class rawData
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Data riferimento campione in formato YMD = yyyyMMdd
|
||||
/// </summary>
|
||||
public int dateYMD { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Macchina
|
||||
/// </summary>
|
||||
public string macName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Periodo di aggregazione di riferimento
|
||||
/// </summary>
|
||||
//[JsonConverter(typeof(StringEnumConverter))]
|
||||
public timeWindow period { get; set; } = timeWindow.day;
|
||||
|
||||
/// <summary>
|
||||
/// Dati raw registrati nel periodo
|
||||
/// </summary>
|
||||
public List<rawSample> samples { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Nome della Variabile tracciata
|
||||
/// </summary>
|
||||
public string varName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Tipo di valore registrato (internamente è string)
|
||||
/// </summary>
|
||||
//[JsonConverter(typeof(StringEnumConverter))]
|
||||
public plcDataType varType { get; set; } = plcDataType.Int;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe oggetto base TimeSeries
|
||||
/// </summary>
|
||||
public class rawSample
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Data-Ora riferimento campione
|
||||
/// </summary>
|
||||
public DateTime timeStamp { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Valore in formato stringa
|
||||
/// </summary>
|
||||
public string value { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe x definire un file (corto) inviato come Json tramite httpost
|
||||
/// </summary>
|
||||
public class smallFile
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string content { get; set; } = "";
|
||||
public string fileName { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
public class StCheckOverride
|
||||
{
|
||||
#region Public Properties
|
||||
@@ -896,168 +438,4 @@ namespace MapoSDK
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe oggetto base TimeSeries
|
||||
/// </summary>
|
||||
public class tsData
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// In base al tipo di oggetto restituisce il valore cona deguata conversione......
|
||||
/// </summary>
|
||||
public object actValue
|
||||
{
|
||||
get
|
||||
{
|
||||
object answ = null;
|
||||
bool currBool = false;
|
||||
int currInt = 0;
|
||||
double currDouble = 0;
|
||||
switch (vcType)
|
||||
{
|
||||
case plcDataType.Boolean:
|
||||
_ = bool.TryParse(strValue, out currBool);
|
||||
answ = currBool;
|
||||
break;
|
||||
|
||||
case plcDataType.Int:
|
||||
case plcDataType.DInt:
|
||||
_ = int.TryParse(strValue, out currInt);
|
||||
answ = currInt;
|
||||
break;
|
||||
|
||||
case plcDataType.Real:
|
||||
_ = double.TryParse(strValue, out currDouble);
|
||||
answ = currDouble;
|
||||
break;
|
||||
|
||||
case plcDataType.String:
|
||||
default:
|
||||
answ = strValue;
|
||||
break;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Valore float
|
||||
/// </summary>
|
||||
public float floatVal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Valore intero
|
||||
/// </summary>
|
||||
public int intVal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Valore in formato stringa (che può venire customizzato)
|
||||
/// </summary>
|
||||
public string strValue { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Data-Ora riferimento campione
|
||||
/// </summary>
|
||||
public DateTime timeStamp { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Nome Macchina
|
||||
/// </summary>
|
||||
public string vcMachine { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Nome della Var Casuale
|
||||
/// </summary>
|
||||
public string vcName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Tipo di valore gestito
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public plcDataType vcType { get; set; } = plcDataType.Int;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggregazione dati VC
|
||||
/// </summary>
|
||||
public class tsGrouped
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Valore medio (NON definito)
|
||||
/// </summary>
|
||||
public object avgValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Periodo di aggregazione di riferimento
|
||||
/// </summary>
|
||||
public timeWindow period { get; set; } = timeWindow.hour;
|
||||
|
||||
/// <summary>
|
||||
/// Campioni effettivi nel periodo
|
||||
/// </summary>
|
||||
public List<tsData> samples { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Data-Ora riferimento campione
|
||||
/// </summary>
|
||||
public DateTime timeStamp { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Unità di Misura
|
||||
/// </summary>
|
||||
public string UM { get; set; } = "#";
|
||||
|
||||
/// <summary>
|
||||
/// Nome Macchina
|
||||
/// </summary>
|
||||
public string vcMachine { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Nome della Var Casuale
|
||||
/// </summary>
|
||||
public string vcName { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe oggetto statistiche sui dati
|
||||
/// </summary>
|
||||
public class varStats
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Valore medio/mediano
|
||||
/// </summary>
|
||||
public float avg { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Valore max
|
||||
/// </summary>
|
||||
public float max { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Valore min
|
||||
/// </summary>
|
||||
public float min { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Num record
|
||||
/// </summary>
|
||||
public int numRec { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Nome della Variabile tracciata
|
||||
/// </summary>
|
||||
public string varName { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MapoSDK
|
||||
{
|
||||
/// <summary>
|
||||
/// Definizione allarme
|
||||
/// </summary>
|
||||
public class alarmData
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Codice univoco
|
||||
/// </summary>
|
||||
public string code { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Descrizione
|
||||
/// </summary>
|
||||
public string description { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Severity (0....1000, minimo...massimo)
|
||||
/// </summary>
|
||||
public int severity { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Definizione classe evento allarme
|
||||
/// </summary>
|
||||
public class alarmEvent
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Lista delle condizioni di allarme attive ad inizio evento
|
||||
/// </summary>
|
||||
public List<alarmData> activeConditions { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Elenco dei dati di tipo FluxLog nei minuti antecedenti l'evento
|
||||
/// </summary>
|
||||
public List<rawData> blackBoxData { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Data riferimento campione in formato YMD = yyyyMMdd
|
||||
/// </summary>
|
||||
public int dateYMD { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Data-Ora inizio evento
|
||||
/// </summary>
|
||||
public DateTime ended { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Data-Ora inizio evento
|
||||
/// </summary>
|
||||
public DateTime started { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Contatore incrementale univoco annuale (per chiave yyyy.n)
|
||||
/// </summary>
|
||||
public int yCounter { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Anno di riferimento allarme (per chiave yyyy.n)
|
||||
/// </summary>
|
||||
public int yCurr { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Definizione classe evento allarme
|
||||
/// </summary>
|
||||
public class alarmStats
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Durata media annuale allarmi
|
||||
/// </summary>
|
||||
public double avgDuration
|
||||
{
|
||||
get
|
||||
{
|
||||
double answ = 0;
|
||||
try
|
||||
{
|
||||
answ = totalDuration / yCounter;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Valore cumulato complessivo degli allarmi registrati
|
||||
/// </summary>
|
||||
public double totalDuration { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Valore Contatore univoco annuale raggiunto yyyy.n
|
||||
/// </summary>
|
||||
public int yCounter { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Anno riferimento
|
||||
/// </summary>
|
||||
public int year { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace MapoSDK
|
||||
{
|
||||
/// <summary>
|
||||
/// Struttura conf tipo dati
|
||||
/// </summary>
|
||||
public class dataConf
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// DESCRIZIONE parametro
|
||||
/// </summary>
|
||||
public string description { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Fattore per eventuale divisione (es leggo 1234 --> 12,34 con factor=100)
|
||||
/// </summary>
|
||||
public int factor { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Indice nell'area di memoria (da valore iniziale = 0)
|
||||
/// </summary>
|
||||
public int index { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Valore massimo ammesso (ove usato, es simulazione)
|
||||
/// </summary>
|
||||
public int maxVal { get; set; } = 9999;
|
||||
|
||||
/// <summary>
|
||||
/// Nome "assoluto" della posizione nell'area di memoria (anche diverso da indice)
|
||||
/// </summary>
|
||||
public string memAddr { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Valore minimo ammesso (ove usato, es simulazione)
|
||||
/// </summary>
|
||||
public int minVal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// NOME parametro
|
||||
/// </summary>
|
||||
public string name { get; set; } = "none";
|
||||
|
||||
/// <summary>
|
||||
/// Size in byte
|
||||
/// </summary>
|
||||
public int size { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Tipo di dato
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public plcDataType tipoMem { get; set; } = plcDataType.Int;
|
||||
|
||||
/// <summary>
|
||||
/// Unità di misura del parametro
|
||||
/// </summary>
|
||||
public string unit { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Valore parametro (come stringa, decimali con ",", default VUOTO), poi LETTO da PLC (o appena scritto)
|
||||
/// </summary>
|
||||
public string value { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Struttura conf tipo dati
|
||||
/// </summary>
|
||||
public class dataConfTSVC : dataConf
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Tipo di funzione da applicare al dato
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public VC_func func { get; set; } = VC_func.MAX;
|
||||
|
||||
/// <summary>
|
||||
/// Periodo campionamento
|
||||
/// </summary>
|
||||
public int period { get; set; } = 60;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MapoSDK
|
||||
{
|
||||
/// <summary>
|
||||
/// Tracciato InputEvents in formato JSON valido
|
||||
/// Derivato da input realtime valore=3&dtEve=20181206180600000&dtCurr=20181206180600000&cnt=999
|
||||
/// </summary>
|
||||
public class evData
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Contatore incrementale x riordino invio (opzionale)
|
||||
/// </summary>
|
||||
public int cnt { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// DataOra corrente della trasmissione
|
||||
/// </summary>
|
||||
public DateTime dtCurr { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// DataOra evento
|
||||
/// </summary>
|
||||
public DateTime dtEve { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Valore del dato di flusso registrato
|
||||
/// </summary>
|
||||
public string valore { get; set; } = "-";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Singolo dettaglio evento
|
||||
/// </summary>
|
||||
public class EventDetail
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Nome evento
|
||||
/// </summary>
|
||||
public string what { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Data di riferimento
|
||||
/// </summary>
|
||||
public DateTime when { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Array valori tipo evData inviati come JSon
|
||||
/// </summary>
|
||||
public class evJsonPayload
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public List<evData> eventList { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MapoSDK
|
||||
{
|
||||
public class fileEmbed
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Array di file da inviare
|
||||
/// </summary>
|
||||
public List<smallFile> fileList { get; set; } = new List<smallFile>();
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe x definire un file (corto) inviato come Json tramite httpost
|
||||
/// </summary>
|
||||
public class smallFile
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string content { get; set; } = "";
|
||||
public string fileName { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MapoSDK
|
||||
{
|
||||
/// <summary>
|
||||
/// Tracciato FluxLog in formato JSON valido
|
||||
/// </summary>
|
||||
public class flogData : evData
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// nome del flusso
|
||||
/// </summary>
|
||||
public string flux { get; set; } = "ND";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Array valori tipo flogData inviati come JSon
|
||||
/// </summary>
|
||||
public class flogJsonPayload
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public List<flogData> fluxData { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MapoSDK
|
||||
{
|
||||
/// <summary>
|
||||
/// Raccolta dati di storici raw per Macchina e Variabile
|
||||
/// </summary>
|
||||
public class rawData
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Data riferimento campione in formato YMD = yyyyMMdd
|
||||
/// </summary>
|
||||
public int dateYMD { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Macchina
|
||||
/// </summary>
|
||||
public string macName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Periodo di aggregazione di riferimento
|
||||
/// </summary>
|
||||
//[JsonConverter(typeof(StringEnumConverter))]
|
||||
public timeWindow period { get; set; } = timeWindow.day;
|
||||
|
||||
/// <summary>
|
||||
/// Dati raw registrati nel periodo
|
||||
/// </summary>
|
||||
public List<rawSample> samples { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Nome della Variabile tracciata
|
||||
/// </summary>
|
||||
public string varName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Tipo di valore registrato (internamente è string)
|
||||
/// </summary>
|
||||
//[JsonConverter(typeof(StringEnumConverter))]
|
||||
public plcDataType varType { get; set; } = plcDataType.Int;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe oggetto base TimeSeries
|
||||
/// </summary>
|
||||
public class rawSample
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Data-Ora riferimento campione
|
||||
/// </summary>
|
||||
public DateTime timeStamp { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Valore in formato stringa
|
||||
/// </summary>
|
||||
public string value { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MapoSDK
|
||||
{
|
||||
/// <summary>
|
||||
/// Raccolta dati di storici sintetici per Macchina e Variabile
|
||||
/// </summary>
|
||||
public class histData
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Data riferimento campione in formato YMD = yyyyMMdd
|
||||
/// </summary>
|
||||
public int dateYMD { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Macchina
|
||||
/// </summary>
|
||||
public string macName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Periodo di aggregazione di riferimento
|
||||
/// </summary>
|
||||
//[JsonConverter(typeof(StringEnumConverter))]
|
||||
public timeWindow period { get; set; } = timeWindow.day;
|
||||
|
||||
/// <summary>
|
||||
/// Statistiche raccolte nel periodo
|
||||
/// </summary>
|
||||
public List<varStats> stats { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Tipo di valore registrato (internamente è string)
|
||||
/// </summary>
|
||||
//[JsonConverter(typeof(StringEnumConverter))]
|
||||
public plcDataType varType { get; set; } = plcDataType.Int;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe oggetto base TimeSeries
|
||||
/// </summary>
|
||||
public class tsData
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// In base al tipo di oggetto restituisce il valore cona deguata conversione......
|
||||
/// </summary>
|
||||
public object actValue
|
||||
{
|
||||
get
|
||||
{
|
||||
object answ = null;
|
||||
bool currBool = false;
|
||||
int currInt = 0;
|
||||
double currDouble = 0;
|
||||
switch (vcType)
|
||||
{
|
||||
case plcDataType.Boolean:
|
||||
_ = bool.TryParse(strValue, out currBool);
|
||||
answ = currBool;
|
||||
break;
|
||||
|
||||
case plcDataType.Int:
|
||||
case plcDataType.DInt:
|
||||
_ = int.TryParse(strValue, out currInt);
|
||||
answ = currInt;
|
||||
break;
|
||||
|
||||
case plcDataType.Real:
|
||||
_ = double.TryParse(strValue, out currDouble);
|
||||
answ = currDouble;
|
||||
break;
|
||||
|
||||
case plcDataType.String:
|
||||
default:
|
||||
answ = strValue;
|
||||
break;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Valore float
|
||||
/// </summary>
|
||||
public float floatVal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Valore intero
|
||||
/// </summary>
|
||||
public int intVal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Valore in formato stringa (che può venire customizzato)
|
||||
/// </summary>
|
||||
public string strValue { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Data-Ora riferimento campione
|
||||
/// </summary>
|
||||
public DateTime timeStamp { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Nome Macchina
|
||||
/// </summary>
|
||||
public string vcMachine { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Nome della Var Casuale
|
||||
/// </summary>
|
||||
public string vcName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Tipo di valore gestito
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public plcDataType vcType { get; set; } = plcDataType.Int;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggregazione dati VC
|
||||
/// </summary>
|
||||
public class tsGrouped
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Valore medio (NON definito)
|
||||
/// </summary>
|
||||
public object avgValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Periodo di aggregazione di riferimento
|
||||
/// </summary>
|
||||
public timeWindow period { get; set; } = timeWindow.hour;
|
||||
|
||||
/// <summary>
|
||||
/// Campioni effettivi nel periodo
|
||||
/// </summary>
|
||||
public List<tsData> samples { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Data-Ora riferimento campione
|
||||
/// </summary>
|
||||
public DateTime timeStamp { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Unità di Misura
|
||||
/// </summary>
|
||||
public string UM { get; set; } = "#";
|
||||
|
||||
/// <summary>
|
||||
/// Nome Macchina
|
||||
/// </summary>
|
||||
public string vcMachine { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Nome della Var Casuale
|
||||
/// </summary>
|
||||
public string vcName { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Classe oggetto statistiche sui dati
|
||||
/// </summary>
|
||||
public class varStats
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Valore medio/mediano
|
||||
/// </summary>
|
||||
public float avg { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Valore max
|
||||
/// </summary>
|
||||
public float max { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Valore min
|
||||
/// </summary>
|
||||
public float min { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Num record
|
||||
/// </summary>
|
||||
public int numRec { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Nome della Variabile tracciata
|
||||
/// </summary>
|
||||
public string varName { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MapoSDK
|
||||
{
|
||||
/// <summary>
|
||||
/// Tracciato UserLog in formato JSON valido
|
||||
/// </summary>
|
||||
public class ulogData : evData
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Nome del flusso (RC/RS/DI)
|
||||
/// </summary>
|
||||
public string flux { get; set; } = "DI";
|
||||
|
||||
/// <summary>
|
||||
/// [OPZIONALE] label = causale scarto / tagCode
|
||||
/// </summary>
|
||||
public string label { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Operatore di riferimento
|
||||
/// </summary>
|
||||
public int matrOpr { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// [OPZIONALE] valNum = esitoOk (0/1) / Quantità di scarto associata
|
||||
/// </summary>
|
||||
public int valNum { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Array valori tipo flogData inviati come JSon
|
||||
/// </summary>
|
||||
public class ulogJsonPayload
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public List<ulogData> fluxData { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user