UPdate FANUC x controllo se connected prima di gestire G43 + conf 529

This commit is contained in:
Samuele E. Locatelli
2018-11-30 15:33:37 +01:00
parent bb491ac709
commit 05c0fe8e13
3 changed files with 151 additions and 65 deletions
+74
View File
@@ -0,0 +1,74 @@
;Configurazione IOB-WIN
[IOB]
;Tornio FANUC ROBOTDRILL
CNCTYPE=FANUC
PING_MS_TIMEOUT=500
[MACHINE]
VENDOR=TREVISAN
MODEL=GT555
[CNC]
IP=192.168.0.85
PORT=8193
GETPRGNAME=true
[SERVER]
MPIP=http://192.168.1.64
MPURL=/MP/IO
CMDBASE=/IOB/input/
CMDFLOG=/IOB/flog/
CMDALIVE=/IOB
CMDENABLED=/IOB/enabled/
CMDADV1=?valore=
CMDREBO=/sendReboot.aspx?idxMacchina=
[MEMORY]
; Red: Y0.2 | Yellow: Y0.3 | Green Y0.0 | Apertura Auto porta: Y0.4 (X5.1) | NON Emergenza Y0.5 | MODO AUTO Y0.6 | Contapezzi Y0.1
;BIT0=CONN
BIT1=Y0.0
BIT2=Y0.1
;BIT2=PZCOUNT.PAR.6711
BIT3=Y0.2
BIT4=Y0.3
BIT5=Y0.4
BIT6=Y0.5
AREAD_START=0
AREAD_SIZE=9999
AREAG_START=0
AREAG_SIZE=0
AREAR_START=0
AREAR_SIZE=64
AREAX_START=0
AREAX_SIZE=64
AREAY_START=0
AREAY_SIZE=4
PAR_START=6711
PAR_SIZE=3
[BLINK]
;MAX_COUNTER_BLINK = 30
MAX_COUNTER_BLINK = 15
;bit0 = 0
;bit1 = 0
;bit2 = 1
;bit3 = 1
;bit4 = 1
;bit5 = 0
;bit6 = 0
;bit7 = 0
BLINK_FILT=0
;BLINK_FILT=28
[OPTPAR]
;PZCOUNT_MODE=STD.[PAR/MEM].info|BIT.indice
; attenzione memoria sempre base BYTE (1604 DW --> 6416...)
PZCOUNT_MODE=BIT
;PZCOUNT_MODE=STD.PAR.6711
;PZ_CAD_MADDR=1602; cad
;PZ_REQ_MADDR=1603; pz richiesti (DW)
;PZ_DONE_MADDR=1604; pz fatti
;PZ_GTOT_MADDR=1605; pz tot macchina
[BRANCH]
NAME=develop
+2 -2
View File
@@ -24,9 +24,9 @@ CMDADV1=?valore=
CMDREBO=/sendReboot.aspx?idxMacchina=
[MEMORY]
; Red: Y95.7 | Yellow: Y96.7 | Green Y97.3 | All DoorsClosed: Y4.0 (X5.1) | ..........WrkZone Y8.7 | Contapezzi X7.1
; Red: Y95.7 | Yellow: Y96.7 | Green Y96.3 | All DoorsClosed: Y4.0 (X5.1) | ..........WrkZone Y8.7 | Contapezzi X7.1
;BIT0=CONN
BIT1=Y97.3
BIT1=Y96.3
BIT2=PZCOUNT.PAR.6711
BIT3=Y95.7
BIT4=Y96.7
+75 -63
View File
@@ -788,40 +788,44 @@ namespace IOB_WIN
/// </summary>
public override void processMode()
{
if (utils.CRB("enableMode"))
// processo SOLO SE connected...
if (FANUC_ref.Connected)
{
try
if (utils.CRB("enableMode"))
{
// leggo tutto da 0 a 43...
int memIndex = 0;
// controllo modalità lettura memoria
stopwatch.Restart();
FanucMemRW(R, FANUC.MemType.G, memIndex, ref MemBlockG);
if (utils.CRB("recTime"))
try
{
TimingData.addResult(cIobConf.codIOB, string.Format("R{0}-G-AREA", MemBlockG.Length), stopwatch.ElapsedTicks);
}
// leggo tutto da 0 a 43...
int memIndex = 0;
// controllo modalità lettura memoria
stopwatch.Restart();
FanucMemRW(R, FANUC.MemType.G, memIndex, ref MemBlockG);
if (utils.CRB("recTime"))
{
TimingData.addResult(cIobConf.codIOB, string.Format("R{0}-G-AREA", MemBlockG.Length), stopwatch.ElapsedTicks);
}
stopwatch.Stop();
// verifico modo con valore corrente, se cambia aggiorno...
CNC_MODE newMode = decodeG43(MemBlockG[43]);
if (newMode != currMode)
{
// aggiorno!
currMode = newMode;
// conversione NUM MODE in descrizione da ENUM
string descrMode = Enum.GetName(typeof(CNC_MODE), currMode);
// accodo x invio
string sVal = string.Format("[CNC_MODE]{0}", descrMode);
// chiamo accodamento...
accodaFLog(sVal, qEncodeFLog("CNC_MODE", descrMode));
stopwatch.Stop();
// verifico modo con valore corrente, se cambia aggiorno...
CNC_MODE newMode = decodeG43(MemBlockG[43]);
if (newMode != currMode)
{
// aggiorno!
currMode = newMode;
// conversione NUM MODE in descrizione da ENUM
string descrMode = Enum.GetName(typeof(CNC_MODE), currMode);
// accodo x invio
string sVal = string.Format("[CNC_MODE]{0}", descrMode);
// chiamo accodamento...
accodaFLog(sVal, qEncodeFLog("CNC_MODE", descrMode));
}
}
catch (Exception exc)
{
lgError(exc, string.Format("Errore in process Mode G43: {0}{1}", Environment.NewLine, exc));
connectionOk = false;
stopwatch.Stop();
}
}
catch (Exception exc)
{
lgError(exc, string.Format("Errore in process Mode G43: {0}{1}", Environment.NewLine, exc));
connectionOk = false;
stopwatch.Stop();
}
}
}
@@ -875,45 +879,49 @@ namespace IOB_WIN
public override Dictionary<string, string> getDynData()
{
Dictionary<string, string> outVal = new Dictionary<string, string>();
stopwatch.Restart();
CncLib.Focas1.ODBDY2_1 answ = FANUC_ref.getAllDynData();
if (utils.CRB("recTime"))
// processo SOLO SE connected...
if (FANUC_ref.Connected)
{
TimingData.addResult(cIobConf.codIOB, string.Format("PROC-DYN-DATA"), stopwatch.ElapsedTicks);
}
try
{
string actf = answ.actf.ToString();
string acts = answ.acts.ToString();
//string numAlarm = answ.alarm.ToString();
// preparo i singoli valori dell'array...
//outVal.Add("DYNDATA", string.Format("{0}#{1}#{2}", actf, acts, numAlarm));
outVal.Add("DYNDATA", string.Format("FEED {0}#SPEED_RPM {1}", actf, acts));
if (utils.CRB("SendFeedSpeed"))
stopwatch.Restart();
CncLib.Focas1.ODBDY2_1 answ = FANUC_ref.getAllDynData();
if (utils.CRB("recTime"))
{
outVal.Add("FEED", actf);
outVal.Add("SPEED_RPM", acts);
//outVal.Add("NUM_ALARM", numAlarm);
TimingData.addResult(cIobConf.codIOB, string.Format("PROC-DYN-DATA"), stopwatch.ElapsedTicks);
}
if (utils.CRB("SendAxPos"))
try
{
// salvo le posizioni...
CncLib.Focas1.FAXIS posAx = answ.pos;
int[] currPosAbs = posAx.absolute;
int i = 0;
foreach (var item in currPosAbs)
string actf = answ.actf.ToString();
string acts = answ.acts.ToString();
//string numAlarm = answ.alarm.ToString();
// preparo i singoli valori dell'array...
//outVal.Add("DYNDATA", string.Format("{0}#{1}#{2}", actf, acts, numAlarm));
outVal.Add("DYNDATA", string.Format("FEED {0}#SPEED_RPM {1}", actf, acts));
if (utils.CRB("SendFeedSpeed"))
{
i++;
outVal.Add(string.Format("POS_{0:00}", i), item.ToString());
outVal.Add("FEED", actf);
outVal.Add("SPEED_RPM", acts);
//outVal.Add("NUM_ALARM", numAlarm);
}
if (utils.CRB("SendAxPos"))
{
// salvo le posizioni...
CncLib.Focas1.FAXIS posAx = answ.pos;
int[] currPosAbs = posAx.absolute;
int i = 0;
foreach (var item in currPosAbs)
{
i++;
outVal.Add(string.Format("POS_{0:00}", i), item.ToString());
}
}
}
catch (Exception exc)
{
lgError(exc, "Errore in getDynData");
}
stopwatch.Stop();
}
catch (Exception exc)
{
lgError(exc, "Errore in getDynData");
}
stopwatch.Stop();
return outVal;
}
/// <summary>
@@ -923,10 +931,14 @@ namespace IOB_WIN
public override Dictionary<string, string> getOverrides()
{
Dictionary<string, string> outVal = new Dictionary<string, string>();
if (utils.CRB("enableMode") && MemBlockG != null)
// processo SOLO SE connected...
if (FANUC_ref.Connected)
{
outVal.Add("FEED_OVER", MemBlockG[30].ToString());
outVal.Add("RAPID_OVER", MemBlockG[12].ToString());
if (utils.CRB("enableMode") && MemBlockG != null)
{
outVal.Add("FEED_OVER", MemBlockG[30].ToString());
outVal.Add("RAPID_OVER", MemBlockG[12].ToString());
}
}
return outVal;
}