Inizio gestione kawasaki OK...
This commit is contained in:
+79
-22
@@ -8,6 +8,39 @@ namespace IOB_WIN
|
||||
public class IobKawasaki : IobGeneric
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Enum segnali status macchina (ByteStatus) come flag
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum bitStatus
|
||||
{
|
||||
NONE = 0,
|
||||
POWER_ON = 1 << 0,
|
||||
AUTO = 1 << 1,
|
||||
RUN = 1 << 2,
|
||||
ERROR = 1 << 3,
|
||||
ALARM = 1 << 4,
|
||||
EMERG_OK = 1 << 5,
|
||||
DOOR_CLOSED = 1 << 6,
|
||||
READY_LOAD = 1 << 7
|
||||
}
|
||||
/// <summary>
|
||||
/// Enum segnali macchina ulteriori (ByteSignals)
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum bitSignals
|
||||
{
|
||||
NONE = 0,
|
||||
TRANSF_AUTO = 1 << 0,
|
||||
PUNZ_AUTO = 1 << 1,
|
||||
BARR_TAV_RIPR = 1 << 2,
|
||||
ARIA_OK = 1 << 3,
|
||||
CONS_TRANS_OK = 1 << 4,
|
||||
TAV_A = 1 << 5,
|
||||
TAV_B = 1 << 6,
|
||||
RICH_ACCESSO = 1 << 7
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// LookUpTable di decodifica da CNC a segnali tipo bitmap MAPO
|
||||
/// </summary>
|
||||
@@ -86,13 +119,14 @@ namespace IOB_WIN
|
||||
if (KAWASAKI_ref.IsConnected)
|
||||
{
|
||||
// connect ok
|
||||
resDataArray = KAWASAKI_ref.command("where", 3000); // WHERE [RET]
|
||||
// Console.WriteLine(resDataArray[1]);
|
||||
// [0] = 0
|
||||
// [1] = JT1 JT2 JT3 JT4 JT5 JT6
|
||||
// -23.205 - 39.967 - 13.176 95.663 71.402 - 21.512
|
||||
// X[mm] Y[mm] Z[mm] O[deg] A[deg] T[deg]
|
||||
// - 489.620 693.940 1564.733 92.612 131.285 7.482
|
||||
resDataArray = KAWASAKI_ref.command("where", 3000);
|
||||
// WHERE [RET]
|
||||
// Console.WriteLine(resDataArray[1]);
|
||||
// [0] = 0
|
||||
// [1] = JT1 JT2 JT3 JT4 JT5 JT6
|
||||
// -23.205 - 39.967 - 13.176 95.663 71.402 - 21.512
|
||||
// X[mm] Y[mm] Z[mm] O[deg] A[deg] T[deg]
|
||||
// - 489.620 693.940 1564.733 92.612 131.285 7.482
|
||||
|
||||
threadOk = commThreadOk;
|
||||
|
||||
@@ -767,7 +801,7 @@ namespace IOB_WIN
|
||||
if (KAWASAKI_ref.IsConnected)
|
||||
{
|
||||
resDataArray = KAWASAKI_ref.command("TYPE r_tempo", 3000); // ultimo TCiclo rilevato --> " 349.19\r\n"
|
||||
decimal.TryParse(resDataArray[1].ToString().Replace("\n", "").Replace("\r", ""), out answ);
|
||||
decimal.TryParse(resDataArray[1].ToString().Replace("\n", "").Replace("\r", "").Replace(".",","), out answ);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
@@ -881,12 +915,12 @@ namespace IOB_WIN
|
||||
/// Restituisce SEGNALI macchina nel formato:
|
||||
/// B0: Transfer in auto
|
||||
/// B1: Punzonatrice in AUTO
|
||||
/// B2: Barriera tavola
|
||||
/// B3:
|
||||
/// B4:
|
||||
/// B5:
|
||||
/// B6:
|
||||
/// B7:
|
||||
/// B2: Barriera tavola ripristinata
|
||||
/// B3: Aria in linea OK
|
||||
/// B4: Console Transfer in fuori ingombro
|
||||
/// B5: TAV A
|
||||
/// B6: TAV B
|
||||
/// B7: Richiesta accesso attiva
|
||||
/// </summary>
|
||||
protected string currBitmapSignals
|
||||
{
|
||||
@@ -1064,7 +1098,7 @@ namespace IOB_WIN
|
||||
cSignals = currBitmapSignals;
|
||||
lastCountCNC = pzCounter;
|
||||
// decodifica e gestione
|
||||
decodeToBaseBitmap();
|
||||
decodeToBaseBitmap();
|
||||
decodeOtherData();
|
||||
}
|
||||
|
||||
@@ -1073,15 +1107,8 @@ namespace IOB_WIN
|
||||
/// </summary>
|
||||
private void decodeToBaseBitmap()
|
||||
{
|
||||
#if false
|
||||
// init a zero...
|
||||
B_input = 0;
|
||||
// FAPE: leggo i primi 2 WORD x decodifica stato e posizione...
|
||||
ushort valStatus = S7.Net.Types.Word.FromByteArray(RawInput.Skip(0).Take(2).ToArray());
|
||||
ushort valPosit = S7.Net.Types.Word.FromByteArray(RawInput.Skip(2).Take(2).ToArray());
|
||||
statoMacchina _stMacch = ((statoMacchina)valStatus);
|
||||
posizioneSequenza _posSeq = ((posizioneSequenza)valPosit);
|
||||
|
||||
/* -----------------------------------------------------
|
||||
* bitmap MAPO
|
||||
* B0: POWER_ON
|
||||
@@ -1091,6 +1118,36 @@ namespace IOB_WIN
|
||||
* B4: manuale
|
||||
* B5: emergenza
|
||||
----------------------------------------------------- */
|
||||
// bit 0 (poweron) imposto a 1 SE connected...
|
||||
B_input = KAWASAKI_ref.IsConnected ? 1 : 0;
|
||||
// RUN
|
||||
if (cStatus[2] == '1')
|
||||
{
|
||||
B_input += (1 << 1);
|
||||
}
|
||||
// ERROR
|
||||
if (cStatus[3] == '1')
|
||||
{
|
||||
B_input += (1 << 3);
|
||||
}
|
||||
// ERROR
|
||||
if (cStatus[4] == '1')
|
||||
{
|
||||
B_input += (1 << 3);
|
||||
}
|
||||
// Automatico (porta chiusa)
|
||||
if (cStatus[6] == '1' || cStatus[1] == '1')
|
||||
{
|
||||
B_input += (1 << 4);
|
||||
}
|
||||
// NON EMERGENZA
|
||||
if (cStatus[5] == '0')
|
||||
{
|
||||
B_input += (1 << 5);
|
||||
}
|
||||
|
||||
|
||||
#if false
|
||||
|
||||
// bit 0 (poweron) imposto a 1 SE connected...
|
||||
B_input = currPLC.IsConnected ? 1 : 0;
|
||||
|
||||
Reference in New Issue
Block a user