From e04a4f5b3a677f550c6829fe1644892d8668453a Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Mon, 5 Jun 2017 12:31:51 +0200 Subject: [PATCH] modifiche x test lettura posizione assi siemens --- MTC_Adapter/MTC_Adapter/AdapterGeneric.cs | 1 - MTC_Adapter/MTC_Adapter/AdapterSiemens.cs | 60 +++++++++---------- MTC_Adapter/MTC_Adapter/MTC-Adapter.csproj | 1 + .../MTC_Adapter/Readme/ToDos_Siemens.txt | 8 +++ 4 files changed, 39 insertions(+), 31 deletions(-) create mode 100644 MTC_Adapter/MTC_Adapter/Readme/ToDos_Siemens.txt diff --git a/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs b/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs index 564a226..8e8522e 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterGeneric.cs @@ -3199,7 +3199,6 @@ namespace MTC_Adapter getMtzDataFromPlc(); // gestisco lettura dati analogici da PLC... getAnalogDataFromPlc(); - // reload dati da file... reloadDataFromFile(); diff --git a/MTC_Adapter/MTC_Adapter/AdapterSiemens.cs b/MTC_Adapter/MTC_Adapter/AdapterSiemens.cs index 13ff133..bb367a2 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterSiemens.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterSiemens.cs @@ -655,7 +655,7 @@ namespace MTC_Adapter if (maintData.Length > 0) { // recupero i dati di manutenzione dall'area di memoria IN BLOCCO - int memIndex = 524; + int memIndex = 536; uint[] tabDatiMtz = new uint[maintData.Length]; inizio = DateTime.Now; SIEMENSMemRW_DWord(R, baseMemDb, memIndex, ref tabDatiMtz); @@ -670,31 +670,6 @@ namespace MTC_Adapter return fatto; } /// - /// Gestione lettura dati analogici - /// - public override bool getAnalogDataFromPlc() - { - bool fatto = false; - try - { - if (analogData.Length > 0) - { - // recupero i dati di manutenzione dall'area di memoria IN BLOCCO - int memIndex = 1052; - uint[] tabDatiAnalog = new uint[analogData.Length]; - inizio = DateTime.Now; - SIEMENSMemRW_DWord(R, baseMemDb, memIndex, ref tabDatiAnalog); - if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-DatiAnalog", tabDatiAnalog.Length * 4), DateTime.Now.Subtract(inizio).Ticks); - // decodifico aree memoria secondo tab configurazione - processAnalogData(tabDatiAnalog, analogData); - } - fatto = true; - } - catch - { } - return fatto; - } - /// /// Gestione lettura dati status da PLC /// public override bool getStatusDataFromPlc() @@ -705,7 +680,7 @@ namespace MTC_Adapter if (statusData.Length > 0) { // recupero i dati di manutenzione dall'area di memoria IN BLOCCO - int memIndex = 1036; + int memIndex = 1048; int numByte = 1 + (statusData.Length / 8); byte[] tabDatiStatus = new byte[numByte]; inizio = DateTime.Now; @@ -720,6 +695,31 @@ namespace MTC_Adapter { } return fatto; } + /// + /// Gestione lettura dati analogici + /// + public override bool getAnalogDataFromPlc() + { + bool fatto = false; + try + { + if (analogData.Length > 0) + { + // recupero i dati di manutenzione dall'area di memoria IN BLOCCO + int memIndex = 1064; + uint[] tabDatiAnalog = new uint[analogData.Length]; + inizio = DateTime.Now; + SIEMENSMemRW_DWord(R, baseMemDb, memIndex, ref tabDatiAnalog); + if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-DatiAnalog", tabDatiAnalog.Length * 4), DateTime.Now.Subtract(inizio).Ticks); + // decodifico aree memoria secondo tab configurazione + processAnalogData(tabDatiAnalog, analogData); + } + fatto = true; + } + catch + { } + return fatto; + } #endregion @@ -729,9 +729,9 @@ namespace MTC_Adapter protected override void loadOtherFile() { base.loadOtherFile(); - loadMaintData("DB1499", 524, 4); - loadStatusData("DB1499", 1036, 1); - loadAnalogData("DB1499", 1052, 1); + loadMaintData("DB1499", 536, 4); + loadStatusData("DB1499", 1048, 1); + loadAnalogData("DB1499", 1064, 1); } /// /// Processing allarmi CNC diff --git a/MTC_Adapter/MTC_Adapter/MTC-Adapter.csproj b/MTC_Adapter/MTC_Adapter/MTC-Adapter.csproj index eb7badb..d2d2f7d 100644 --- a/MTC_Adapter/MTC_Adapter/MTC-Adapter.csproj +++ b/MTC_Adapter/MTC_Adapter/MTC-Adapter.csproj @@ -184,6 +184,7 @@ Designer + diff --git a/MTC_Adapter/MTC_Adapter/Readme/ToDos_Siemens.txt b/MTC_Adapter/MTC_Adapter/Readme/ToDos_Siemens.txt new file mode 100644 index 0000000..daa4db7 --- /dev/null +++ b/MTC_Adapter/MTC_Adapter/Readme/ToDos_Siemens.txt @@ -0,0 +1,8 @@ +---------------------------------------------------------------- +- SIEMENS +---------------------------------------------------------------- + +- lettura multiValore: implementata x assi, da testare!!! +- modificare lettura dati UT per fare un solo accesso con + ItemRead contemporanei... +- LF: vanno accorpate letture COntatori (getMtzDataFromPlc | 536+) e Valori Analogici (getAnalogDataFromPlc | 1064+) con un unica lettura di 2 oggetti di dimensione pari a quanti valori ci sono da leggere... +- MF: lettura valori status (getStatusDataFromPlc | 1048+) da fare insieme alle altre info con readGlobalData \ No newline at end of file