Altre modifiche x gestione corretta lettura buffer (sono N valorizzati in blocco...)

This commit is contained in:
Samuele E. Locatelli
2016-05-10 18:06:59 +02:00
parent 21c8a12310
commit 5fd3254de8
8 changed files with 2098 additions and 1055 deletions
Binary file not shown.
+16 -14
View File
@@ -72,12 +72,11 @@ namespace MTC_Sim
int numEv = 0;
int codEv = 0;
// blocco memoria x lettura dati (qui max 2*16bit...)
byte[] MemBlock = new byte[4];
byte[] MemBlock = new byte[22];
// 2016.05.09 ci sono solo 4 bit x ora da controllare...
// check COD_M
bitNum = 0;
//if (STRB_DW1.getBit<StFlag32>(bitNum))
if (STRB_DW1.HasFlag((StFlag32)Math.Pow(2, bitNum)))
{
memIndex = 10660;
@@ -87,18 +86,25 @@ namespace MTC_Sim
numEv = BitConverter.ToUInt16(MemBlock, 0);
if (numEv > 0)
{
// leggo valore Codice M
codEv = BitConverter.ToUInt16(MemBlock, 2);
// salvo evento Codice M
vettPath[idxPath].mPathCodM.Value = string.Format("M{0:###}", codEv); // VERIFICARE num cod M... 3 cifre?
// !!!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)
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?
}
}
// memorizzo allarme nel vettore ack....
retACK_DW1 = utils.setBitOnStFlag(retACK_DW1, 1, bitNum);
}
}
// check COD_S
bitNum = 1;
//if (STRB_DW1.getBit<StFlag32>(bitNum))
if (STRB_DW1.HasFlag((StFlag32)Math.Pow(2, bitNum)))
{
memIndex = 10682;
@@ -111,7 +117,7 @@ namespace MTC_Sim
// 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?
vettPath[idxPath].mPathCodS.Value = string.Format("S{0:#####}", codEv); // VERIFICARE num cod S... 3 cifre?
}
// memorizzo allarme nel vettore ack....
retACK_DW1 = utils.setBitOnStFlag(retACK_DW1, 1, bitNum);
@@ -119,7 +125,6 @@ namespace MTC_Sim
// check COD_T
bitNum = 2;
//if (STRB_DW1.getBit<StFlag32>(bitNum))
if (STRB_DW1.HasFlag((StFlag32)Math.Pow(2, bitNum)))
{
memIndex = 10694;
@@ -140,7 +145,6 @@ namespace MTC_Sim
// check assi assegnati al path 01...
bitNum = 3;
//if (STRB_DW1.getBit<StFlag32>(bitNum))
if (STRB_DW1.HasFlag((StFlag32)Math.Pow(2, bitNum)))
{
// mi basta un solo byte...
@@ -154,7 +158,6 @@ namespace MTC_Sim
// spazzo i bit, dove è 1 metto nella stringa degli assi attivi...
for (int i = 0; i < 8; i++)
{
//if (StrobeBlock.getBit<StFlag8>(i))
if (StrobeBlock.HasFlag((StFlag8)Math.Pow(2, i)))
{
AssiAttivi += string.Format(" {0}", i);
@@ -179,7 +182,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
@@ -254,7 +257,6 @@ namespace MTC_Sim
for (int j = 0; j < 32; j++)
{
// converto! e aggiungo allarmi sollevati al corretto controller allarmi...
//if (AlarmBlock.getBit<StFlag32>(j))
if (AlarmBlock.HasFlag((StFlag32)Math.Pow(2, j)))
{
// recupero allarme da oggetto in memoria...
+20 -3
View File
@@ -987,12 +987,19 @@ namespace MTC_Sim
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)
{
// processo strobe restanti (non allarmi)
processStrobe();
// !!!FARE!!! modirifa x avere QUI la letturadegli strobe
/*
* - check degli strobe e lettura stribes in vettore
* - check degli allarmi MODIFICATI
*/
}
else if (ciclo == gatherCycle.MF)
{
@@ -1007,6 +1014,8 @@ namespace MTC_Sim
getConfigParam();
///acquisisco dati su programma in esecuzione e dati generali (stato, orologio, power...)
getSlowChangingData();
// faccio comunque rilettura completa allarmi...
forceAlarmCheck();
}
// INVIO dati variati!
@@ -1016,7 +1025,15 @@ namespace MTC_Sim
adpRunning = false;
}
}
/// <summary>
/// effettua ogni log period una rilettura di TUTTI gli allarmi...
/// </summary>
public virtual void forceAlarmCheck()
{
// carico status allarmi (completo)
StFlag32 forceAlarm = (StFlag32)unchecked((int)UInt32.MaxValue);
refreshAlarmState(forceAlarm, false);
}
/// <summary>
/// recupero dati PATH
/// </summary>
+1024 -1024
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -5,10 +5,10 @@
</startup>
<appSettings>
<!--gestione TIMERS e periodi multipli x thread lenti-->
<add key="timerIntMs" value="50"/>
<add key="fastCount" value="5" />
<add key="normCount" value="20" />
<add key="slowCount" value="100" />
<add key="timerIntMs" value="10"/>
<add key="fastCount" value="10" />
<add key="normCount" value="100" />
<add key="slowCount" value="500" />
<add key="D1_NAME" value="CMS-ARES-SIM"/>
<add key="D1_ID" value="demo_123456"/>
+8 -10
View File
@@ -5,14 +5,12 @@
ATTENZIONE: aggiungere pos memoria x status e strobe x path
Aggiungere condition (1) x ogni path e x ogni asse
- chiusura app --> FANUC_ref.disconnect
1) rivedere GetBit (cambiare!!!)
2) strobe allarmi --> su cambio fronte --> serve vettore stato COMPLETO allarmi
3) lo strobe allarmi va inizializzato all'avvio (carica TUTTI i bit...)
4) da strobe allarmi --> vettore allarmi
5) CodS 5 cifre
6) CodM/CodT 3 cifre
0) chiusura app --> FANUC_ref.disconnect
OK 1) rivedere GetBit (cambiare!!!)
OK 2) strobe allarmi --> su cambio fronte --> serve vettore stato COMPLETO allarmi
OK 3) lo strobe allarmi va inizializzato all'avvio (carica TUTTI i bit...)
OK 4) da strobe allarmi --> vettore allarmi
OK 5) CodS 5 cifre
OK 6) CodM/CodT 3 cifre
7) lettura assi: vedere in progetto CMSConnect in OpPanel di FANUC la RefreshAxisNames()
+1
View File
@@ -119,6 +119,7 @@
<Content Include="AlarmList.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="AlarmListFANUC.txt" />
<Content Include="Appunti.txt" />
<Content Include="HaltTypeList.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>