Aggiunta gestione dati stringa x ESA

This commit is contained in:
Samuele E. Locatelli
2021-07-22 14:31:03 +02:00
parent c315266041
commit b7f3fa236e
9 changed files with 2842 additions and 2578 deletions
+32 -9
View File
@@ -119,6 +119,7 @@ namespace EsaCncLib
public EsaStringMem SCMA_MManCMS_Release;
public EsaStringMem SCMA_MManCMS_SerialNumber;
public EsaStringMem[] SCMA_MManCMS_Strings;
public EsaDWordMem SCMA_MMan_ACK;
public EsaDWordMem SCMA_MMan_STROBE;
public EsaDWordMem SCMA_MMan_ALM;
@@ -164,13 +165,13 @@ namespace EsaCncLib
private static extern int ConvComunicationChannel([MarshalAs(UnmanagedType.LPStr)] string sChannelType);
[DllImport("KvCom3x", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, EntryPoint = "_init_board@8")]
private static extern int init_board([MarshalAs(UnmanagedType.LPStr)]string defcn_name, int ChannelType);
private static extern int init_board([MarshalAs(UnmanagedType.LPStr)] string defcn_name, int ChannelType);
[DllImport("KvCom3x", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, EntryPoint = "_exit_board@0")]
private static extern int exit_board();
[DllImport("KvCom3x", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, EntryPoint = "_get_reg_by_name@8")]
private static extern int get_reg_by_name([MarshalAs(UnmanagedType.LPStr)]string name, ref TS_REG pReg);
private static extern int get_reg_by_name([MarshalAs(UnmanagedType.LPStr)] string name, ref TS_REG pReg);
[DllImport("KvCom3x", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, EntryPoint = "_read_regbuffer@16")]
private static extern int read_regbuffer(ref TS_REG pReg, UInt16 Offset, UInt16 Count, [MarshalAs(UnmanagedType.LPArray)] UInt32[] pDst);
@@ -242,6 +243,7 @@ namespace EsaCncLib
{
SCMA_MManCMS_Release = new EsaStringMem();
SCMA_MManCMS_SerialNumber = new EsaStringMem();
SCMA_MManCMS_Strings = new EsaStringMem[20];
SCMA_MMan_ACK = new EsaDWordMem();
SCMA_MMan_STROBE = new EsaDWordMem();
SCMA_MMan_WD = new EsaWordMem();
@@ -260,6 +262,11 @@ namespace EsaCncLib
// aree FIXED secondo necessità: indicazione dimensione x impiego // rif aree reali ESA reale (commento successivo)
SCMA_MManCMS_Release.MemorySize = 20;
SCMA_MManCMS_SerialNumber.MemorySize = 50;
for (int i = 0; i < 20; i++)
{
SCMA_MManCMS_Strings[i] = new EsaStringMem();
SCMA_MManCMS_Strings[i].MemorySize = 50;
}
SCMA_MMan_ACK.MemorySize = 4; // 32
SCMA_MMan_STROBE.MemorySize = 4; // 32
SCMA_MMan_WD.MemorySize = 1; // 1
@@ -279,6 +286,10 @@ namespace EsaCncLib
// indirizzo area ESA...
SCMA_MManCMS_Release.AddressName = "CMSretvariables.Release";
SCMA_MManCMS_SerialNumber.AddressName = "CMSretvariables.SerialNumber";
for (int i = 0; i < 20; i++)
{
SCMA_MManCMS_Strings[i].AddressName = $"scma.scmastring[{i}].tag";
}
SCMA_MMan_ACK.AddressName = "scma.ACK"; //fIni.ReadString("NC", "SCMA_AreaAddress_ACK", "scma.ACK");
SCMA_MMan_STROBE.AddressName = "scma.STROBE";
SCMA_MMan_WD.AddressName = "scma.WD";
@@ -298,6 +309,10 @@ namespace EsaCncLib
// Creazione buffers letture memoria
SCMA_MManCMS_Release.data = "Release";
SCMA_MManCMS_SerialNumber.data = "SerialNumber";
for (int i = 0; i < 20; i++)
{
SCMA_MManCMS_Strings[i].data = "";
}
SCMA_MMan_ACK.data = new UInt32[SCMA_MMan_ACK.MemorySize];
SCMA_MMan_STROBE.data = new UInt32[SCMA_MMan_STROBE.MemorySize];
SCMA_MMan_ALM.data = new UInt32[SCMA_MMan_ALM.MemorySize];
@@ -412,15 +427,18 @@ namespace EsaCncLib
string valString = "";
for (int i = 0; i < currData.MemorySize; i++)
if (currData.tempData != null)
{
try
for (int i = 0; i < currData.MemorySize; i++)
{
valString += Convert.ToChar(currData.tempData[i]).ToString().Replace("\0", " ");
}
catch (Exception exc)
{
lg.Error(exc, $"Errore in decodifica {currData.AddressName}");
try
{
valString += Convert.ToChar(currData.tempData[i]).ToString().Replace("\0", " ");
}
catch (Exception exc)
{
lg.Error(exc, $"Errore in decodifica {currData.AddressName}");
}
}
}
// trimmo!
@@ -438,6 +456,11 @@ namespace EsaCncLib
{
readConvString(SCMA_MManCMS_Release);
readConvString(SCMA_MManCMS_SerialNumber);
// leggo le 20 variabili stringa...
for (int i = 0; i < 20; i++)
{
readConvString(SCMA_MManCMS_Strings[i]);
}
}
/// <summary>
/// Leggo il buffer di memorie DWORD
@@ -54,6 +54,7 @@ namespace SCMA.AdapterPLC.CMS
loadMaintData("CNT", 0, 1);
loadStatusData("MNT", 0, 1);
loadAnalogData("ANALOG", 0, 1);
loadStringData("STR", 0, 1);
loadAllarmiCNC();
}
@@ -597,6 +598,42 @@ namespace SCMA.AdapterPLC.CMS
}
return fatto;
}
/// <summary>
/// Gestione lettura dati stringa
/// </summary>
public override bool getStringDataFromPlc()
{
bool fatto = false;
try
{
// leggo e salvo var analogiche ANALOG
if (stringDataMaxNum > 0)
{
// recupero dati
inizio = DateTime.Now;
ncDevice.ReadStringData();
if (utils.CRB("recTime"))
{
TimingData.addResult("R-StringData", DateTime.Now.Subtract(inizio).Ticks);
}
string[] tabDatiString = new string[stringDataMaxNum];
for (int i = 0; i < stringDataMaxNum; i++)
{
tabDatiString[i] = ncDevice.SCMA_MManCMS_Strings[i].data;
}
// decodifico aree memoria secondo tab configurazione
processStringData(tabDatiString, stringData);
}
fatto = true;
}
catch (Exception exc)
{
lg.Error(string.Format("{0}", exc));
}
return fatto;
}
/// <summary>
/// Gestione lettura dati status da PLC
/// </summary>
+161 -6
View File
@@ -4,12 +4,12 @@ using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using NLog;
namespace SCMA.AdapterPLC
{
using AdapterCom;
using MTC;
using NLog;
using OPC_UA_REDIS;
#region macro oggetti da istanziare a blocchi da configurazione XML
@@ -754,7 +754,7 @@ namespace SCMA.AdapterPLC
currGateway.addItemNodeAndSet(vettUnOp[i].loadKey, itemType.Sample, availStatus.UNAVAILABLE.ToString().ToLower());
currGateway.addItemNodeAndSet(vettUnOp[i].accTimeKey, itemType.Sample, availStatus.UNAVAILABLE.ToString().ToLower());
currGateway.addItemNodeAndSet(vettUnOp[i].countKey, itemType.Sample, availStatus.UNAVAILABLE.ToString().ToLower());
// SOLO SE NON sono SOUR...
if (currGateway.protocollo != gwProtocol.SOURS)
{
@@ -794,7 +794,7 @@ namespace SCMA.AdapterPLC
// allarmi "base"
currGateway.addAlarmNodes();
//2019.07.22 NON RIPORTO USER_ACTION x SOUR
// 2019.07.22 NON RIPORTO USER_ACTION x SOUR
if (currGateway.protocollo != gwProtocol.SOURS)
{
// azioni utente
@@ -1093,6 +1093,11 @@ namespace SCMA.AdapterPLC
/// </summary>
public otherData[] analogData;
/// <summary>
/// Contenuto valori variabili stringa da PLC
/// </summary>
public otherData[] stringData;
/// <summary>
/// Contenuto valori status data da PLC
/// </summary>
@@ -1351,6 +1356,11 @@ namespace SCMA.AdapterPLC
/// </summary>
public List<string> elAnalogData;
/// <summary>
/// Vettore string data (SAMPLE)
/// </summary>
public List<string> elStringData;
#endregion Gestione contatori & obj specifici (Events & Samples)
#region oggetti complessi/completi
@@ -1889,6 +1899,76 @@ namespace SCMA.AdapterPLC
}
}
/// <summary>
/// Lettura file gestione dati stringa da PLC
/// </summary>
/// <param name="memPre"></param>
/// <param name="baseAddr"></param>
/// <param name="memSize"></param>
public void loadStringData(string memPre, int baseAddr, int memSize)
{
// carico dati x Maintenance
if (utils.CRB("verbose"))
{
lg.Info("Inizio caricamento vettore variabili stringa gestite");
}
int totRighe = 0;
string fileName = utils.StringListFile;
if (currGateway.protocollo == gwProtocol.SOURS)
{
fileName = utils.StringListFileSOUR;
}
string linea;
totRighe = File.ReadLines(fileName).Count();
// creo un vettore della dimensione corretta... conta anche commenti tanto poi riduco...
stringData = new otherData[File.ReadLines(fileName).Count()];
// carica da file...
StreamReader file = new StreamReader(fileName);
// leggo 1 linea alla volta...
int numRiga = 0;
while ((linea = file.ReadLine()) != null)
{
// se NON VUOTA...
if (linea != "")
{
// SE non è un commento...
if (linea.Substring(0, 1) != "#")
{
stringData[numRiga] = decodeOtherData(linea, utils.CRC("testCharSep"), memPre, baseAddr, memSize);
numRiga++;
}
}
}
// chiudo file
file.Close();
// ora trimmo vettore al solo numero VERO dei valori caricati...
Array.Resize<otherData>(ref stringData, numRiga);
if (utils.CRB("verbose"))
{
lg.Info(string.Format("Fine caricamento vettore di {0} variabili stringa gestite", numRiga));
}
// ora inizializzo l'insieme dei Samples delle var analogiche
elStringData = new List<string>();
string varName = "";
for (int i = 0; i < numRiga; i++)
{
varName = stringData[i].varName;
if (currGateway.protocollo != gwProtocol.SOURS)
{
varName = string.Format("STR_" + stringData[i].varName);
}
elStringData.Add(varName);
currGateway.addItemNodeByType(varName, itemType.Sample);
}
if (utils.CRB("verbose"))
{
lg.Info(string.Format("inizializzato vettore di {0} MTC.SAMPLES delle variabili string", numRiga));
}
}
/// <summary>
/// caricamento allarmi da file
/// </summary>
@@ -2736,6 +2816,15 @@ namespace SCMA.AdapterPLC
{
lg.Error($"Eccezione in getAnalogDataFromPlc:{Environment.NewLine}{exc}");
}
// gestisco lettura dati stringa da PLC...
try
{
getStringDataFromPlc();
}
catch (Exception exc)
{
lg.Error($"Eccezione in getStringDataFromPlc:{Environment.NewLine}{exc}");
}
}
/// <summary>
@@ -2783,6 +2872,15 @@ namespace SCMA.AdapterPLC
return fatto;
}
/// <summary>
/// Gestione lettura dati stringa
/// </summary>
public virtual bool getStringDataFromPlc()
{
bool fatto = false;
return fatto;
}
/// <summary>
/// Gestione lettura dati status da PLC
/// </summary>
@@ -4605,6 +4703,36 @@ namespace SCMA.AdapterPLC
return _analogDataMaxNum;
}
}
/// <summary>
/// Numero massimo (indice) valori string (privato)
/// </summary>
protected int _stringDataMaxNum = 0;
/// <summary>
/// Numero massimo (indice) valori string (calcolato)
/// </summary>
public int stringDataMaxNum
{
get
{
if (_stringDataMaxNum == 0)
{
if (stringData != null)
{
// prima stima
int idx = stringData.Length;
// ora ciclo...
foreach (var item in stringData)
{
int.TryParse(item.codNum, out idx);
_stringDataMaxNum = idx > _stringDataMaxNum ? idx : _stringDataMaxNum;
}
}
}
return _stringDataMaxNum;
}
}
/// <summary>
/// Processa la tabella di memoria dei dati analogici
/// </summary>
@@ -4664,7 +4792,7 @@ namespace SCMA.AdapterPLC
// gestisco in modalità "lazy" qualsiasi variabile (dividendo x opportuno fattore conversione...)
try
{
analogVal = (double) tabDatiAnag[idxTab] / (double) utils.CRI("fattDecVA");
analogVal = (double)tabDatiAnag[idxTab] / (double)utils.CRI("fattDecVA");
}
catch (Exception exc)
{
@@ -4679,6 +4807,33 @@ namespace SCMA.AdapterPLC
// aggiungo i vari analogici rilevati
parentForm.dataMonitor_3 += sb.ToString();
}
/// <summary>
/// Processa la tabella di memoria dei dati stringa
/// </summary>
/// <param name="tabDatiString"></param>
/// <param name="stringData"></param>
public void processStringData(string[] tabDatiString, otherData[] stringData)
{
// uno ad uno vado a inserirli nella mappa dei dati dell'adapter...
StringBuilder sb = new StringBuilder();
double analogVal = 0;
int idxTab = 0;
string origName = "";
for (int i = 0; i < stringData.Length; i++)
{
// calcolo idx a indice 0...
int.TryParse(stringData[i].codNum, out idxTab);
idxTab--;
origName = getOrigName(stringData[i].varName);
// salvo vettore Eventi...
currGateway.updateItemNodeValue(elStringData[idxTab], tabDatiString[idxTab]);
// accodo ultimi codici in visualizzazione...
sb.AppendLine(currGateway.getItemNode(elStringData[idxTab]).ToString().Replace("|", " | "));
}
// aggiungo i vari analogici rilevati
parentForm.dataMonitor_3 += sb.ToString();
}
/// <summary>
/// processa dataLayer e se necessario salva/mostra
@@ -4711,7 +4866,7 @@ namespace SCMA.AdapterPLC
needSave = procPzProd(needSave);
needSave = procGiriTotUnOp(needSave);
needSave = procNumCU(needSave);
needSave = procRepetitions(needSave);
needSave = procRepetitions(needSave);
needSave = procCounters(needSave);
needSave = procMovTotAssi(needSave);
needSave = procAccTimeAssi(needSave);
@@ -5783,7 +5938,7 @@ namespace SCMA.AdapterPLC
parentForm.dataMonitor_2 += string.Format("{0}{1}", outString.Substring(0, outString.Length - 3), Environment.NewLine);
return needSave;
}
/// <summary>
/// Processing delle variabili sul totale m percorsi dagli assi
+187 -186
View File
@@ -1,197 +1,198 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
</startup>
<appSettings>
<!--MAIN CONF-->
<add key="appName" value="SCMA" />
<!--parametri protocollo comunicazione-->
<!--<add key="adpProto" value="MTC" />-->
<!--<add key="adpProto" value="SOURS" />-->
<add key="adpProto" value="SOURS" />
<add key="MTC_port" value="7878" />
<add key="SOURS_IP" value="localhost" />
<add key="SOURS_port" value="6379" />
<add key="SOURS_baseHash" value="SOUR" />
<add key="stChkEnabled" value="true" />
<add key="logRedConnWaitTime" value="5" />
<add key="fullReset" value="false" />
<!--gestione TIMERS e periodi multipli x thread lenti-->
<add key="startTimerMs" value="250" />
<add key="timerIntMs" value="5" />
<!--invio da adapter ad agent: 5ms-->
<add key="fastCount" value="20" />
<!--100ms-->
<add key="normCount" value="100" />
<!--500ms-->
<add key="slowCount" value="1000" />
<!--5 sec-->
<add key="alarmSyncCount" value="6000" />
<!--30 sec-->
<add key="waitEndCycle" value="0" />
<!--ms attesa dopo ogni ciclo lettura...-->
<!--30 sec-->
<!--num cicli PRIMA di leggere davvero GCode x rallentare-->
<add key="contChkGCod" value="2" />
<!--gestione FINESTRA campionamento x counter in secondi (dati validi dati DOPO che è piena la coda x la finestra richiesta, mantenuta a quella durata...)-->
<add key="countWindSize" value="10" />
<!--parametri gestione watchdog-->
<add key="maxAdapterLockSec" value="5" />
<!--disabilito letture avanzate che UCCIDONO il programma (x ora SOLO allarmi CNC x FANUC-->
<add key="disableAdvRead" value="true" />
<!--gestione x abilitare/disabilitare lettura nome asse e path di controllo (OSAI)-->
<add key="enableAxNamePath" value="true" />
<!--AREA CONF IP FANUC-->
<!--SIMULATORE LOCALE
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
</startup>
<appSettings>
<!--MAIN CONF-->
<add key="appName" value="SCMA" />
<!--parametri protocollo comunicazione-->
<!--<add key="adpProto" value="MTC" />-->
<!--<add key="adpProto" value="SOURS" />-->
<add key="adpProto" value="SOURS" />
<add key="MTC_port" value="7878" />
<add key="SOURS_IP" value="localhost" />
<add key="SOURS_port" value="6379" />
<add key="SOURS_baseHash" value="SOUR" />
<add key="stChkEnabled" value="true" />
<add key="logRedConnWaitTime" value="5" />
<add key="fullReset" value="false" />
<!--gestione TIMERS e periodi multipli x thread lenti-->
<add key="startTimerMs" value="250" />
<add key="timerIntMs" value="5" />
<!--invio da adapter ad agent: 5ms-->
<add key="fastCount" value="20" />
<!--100ms-->
<add key="normCount" value="100" />
<!--500ms-->
<add key="slowCount" value="1000" />
<!--5 sec-->
<add key="alarmSyncCount" value="6000" />
<!--30 sec-->
<add key="waitEndCycle" value="0" />
<!--ms attesa dopo ogni ciclo lettura...-->
<!--30 sec-->
<!--num cicli PRIMA di leggere davvero GCode x rallentare-->
<add key="contChkGCod" value="2" />
<!--gestione FINESTRA campionamento x counter in secondi (dati validi dati DOPO che è piena la coda x la finestra richiesta, mantenuta a quella durata...)-->
<add key="countWindSize" value="10" />
<!--parametri gestione watchdog-->
<add key="maxAdapterLockSec" value="5" />
<!--disabilito letture avanzate che UCCIDONO il programma (x ora SOLO allarmi CNC x FANUC-->
<add key="disableAdvRead" value="true" />
<!--gestione x abilitare/disabilitare lettura nome asse e path di controllo (OSAI)-->
<add key="enableAxNamePath" value="true" />
<!--AREA CONF IP FANUC-->
<!--SIMULATORE LOCALE
IP LOOPBACK: 192.168.211.5/255.255.255.0
ipPLC = "192.168.211.5"-->
<!--<add key="ipPLC" value="192.168.211.5" />-->
<!--SIM PC
<!--<add key="ipPLC" value="192.168.211.5" />-->
<!--SIM PC
IP ETH: 192.168.139.201/255.255.255.0
ipPLC = "192.168.139.100"-->
<!--<add key="ipPLC" value="192.168.139.100" />-->
<!--<add key="ipPLC" value="192.168.139.1" />-->
<!--<add key="ipPLC" value="192.168.157.2"/>-->
<!--Sviluppo Steamware
<!--<add key="ipPLC" value="192.168.139.100" />-->
<!--<add key="ipPLC" value="192.168.139.1" />-->
<!--<add key="ipPLC" value="192.168.157.2"/>-->
<!--Sviluppo Steamware
IP ETH: 10.74.82.110/255.255.255.0
ipPLC = "10.74.82.110"-->
<!--PRODUZIONE
<!--PRODUZIONE
IP ETH: 192.168.139.201/255.255.255.0
ipPLC = "192.168.139.1"-->
<!--<add key="ipPLC" value="192.168.157.2"/>-->
<!--OSAI DEV-->
<!--<add key="ipPLC" value="192.168.157.2" />-->
<!--SIEMENS DEV-->
<!--<add key="ipPLC" value="192.168.214.1" />-->
<!--CMS PROD-->
<!--<add key="ipPLC" value="192.168.139.1" />-->
<add key="ipPLC" value="192.168.139.1" />
<add key="recTime" value="true" />
<add key="verbose" value="true" />
<add key="loglevel" value="5" />
<add key="mode" value="prod" />
<!--Definizione avvio Adapter-->
<add key="autoLoadConf" value="false" />
<add key="autoStartOnLoad" value="true" />
<add key="openDumpOnStart" value="true" />
<add key="startMinimized" value="false" />
<add key="windowCanMax" value="true" />
<add key="trayClose" value="true" />
<add key="autoSaveSec" value="60" />
<add key="waitRecMSec" value="5000" />
<add key="testCharSep" value="|" />
<add key="fattdecimale" value="1000" />
<add key="fattConvDistAssi" value="1000" />
<add key="fattDecVA" value="1" />
<!--<add key="fattDecVA" value="1000" />-->
<add key="fattFeedFanuc" value="10" />
<!--pre-filtraggio XML-->
<add key="xmlSanitize" value="true" />
<!--conf file-->
<add key="dataPath" value="DATA" />
<add key="dataConfPath" value="DATA\CONF" />
<add key="dataDatPath" value="DATA\DAT" />
<add key="resxPath" value="Resources" />
<add key="AlarmList" value="AlarmList.map" />
<add key="NameRepRolesList" value="NameRepRolesList.map" />
<add key="MemCopyList" value="MemCopyList.map" />
<add key="DataModel" value="DataModel.xml" />
<add key="AlarmListCNC" value="AlarmListCNC.map" />
<add key="defaultConfFile" value="DataModel.xml" />
<!--<add key="defaultConfFile" value="Adapter_ItemList.xml" />-->
<add key="defaultPersLayerFile" value="PersistData.dat" />
<add key="maxNumDD" value="30" />
<add key="defaultEsaFile" value="EsaKvara.ini" />
<add key="CounterListFilePath" value="CounterList.map" />
<add key="AnalogDataFilePath" value="AnalogData.map" />
<add key="StatusListFilePath" value="StatusList.map" />
<add key="SubModeListFilePath" value="SubModeList.map" />
<!--Gestione pathFanuc-->
<add key="FanucPathComb" value="true" />
<add key="FanucAxPathAssign" value="1,1,1,2,2,2" />
<!--Gestione path siemens-->
<add key="SiemensBaseCountPath" value="0" />
<!--gestione FANUC con assi limitati-->
<add key="FanucLimit3D" value="true" />
<!--conf gestione "semplificata" accesso a tutta la memoria ogni volta-->
<!--conf x CMS-->
<add key="procIotMem" value="false" />
<!--conf x ESA-KVARA-->
<!--<add key="procIotMem" value="true"/>-->
<!--file configurazione IotMem (ESA KVARA)-->
<add key="IOTByteFilePath" value="IOT_ByteList.map" />
<add key="IOTWordFilePath" value="IOT_WordList.map" />
<add key="IOTDWordFilePath" value="IOT_DWordList.map" />
<add key="IOTStringFilePath" value="IOT_StringList.map" />
<!--percorso file scambio dati "lenti" e conf MaintData memory area -->
<add key="GeneralStatusFilePath" value="CmsGeneralStatus.mtc" />
<!--gestione trigger eventi da allarmi-->
<add key="eStopCode" value="152" />
<!--gestione watchdog CMS-->
<add key="sendWatchDog" value="true" />
<add key="cycleWatchDog" value="3" />
<add key="readAllTop" value="true" />
<add key="fastCopy" value="true" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
<!--gestione spindle override gobale forzato da max valori letti...-->
<add key="getMaxSpOver" value="true" />
<!--gestione decodifica status-->
<add key="ouStatusByPlc" value="true" />
</appSettings>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="OPENcontrol" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://192.168.20.2:8080" binding="basicHttpBinding" bindingConfiguration="OPENcontrol" contract="OPENcontrol.OPENcontrolPortType" name="OPENcontrol" />
</client>
</system.serviceModel>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="lib;libs" />
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.1" newVersion="4.0.2.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<!--<add key="ipPLC" value="192.168.157.2"/>-->
<!--OSAI DEV-->
<!--<add key="ipPLC" value="192.168.157.2" />-->
<!--SIEMENS DEV-->
<!--<add key="ipPLC" value="192.168.214.1" />-->
<!--CMS PROD-->
<!--<add key="ipPLC" value="192.168.139.1" />-->
<add key="ipPLC" value="192.168.139.1" />
<add key="recTime" value="true" />
<add key="verbose" value="true" />
<add key="loglevel" value="5" />
<add key="mode" value="prod" />
<!--Definizione avvio Adapter-->
<add key="autoLoadConf" value="false" />
<add key="autoStartOnLoad" value="true" />
<add key="openDumpOnStart" value="true" />
<add key="startMinimized" value="false" />
<add key="windowCanMax" value="true" />
<add key="trayClose" value="true" />
<add key="autoSaveSec" value="60" />
<add key="waitRecMSec" value="5000" />
<add key="testCharSep" value="|" />
<add key="fattdecimale" value="1000" />
<add key="fattConvDistAssi" value="1000" />
<add key="fattDecVA" value="1" />
<!--<add key="fattDecVA" value="1000" />-->
<add key="fattFeedFanuc" value="10" />
<!--pre-filtraggio XML-->
<add key="xmlSanitize" value="true" />
<!--conf file-->
<add key="dataPath" value="DATA" />
<add key="dataConfPath" value="DATA\CONF" />
<add key="dataDatPath" value="DATA\DAT" />
<add key="resxPath" value="Resources" />
<add key="AlarmList" value="AlarmList.map" />
<add key="NameRepRolesList" value="NameRepRolesList.map" />
<add key="MemCopyList" value="MemCopyList.map" />
<add key="DataModel" value="DataModel.xml" />
<add key="AlarmListCNC" value="AlarmListCNC.map" />
<add key="defaultConfFile" value="DataModel.xml" />
<!--<add key="defaultConfFile" value="Adapter_ItemList.xml" />-->
<add key="defaultPersLayerFile" value="PersistData.dat" />
<add key="maxNumDD" value="30" />
<add key="defaultEsaFile" value="EsaKvara.ini" />
<add key="CounterListFilePath" value="CounterList.map" />
<add key="AnalogDataFilePath" value="AnalogData.map" />
<add key="StatusListFilePath" value="StatusList.map" />
<add key="StringDataFilePath" value="StringData.map" />
<add key="SubModeListFilePath" value="SubModeList.map" />
<!--Gestione pathFanuc-->
<add key="FanucPathComb" value="true" />
<add key="FanucAxPathAssign" value="1,1,1,2,2,2" />
<!--Gestione path siemens-->
<add key="SiemensBaseCountPath" value="0" />
<!--gestione FANUC con assi limitati-->
<add key="FanucLimit3D" value="true" />
<!--conf gestione "semplificata" accesso a tutta la memoria ogni volta-->
<!--conf x CMS-->
<add key="procIotMem" value="false" />
<!--conf x ESA-KVARA-->
<!--<add key="procIotMem" value="true"/>-->
<!--file configurazione IotMem (ESA KVARA)-->
<add key="IOTByteFilePath" value="IOT_ByteList.map" />
<add key="IOTWordFilePath" value="IOT_WordList.map" />
<add key="IOTDWordFilePath" value="IOT_DWordList.map" />
<add key="IOTStringFilePath" value="IOT_StringList.map" />
<!--percorso file scambio dati "lenti" e conf MaintData memory area -->
<add key="GeneralStatusFilePath" value="CmsGeneralStatus.mtc" />
<!--gestione trigger eventi da allarmi-->
<add key="eStopCode" value="152" />
<!--gestione watchdog CMS-->
<add key="sendWatchDog" value="true" />
<add key="cycleWatchDog" value="3" />
<add key="readAllTop" value="true" />
<add key="fastCopy" value="true" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
<!--gestione spindle override gobale forzato da max valori letti...-->
<add key="getMaxSpOver" value="true" />
<!--gestione decodifica status-->
<add key="ouStatusByPlc" value="true" />
</appSettings>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="OPENcontrol" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://192.168.20.2:8080" binding="basicHttpBinding" bindingConfiguration="OPENcontrol" contract="OPENcontrol.OPENcontrolPortType" name="OPENcontrol" />
</client>
</system.serviceModel>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="lib;libs" />
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.1" newVersion="4.0.2.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+1 -1
View File
@@ -260,7 +260,7 @@
<Component Name="01">
<Variable SymbolicName="RepsDone" BrowseName="RepsDone" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="003" CmsDataOpt="RTV" />
<Variable SymbolicName="RepsTarget" BrowseName="RepsTarget" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="035" CmsDataOpt="COUNT" />
<Variable SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Units="" />
<Variable SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Units="" CmsDataType="StringData" CmsDataIndex="01" />
</Component>
</Component>
</Component>
+2241 -2218
View File
File diff suppressed because it is too large Load Diff
@@ -260,7 +260,7 @@
<Component Name="01">
<Variable SymbolicName="RepsDone" BrowseName="RepsDone" DataType="ua:UInt32" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="003" CmsDataOpt="RTV" />
<Variable SymbolicName="RepsTarget" BrowseName="RepsTarget" DataType="ua:Float" ValueRank="Scalar" Units="Count" CmsDataType="CounterList" CmsDataIndex="035" CmsDataOpt="COUNT" />
<Variable SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Units="" />
<Variable SymbolicName="Name" BrowseName="Name" DataType="ua:String" ValueRank="Scalar" Units="" CmsDataType="StringData" CmsDataIndex="01" CmsDataOpt="" />
</Component>
</Component>
</Component>
+3
View File
@@ -266,6 +266,9 @@
<DependentUpon>App.config</DependentUpon>
<IsTransformFile>true</IsTransformFile>
</None>
<None Include="DATA\CONF\StringList.map">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\NameRepRolesList.map">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
+179 -157
View File
@@ -4,165 +4,187 @@ using System.Xml;
namespace SCMA
{
public class utils : MTC.baseUtils
{
/// <summary>
/// folder archiviazione dati configurazione (DATA\CONF)
/// </summary>
public static string resxDir
public class utils : MTC.baseUtils
{
get
{
return string.Format(@"{0}\{1}", Application.StartupPath, CRS("resxPath"));
}
}
/// <summary>
/// folder archiviazione dati configurazione (DATA\CONF)
/// </summary>
public static string confDir
{
get
{
return string.Format(@"{0}\{1}", Application.StartupPath, CRS("dataConfPath"));
}
}
/// <summary>
/// folder archiviazione dati storici giornalieri (DATA\DAT)
/// </summary>
public static string dataDatDir
{
get
{
return string.Format(@"{0}\{1}", Application.StartupPath, CRS("dataDatPath"));
}
}
/// <summary>
/// folder archiviazione dati (DATA)
/// </summary>
public static string dataDir
{
get
{
return string.Format(@"{0}\{1}", Application.StartupPath, CRS("dataPath"));
}
}
/// <summary>
/// File x regole di replacement USER DEFINED
/// </summary>
public static string nameRepRoleFile
{
get
{
return string.Format(@"{0}\{1}", utils.confDir, utils.CRS("NameRepRolesList"));
}
}
/// <summary>
/// File x regole di replacement generato ad hoc x SOUR / OPC-UA
/// </summary>
public static string nameRepRoleFileSOUR
{
get
{
return nameRepRoleFile.Replace(".map", ".SOUR.map");
}
}
/// <summary>
/// File StatusList
/// </summary>
public static string StatusListFile
{
get
{
return string.Format(@"{0}\{1}", utils.confDir, utils.CRS("StatusListFilePath"));
}
}
/// <summary>
/// File StatusList generato ad hoc x SOUR / OPC-UA
///
/// </summary>
public static string StatusListFileSOUR
{
get
{
return StatusListFile.Replace(".map", ".SOUR.map");
}
}
/// <summary>
/// File CounterList
/// </summary>
public static string CounterListFile
{
get
{
return string.Format(@"{0}\{1}", utils.confDir, utils.CRS("CounterListFilePath"));
}
}
/// <summary>
/// File CounterList generato ad hoc x SOUR / OPC-UA
///
/// </summary>
public static string CounterListFileSOUR
{
get
{
return CounterListFile.Replace(".map", ".SOUR.map");
}
}
/// <summary>
/// File AnalogList
/// </summary>
public static string AnalogListFile
{
get
{
return string.Format(@"{0}\{1}", utils.confDir, utils.CRS("AnalogDataFilePath"));
}
}
/// <summary>
/// File AnalogList generato ad hoc x SOUR / OPC-UA
///
/// </summary>
public static string AnalogListFileSOUR
{
get
{
return AnalogListFile.Replace(".map", ".SOUR.map");
}
}
/// <summary>
/// Metodo di sanitizzazione XML
/// - elimina commenti
/// - formatta
/// </summary>
/// <param name="xmlOrig"></param>
/// <returns></returns>
public static string xmlSanitize(string xmlOrig)
{
string sXml = xmlOrig;
bool xmlSanitize = utils.CRB("xmlSanitize");
// se richeisto faccio sanitize xml (pulizia commenti...)
if (xmlSanitize)
{
// primo step: converto stringa in dox XML
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.PreserveWhitespace = false;
xmlDoc.LoadXml(sXml);
// ora lo parso come lista eliminando i commenti
XmlNodeList list = xmlDoc.SelectNodes("//comment()");
foreach (XmlNode node in list)
/// <summary>
/// folder archiviazione dati configurazione (DATA\CONF)
/// </summary>
public static string resxDir
{
node.ParentNode.RemoveChild(node);
get
{
return string.Format(@"{0}\{1}", Application.StartupPath, CRS("resxPath"));
}
}
/// <summary>
/// folder archiviazione dati configurazione (DATA\CONF)
/// </summary>
public static string confDir
{
get
{
return string.Format(@"{0}\{1}", Application.StartupPath, CRS("dataConfPath"));
}
}
/// <summary>
/// folder archiviazione dati storici giornalieri (DATA\DAT)
/// </summary>
public static string dataDatDir
{
get
{
return string.Format(@"{0}\{1}", Application.StartupPath, CRS("dataDatPath"));
}
}
/// <summary>
/// folder archiviazione dati (DATA)
/// </summary>
public static string dataDir
{
get
{
return string.Format(@"{0}\{1}", Application.StartupPath, CRS("dataPath"));
}
}
/// <summary>
/// File x regole di replacement USER DEFINED
/// </summary>
public static string nameRepRoleFile
{
get
{
return string.Format(@"{0}\{1}", utils.confDir, utils.CRS("NameRepRolesList"));
}
}
/// <summary>
/// File x regole di replacement generato ad hoc x SOUR / OPC-UA
/// </summary>
public static string nameRepRoleFileSOUR
{
get
{
return nameRepRoleFile.Replace(".map", ".SOUR.map");
}
}
/// <summary>
/// File StatusList
/// </summary>
public static string StatusListFile
{
get
{
return string.Format(@"{0}\{1}", utils.confDir, utils.CRS("StatusListFilePath"));
}
}
/// <summary>
/// File StatusList generato ad hoc x SOUR / OPC-UA
///
/// </summary>
public static string StatusListFileSOUR
{
get
{
return StatusListFile.Replace(".map", ".SOUR.map");
}
}
/// <summary>
/// File CounterList
/// </summary>
public static string CounterListFile
{
get
{
return string.Format(@"{0}\{1}", utils.confDir, utils.CRS("CounterListFilePath"));
}
}
/// <summary>
/// File CounterList generato ad hoc x SOUR / OPC-UA
///
/// </summary>
public static string CounterListFileSOUR
{
get
{
return CounterListFile.Replace(".map", ".SOUR.map");
}
}
/// <summary>
/// File AnalogList
/// </summary>
public static string AnalogListFile
{
get
{
return string.Format(@"{0}\{1}", utils.confDir, utils.CRS("AnalogDataFilePath"));
}
}
/// <summary>
/// File AnalogList generato ad hoc x SOUR / OPC-UA
///
/// </summary>
public static string AnalogListFileSOUR
{
get
{
return AnalogListFile.Replace(".map", ".SOUR.map");
}
}
/// <summary>
/// File AnalogList
/// </summary>
public static string StringListFile
{
get
{
return string.Format(@"{0}\{1}", utils.confDir, utils.CRS("StringDataFilePath"));
}
}
/// <summary>
/// File AnalogList generato ad hoc x SOUR / OPC-UA
///
/// </summary>
public static string StringListFileSOUR
{
get
{
return StringListFile.Replace(".map", ".SOUR.map");
}
}
/// <summary>
/// Metodo di sanitizzazione XML
/// - elimina commenti
/// - formatta
/// </summary>
/// <param name="xmlOrig"></param>
/// <returns></returns>
public static string xmlSanitize(string xmlOrig)
{
string sXml = xmlOrig;
bool xmlSanitize = utils.CRB("xmlSanitize");
// se richeisto faccio sanitize xml (pulizia commenti...)
if (xmlSanitize)
{
// primo step: converto stringa in dox XML
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.PreserveWhitespace = false;
xmlDoc.LoadXml(sXml);
// ora lo parso come lista eliminando i commenti
XmlNodeList list = xmlDoc.SelectNodes("//comment()");
foreach (XmlNode node in list)
{
node.ParentNode.RemoveChild(node);
}
// fix formattazione "riscrivendo" indentazione...
StringWriter string_writer = new StringWriter();
XmlTextWriter xml_text_writer = new XmlTextWriter(string_writer);
xml_text_writer.Formatting = Formatting.Indented;
xmlDoc.WriteTo(xml_text_writer);
sXml = string_writer.ToString();
}
// restituisco
return sXml;
}
// fix formattazione "riscrivendo" indentazione...
StringWriter string_writer = new StringWriter();
XmlTextWriter xml_text_writer = new XmlTextWriter(string_writer);
xml_text_writer.Formatting = Formatting.Indented;
xmlDoc.WriteTo(xml_text_writer);
sXml = string_writer.ToString();
}
// restituisco
return sXml;
}
}
}