Aggiunte note e test x contapezzi

This commit is contained in:
Samuele E. Locatelli
2017-10-31 17:05:00 +01:00
parent 8d2628228b
commit c4278504bf
3 changed files with 80 additions and 4 deletions
+1
View File
@@ -10,6 +10,7 @@
<add key="enableContapezzi" value="true" />
<add key="enableMode" value="true" />
<add key="doMemDump" value="true" />
<add key="doSampleMemory" value="true" />
<!--gestione TIMERS e periodi multipli x thread lenti-->
<add key="startTimerMs" value="250" />
<!-- ciclo corto x invio a server: ms -->
+68 -4
View File
@@ -173,7 +173,7 @@ namespace IOB_WIN
parentForm.sIN = Semaforo.SV;
// leggo SEMAFORI, leggo da Y8 ...leggo 6 bit da Y8 a Y13...
byte[] MemBlock = new byte[RawInput.Length];
// Red: Y8.4 | Yellow: Y8.5 | Green Y8.6 | WrkZone Y8.7 | All DOorsClosed: Y10.5
// Red: Y8.4 | Yellow: Y8.5 | Green Y8.6 | WrkZone Y8.7 | All DoorsClosed: Y10.5
int memIndex = 8;
inizio = DateTime.Now;
if (verboseLog) lg.Info("START FanucMemRW-Y");
@@ -208,6 +208,19 @@ namespace IOB_WIN
if (nReadIN % 50 == 0) lg.Info(string.Format("Dati F: {0:X} | {1:X}", MemBlockF[0], MemBlockF[1]));
MemBlockF_pre = MemBlockF;
//if (nReadIN % 50 == 0) lg.Info(string.Format("Dati G: {0:X}", MemBlockG));
// commento lettura X...
#if false
byte[] MemBlockX = new byte[2];
inizio = DateTime.Now;
FanucMemRW(R, FANUC.MemType.X, 6, ref MemBlockX);
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-X", MemBlockF.Length), DateTime.Now.Subtract(inizio).Ticks);
// output!
for (int i = 0; i < MemBlockX.Length; i++)
{
lg.Info(string.Format("MemBlockX[{0}]: {0} | {1}", i, utils.binaryForm((int)MemBlockX[i])));
}
#endif
}
}
/// <summary>
@@ -245,13 +258,13 @@ namespace IOB_WIN
{
B_input += 1 << 1;
}
// NON HO CONTAPEZZI ovvero 1 << 3
// B1: verde! Y8.4
// NON HO CONTAPEZZI ovvero 1 << 2
// B3: Rosso! Y8.4
if ((primoByte & 16) > 0)
{
B_input += 1 << 3;
}
// B1: verde! Y8.5
// B4: giallo! Y8.5
if ((primoByte & 32) > 0)
{
B_input += 1 << 4;
@@ -318,6 +331,7 @@ namespace IOB_WIN
/// </summary>
public override void processContapezzi()
{
//base.processContapezzi();
if (utils.CRB("enableContapezzi"))
{
@@ -338,6 +352,27 @@ namespace IOB_WIN
// output!
// posizioni DWord
//1602:543809: NUM PEZZI x ciclo (6408..6411)
//1603:5300: NUM PEZZI RICHIESTI (6412..6415)
//1604:5007: NUM PEZZI FATTI (6416..6419)
//1605:543809: NUM PEZZI TOTALI (6420..6423)
// aggiunta lettura area X
byte[] MemBlockX = new byte[2];
inizio = DateTime.Now;
FanucMemRW(R, FANUC.MemType.X, 6, ref MemBlockX);
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-X", MemBlockF.Length), DateTime.Now.Subtract(inizio).Ticks);
// output!
for (int i = 0; i < MemBlockX.Length; i++)
{
lg.Info(string.Format("MemBlockX_{0}: {0} | {1}", i, utils.binaryForm((int)MemBlockX[i])));
}
// la variabile X7.0 (da 1 a 0) oppure la X7.1 (da 0 a 1) indica il CONTAPEZZI
}
catch (Exception exc)
{
@@ -376,6 +411,35 @@ namespace IOB_WIN
dump_MemAreaD();
dump_MemAreaY();
}
public override void sampleMemDump()
{
dump_MemAreaD(6400, 400);
}
/// <summary>
/// Dump PERIODICO area D della memoria
/// </summary>
/// <param name="memIndex">area memoria di partenza</param>
/// <param name="memSyzeByte"></param>
private void dump_MemAreaD(int memIndex, int memSyzeByte)
{
// leggo TUTTI i 9999 byte della memoria D...
byte[] MemBlockD = new byte[memSyzeByte];
inizio = DateTime.Now;
if (verboseLog) lg.Info("START MemDump AreaD");
FanucMemRW(R, FANUC.MemType.D, memIndex, ref MemBlockD);
if (verboseLog) lg.Info("END MemDump AreaD");
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-MemDumpD", MemBlockD.Length), DateTime.Now.Subtract(inizio).Ticks);
// file out!
string nomeFile = "";
Dictionary<string, string> mappaValori = new Dictionary<string, string>();
// salvo in file i dati letti come DWord (4byte)
nomeFile = string.Format(@"{0}\SAMPLES\MemDump_D_DW_{1:yyyyMMdd_HHmmss}.dat", utils.dataDatDir, DateTime.Now);
for (int i = 0; i < MemBlockD.Length / 4; i++)
{
mappaValori.Add(i.ToString("0000"), BitConverter.ToUInt32(MemBlockD, i * 4).ToString());
}
utils.WritePlain(mappaValori, nomeFile);
}
/// <summary>
/// Dump area D della memoria
/// </summary>
+11
View File
@@ -414,6 +414,8 @@ namespace IOB_WIN
{
// recupero dati SETUP (sysinfo) e li invio/mostro se variati...
processSysInfo();
// se richiesto faccio salvataggio aree memorie
if (utils.CRB("doSampleMemory")) sampleMemDump();
// eventuale log!
if (utils.CRB("recTime")) logTimeResults();
}
@@ -1516,6 +1518,15 @@ namespace IOB_WIN
public virtual void saveMemDump()
{
}
/// <summary>
/// metodo dummy x salvataggio aree memoria conf x CN
/// </summary>
public virtual void sampleMemDump()
{
}
#endregion