gestione lettura GCodes meno frequente...

This commit is contained in:
Samuele E. Locatelli
2017-06-28 10:50:00 +02:00
parent bf4ff0ccf8
commit 524c6816ed
2 changed files with 41 additions and 22 deletions
+39 -22
View File
@@ -159,7 +159,18 @@ namespace MTC_Adapter
parentForm.commPlcActive = false;
return answ;
}
/// <summary>
/// variabile contatore cicli prima di rileggere codici G di un path inattivo...
/// </summary>
public int contChkGCod;
/// <summary>
/// Vettore codici G attivi x PATH 1...
/// </summary>
ushort[] vettGCodes_01;
/// <summary>
/// Vettore codici G attivi x PATH 2...
/// </summary>
ushort[] vettGCodes_02;
/// <summary>
/// struttura dati OSAI x dati NC (pag 148)
/// </summary>
@@ -183,6 +194,12 @@ namespace MTC_Adapter
MemBlock_MST = new byte[52];
// salto necessario!
saltoMST = 1;
// GCodes!
vettGCodes_01 = new ushort[14];
vettGCodes_02 = new ushort[14];
contChkGCod = utils.CRI("contChkGCod");
// è littel endian (NON serve conversione)
hasBigEndian = false;
@@ -879,40 +896,40 @@ namespace MTC_Adapter
public override void getPath()
{
// NON ci sono nella documentazione metodi x recuperare posizione PuntaUtensile, in attesa news da OSAI/Andrea...
#if false
parentForm.commPlcActive = true;
inizio = DateTime.Now;
CMSCncLib.Focas1.ODB5AXMAN vettTTCoord = OSAI_ref.getPathTTCoord();
if (utils.CRB("recTime")) TimingData.addResult("R-TTCoord", DateTime.Now.Subtract(inizio).Ticks);
parentForm.commPlcActive = false;
#endif
// ciclo su path
StringBuilder sb_2;
StringBuilder sb_3;
ushort[] vettGCodes;
// faccio VERA lettura SOLO ogni TOT cicli...
if (contChkGCod <= 0)
{
// reimposto contatore
contChkGCod = utils.CRI("contChkGCod");
// recupero vettore generale G MODE
parentForm.commPlcActive = true;
inizio = DateTime.Now;
OSAI_ref.getPathGCodeMod(1, ref vettGCodes_01);
OSAI_ref.getPathGCodeMod(2, ref vettGCodes_01);
if (utils.CRB("recTime")) TimingData.addResult("R-GCodModal", DateTime.Now.Subtract(inizio).Ticks);
parentForm.commPlcActive = false;
}
else
{
contChkGCod--;
}
for (int i = 0; i < currAdpConf.nPath; i++)
{
// accodo dati path in DataMonitor...
sb_2 = new StringBuilder();
sb_3 = new StringBuilder();
// recupero vettore generale G MODE
parentForm.commPlcActive = true;
inizio = DateTime.Now;
ushort[] vettGCodes = new ushort[14];
OSAI_ref.getPathGCodeMod(i + 1, ref vettGCodes);
if (utils.CRB("recTime")) TimingData.addResult("R-GCodModal", DateTime.Now.Subtract(inizio).Ticks);
parentForm.commPlcActive = false;
// attenzione: il vettore contiene come campi "vuoti" il valore MAX di USHort (16bit) ovvero 2^16 -1 (base 0) --> 65535
string GCodAttivi = "";
vettGCodes = i == 0 ? vettGCodes_01 : vettGCodes_02;
for (int j = 0; j < vettGCodes.Length; j++)
{
// se il valore è < di UShort.max (65535)...
+2
View File
@@ -17,6 +17,8 @@
<add key="waitEndCycle" value="0"/><!--ms attesa dopo ogni ciclo lettura...-->
<!--30 sec-->
<add key="contChkGCod" value="5"/>
<!--parametri gestione watchdog-->
<add key="maxAdapterLockSec" value="5"/>
<!--AREA CONF IP FANUC-->