diff --git a/MTC_Adapter/EsaCncLib/thdNcEsaGvKvara.cs b/MTC_Adapter/EsaCncLib/thdNcEsaGvKvara.cs
index c90de67..f92e1a6 100644
--- a/MTC_Adapter/EsaCncLib/thdNcEsaGvKvara.cs
+++ b/MTC_Adapter/EsaCncLib/thdNcEsaGvKvara.cs
@@ -119,71 +119,6 @@ namespace EsaCncLib
private EsaByteMem SCMA_MMan_OVR;
private EsaByteMem SCMA_MMan_status;
- // byteSize
-#if fase
- private UInt16 IOT_ByteAreaByteSize;
- private UInt16 IOT_WordAreaByteSize;
- private UInt16 IOT_DWordAreaByteSize;
- private UInt16 IOT_String_AreaByteSize;
-#endif
-
- // registri e nome aree
-#if false
- private string IOT_ByteAreaAddressName;
- private TS_REG IOT_ByteAreaAddress;
-
- private string IOT_WordAreaAddressName;
- private TS_REG IOT_WordAreaAddress;
-
- private string IOT_DWordAreaAddressName;
- private TS_REG IOT_DWordAreaAddress;
-
- private string IOT_StringA_AreaAddressName;
- private TS_REG IOT_StringA_AreaAddress;
- private string IOT_StringB_AreaAddressName;
- private TS_REG IOT_StringB_AreaAddress;
- private string IOT_StringC_AreaAddressName;
- private TS_REG IOT_StringC_AreaAddress;
- private string IOT_StringD_AreaAddressName;
- private TS_REG IOT_StringD_AreaAddress;
-#endif
-
- // memorie temp e reali
-#if false
- ///
- /// Area IOT_Byte: memoria temp di UINT di 4 byte (32 bit)
- ///
- public UInt32[] PLC_MemoryAreaIOT_Byte_tmp;
- ///
- /// Area IOT_Word: memoria temp di UINT di 4 byte (32 bit)
- ///
- public UInt32[] PLC_MemoryAreaIOT_Word_tmp;
- ///
- /// memorie a 1 byte (8 bit) x area IOT.Byte
- ///
- public Byte[] PLC_MemoryAreaIOT_Byte;
- ///
- /// memorie a 2 byte (16 bit) x area IOT.Word
- ///
- public UInt16[] PLC_MemoryAreaIOT_Word;
- ///
- /// memorie a 4 byte (32 bit) x area IOT.DWord
- ///
- public UInt32[] PLC_MemoryAreaIOT_DWord;
- ///
- /// memorie TEMP x area IOT.String
- ///
- public UInt32[] PLC_MemoryAreaIOT_String_tmp;
- ///
- /// memorie a 1 byte (8 bit) x area IOT.String (singoli caratteri...)
- ///
- public Byte[] PLC_MemoryAreaIOT_String_row;
- ///
- /// memorie a 1 byte (8 bit) x area IOT.String (singoli caratteri...)
- ///
- public Byte[,] PLC_MemoryAreaIOT_String;
-#endif
-
#endregion
diff --git a/MTC_Adapter/SCMA/AdapterPLC/CMS/EsaKosmos.cs b/MTC_Adapter/SCMA/AdapterPLC/CMS/EsaKosmos.cs
index cf2d243..1c963df 100644
--- a/MTC_Adapter/SCMA/AdapterPLC/CMS/EsaKosmos.cs
+++ b/MTC_Adapter/SCMA/AdapterPLC/CMS/EsaKosmos.cs
@@ -33,22 +33,6 @@ namespace SCMA.AdapterPLC.CMS
///
public allarme[] elencoAllarmiCNC;
- ///
- /// dimensione buffer BYTE (da file map)
- ///
- public int numByte = 0;
- ///
- /// dimensione buffer WORD (da file map)
- ///
- public int numWord = 0;
- ///
- /// dimensione buffer DWORD (da file map)
- ///
- public int numDWord = 0;
- ///
- /// Dimensione buffer string (FISSO!!!)
- ///
- public int numString = 255;
///
/// Carico file conf dati IOT
@@ -56,42 +40,15 @@ namespace SCMA.AdapterPLC.CMS
protected override void loadOtherFile()
{
base.loadOtherFile();
+#if false
loadByteListMap();
loadWordListMap();
loadDWordListMap();
- loadStringListMap();
+ loadStringListMap();
+#endif
loadAllarmiCNC();
}
- ///
- /// Carico conf vettore dati STRING
- ///
- private void loadStringListMap()
- {
- loadConfFile(ref mapIOT_String, filePath("IOTStringFilePath"), 1, ref numString);
- // riporto numString a 255!
- numString = 255;
- }
- ///
- /// Carico conf vettore dati DWORD
- ///
- private void loadDWordListMap()
- {
- loadConfFile(ref mapIOT_DWord, filePath("IOTDWordFilePath"), 1, ref numDWord);
- }
- ///
- /// Carico conf vettore dati WORD
- ///
- private void loadWordListMap()
- {
- loadConfFile(ref mapIOT_Word, filePath("IOTWordFilePath"), 1, ref numWord);
- }
- ///
- /// Carico conf vettore dati BYTE
- ///
- private void loadByteListMap()
- {
- loadConfFile(ref mapIOT_Byte, filePath("IOTByteFilePath"), 1, ref numByte);
- }
+
///
/// caricamento allarmi da file (CON RIEMPIMENTO MANCANTI!!!!)
///
@@ -151,84 +108,6 @@ namespace SCMA.AdapterPLC.CMS
{
return string.Format(@"{0}\{1}", utils.confDir, utils.CRS(keyFile));
}
- ///
- /// Legge il file di conf di una MAP di informazioni da gestire con lettura set memoria
- ///
- /// nome vettore memoria
- /// file origine
- /// dimensione (in byte) della memoria
- /// dimensione (in byte) della memoria
- protected void loadConfFile(ref otherData[] vettoreConf, string nomeFile, int memSize, ref int numVett)
- {
- otherData lastData = new otherData();
- int totRighe = 0;
- string linea;
- totRighe = File.ReadLines(nomeFile).Count();
- // creo un vettore della dimensione corretta... conta anche commenti tanto poi riduco...
- vettoreConf = new otherData[File.ReadLines(nomeFile).Count()];
- // carica da file...
- StreamReader file = new StreamReader(nomeFile);
- // leggo 1 linea alla volta...
- int numRiga = 0;
- int bitNum = 0;
- int byteNum = 0;
- while ((linea = file.ReadLine()) != null)
- {
- // SE non รจ un commento...
- if (linea.Substring(0, 1) != "#")
- {
- // se finisce per BIT allora processo bit-a-bit...
- if (linea.EndsWith("BOOL"))
- {
- try
- {
- string[] memIdx = linea.Split(utils.CRC("testCharSep"))[0].Split('.');
- // calcolo bit e byte number...
- int.TryParse(memIdx[0], out byteNum);
- if (memIdx.Length > 1)
- {
- int.TryParse(memIdx[1], out bitNum);
- }
- else
- {
- bitNum = 0;
- }
- }
- catch
- {
- byteNum = 0;
- bitNum = 0;
- }
- lastData = decodeBitData(linea, utils.CRC("testCharSep"), byteNum, 1, bitNum);
- vettoreConf[numRiga] = lastData;
- }
- else
- {
- lastData = decodeOtherData(linea, utils.CRC("testCharSep"), "", 1, memSize);
- vettoreConf[numRiga] = lastData;
- }
- numRiga++;
- }
- }
- // salvo lunghezza file...
- try
- {
- numVett = Convert.ToInt32(lastData.memAddr) + 1;
- }
- catch
- {
- numVett = numRiga + 1;
- }
- // chiudo file
- file.Close();
- // ora trimmo vettore al solo numero VERO dei valori caricati...
- Array.Resize(ref vettoreConf, numRiga);
-
- if (utils.CRB("verbose"))
- {
- lg.Info(string.Format("Fine caricamento vettore di {0} variabili per file {1}", numRiga, nomeFile));
- }
- }
///
/// oggetto onnessione ESA
@@ -261,8 +140,8 @@ namespace SCMA.AdapterPLC.CMS
loadOtherFile();
parentForm.commPlcActive = true;
- //ncDevice = new thdNcEsaGvKvara(EsaIni, mapIOT_Byte.Length, mapIOT_Word.Length, mapIOT_DWord.Length, 255); // impostato a 255 byte (char) FISSO x la parte stringa... mapIOT_String.Length);
- ncDevice = new thdNcEsaKvara(EsaIni, numByte, numWord, numDWord, numString); // impostato a 255 byte (char) FISSO x la parte stringa... mapIOT_String.Length);
+ // init classe comunicazione NC
+ ncDevice = new thdNcEsaKvara(EsaIni);
parentForm.commPlcActive = false;
if (utils.CRB("verbose"))
@@ -339,15 +218,15 @@ namespace SCMA.AdapterPLC.CMS
ncDevice.ReadBufferByte();
if (utils.CRB("recTime"))
{
- TimingData.addResult(string.Format("R{0}-PLC_IOT-Byte", ncDevice.PLC_MemoryAreaIOT_Byte.Length), DateTime.Now.Subtract(inizio).Ticks);
+ TimingData.addResult("R-PLC_SCMA-Byte", DateTime.Now.Subtract(inizio).Ticks);
}
-
parentForm.commPlcActive = false;
}
else
{
lg.Error("Errore connessione mancante in getIotMem_Byte");
}
+
// Processing area BYTE
int numero = 0;
string status = "";
@@ -973,57 +852,7 @@ namespace SCMA.AdapterPLC.CMS
// update form!
parentForm.dataMonitor_1 += sb.ToString();
}
- ///
- /// Carica ed acquisisce dati del buffer STRING di memoria
- ///
- protected void getIotMem_String()
- {
- // accodo dati path in DataMonitor......
- StringBuilder sb = new StringBuilder();
- if (connectionOk)
- {
- // leggo TUTTO il blocco di memoria
- parentForm.commPlcActive = true;
- inizio = DateTime.Now;
- ncDevice.ReadBufferString();
- if (utils.CRB("recTime"))
- {
- TimingData.addResult(string.Format("R{0}-PLC_IOT-DWord", ncDevice.PLC_MemoryAreaIOT_DWord.Length), DateTime.Now.Subtract(inizio).Ticks);
- }
- parentForm.commPlcActive = false;
- }
- else
- {
- lg.Error("Errore connessione mancante in getIotMem_DWord");
- }
-
- // Processing area STRING: OGNI area di memoria...
- for (int j = 0; j < mapIOT_String.Length; j++)
- {
- string valString = "";
-
- for (int i = 0; i < numString; i++)
- {
- try
- {
- valString += Convert.ToChar(ncDevice.PLC_MemoryAreaIOT_String[j, i]).ToString().Replace("\0", " ");
- }
- catch (Exception exc)
- {
- lg.Error(exc, "Errore in decodifica " + mapIOT_String[i].varName);
- }
- }
- // trimmo!
- valString = valString.Trim();
- // salvo
- currGateway.updateItemNodeCodeValue(vettMemArea[j].prgNameKey, j.ToString(), valString);
- // aggiungo nomi programmi...
- sb.AppendLine(string.Format("{0}: {1}", mapIOT_String[j].varName, valString));
- }
- // update form!
- parentForm.dataMonitor_2 += sb.ToString();
- }
public override void getGlobalData()
{
base.getGlobalData();
@@ -1040,7 +869,6 @@ namespace SCMA.AdapterPLC.CMS
parentForm.dataMonitor_3 = "";
// recupero le varie memorie (prima string che mi serve x area selezionata --> programma selezionato)
- getIotMem_String();
getIotMem_Byte();
getIotMem_Word();
getIotMem_DWord();