Completata gestione status

Creato log performances esecuzione letture
inizio modifica visualizzione strobes in maschera
This commit is contained in:
Samuele E. Locatelli
2016-05-11 15:36:40 +02:00
parent 7597be9641
commit f3b0111eb0
10 changed files with 1617 additions and 1434 deletions
Binary file not shown.
+2 -2
View File
@@ -52,9 +52,9 @@ namespace MTC_Sim
mPower.Value = parentForm.datiProd.Power;
}
public override void getStrobeStatus()
public override void getStrobeAndAckStatus()
{
base.getStrobeStatus();
base.getStrobeAndAckStatus();
// controllo bool allarmi...
if (parentForm.datiProd.EmrStop)
+84 -55
View File
@@ -92,22 +92,28 @@ namespace MTC_Sim
/// <summary>
/// Effettuo lettura dei 16 byte di strobe/status
/// </summary>
public override void getStrobeStatus()
public override void getStrobeAndAckStatus()
{
base.getStrobeStatus();
base.getStrobeAndAckStatus();
// leggo TUTTO ack e strobe,
byte[] MemBlock = new byte[Strobes.Length + Acknowl.Length];
int memIndex = 10500;
DateTime inizio = DateTime.Now;
FANUC_ref.F_RW_Byte(R, FANUC.MemType.R, memIndex, ref MemBlock);
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}", MemBlock.Length), DateTime.Now.Subtract(inizio).Ticks);
// suddivido!
Buffer.BlockCopy(MemBlock, 0, Acknowl, 0, Acknowl.Length);
Buffer.BlockCopy(MemBlock, Acknowl.Length, Strobes, 0, Strobes.Length);
#if false
// hard coded: leggo le 16 word standard dello strobe... R10500--> R10515
FANUC_ref.F_RW_Byte(R, FANUC.MemType.R, 10500, ref Acknowl);
// hard coded: leggo le 16 word standard dello strobe... R10516--> R10532
FANUC_ref.F_RW_Byte(R, FANUC.MemType.R, 10516, ref Strobes);
}
/// <summary>
/// leggo i byte di ACK...
/// </summary>
public override void getAckStatus()
{
base.getAckStatus();
// hard coded: leggo le 16 word standard dello strobe... R10500--> R10515
FANUC_ref.F_RW_Byte(R, FANUC.MemType.R, 10500, ref Acknowl);
#endif
}
/// <summary>
@@ -122,6 +128,7 @@ namespace MTC_Sim
int idxPath = 0;
int memIndex = 0;
int bitNum = 0;
DateTime inizio = DateTime.Now;
// byte di acknowledge...
byte[] retACK_DW1 = new byte[4];
// controllo TUTTI i flag: se ce ne sono di alzati DEVO processare...
@@ -134,9 +141,9 @@ namespace MTC_Sim
byte[] MemBlock = new byte[46];
// leggo tutto!!!
memIndex = 10660;
if (utils.CRB("recTime")) lg.Info("Inizio lettura 46 byte");
inizio = DateTime.Now;
FANUC_ref.F_RW_Byte(R, FANUC.MemType.R, memIndex, ref MemBlock);
if (utils.CRB("recTime")) lg.Info("Fine lettura 46 byte");
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}", MemBlock.Length), DateTime.Now.Subtract(inizio).Ticks);
// check COD_M
bitNum = 0;
@@ -204,6 +211,7 @@ namespace MTC_Sim
retACK_DW1 = utils.setBitOnStFlag(retACK_DW1, 1, bitNum);
}
#if false
// check assi assegnati al path 01...
bitNum = 3;
if (STRB_DW1.HasFlag((StFlag32)Math.Pow(2, bitNum)))
@@ -229,7 +237,8 @@ namespace MTC_Sim
// memorizzo allarme nel vettore ack....
retACK_DW1 = utils.setBitOnStFlag(retACK_DW1, 1, bitNum);
}
}
#endif
}
else
{
@@ -242,8 +251,9 @@ namespace MTC_Sim
}
memIndex = 10504;
// scrivo update ad ack!!!
inizio = DateTime.Now;
FANUC_ref.F_RW_Byte(W, FANUC.MemType.R, memIndex, ref retACK_DW1);
if (utils.CRB("recTime")) TimingData.addResult(string.Format("W{0}", retACK_DW1.Length), DateTime.Now.Subtract(inizio).Ticks);
}
/// <summary>
/// recupera allarmi ed agiorna strobe (privato) degli allarmi
@@ -254,6 +264,7 @@ namespace MTC_Sim
{
base.refreshAlarmState(Alarm2Refresh, giveAck);
DateTime inizio = DateTime.Now;
// byte di acknowledge...
byte[] retACK_DW0 = new byte[4];
@@ -269,7 +280,9 @@ namespace MTC_Sim
if (Alarm2Refresh.HasFlag((StFlag32)Math.Pow(2, i)))
{
// recupero tutti i 32 bit del blocco
inizio = DateTime.Now;
FANUC_ref.F_RW_Byte(R, FANUC.MemType.R, memIndex + i * 4, ref MemBlock);
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}", MemBlock.Length), DateTime.Now.Subtract(inizio).Ticks);
// aggiorno nel vettore allarmi i byte interessati
for (int j = 0; j < 4; j++)
{
@@ -286,7 +299,9 @@ namespace MTC_Sim
// mi preparo a scrivere ACK
memIndex = 10500;
// scrivo update ad ack!!!
inizio = DateTime.Now;
FANUC_ref.F_RW_Byte(W, FANUC.MemType.R, memIndex, ref retACK_DW0);
if (utils.CRB("recTime")) TimingData.addResult(string.Format("W{0}", retACK_DW0.Length), DateTime.Now.Subtract(inizio).Ticks);
}
}
}
@@ -335,10 +350,10 @@ namespace MTC_Sim
{
base.processStrobe();
// update status da DW3
// update status da DW2/ DW3
// EMstop: verifico BIT e di conseguenza imposto
if (STRB_DW3.HasFlag(StFlag32.B00))
if (STRB_DW2.HasFlag(StFlag32.B00))
{
mEStop.Value = "TRIGGERED";
}
@@ -350,49 +365,56 @@ namespace MTC_Sim
// HARD CODE: forzo path 1 (indice 0...)
int idxPath = 0;
// switch su run mode...
switch (STRB_DW3)
if (STRB_DW2.HasFlag(StFlag32.B01))
{
case StFlag32.B01:
vettPath[idxPath].mPathRunMode.Value = "AUTO";
break;
case StFlag32.B02:
vettPath[idxPath].mPathRunMode.Value = "EDIT";
break;
case StFlag32.B03:
vettPath[idxPath].mPathRunMode.Value = "MDI";
break;
case StFlag32.B04:
vettPath[idxPath].mPathRunMode.Value = "REF";
break;
case StFlag32.B05:
vettPath[idxPath].mPathRunMode.Value = "JOG";
break;
case StFlag32.B06:
vettPath[idxPath].mPathRunMode.Value = "JOGINC";
break;
case StFlag32.B07:
vettPath[idxPath].mPathRunMode.Value = "HANDLE";
break;
vettPath[idxPath].mPathRunMode.Value = "AUTO";
}
// switch su EXE mode...
switch (STRB_DW3)
else if (STRB_DW2.HasFlag(StFlag32.B02))
{
case StFlag32.B08:
vettPath[idxPath].mPathExeMode.Value = "RUN";
break;
case StFlag32.B09:
vettPath[idxPath].mPathExeMode.Value = "READY";
break;
case StFlag32.B10:
vettPath[idxPath].mPathExeMode.Value = "HOLD";
break;
case StFlag32.B11:
vettPath[idxPath].mPathExeMode.Value = "FEEDHOLD";
break;
vettPath[idxPath].mPathRunMode.Value = "EDIT";
}
else if (STRB_DW2.HasFlag(StFlag32.B03))
{
vettPath[idxPath].mPathRunMode.Value = "MDI";
}
else if (STRB_DW2.HasFlag(StFlag32.B04))
{
vettPath[idxPath].mPathRunMode.Value = "REF";
}
else if (STRB_DW2.HasFlag(StFlag32.B05))
{
vettPath[idxPath].mPathRunMode.Value = "JOG";
}
else if (STRB_DW2.HasFlag(StFlag32.B07))
{
vettPath[idxPath].mPathRunMode.Value = "JOGINC";
}
else if (STRB_DW2.HasFlag(StFlag32.B07))
{
vettPath[idxPath].mPathRunMode.Value = "HANDLE";
}
// switch su EXE mode...
if (STRB_DW2.HasFlag(StFlag32.B08))
{
vettPath[idxPath].mPathExeMode.Value = "RUN";
}
else if (STRB_DW2.HasFlag(StFlag32.B09))
{
vettPath[idxPath].mPathExeMode.Value = "READY";
}
else if (STRB_DW2.HasFlag(StFlag32.B10))
{
vettPath[idxPath].mPathExeMode.Value = "HOLD";
}
else if (STRB_DW2.HasFlag(StFlag32.B11))
{
vettPath[idxPath].mPathExeMode.Value = "FEEDHOLD";
}
// verifico tipo path...
if (STRB_DW3.HasFlag(StFlag32.B12))
if (STRB_DW2.HasFlag(StFlag32.B12))
{
vettPath[idxPath].mPathType.Value = "LAVORO";
}
@@ -401,6 +423,13 @@ namespace MTC_Sim
vettPath[idxPath].mPathType.Value = "ASSERV";
}
// verifico sulla STRB_DW3 i submode che POTREBBERO tutti sovrapposti...
// devo aver già in memoria come allarmi la lista dei SUBMODE (32)
// leggo come allarmi i BIT attivi
// per ogni BIT attivo aggiungo nell'event del PATH (forzato a 1) l'elenco separato da spazio dei submode attivi
#if false
+27 -14
View File
@@ -719,6 +719,8 @@ namespace MTC_Sim
#endregion
public event EventHandler eh_refreshed;
/// <summary>
/// inizializzo l'oggetto sulla form SULLA BASE DEL FILE DI CONFIGURAZIONE letto
/// </summary>
@@ -1015,12 +1017,8 @@ namespace MTC_Sim
if (ciclo == gatherCycle.HF)
{
// parte che eseguo SEMPRE: RECUPERO stato di tutti gli strobe/status e degli ack attualmente noti
getStrobeStatus();
#if false
// !!!FARE!!! verifica, forse inutile rileggere ACK...
getAckStatus();
getStrobeAndAckStatus();
#endif
// faccio refresh degli allarmi segnalati (da strobe su vettore locale)
refreshAlarmState(STRB_DW0, true);
// acquisizione degli status
@@ -1035,14 +1033,18 @@ namespace MTC_Sim
getUnOp();
getAxis();
}
else
else // ciclo lento!!!
{
// leggo EVENTUALI parametri da config file
getConfigParam();
///acquisisco dati su programma in esecuzione e dati generali (stato, orologio, power...)
getSlowChangingData();
// faccio comunque rilettura completa allarmi...
forceAlarmCheck();
// eventuale log!
if (utils.CRB("recTime")) logTimeResults();
}
// INVIO dati variati!
@@ -1064,7 +1066,25 @@ namespace MTC_Sim
// provo a riconnettere...
tryConnect();
}
if(eh_refreshed!=null)
{
eh_refreshed(this, new EventArgs());
}
}
/// <summary>
/// riporta il log di tutti i dati di results temporali registrati
/// </summary>
private void logTimeResults()
{
if (TimingData.results.Count > 0)
{
foreach (TimeRec item in TimingData.results)
{
lg.Info("Chiamate {0}: effettuate {1}, tempo medio {2:N1} msec", item.codCall, item.numCall, item.avgMsec);
}
}
}
/// <summary>
/// verifico se ho dati M/S/T e li invio nel caso
/// </summary>
@@ -1190,14 +1210,7 @@ namespace MTC_Sim
/// <summary>
/// recupero di TUTTI gli strobes/status attivi
/// </summary>
public virtual void getStrobeStatus()
{
// da gestire su ogni adapter... legge tutto array STROBE!!!
}
/// <summary>
/// recupero di TUTTI gli ack attivi
/// </summary>
public virtual void getAckStatus()
public virtual void getStrobeAndAckStatus()
{
// da gestire su ogni adapter... legge tutto array STROBE!!!
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -6,9 +6,9 @@
<appSettings>
<!--gestione TIMERS e periodi multipli x thread lenti-->
<add key="timerIntMs" value="10"/> <!--invio da adapter ad agent: 10ms-->
<add key="fastCount" value="10" /> <!--100ms-->
<add key="normCount" value="100" /> <!--1sec-->
<add key="slowCount" value="1000" /> <!--10sec-->
<add key="fastCount" value="25" /> <!--250ms-->
<add key="normCount" value="100" /> <!--1 sec-->
<add key="slowCount" value="500" /> <!--5 sec-->
<add key="recTime" value="true"/>
+76 -30
View File
@@ -104,9 +104,9 @@
this.PROG_ROW_NUM = new System.Windows.Forms.TextBox();
this.label17 = new System.Windows.Forms.Label();
this.groupBox11 = new System.Windows.Forms.GroupBox();
this.STATUS_ADP_PLC = new System.Windows.Forms.TextBox();
this.STATUS_STRB_DW1 = new System.Windows.Forms.TextBox();
this.label18 = new System.Windows.Forms.Label();
this.STATUS_PLC_ADP = new System.Windows.Forms.TextBox();
this.STATUS_STRB_DW0 = new System.Windows.Forms.TextBox();
this.lblPLC_ADP = new System.Windows.Forms.Label();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
@@ -198,6 +198,10 @@
this.lblCodaM = new System.Windows.Forms.Label();
this.addCodM = new System.Windows.Forms.TextBox();
this.label20 = new System.Windows.Forms.Label();
this.STATUS_STRB_DW2 = new System.Windows.Forms.TextBox();
this.label47 = new System.Windows.Forms.Label();
this.STATUS_STRB_DW3 = new System.Windows.Forms.TextBox();
this.label49 = new System.Windows.Forms.Label();
this.groupBox4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PosAct)).BeginInit();
this.groupBox3.SuspendLayout();
@@ -922,50 +926,54 @@
//
// groupBox11
//
this.groupBox11.Controls.Add(this.STATUS_ADP_PLC);
this.groupBox11.Controls.Add(this.STATUS_STRB_DW3);
this.groupBox11.Controls.Add(this.label49);
this.groupBox11.Controls.Add(this.STATUS_STRB_DW2);
this.groupBox11.Controls.Add(this.label47);
this.groupBox11.Controls.Add(this.STATUS_STRB_DW1);
this.groupBox11.Controls.Add(this.label18);
this.groupBox11.Controls.Add(this.STATUS_PLC_ADP);
this.groupBox11.Controls.Add(this.STATUS_STRB_DW0);
this.groupBox11.Controls.Add(this.lblPLC_ADP);
this.groupBox11.Location = new System.Drawing.Point(3, 108);
this.groupBox11.Name = "groupBox11";
this.groupBox11.Size = new System.Drawing.Size(773, 75);
this.groupBox11.Size = new System.Drawing.Size(773, 155);
this.groupBox11.TabIndex = 57;
this.groupBox11.TabStop = false;
this.groupBox11.Text = "Strobes";
this.groupBox11.Text = "Strobes PLC --> ADP";
//
// STATUS_ADP_PLC
// STATUS_STRB_DW1
//
this.STATUS_ADP_PLC.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.STATUS_ADP_PLC.Location = new System.Drawing.Point(85, 43);
this.STATUS_ADP_PLC.Name = "STATUS_ADP_PLC";
this.STATUS_ADP_PLC.Size = new System.Drawing.Size(363, 29);
this.STATUS_ADP_PLC.TabIndex = 55;
this.STATUS_STRB_DW1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.STATUS_STRB_DW1.Location = new System.Drawing.Point(85, 49);
this.STATUS_STRB_DW1.Name = "STATUS_STRB_DW1";
this.STATUS_STRB_DW1.Size = new System.Drawing.Size(363, 29);
this.STATUS_STRB_DW1.TabIndex = 55;
//
// label18
//
this.label18.AutoSize = true;
this.label18.Location = new System.Drawing.Point(15, 49);
this.label18.Location = new System.Drawing.Point(15, 55);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(64, 13);
this.label18.Size = new System.Drawing.Size(67, 13);
this.label18.TabIndex = 54;
this.label18.Text = "ADP -> PLC";
this.label18.Text = "STRB_DW1";
//
// STATUS_PLC_ADP
// STATUS_STRB_DW0
//
this.STATUS_PLC_ADP.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.STATUS_PLC_ADP.Location = new System.Drawing.Point(85, 11);
this.STATUS_PLC_ADP.Name = "STATUS_PLC_ADP";
this.STATUS_PLC_ADP.Size = new System.Drawing.Size(363, 29);
this.STATUS_PLC_ADP.TabIndex = 53;
this.STATUS_STRB_DW0.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.STATUS_STRB_DW0.Location = new System.Drawing.Point(85, 14);
this.STATUS_STRB_DW0.Name = "STATUS_STRB_DW0";
this.STATUS_STRB_DW0.Size = new System.Drawing.Size(363, 29);
this.STATUS_STRB_DW0.TabIndex = 53;
//
// lblPLC_ADP
//
this.lblPLC_ADP.AutoSize = true;
this.lblPLC_ADP.Location = new System.Drawing.Point(15, 19);
this.lblPLC_ADP.Location = new System.Drawing.Point(15, 22);
this.lblPLC_ADP.Name = "lblPLC_ADP";
this.lblPLC_ADP.Size = new System.Drawing.Size(64, 13);
this.lblPLC_ADP.Size = new System.Drawing.Size(67, 13);
this.lblPLC_ADP.TabIndex = 52;
this.lblPLC_ADP.Text = "PLC -> ADP";
this.lblPLC_ADP.Text = "STRB_DW0";
//
// statusStrip1
//
@@ -1202,7 +1210,7 @@
//
this.groupBox6.Controls.Add(this.STATUS_FLAGS);
this.groupBox6.Controls.Add(this.label48);
this.groupBox6.Location = new System.Drawing.Point(1, 207);
this.groupBox6.Location = new System.Drawing.Point(1, 278);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(773, 75);
this.groupBox6.TabIndex = 58;
@@ -1295,7 +1303,7 @@
this.tbConf.Location = new System.Drawing.Point(4, 22);
this.tbConf.Name = "tbConf";
this.tbConf.Padding = new System.Windows.Forms.Padding(3);
this.tbConf.Size = new System.Drawing.Size(772, 649);
this.tbConf.Size = new System.Drawing.Size(772, 643);
this.tbConf.TabIndex = 1;
this.tbConf.Text = "XML CONFIG";
//
@@ -1305,7 +1313,7 @@
this.wbXmlConf.Location = new System.Drawing.Point(3, 3);
this.wbXmlConf.MinimumSize = new System.Drawing.Size(20, 20);
this.wbXmlConf.Name = "wbXmlConf";
this.wbXmlConf.Size = new System.Drawing.Size(766, 643);
this.wbXmlConf.Size = new System.Drawing.Size(766, 637);
this.wbXmlConf.TabIndex = 0;
//
// tpSIM
@@ -1325,7 +1333,7 @@
this.tpSIM.Controls.Add(this.groupBox12);
this.tpSIM.Location = new System.Drawing.Point(4, 22);
this.tpSIM.Name = "tpSIM";
this.tpSIM.Size = new System.Drawing.Size(772, 649);
this.tpSIM.Size = new System.Drawing.Size(772, 643);
this.tpSIM.TabIndex = 2;
this.tpSIM.Text = "SIMULATION";
//
@@ -1863,6 +1871,40 @@
this.label20.TabIndex = 52;
this.label20.Text = "AddM";
//
// STATUS_STRB_DW2
//
this.STATUS_STRB_DW2.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.STATUS_STRB_DW2.Location = new System.Drawing.Point(85, 84);
this.STATUS_STRB_DW2.Name = "STATUS_STRB_DW2";
this.STATUS_STRB_DW2.Size = new System.Drawing.Size(363, 29);
this.STATUS_STRB_DW2.TabIndex = 57;
//
// label47
//
this.label47.AutoSize = true;
this.label47.Location = new System.Drawing.Point(15, 90);
this.label47.Name = "label47";
this.label47.Size = new System.Drawing.Size(67, 13);
this.label47.TabIndex = 56;
this.label47.Text = "STRB_DW2";
//
// STATUS_STRB_DW3
//
this.STATUS_STRB_DW3.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.STATUS_STRB_DW3.Location = new System.Drawing.Point(85, 119);
this.STATUS_STRB_DW3.Name = "STATUS_STRB_DW3";
this.STATUS_STRB_DW3.Size = new System.Drawing.Size(363, 29);
this.STATUS_STRB_DW3.TabIndex = 59;
//
// label49
//
this.label49.AutoSize = true;
this.label49.Location = new System.Drawing.Point(15, 125);
this.label49.Name = "label49";
this.label49.Size = new System.Drawing.Size(67, 13);
this.label49.TabIndex = 58;
this.label49.Text = "STRB_DW3";
//
// CMS_MachineSim
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -1962,9 +2004,9 @@
private System.Windows.Forms.TextBox PROG_ROW_NUM;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.GroupBox groupBox11;
private System.Windows.Forms.TextBox STATUS_ADP_PLC;
private System.Windows.Forms.TextBox STATUS_STRB_DW1;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.TextBox STATUS_PLC_ADP;
private System.Windows.Forms.TextBox STATUS_STRB_DW0;
private System.Windows.Forms.Label lblPLC_ADP;
private System.Windows.Forms.TextBox OPERATOR_ID;
private System.Windows.Forms.Label label19;
@@ -2091,6 +2133,10 @@
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.TextBox STATUS_FLAGS;
private System.Windows.Forms.Label label48;
private System.Windows.Forms.TextBox STATUS_STRB_DW3;
private System.Windows.Forms.Label label49;
private System.Windows.Forms.TextBox STATUS_STRB_DW2;
private System.Windows.Forms.Label label47;
}
}
+23 -12
View File
@@ -146,8 +146,11 @@ namespace MTC_Sim
OPERATOR_ID.Text = "M9999";
STATUS_PLC_ADP.Text = utils.binaryForm(0);
STATUS_ADP_PLC.Text = utils.binaryForm(0);
STATUS_STRB_DW0.Text = utils.binaryForm(0);
STATUS_STRB_DW1.Text = utils.binaryForm(0);
STATUS_STRB_DW2.Text = utils.binaryForm(0);
STATUS_STRB_DW3.Text = utils.binaryForm(0);
STATUS_FLAGS.Text = utils.binaryForm(0);
MainProgrBar.Minimum = 0;
@@ -269,8 +272,8 @@ namespace MTC_Sim
slowCount--;
if(slowCount<=0)
{
slowCount = 0;
slowCount = utils.CRI("slowCount");
// avvio fase raccolta dati e invio con adapter
agObj.gaterAndSend(gatherCycle.LF);
MainProgrBar.PerformStep();
@@ -287,7 +290,7 @@ namespace MTC_Sim
// se il counter è a zero eseguo...
if (normCount <= 0)
{
normCount = 0;
normCount = utils.CRI("normCount");
// avvio fase raccolta dati e invio con adapter
agObj.gaterAndSend(gatherCycle.MF);
@@ -302,11 +305,12 @@ namespace MTC_Sim
// se il counter è a zero eseguo...
if (fastCount <= 0)
{
fastCount = 0;
fastCount = utils.CRI("fastCount");
// avvio fase raccolta dati e invio con adapter
agObj.gaterAndSend(gatherCycle.HF);
refreshVisualStrobes();
MainProgrBar.PerformStep();
}
}
@@ -482,13 +486,21 @@ namespace MTC_Sim
if (utils.IsSetAll(agObj.STROBE_PLC, Strobe.POS_ACT)) agObj.STROBE_PLC -= Strobe.POS_ACT;
}
// aggiorno visualizzazione strobe!
STATUS_PLC_ADP.Text = utils.binaryForm((int)agObj.STROBE_PLC);
STATUS_ADP_PLC.Text = utils.binaryForm((int)agObj.STROBE_ADP);
STATUS_FLAGS.Text = utils.binaryForm((int)agObj.STATUS_FLAG);
refreshVisualStrobes();
}
}
private void refreshVisualStrobes()
{
// aggiorno visualizzazione strobe!
STATUS_STRB_DW0.Text = utils.binaryForm((int)agObj.STRB_DW0);
STATUS_STRB_DW1.Text = utils.binaryForm((int)agObj.STRB_DW1);
STATUS_STRB_DW1.Text = utils.binaryForm((int)agObj.STRB_DW2);
STATUS_STRB_DW1.Text = utils.binaryForm((int)agObj.STRB_DW3);
STATUS_FLAGS.Text = utils.binaryForm((int)agObj.STATUS_FLAG);
}
/// <summary>
@@ -1090,6 +1102,5 @@ namespace MTC_Sim
}
#endregion
}
}
+84
View File
@@ -156,6 +156,90 @@ namespace MTC_Sim
return answ;
}
}
/// <summary>
/// Oggetto timing x archiviazione dati perfomances
/// </summary>
public class TimeRec
{
/// <summary>
/// Codice univoco chiamata: tipo R4 (read 4 byte), W2 (write 2 Byte)
/// </summary>
public string codCall;
/// <summary>
/// Num chiamate totale
/// </summary>
public int numCall;
/// <summary>
/// Tempo medio chiamata
/// </summary>
public float avgMsec
{
get
{
return (float)totMsec.TotalMilliseconds / numCall;
}
}
/// <summary>
/// Totale Msec accumulati
/// </summary>
public TimeSpan totMsec;
/// <summary>
/// Classe record timing
/// </summary>
public TimeRec()
{
codCall = "";
numCall = 0;
totMsec = new TimeSpan(0);
}
/// <summary>
/// Classe record timing
/// </summary>
/// <param name="codice"></param>
/// <param name="ticks"></param>
public TimeRec(string codice, long nTicks)
{
codCall = codice;
numCall = 1;
totMsec = new TimeSpan(nTicks);
}
}
public static class TimingData
{
public static List<TimeRec> results = new List<TimeRec>();
/// <summary>
/// aggiorno vettore aggiungendo risultato
/// </summary>
/// <param name="codice"></param>
/// <param name="ticks"></param>
public static void addResult(string codice, long ticks)
{
if (results.Count == 0)
{
results.Add(new TimeRec(codice, ticks));
}
int indice = -1;
for (int i = 0; i < results.Count; i++)
{
// se il codice è quello cercato...
if(results[i].codCall==codice) indice = i;
}
// se c'è aggiorno...
if (indice >= 0)
{
results[indice].numCall++;
results[indice].totMsec = results[indice].totMsec.Add(new TimeSpan(ticks));
}
// altrimenti aggiungo...
else
{
results.Add(new TimeRec(codice, ticks));
}
}
}
public enum tipoAdapter