From f19461d0930aedebc9bd541dbbad165af860ae55 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Mon, 23 Apr 2018 16:12:32 +0200 Subject: [PATCH] inizio ad aggiungere area R --- IOB-WIN/DATA/CONF/3007.ini | 13 ++++-- IOB-WIN/IobFanuc.cs | 89 +++++++++++++++++++++++++++++++++++++- Jenkinsfile | 2 +- 3 files changed, 97 insertions(+), 7 deletions(-) diff --git a/IOB-WIN/DATA/CONF/3007.ini b/IOB-WIN/DATA/CONF/3007.ini index dacaf7f3..a19a6693 100644 --- a/IOB-WIN/DATA/CONF/3007.ini +++ b/IOB-WIN/DATA/CONF/3007.ini @@ -23,18 +23,23 @@ CMDREBO=/sendReboot.aspx?idxMacchina= [MEMORY] AREAG_SIZE=48 +AREAR_SIZE=24 AREAX_SIZE=8 AREAY_SIZE=8 -; Red: Y0.2 | Yellow: Y1.2 | Green Y2.6 +; Red: Y0.2 | Yellow: Y1.2 | Green Y2.6 | PZCount R10.5 / R22.4 ;BIT0=CONN BIT1=Y2.6 -BIT2=X5.2 +BIT2=R10.5 BIT3=Y0.2 BIT4=Y1.2 AREAD_START=0 -AREAD_SIZE=9999 +AREAD_SIZE=0 +AREAR_START=0 +AREAR_SIZE=24 +AREAX_START=0 +AREAX_SIZE=0 AREAY_START=0 -AREAY_SIZE=64 +AREAY_SIZE=0 [BLINK] ;MAX_COUNTER_BLINK = 30 diff --git a/IOB-WIN/IobFanuc.cs b/IOB-WIN/IobFanuc.cs index 840e3460..3290095d 100644 --- a/IOB-WIN/IobFanuc.cs +++ b/IOB-WIN/IobFanuc.cs @@ -26,6 +26,10 @@ namespace IOB_WIN /// protected byte[] MemBlockG = new byte[2]; /// + /// Area memoria R (copia) + /// + protected byte[] MemBlockR = new byte[2]; + /// /// Area memoria X (copia) /// protected byte[] MemBlockX = new byte[2]; @@ -104,13 +108,17 @@ namespace IOB_WIN /// protected memAddressFanuc areaD; /// - /// Dati dell'area Y + /// Dati dell'area R /// - protected memAddressFanuc areaY; + protected memAddressFanuc areaR; /// /// Dati dell'area X /// protected memAddressFanuc areaX; + /// + /// Dati dell'area Y + /// + protected memAddressFanuc areaY; /// /// estende l'init della classe base... @@ -130,10 +138,12 @@ namespace IOB_WIN IniFile fIni = new IniFile(IOBConf.iniFileName); // inizializzo aree di memoria correnti... MemBlockG = new byte[fIni.ReadInteger("MEMORY", "AREAG_SIZE", 8)]; + MemBlockR = new byte[fIni.ReadInteger("MEMORY", "AREAR_SIZE", 8)]; MemBlockX = new byte[fIni.ReadInteger("MEMORY", "AREAX_SIZE", 8)]; MemBlockY = new byte[fIni.ReadInteger("MEMORY", "AREAY_SIZE", 8)]; // loggo aree di memoria avviate... lgInfo(string.Format("Avviare area di memoria MemBlockG: {0} byte", MemBlockG.Length)); + lgInfo(string.Format("Avviare area di memoria MemBlockR: {0} byte", MemBlockR.Length)); lgInfo(string.Format("Avviare area di memoria MemBlockX: {0} byte", MemBlockX.Length)); lgInfo(string.Format("Avviare area di memoria MemBlockY: {0} byte", MemBlockY.Length)); @@ -144,6 +154,12 @@ namespace IOB_WIN startIdx = fIni.ReadInteger("MEMORY", "AREAD_START", 0), arraySize = fIni.ReadInteger("MEMORY", "AREAD_SIZE", 0) }; + areaR = new memAddressFanuc + { + areaName = "AreaR", + startIdx = fIni.ReadInteger("MEMORY", "AREAR_START", 0), + arraySize = fIni.ReadInteger("MEMORY", "AREAR_SIZE", 0) + }; areaX = new memAddressFanuc { areaName = "AreaX", @@ -157,6 +173,7 @@ namespace IOB_WIN arraySize = fIni.ReadInteger("MEMORY", "AREAY_SIZE", 0) }; lgInfo(string.Format("Salvata area di memoria: {0}, da {1} per {2} byte", areaD.areaName, areaD.startIdx, areaD.arraySize)); + lgInfo(string.Format("Salvata area di memoria: {0}, da {1} per {2} byte", areaR.areaName, areaR.startIdx, areaR.arraySize)); lgInfo(string.Format("Salvata area di memoria: {0}, da {1} per {2} byte", areaX.areaName, areaX.startIdx, areaX.arraySize)); lgInfo(string.Format("Salvata area di memoria: {0}, da {1} per {2} byte", areaY.areaName, areaY.startIdx, areaY.arraySize)); @@ -755,6 +772,74 @@ namespace IOB_WIN { dump_MemAreaY(tipo, areaY.startIdx, areaY.arraySize); } + // se l'area ha una size > 0... + if (areaR.arraySize > 0) + { + dump_MemArea(tipo, FANUC.MemType.R, areaR.startIdx, areaR.arraySize); + } + } + /// + /// Dump area D della memoria + /// + /// tipo di DUMP: START (sovrascrivendo) / SAMPLE (salva tanti campionamenti) + /// tipo memoria + /// area memoria di partenza + /// dimensione memoria + private void dump_MemArea(dumpType tipo, FANUC.MemType tipoMem, int memIndex, int memSizeByte) + { + DateTime adesso = DateTime.Now; + string nomeFileB = ""; + string nomeFileW = ""; + string nomeFileDW = ""; + Dictionary mappaValori = new Dictionary(); + // per sicurezza verifico < 9999 byte + if (memSizeByte > 9999) memSizeByte = 9999; + // leggo TUTTI i (MAX 9999) byte della memoria D... + byte[] MemBlockCurr = new byte[memSizeByte]; + if (verboseLog) lgInfo("START MemDump", tipoMem); + stopwatch.Restart(); + FanucMemRW(R, tipoMem, memIndex, ref MemBlockCurr); + if (utils.CRB("recTime")) TimingData.addResult(currIobConf.codIOB, string.Format("R{0}-{1}", MemBlockCurr.Length, tipoMem), stopwatch.ElapsedTicks); + if (verboseLog) lgInfo("END MemDump",tipoMem); + + // seconda del tipo di lettura definisco i nomi delle variabili... + if (tipo == dumpType.SAMPLE) + { + nomeFileB = string.Format(@"{0}\SAMPLES\{1}_{2}_Byte_{3:yyyyMMdd_HHmmss}.dat", utils.dataDatDir, currIobConf.codIOB, tipoMem, adesso); + nomeFileW = string.Format(@"{0}\SAMPLES\{1}_{2}_W_{3:yyyyMMdd_HHmmss}.dat", utils.dataDatDir, currIobConf.codIOB, tipoMem, adesso); + nomeFileDW = string.Format(@"{0}\SAMPLES\{1}_{2}_DW_{3:yyyyMMdd_HHmmss}.dat", utils.dataDatDir, currIobConf.codIOB, tipoMem, adesso); + } + else + { + // salvo in file i dati letti come BYTE + nomeFileB = string.Format(@"{0}\{1}_{2}_Byte.dat", utils.dataDatDir, currIobConf.codIOB, tipoMem); + nomeFileW = string.Format(@"{0}\{1}_{2}_W.dat", utils.dataDatDir, currIobConf.codIOB, tipoMem); + nomeFileDW = string.Format(@"{0}\{1}_{2}_DW.dat", utils.dataDatDir, currIobConf.codIOB, tipoMem); + } + + // salvo in file i dati letti come BYTE + mappaValori = new Dictionary(); + for (int i = 0; i < MemBlockCurr.Length; i++) + { + mappaValori.Add(i.ToString("0000"), MemBlockCurr[i].ToString()); + } + utils.WritePlain(mappaValori, nomeFileB); + + // salvo in file i dati letti come Word (2byte) + mappaValori = new Dictionary(); + for (int i = 0; i < MemBlockCurr.Length / 2; i++) + { + mappaValori.Add(i.ToString("0000"), BitConverter.ToUInt16(MemBlockCurr, i * 2).ToString()); + } + utils.WritePlain(mappaValori, nomeFileW); + + // salvo in file i dati letti come DWord (4byte) + mappaValori = new Dictionary(); + for (int i = 0; i < MemBlockCurr.Length / 4; i++) + { + mappaValori.Add(i.ToString("0000"), BitConverter.ToUInt32(MemBlockCurr, i * 4).ToString()); + } + utils.WritePlain(mappaValori, nomeFileDW); } /// /// Dump area D della memoria diff --git a/Jenkinsfile b/Jenkinsfile index e2b781d0..92b3d1df 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=249']) { + withEnv(['NEXT_BUILD_NUMBER=251']) { // env.versionNumber = VersionNumber(versionNumberString : '1.18.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '1.18.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO-IOB-WIN'