Fix gestione code M/S/T
Aggiunta iniziale NLog
This commit is contained in:
Binary file not shown.
+61
-167
@@ -22,9 +22,31 @@ namespace MTC_Sim
|
||||
|
||||
FANUC_ref = (FANUC)Runtime.NC;
|
||||
|
||||
string szStatusConnection = "";
|
||||
FANUC_ref.Connect(ref szStatusConnection);
|
||||
tryConnect();
|
||||
}
|
||||
|
||||
public override void tryConnect()
|
||||
{
|
||||
if (!connectionOk)
|
||||
{
|
||||
string szStatusConnection = "";
|
||||
FANUC_ref.Connect(ref szStatusConnection);
|
||||
lg.Info(szStatusConnection);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifico connessione fanuc...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override bool connectionOk
|
||||
{
|
||||
get
|
||||
{
|
||||
return FANUC_ref.Connected;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettuo lettura dei 16 byte di strobe/status
|
||||
/// </summary>
|
||||
@@ -32,9 +54,6 @@ namespace MTC_Sim
|
||||
{
|
||||
base.getStrobeStatus();
|
||||
|
||||
// se non sono connesso esco
|
||||
if (!FANUC_ref.Connected) return;
|
||||
|
||||
// hard coded: leggo le 16 word standard dello strobe... R10516--> R10532
|
||||
FANUC_ref.F_RW_Byte(R, FANUC.MemType.R, 10516, ref Strobes);
|
||||
}
|
||||
@@ -44,8 +63,6 @@ namespace MTC_Sim
|
||||
public override void getAckStatus()
|
||||
{
|
||||
base.getAckStatus();
|
||||
// se non sono connesso esco
|
||||
if (!FANUC_ref.Connected) return;
|
||||
|
||||
// hard coded: leggo le 16 word standard dello strobe... R10500--> R10515
|
||||
FANUC_ref.F_RW_Byte(R, FANUC.MemType.R, 10500, ref Acknowl);
|
||||
@@ -57,9 +74,8 @@ namespace MTC_Sim
|
||||
public override void processStrobe()
|
||||
{
|
||||
base.processStrobe();
|
||||
// se non sono connesso esco
|
||||
if (!FANUC_ref.Connected) return;
|
||||
|
||||
// !!!FARE!!! multipath...
|
||||
// verifico i vari strobe x recuperare i dati... PER ORA SOLO DW1 per path1 (indice 0)...
|
||||
int idxPath = 0;
|
||||
int memIndex = 0;
|
||||
@@ -71,53 +87,52 @@ namespace MTC_Sim
|
||||
{
|
||||
int numEv = 0;
|
||||
int codEv = 0;
|
||||
// blocco memoria x lettura dati (qui max 2*16bit...)
|
||||
byte[] MemBlock = new byte[22];
|
||||
int memShift = 0;
|
||||
// blocco memoria x lettura TUTTI i dati di buffer M/S/T: 46 byte: 2byte (16bit) x (11+6+6) aree
|
||||
byte[] MemBlock = new byte[46];
|
||||
// leggo tutto!!!
|
||||
memIndex = 10660;
|
||||
FANUC_ref.F_RW_Byte(R, FANUC.MemType.R, memIndex, ref MemBlock);
|
||||
|
||||
// 2016.05.09 ci sono solo 4 bit x ora da controllare...
|
||||
// check COD_M
|
||||
bitNum = 0;
|
||||
memShift = 0;
|
||||
if (STRB_DW1.HasFlag((StFlag32)Math.Pow(2, bitNum)))
|
||||
{
|
||||
memIndex = 10660;
|
||||
// recupero tutti i 16+16 bit del blocco
|
||||
FANUC_ref.F_RW_Byte(R, FANUC.MemType.R, memIndex, ref MemBlock);
|
||||
// verifico sia > 0 il numero di valori da leggere...
|
||||
numEv = BitConverter.ToUInt16(MemBlock, 0);
|
||||
// verifico sia > 0 il numero di valori da leggere indice 0 sull'area...
|
||||
numEv = BitConverter.ToUInt16(MemBlock, 2 * memShift);
|
||||
if (numEv > 0)
|
||||
{
|
||||
// !!!FARE!!! il num ev rappresenta quanyti buffer (da 2 byte) sono stati valorizzati, VA FATTO CICLO E LETTI TUTTI
|
||||
|
||||
// necessario portare in VHF lo svuotamento dei buffer M/S/T e poi al contrario leggere ogni HF il buffer INTERO M/S/T da svuotare (poi)
|
||||
|
||||
// il num ev rappresenta quanti slot 16bit (da 2 byte) sono stati valorizzati, VA FATTO CICLO E LETTI TUTTI
|
||||
for (int i = 0; i < numEv; i++)
|
||||
{
|
||||
// leggo valore Codice M
|
||||
codEv = BitConverter.ToUInt16(MemBlock, 2 *(i+1));
|
||||
// salvo evento Codice M
|
||||
vettPath[idxPath].mPathCodM.Value = string.Format("M{0:###}", codEv); // VERIFICARE num cod M... 3 cifre?
|
||||
codEv = BitConverter.ToUInt16(MemBlock, 2 * (i + 1 + memShift));
|
||||
// accodo evento Codice M
|
||||
addMCode(codEv.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
// memorizzo allarme nel vettore ack....
|
||||
retACK_DW1 = utils.setBitOnStFlag(retACK_DW1, 1, bitNum);
|
||||
}
|
||||
}
|
||||
|
||||
// check COD_S
|
||||
bitNum = 1;
|
||||
memShift = 11;
|
||||
if (STRB_DW1.HasFlag((StFlag32)Math.Pow(2, bitNum)))
|
||||
{
|
||||
memIndex = 10682;
|
||||
// recupero tutti i 16+16 bit del blocco
|
||||
FANUC_ref.F_RW_Byte(R, FANUC.MemType.R, memIndex, ref MemBlock);
|
||||
// verifico sia > 0 il numero di valori da leggere...
|
||||
numEv = BitConverter.ToUInt16(MemBlock, 0);
|
||||
numEv = BitConverter.ToUInt16(MemBlock, 2 * memShift);
|
||||
if (numEv > 0)
|
||||
{
|
||||
// leggo valore Codice S
|
||||
codEv = BitConverter.ToUInt16(MemBlock, 2);
|
||||
// salvo evento Codice S
|
||||
vettPath[idxPath].mPathCodS.Value = string.Format("S{0:#####}", codEv); // VERIFICARE num cod S... 3 cifre?
|
||||
// il num ev rappresenta quanti slot 16bit (da 2 byte) sono stati valorizzati, VA FATTO CICLO E LETTI TUTTI
|
||||
for (int i = 0; i < numEv; i++)
|
||||
{
|
||||
// leggo valore Codice M
|
||||
codEv = BitConverter.ToUInt16(MemBlock, 2 * (i + 1 + memShift));
|
||||
// accodo evento Codice M
|
||||
addSCode(codEv.ToString());
|
||||
}
|
||||
}
|
||||
// memorizzo allarme nel vettore ack....
|
||||
retACK_DW1 = utils.setBitOnStFlag(retACK_DW1, 1, bitNum);
|
||||
@@ -125,19 +140,21 @@ namespace MTC_Sim
|
||||
|
||||
// check COD_T
|
||||
bitNum = 2;
|
||||
memShift = 17;
|
||||
if (STRB_DW1.HasFlag((StFlag32)Math.Pow(2, bitNum)))
|
||||
{
|
||||
memIndex = 10694;
|
||||
// recupero tutti i 16+16 bit del blocco
|
||||
FANUC_ref.F_RW_Byte(R, FANUC.MemType.R, memIndex, ref MemBlock);
|
||||
// verifico sia > 0 il numero di valori da leggere...
|
||||
numEv = BitConverter.ToUInt16(MemBlock, 0);
|
||||
numEv = BitConverter.ToUInt16(MemBlock, 2 * memShift);
|
||||
if (numEv > 0)
|
||||
{
|
||||
// leggo valore Codice T
|
||||
codEv = BitConverter.ToUInt16(MemBlock, 2);
|
||||
// salvo evento Codice T
|
||||
vettPath[idxPath].mPathCodT.Value = string.Format("T{0:###}", codEv); // VERIFICARE num cod T... 3 cifre?
|
||||
// il num ev rappresenta quanti slot 16bit (da 2 byte) sono stati valorizzati, VA FATTO CICLO E LETTI TUTTI
|
||||
for (int i = 0; i < numEv; i++)
|
||||
{
|
||||
// leggo valore Codice M
|
||||
codEv = BitConverter.ToUInt16(MemBlock, 2 * (i + 1 + memShift));
|
||||
// accodo evento Codice M
|
||||
addTCode(codEv.ToString());
|
||||
}
|
||||
}
|
||||
// memorizzo allarme nel vettore ack....
|
||||
retACK_DW1 = utils.setBitOnStFlag(retACK_DW1, 1, bitNum);
|
||||
@@ -182,7 +199,7 @@ namespace MTC_Sim
|
||||
memIndex = 10504;
|
||||
// scrivo update ad ack!!!
|
||||
FANUC_ref.F_RW_Byte(W, FANUC.MemType.R, memIndex, ref retACK_DW1);
|
||||
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// recupera allarmi ed agiorna strobe (privato) degli allarmi
|
||||
@@ -212,13 +229,12 @@ namespace MTC_Sim
|
||||
// aggiorno nel vettore allarmi i byte interessati
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
// copy array o byte?!? !!!FARE!!! verifica
|
||||
AlarmFlags[i * 4 + j] = MemBlock[j];
|
||||
}
|
||||
//AlarmFlags.SetValue(MemBlock, i * 4);
|
||||
|
||||
// segnalo allarme letto! memorizzo allarme nel vettore ack....
|
||||
retACK_DW0 = utils.setBitOnStFlag(retACK_DW0, 1, i);
|
||||
|
||||
}
|
||||
}
|
||||
if (giveAck)
|
||||
@@ -236,14 +252,6 @@ namespace MTC_Sim
|
||||
public override void processAlarm()
|
||||
{
|
||||
base.processAlarm();
|
||||
// se non sono connesso esco
|
||||
if (!FANUC_ref.Connected) return;
|
||||
|
||||
// byte di acknowledge...
|
||||
byte[] retACK_DW0 = new byte[4];
|
||||
|
||||
// faccio refresh degli allarmi segnalati
|
||||
refreshAlarmState(STRB_DW0, true);
|
||||
|
||||
// variabili helper
|
||||
StFlag32 AlarmBlock = 0;
|
||||
@@ -401,120 +409,6 @@ namespace MTC_Sim
|
||||
{
|
||||
base.getPath();
|
||||
|
||||
|
||||
#if false
|
||||
// byte x lettura memoria... 8byte --> 64 bit!
|
||||
byte[] status = new byte[8];
|
||||
// variabili che utilizzerò...
|
||||
StFlag8 RunStatus;
|
||||
StFlag8 ExeStatus;
|
||||
|
||||
|
||||
// se non sono connesso esco
|
||||
if (!FANUC_ref.Connected) return;
|
||||
|
||||
// hard coded: leggo 8 word (byte) dalla memoria 3450--> 3457
|
||||
FANUC_ref.F_RW_Byte(R, FANUC.MemType.D, 3450, ref status);
|
||||
#endif
|
||||
|
||||
#if false
|
||||
// imposto RUN mode
|
||||
mMode.Value = parentForm.datiProd.RunMode;
|
||||
|
||||
// imposto EXE mode
|
||||
mExec.Value = parentForm.datiProd.ExeMode;
|
||||
|
||||
vettPath[PtData.PathSel].mPathFeed.Value = PtData.PathFeedrate;
|
||||
vettPath[PtData.PathSel].mPathFeedOver.Value = PtData.PathFeedrateOver;
|
||||
vettPath[PtData.PathSel].mPathRapidOver.Value = PtData.PathRapidOver;
|
||||
vettPath[PtData.PathSel].mPathPosActX.Value = PtData.PathPosAct.x;
|
||||
vettPath[PtData.PathSel].mPathPosActY.Value = PtData.PathPosAct.y;
|
||||
vettPath[PtData.PathSel].mPathPosActZ.Value = PtData.PathPosAct.z;
|
||||
vettPath[PtData.PathSel].mPathPosActI.Value = PtData.PathPosAct.i;
|
||||
vettPath[PtData.PathSel].mPathPosActJ.Value = PtData.PathPosAct.j;
|
||||
vettPath[PtData.PathSel].mPathPosActK.Value = PtData.PathPosAct.k;
|
||||
#endif
|
||||
|
||||
#if false
|
||||
// HARD CODE: forzo path 1 (indice 0...)
|
||||
int idxPath = 0;
|
||||
|
||||
// IPOTESI DA VERIFICARE!!!
|
||||
// leggo primo byte, i cui bit indicano run mode (3450.0 --> 3450.7)
|
||||
RunStatus = (StFlag8)status[0];
|
||||
// leggo primo byte, i cui bit indicano run mode (3451.0 --> 3451.7)
|
||||
ExeStatus = (StFlag8)status[1];
|
||||
|
||||
// se devo prendere sotto insiemi di byte --> BitConverter
|
||||
//BitConverter.ToUInt32
|
||||
|
||||
// RUN STATUS: verifico BIT e di conseguenza imposto
|
||||
switch (RunStatus)
|
||||
{
|
||||
case StFlag8.NONE:
|
||||
break;
|
||||
case StFlag8.B0:
|
||||
vettPath[idxPath].mPathRunMode.Value = "AUTO";
|
||||
break;
|
||||
case StFlag8.B1:
|
||||
vettPath[idxPath].mPathRunMode.Value = "EDIT";
|
||||
break;
|
||||
case StFlag8.B2:
|
||||
vettPath[idxPath].mPathRunMode.Value = "MDI";
|
||||
break;
|
||||
case StFlag8.B3:
|
||||
break;
|
||||
case StFlag8.B4:
|
||||
vettPath[idxPath].mPathRunMode.Value = "REF";
|
||||
break;
|
||||
case StFlag8.B5:
|
||||
vettPath[idxPath].mPathRunMode.Value = "JOG";
|
||||
break;
|
||||
case StFlag8.B6:
|
||||
vettPath[idxPath].mPathRunMode.Value = "JOGINC";
|
||||
break;
|
||||
case StFlag8.B7:
|
||||
vettPath[idxPath].mPathRunMode.Value = "HANDLE";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// EXE STATUS: verifico BIT e di conseguenza imposto
|
||||
switch (ExeStatus)
|
||||
{
|
||||
case StFlag8.NONE:
|
||||
break;
|
||||
case StFlag8.B0:
|
||||
break;
|
||||
case StFlag8.B1:
|
||||
break;
|
||||
case StFlag8.B2:
|
||||
break;
|
||||
case StFlag8.B3:
|
||||
break;
|
||||
case StFlag8.B4:
|
||||
break;
|
||||
case StFlag8.B5:
|
||||
break;
|
||||
case StFlag8.B6:
|
||||
break;
|
||||
case StFlag8.B7:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if false
|
||||
// check bit 0... SE è presente
|
||||
Status8.Has(StFlag8.B0);
|
||||
|
||||
// check bit 0... SE è SOLO QUELLO
|
||||
Status8.Is(StFlag8.B0);
|
||||
|
||||
// check bit 18...
|
||||
Status8.Has(StFlag32.B18);
|
||||
#endif
|
||||
}
|
||||
|
||||
public override void getAxis()
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using NLog;
|
||||
|
||||
namespace MTC_Sim
|
||||
{
|
||||
@@ -511,7 +511,7 @@ namespace MTC_Sim
|
||||
{
|
||||
public bool R = false;
|
||||
public bool W = true;
|
||||
|
||||
public static Logger lg;
|
||||
protected bool adpRunning;
|
||||
|
||||
/// <summary>
|
||||
@@ -726,6 +726,9 @@ namespace MTC_Sim
|
||||
/// <param name="adpConf"></param>
|
||||
public AdapterGeneric(CMS_MachineSim caller, AdapterConf adpConf)
|
||||
{
|
||||
lg = LogManager.GetCurrentClassLogger();
|
||||
lg.Info("Istanziata classe AdapterGeneric");
|
||||
|
||||
// salvo al form chiamante
|
||||
parentForm = caller;
|
||||
|
||||
@@ -970,61 +973,124 @@ namespace MTC_Sim
|
||||
/// <param name="ciclo"></param>
|
||||
public void gaterAndSend(gatherCycle ciclo)
|
||||
{
|
||||
// controllo non sia già in esecuzione...
|
||||
if (!adpRunning)
|
||||
// controllo connessione/connettività
|
||||
if (connectionOk)
|
||||
{
|
||||
adpRunning = true;
|
||||
|
||||
// avvio fase raccolta dati
|
||||
mAdapter.Begin();
|
||||
|
||||
// parte che eseguo SEMPRE: RECUPERO stato di tutti gli strobe/status e degli ack attualmente noti
|
||||
getStrobeStatus();
|
||||
// !!!FARE!!! verifica, forse inutile rileggere ACK...
|
||||
getAckStatus();
|
||||
|
||||
// acquisizione degli status
|
||||
processStatus();
|
||||
// processing degli strobes di allarme
|
||||
processAlarm();
|
||||
processStrobe();
|
||||
|
||||
// svuotamento strobe in VHF
|
||||
|
||||
// processing condizionale x parti non sempre valutate, 3 cicli a frequenza decrescente (HF/MF/LF)
|
||||
if (ciclo == gatherCycle.HF)
|
||||
// controllo non sia già in esecuzione...
|
||||
if (!adpRunning)
|
||||
{
|
||||
// !!!FARE!!! modirifa x avere QUI la letturadegli strobe
|
||||
// imposto flag adapter running..
|
||||
adpRunning = true;
|
||||
|
||||
/*
|
||||
* - check degli strobe e lettura stribes in vettore
|
||||
* - check degli allarmi MODIFICATI
|
||||
*/
|
||||
}
|
||||
else if (ciclo == gatherCycle.MF)
|
||||
{
|
||||
// leggo parametri a media freq (path, assi, Unità Operatrice)
|
||||
getPath();
|
||||
getUnOp();
|
||||
getAxis();
|
||||
// avvio fase raccolta dati
|
||||
mAdapter.Begin();
|
||||
|
||||
// processing degli strobes di allarme (da ULTIMA rappresentazione vettore dell'ADP)
|
||||
processAlarm();
|
||||
// processo e svuoto eventuali code di invio per Codici M/S/T
|
||||
trySendCodMST();
|
||||
|
||||
// ciclo HF: recupero update status & strobes vari
|
||||
if (ciclo == gatherCycle.HF)
|
||||
{
|
||||
// parte che eseguo SEMPRE: RECUPERO stato di tutti gli strobe/status e degli ack attualmente noti
|
||||
getStrobeStatus();
|
||||
// !!!FARE!!! verifica, forse inutile rileggere ACK...
|
||||
getAckStatus();
|
||||
|
||||
// faccio refresh degli allarmi segnalati (da strobe su vettore locale)
|
||||
refreshAlarmState(STRB_DW0, true);
|
||||
// acquisizione degli status
|
||||
processStatus();
|
||||
// processing degli strobes
|
||||
processStrobe();
|
||||
}
|
||||
else if (ciclo == gatherCycle.MF)
|
||||
{
|
||||
// leggo parametri a media freq (path, assi, Unità Operatrice)
|
||||
getPath();
|
||||
getUnOp();
|
||||
getAxis();
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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();
|
||||
}
|
||||
|
||||
// INVIO dati variati!
|
||||
mAdapter.SendChanged();
|
||||
|
||||
// tolgo flag running
|
||||
adpRunning = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 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();
|
||||
// log ADP running
|
||||
lg.Error("Non eseguo chiamata: ADP ancora in running");
|
||||
}
|
||||
|
||||
// INVIO dati variati!
|
||||
mAdapter.SendChanged();
|
||||
|
||||
// tolgo flag running
|
||||
adpRunning = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// log connessione KO
|
||||
if (ciclo == gatherCycle.LF)
|
||||
{
|
||||
lg.Error("Connessione non disponibile, esco da ciclo");
|
||||
}
|
||||
// provo a riconnettere...
|
||||
tryConnect();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// verifico se ho dati M/S/T e li invio nel caso
|
||||
/// </summary>
|
||||
public virtual void trySendCodMST()
|
||||
{
|
||||
// !!!FARE!!! ciclo su + path
|
||||
int idxPath = 1;
|
||||
for (int i = 0; i < idxPath; i++)
|
||||
{
|
||||
// verifico SE ho codici M/S/T da inviare...
|
||||
string codiceM = getNextMCode;
|
||||
string codiceS = getNextSCode;
|
||||
string codiceT = getNextTCode;
|
||||
if (codiceM != "")
|
||||
{
|
||||
vettPath[i].mPathCodM.Value = string.Format("M{0}", codiceM);
|
||||
}
|
||||
if (codiceS != "")
|
||||
{
|
||||
vettPath[i].mPathCodS.Value = string.Format("S{0}", codiceS);
|
||||
}
|
||||
if (codiceT != "")
|
||||
{
|
||||
vettPath[i].mPathCodT.Value = string.Format("T{0}", codiceT);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Metodo base connessione...
|
||||
/// </summary>
|
||||
public virtual void tryConnect()
|
||||
{
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Dummy method: verifica stato conensisone OK
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public virtual bool connectionOk
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// effettua ogni log period una rilettura di TUTTI gli allarmi...
|
||||
/// </summary>
|
||||
@@ -1073,7 +1139,7 @@ namespace MTC_Sim
|
||||
// da gestire su ogni adapter...
|
||||
}
|
||||
/// <summary>
|
||||
/// processo gli strobe degli allarmi
|
||||
/// processo il vettore LOCALE degli allarmi
|
||||
/// </summary>
|
||||
public virtual void processAlarm()
|
||||
{
|
||||
@@ -1281,6 +1347,30 @@ namespace MTC_Sim
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunge nel vettore coda codici M
|
||||
/// </summary>
|
||||
/// <param name="codice"></param>
|
||||
public void addMCode(string codice)
|
||||
{
|
||||
codaM.Add(codice);
|
||||
}
|
||||
/// <summary>
|
||||
/// Aggiunge nel vettore coda codici S
|
||||
/// </summary>
|
||||
/// <param name="codice"></param>
|
||||
public void addSCode(string codice)
|
||||
{
|
||||
codaS.Add(codice);
|
||||
}
|
||||
/// <summary>
|
||||
/// Aggiunge nel vettore coda codici T
|
||||
/// </summary>
|
||||
/// <param name="codice"></param>
|
||||
public void addTCode(string codice)
|
||||
{
|
||||
codaT.Add(codice);
|
||||
}
|
||||
/// <summary>
|
||||
/// recupera primo elemento codaM
|
||||
/// </summary>
|
||||
@@ -1288,13 +1378,10 @@ namespace MTC_Sim
|
||||
{
|
||||
get
|
||||
{
|
||||
// PRE: eventuale rilettura da PLC x accumulare in coda...
|
||||
tryGetMCode();
|
||||
// ora controllo array locale
|
||||
string answ = "";
|
||||
if (codaM.Count > 0)
|
||||
{
|
||||
// accodo codice M...
|
||||
// recupero codice M...
|
||||
answ = codaM.First();
|
||||
// tolgo elemento
|
||||
codaM.RemoveAt(0);
|
||||
@@ -1309,13 +1396,10 @@ namespace MTC_Sim
|
||||
{
|
||||
get
|
||||
{
|
||||
// PRE: eventuale rilettura da PLC x accumulare in coda...
|
||||
tryGetSCode();
|
||||
// ora controllo array locale
|
||||
string answ = "";
|
||||
if (codaS.Count > 0)
|
||||
{
|
||||
// accodo codice S...
|
||||
// recupero codice S...
|
||||
answ = codaS.First();
|
||||
// tolgo elemento
|
||||
codaS.RemoveAt(0);
|
||||
@@ -1330,13 +1414,10 @@ namespace MTC_Sim
|
||||
{
|
||||
get
|
||||
{
|
||||
// PRE: eventuale rilettura da PLC x accumulare in coda...
|
||||
tryGetTCode();
|
||||
// ora controllo array locale
|
||||
string answ = "";
|
||||
if (codaT.Count > 0)
|
||||
{
|
||||
// accodo codice T...
|
||||
// recupero codice T...
|
||||
answ = codaT.First();
|
||||
// tolgo elemento
|
||||
codaT.RemoveAt(0);
|
||||
@@ -1345,20 +1426,6 @@ namespace MTC_Sim
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected virtual void tryGetMCode()
|
||||
{
|
||||
// altri adapter: DA IMPLEMENTARE lettura buffer codici M (1 alla volta?)
|
||||
}
|
||||
protected virtual void tryGetSCode()
|
||||
{
|
||||
// DA IMPLEMENTARE: lettura buffer codici S (1 alla volta?)
|
||||
}
|
||||
protected virtual void tryGetTCode()
|
||||
{
|
||||
// DA IMPLEMENTARE: lettura buffer codici T (1 alla volta?)
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
</startup>
|
||||
<appSettings>
|
||||
<!--gestione TIMERS e periodi multipli x thread lenti-->
|
||||
<add key="timerIntMs" value="10"/>
|
||||
<add key="fastCount" value="10" />
|
||||
<add key="normCount" value="100" />
|
||||
<add key="slowCount" value="500" />
|
||||
<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="D1_NAME" value="CMS-ARES-SIM"/>
|
||||
<add key="D1_ID" value="demo_123456"/>
|
||||
|
||||
@@ -500,7 +500,7 @@ namespace MTC_Sim
|
||||
{
|
||||
if (addCodM.Text.Trim() != "")
|
||||
{
|
||||
agObj.codaM.Add(addCodM.Text.Trim());
|
||||
agObj.addMCode(addCodM.Text.Trim());
|
||||
addCodM.Text = "";
|
||||
}
|
||||
refreshCodeMST();
|
||||
@@ -509,7 +509,7 @@ namespace MTC_Sim
|
||||
{
|
||||
if (addCodS.Text.Trim() != "")
|
||||
{
|
||||
agObj.codaS.Add(addCodS.Text.Trim());
|
||||
agObj.addSCode(addCodS.Text.Trim());
|
||||
addCodS.Text = "";
|
||||
}
|
||||
refreshCodeMST();
|
||||
@@ -518,7 +518,7 @@ namespace MTC_Sim
|
||||
{
|
||||
if (addCodT.Text.Trim() != "")
|
||||
{
|
||||
agObj.codaT.Add(addCodT.Text.Trim());
|
||||
agObj.addTCode(addCodT.Text.Trim());
|
||||
addCodT.Text = "";
|
||||
}
|
||||
refreshCodeMST();
|
||||
|
||||
@@ -33,6 +33,10 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.3.3\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
@@ -84,6 +88,13 @@
|
||||
<EmbeddedResource Include="SetupAdapter.resx">
|
||||
<DependentUpon>SetupAdapter.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<Content Include="NLog.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="NLog.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
@@ -125,6 +136,9 @@
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="logs\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||
autoReload="true"
|
||||
throwExceptions="false"
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log" >
|
||||
|
||||
|
||||
<!-- optional, add some variabeles
|
||||
https://github.com/nlog/NLog/wiki/Configuration-file#variables
|
||||
-->
|
||||
<variable name="myvar" value="myvalue"/>
|
||||
|
||||
<!--
|
||||
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||
for information on customizing logging rules and outputs.
|
||||
-->
|
||||
<targets>
|
||||
|
||||
<!--
|
||||
add your targets here
|
||||
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
|
||||
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
|
||||
-->
|
||||
|
||||
<!--
|
||||
Write events to a file with the date in the filename.
|
||||
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||
-->
|
||||
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<!-- add your logging rules here -->
|
||||
|
||||
<!--
|
||||
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||
-->
|
||||
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||
</rules>
|
||||
</nlog>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.3.3" targetFramework="net452" />
|
||||
<package id="NLog.Config" version="4.3.3" targetFramework="net452" />
|
||||
<package id="NLog.Schema" version="4.3.0" targetFramework="net452" />
|
||||
</packages>
|
||||
BIN
Binary file not shown.
Binary file not shown.
+19619
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+19202
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
+21494
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
+21586
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
+21769
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
+15160
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
+15160
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
+14355
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||
autoReload="true"
|
||||
throwExceptions="false"
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log" >
|
||||
|
||||
|
||||
<!-- optional, add some variabeles
|
||||
https://github.com/nlog/NLog/wiki/Configuration-file#variables
|
||||
-->
|
||||
<variable name="myvar" value="myvalue"/>
|
||||
|
||||
<!--
|
||||
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||
for information on customizing logging rules and outputs.
|
||||
-->
|
||||
<targets>
|
||||
|
||||
<!--
|
||||
add your targets here
|
||||
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
|
||||
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
|
||||
-->
|
||||
|
||||
<!--
|
||||
Write events to a file with the date in the filename.
|
||||
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||
-->
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<!-- add your logging rules here -->
|
||||
|
||||
<!--
|
||||
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||
-->
|
||||
</rules>
|
||||
</nlog>
|
||||
@@ -0,0 +1,12 @@
|
||||
param($installPath, $toolsPath, $package, $project)
|
||||
|
||||
$configItem = $project.ProjectItems.Item("NLog.config")
|
||||
|
||||
# set 'Copy To Output Directory' to 'Copy if newer'
|
||||
$copyToOutput = $configItem.Properties.Item("CopyToOutputDirectory")
|
||||
$copyToOutput.Value = 1
|
||||
|
||||
# set 'Build Action' to 'Content'
|
||||
$buildAction = $configItem.Properties.Item("BuildAction")
|
||||
$buildAction.Value = 2
|
||||
|
||||
Binary file not shown.
+2601
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user