- fi scrittura macro, PRIAM scrive zero poi valore x evitare error di out-of range come Crossflex
This commit is contained in:
Samuele Locatelli
2024-11-19 09:53:53 +01:00
parent 30d82ec5ad
commit cf710d1ad3
5 changed files with 76 additions and 18 deletions
+2 -1
View File
@@ -47,6 +47,7 @@ CLI_INST=SteamWareSim
;NB: mettere copy always ai file di conf x fare test...
;STARTLIST=FTP_SONATEST
;STARTLIST=SIMUL_01
STARTLIST=L020
STARTLIST=VL27
;STARTLIST=L020
MAXCNC=10
+6 -2
View File
@@ -551,8 +551,12 @@
<None Include="DATA\CONF\L020.ini">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\VL27.json" />
<None Include="DATA\CONF\VL27.ini" />
<None Include="DATA\CONF\VL27.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\VL27.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\SIMUL_01.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
+48 -13
View File
@@ -1,7 +1,9 @@
using EgwProxy.MultiCncLib.CNC;
using IOB_UT_NEXT;
using KRcc;
using MapoSDK;
using Newtonsoft.Json;
using Opc.Ua;
using System;
using System.Collections.Generic;
using System.Data.SqlTypes;
@@ -398,9 +400,14 @@ namespace IOB_WIN_NEXT.Iob
lgInfo($"Chiamata stopSetup: taskOk: {taskOk} | taskVal: {taskVal}");
break;
case taskType.setParameter:
lgInfo($"Chiamata setParameter | NO processing: taskOk: {taskOk} | taskVal: {taskVal}");
taskVal = "setParameter | SKIPPED | NO EXEC";
break;
default:
taskVal = "SKIPPED | NO EXEC";
lgInfo($"Chiamata default senza processing: taskOk: {taskOk} | taskVal: {taskVal}");
taskVal = "SKIPPED | NO EXEC";
break;
}
// aggiungo task!
@@ -428,10 +435,16 @@ namespace IOB_WIN_NEXT.Iob
{
parentForm.commPlcActive = true;
// provo ad usare SEMPRE double...
short zeroVal = 0;
// in primis scrivo reset a zero...
answ = FANUC_ref.F_RW_Macro_Short(bWrite, memIndex, ref zeroVal);
// ora scrivo vero valore...
answ = FANUC_ref.F_RW_Macro_Short(bWrite, memIndex, ref Value);
}
catch
{ }
catch (Exception exc)
{
lgError($"Eccezione in FanucMemMacroRW | Short{Environment.NewLine}{exc}");
}
}
}
parentForm.commPlcActive = false;
@@ -455,10 +468,16 @@ namespace IOB_WIN_NEXT.Iob
try
{
parentForm.commPlcActive = true;
short zeroVal = 0;
// in primis scrivo reset a zero...
answ = FANUC_ref.F_RW_Macro_Short(bWrite, memIndex, ref zeroVal);
// ora scrivo vero valore...
answ = FANUC_ref.F_RW_Macro_Double(bWrite, memIndex, ref Value);
}
catch
{ }
catch (Exception exc)
{
lgError($"Eccezione in FanucMemMacroRW | Double{Environment.NewLine}{exc}");
}
}
}
parentForm.commPlcActive = false;
@@ -1076,11 +1095,10 @@ namespace IOB_WIN_NEXT.Iob
{
cntAddr = 9999;
}
// processo SET contapezzi (lavorati)
stopwatch.Restart();
double vTransf = (double)0;
FANUC_ref.F_RW_Macro_Double(true, cntAddr, ref vTransf);
answ = FanucMemMacroRW(true, cntAddr, ref vTransf);
if (utils.CRB("recTime"))
{
TimingData.addResult(cIobConf.codIOB, "MACRO-SHORT", stopwatch.ElapsedTicks);
@@ -1199,8 +1217,10 @@ namespace IOB_WIN_NEXT.Iob
lgTrace($"MACRO | ART Write 01 | memName: {memAddr} | idx: {cntAddr}");
// processo SET contapezzi (lavorati)
stopwatch.Restart();
// comincio scrivendo reset a zero x cominciare...
double vTransf = (double)valReq;
answ = FANUC_ref.F_RW_Macro_Double(true, cntAddr, ref vTransf);
answ = FanucMemMacroRW(true, cntAddr, ref vTransf);
lgTrace($"MACRO | ART Write 02 | memName: {memAddr} | valReq: {valReq} | vTransf: {vTransf}");
if (utils.CRB("recTime"))
{
@@ -1249,7 +1269,7 @@ namespace IOB_WIN_NEXT.Iob
// processo SET contapezzi (lavorati)
stopwatch.Restart();
double vTransf = (double)valReq;
answ = FANUC_ref.F_RW_Macro_Double(true, cntAddr, ref vTransf);
answ = FanucMemMacroRW(true, cntAddr, ref vTransf);
lgTrace($"MACRO | Com Write 02 | memName: {memAddr} | valReq: {valReq} | vTransf: {vTransf}");
if (utils.CRB("recTime"))
{
@@ -1330,9 +1350,24 @@ namespace IOB_WIN_NEXT.Iob
lgTrace($"MACRO | Pz Write 01 | memName: {memAddr} | idx: {cntAddr}");
// processo SET contapezzi (lavorati)
stopwatch.Restart();
double vTransf = (double)pzReq;
answ = FANUC_ref.F_RW_Macro_Double(true, cntAddr, ref vTransf);
lgTrace($"MACRO | Com Write 02 | memName: {memAddr} | pzReq: {pzReq} | vTransf: {vTransf}");
// se > 2^16 scrivo con INT, sennò con double...
short valTrShr = 0;
double valTrDbl = 0;
if (pzReq < Math.Pow(2, 16))
{
valTrShr = (short)pzReq;
answ = FanucMemMacroRW(true, cntAddr, ref valTrShr);
//answ = FANUC_ref.F_RW_Macro_Short(true, cntAddr, ref valTrShr);
lgTrace($"MACRO | Com Write 02 SHORT | memName: {memAddr} | pzReq: {pzReq} | valTrShr: {valTrShr}");
}
// sennò double!
else
{
valTrDbl = (double)pzReq;
answ = FanucMemMacroRW(true, cntAddr, ref valTrDbl);
//answ = FANUC_ref.F_RW_Macro_Double(true, cntAddr, ref valTrDbl);
lgTrace($"MACRO | Com Write 02 DOUBLE | memName: {memAddr} | pzReq: {pzReq} | valTrDbl: {valTrDbl}");
}
if (utils.CRB("recTime"))
{
TimingData.addResult(cIobConf.codIOB, "MACRO-SHORT", stopwatch.ElapsedTicks);
@@ -1382,7 +1417,7 @@ namespace IOB_WIN_NEXT.Iob
}
catch (Exception exc)
{
lgError(exc, "Errore in SET PzReq Commessa FANUC");
lgError($"Errore in SET PzReq Commessa FANUC{Environment.NewLine}{exc}");
connectionOk = false;
}
answ = true;
+2 -1
View File
@@ -70,7 +70,8 @@ REM IOB-WIN-SIM
REM ROBOCOPY . \\IOB-WIN-SIMULA\Steamware\IOB-WIN-NEXT-DEB /MIR
REM IOBVPN4MACHINE
ROBOCOPY . \\10.51.90.5\Steamware\IOB-WIN-NEXT-DEB /MIR
REM ROBOCOPY . \\10.51.90.5\Steamware\IOB-WIN-NEXT-DEB /MIR
ROBOCOPY . \\10.51.90.6\Steamware\IOB-WIN-NEXT-DEB /MIR
goto END
+18 -1
View File
@@ -102,6 +102,23 @@ namespace Mitsubishi
DoLog(sep);
DoLog("");
DoLog(sep);
DoLog("Test CycleTyme");
DoLog(sep);
// preparo memorie
int plTime = 0;
try
{
oEZNcAutCom.Status_GetCycleTime(out plTime);
DoLog($"GetCycleTime | Time: {plTime}");
}
catch (Exception exc)
{
DoLog($"{exc}");
}
DoLog(sep);
DoLog("");
DoLog(sep);
DoLog("Test Lettura posizioni");
DoLog(sep);
@@ -117,6 +134,7 @@ namespace Mitsubishi
DoLog(sep);
DoLog("Test scrittura Var500");
DoLog(sep);
// NB: max 7 char!!!
oEZNcAutCom.CommonVariable_SetName(500, "ODL");
oEZNcAutCom.CommonVariable_SetName(501, "CodArt");
oEZNcAutCom.CommonVariable_SetName(502, "NumPz");
@@ -248,7 +266,6 @@ namespace Mitsubishi
DoLog(sep);
DoLog("");
DoLog(sep);
DoLog("Test RunStatus");
DoLog(sep);