Aggiunta decodifica allarmi...
This commit is contained in:
Binary file not shown.
@@ -28,7 +28,7 @@ namespace MTC_Sim
|
||||
|
||||
string szStatusConnection = "";
|
||||
FANUC_ref.Connect(ref szStatusConnection);
|
||||
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettuo lettura dei 16 byte di strobe/status
|
||||
@@ -36,11 +36,11 @@ namespace MTC_Sim
|
||||
public override void getStrobeStatus()
|
||||
{
|
||||
base.getStrobeStatus();
|
||||
|
||||
|
||||
// se non sono connesso esco
|
||||
if (!FANUC_ref.Connected) return;
|
||||
|
||||
// hard coded: leggo 16 word R10516--> R10532
|
||||
// hard coded: leggo le 16 word standard dello strobe... R10516--> R10532
|
||||
FANUC_ref.F_RW_Byte(R, FANUC.MemType.R, 10516, ref Strobes);
|
||||
}
|
||||
/// <summary>
|
||||
@@ -56,17 +56,43 @@ namespace MTC_Sim
|
||||
{
|
||||
base.processAlarm();
|
||||
// controllo TUTTI i flag: se ce ne sono di alzati DEVO processare...
|
||||
if(STRB_DW0 != StFlag32.NONE)
|
||||
if (STRB_DW0 != StFlag32.NONE)
|
||||
{
|
||||
// blocco memoria x lettura dati
|
||||
byte[] MemBlock = new byte[4];
|
||||
StFlag32 AlarmBlock = 0;
|
||||
allarme currAllarm;
|
||||
// primo blocco memoria allarmi
|
||||
int memIndex = 10532;
|
||||
// verifico gli allarmi di tutti i bit alzati...
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
StFlag32 AlarmsBlock = 0;
|
||||
if (STRB_DW0.getBit<StFlag32>(i))
|
||||
{
|
||||
// recuper tutti i 32 bit del blocco
|
||||
|
||||
// e aggiungo allarmi sollevati...
|
||||
// recupero tutti i 32 bit del blocco
|
||||
FANUC_ref.F_RW_Byte(R, FANUC.MemType.R, memIndex + i * 4, ref MemBlock);
|
||||
AlarmBlock = (StFlag32)BitConverter.ToUInt32(MemBlock, 0);
|
||||
for (int j = 0; j < 32; j++)
|
||||
{
|
||||
// converto!
|
||||
// e aggiungo allarmi sollevati al corretto controller allarmi...
|
||||
if (AlarmBlock.getBit<StFlag32>(j))
|
||||
{
|
||||
// recupero allarme da oggetto in memoria...
|
||||
currAllarm= elencoAllarmi[i * 32 + j];
|
||||
// in base al gruppo decido dove assegnare come CONDITION...
|
||||
switch(currAllarm.gruppo)
|
||||
{
|
||||
case "PLC":
|
||||
mAlarmPLC.Add(MTConnect.Condition.Level.FAULT, currAllarm.descrizione, currAllarm.codNum, "", "");
|
||||
break;
|
||||
case "CNC":
|
||||
default:
|
||||
mAlarmCNC.Add(MTConnect.Condition.Level.FAULT, currAllarm.descrizione, currAllarm.codNum, "", "");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,7 +107,7 @@ namespace MTC_Sim
|
||||
// update status da DW3
|
||||
|
||||
// EMstop: verifico BIT e di conseguenza imposto
|
||||
if(STRB_DW3.HasFlag(StFlag32.B00))
|
||||
if (STRB_DW3.HasFlag(StFlag32.B00))
|
||||
{
|
||||
mEStop.Value = "TRIGGERED";
|
||||
}
|
||||
@@ -144,7 +170,7 @@ namespace MTC_Sim
|
||||
vettPath[idxPath].mPathType.Value = "ASSERV";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#if false
|
||||
|
||||
@@ -214,7 +240,7 @@ namespace MTC_Sim
|
||||
// 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)
|
||||
@@ -292,6 +318,6 @@ namespace MTC_Sim
|
||||
Status8.Has(StFlag32.B18);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -873,14 +873,7 @@ namespace MTC_Sim
|
||||
protected allarme decodeAlarmLine(string linea, char separator)
|
||||
{
|
||||
string[] valori = linea.Split(separator);
|
||||
int num = 0;
|
||||
try
|
||||
{
|
||||
num = Convert.ToInt32(valori[0]);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return new allarme(num, valori[1], valori[2], valori[3]);
|
||||
return new allarme(valori[0], valori[1], valori[2], valori[3]);
|
||||
}
|
||||
|
||||
#region metodi adapter
|
||||
@@ -944,11 +937,9 @@ namespace MTC_Sim
|
||||
}
|
||||
else if (ciclo == gatherCycle.MF)
|
||||
{
|
||||
// leggo parametri a media freq (path, assi)
|
||||
// leggo parametri a media freq (path, assi, Unità Operatrice)
|
||||
getPath();
|
||||
|
||||
getUnOp();
|
||||
|
||||
getAxis();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -254,18 +254,18 @@ namespace MTC_Sim
|
||||
/// </summary>
|
||||
public class allarme
|
||||
{
|
||||
public int codNum;
|
||||
public string codNum;
|
||||
public string gruppo;
|
||||
public string livello;
|
||||
public string descrizione;
|
||||
public allarme()
|
||||
{
|
||||
codNum = 0;
|
||||
codNum = "";
|
||||
gruppo = "";
|
||||
livello = "";
|
||||
descrizione = "";
|
||||
}
|
||||
public allarme(int _codNum, string _gruppo, string _livello, string _descrizione)
|
||||
public allarme(string _codNum, string _gruppo, string _livello, string _descrizione)
|
||||
{
|
||||
codNum = _codNum;
|
||||
gruppo = _gruppo;
|
||||
|
||||
Reference in New Issue
Block a user