diff --git a/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI.vb b/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI.vb
index 2ecc1e6..7463c4b 100644
--- a/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI.vb
+++ b/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI.vb
@@ -888,10 +888,11 @@ Namespace CNC
'''
''' Restituisce posizione assi (tutti)
'''
- ''' Tipo posizione richeista (1..6)
+ ''' Tipo posizione richiesta (1..6 / 1=tgt, 2 = act)
+ ''' Path/Processo (1..n)
''' Vettore posizioni richieste
'''
- Public Overridable Function getAllAxisPos(tipoPos As Int16, ByRef AxisPos As OPENcontrol.GETINTDATA()) As Boolean
+ Public Overridable Function getAllAxisPos(tipoPos As Int16, ProcessId As Short, ByRef AxisPos As OPENcontrol.GETINTDATA()) As Boolean
Return True
End Function
'''
diff --git a/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI_SOAP.vb b/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI_SOAP.vb
index f577ce4..7bb455a 100644
--- a/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI_SOAP.vb
+++ b/MTC_Adapter/CMSCncLib/CNC/CNC.OSAI/CNC.OSAI_SOAP.vb
@@ -1048,19 +1048,18 @@ Retry: nRetry += 1
End Try
End Function
- Public Overloads Overrides Function getAllAxisPos(tipoPos As Int16, ByRef AxisPos As OPENcontrol.GETINTDATA()) As Boolean
+ Public Overloads Overrides Function getAllAxisPos(tipoPos As Int16, ProcessId As Short, ByRef AxisPos As OPENcontrol.GETINTDATA()) As Boolean
' RIFERIMENTO:
' CndexLinkUser.pdf | pag 146, 266
Dim szReturn As String = ""
Dim myGetAxesPositionR As OPENcontrol.GetAxesPositionR
Dim myGetAxesPosition As New OPENcontrol.GetAxesPosition
- Dim ProcessId As Short
Dim nRetry As Integer
Retry: nRetry += 1
Try
- O_GetSelectedProcess(ProcessId)
+ 'O_GetSelectedProcess(ProcessId)
myGetAxesPosition.ProcNum = ProcessId
myGetAxesPosition.AxisName = "0"
myGetAxesPosition.NumAxis = AxisPos.Length
diff --git a/MTC_Adapter/MTC/baseUtils.cs b/MTC_Adapter/MTC/baseUtils.cs
index f541c61..c213c1f 100644
--- a/MTC_Adapter/MTC/baseUtils.cs
+++ b/MTC_Adapter/MTC/baseUtils.cs
@@ -569,6 +569,35 @@ namespace MTC
((inValue & 0x000000ff) << 24));
}
}
+#if false
+ ///
+ /// Helper gestione dati degli assi...
+ ///
+ public class axisTabOsai
+ {
+ ///
+ /// ID univoco (numerico) asse
+ ///
+ public int Id;
+ ///
+ /// Nome (etichetta) asse
+ ///
+ public char Nome;
+ ///
+ /// Path di apaprtenenza asse
+ ///
+ public int Path;
+ ///
+ /// Init oggetto
+ ///
+ public axisTabOsai()
+ {
+ Id = 0;
+ Nome = '\0';
+ Path = 0;
+ }
+ }
+#endif
public enum tipoAdapter
diff --git a/MTC_Adapter/MTC_Adapter/AdapterOsai.cs b/MTC_Adapter/MTC_Adapter/AdapterOsai.cs
index 8638318..b906458 100644
--- a/MTC_Adapter/MTC_Adapter/AdapterOsai.cs
+++ b/MTC_Adapter/MTC_Adapter/AdapterOsai.cs
@@ -979,13 +979,91 @@ namespace MTC_Adapter
parentForm.commPlcActive = true;
inizio = DateTime.Now;
+ /*------------------------------------------------------------------------
+ * 2018.01.16 modifica per gestione doppio processo e nome assi duplicato
+ * ------------------------------------------------------------------------
+ *
+ * E' risultato (marco.negri, amcchian OSAI con 2 processi in cui glia ssi di ogni processoa vevano lo stesso nome) ceh OSAI NON restituisce ID univoco asse ma nome etichetta asegnato
+ * in questo modo glia ssi verso agent (e seguenti) si sovrappongono/sovrascrivono
+ *
+ * E' quindi necessario procedere in + step
+ * - verificare numero processia ttivi
+ * - chiedere x ogni processo quali assi ci siano (AsixTable (con Id UNIVOCO e consistente e NOME)
+ * - chiedere x ogni processo le posizioni assi in modo che processo + nome --> Id Univoco --> possiamo popolare la tabella da invaire poi all'agent
+ */
+
// inizializzo x numero assi...
+ CMSCncLib.OPENcontrol.GETINTDATA[] tmpPosAssiTgt = new CMSCncLib.OPENcontrol.GETINTDATA[currAdpConf.nAxis];
+ CMSCncLib.OPENcontrol.GETINTDATA[] tmpPosAssi = new CMSCncLib.OPENcontrol.GETINTDATA[currAdpConf.nAxis];
CMSCncLib.OPENcontrol.GETINTDATA[] posAssiTgt = new CMSCncLib.OPENcontrol.GETINTDATA[currAdpConf.nAxis];
CMSCncLib.OPENcontrol.GETINTDATA[] posAssi = new CMSCncLib.OPENcontrol.GETINTDATA[currAdpConf.nAxis];
- OSAI_ref.getAllAxisPos(1, ref posAssiTgt);
- OSAI_ref.getAllAxisPos(2, ref posAssi);
- if (utils.CRB("recTime")) TimingData.addResult("R-AXIS_POS", DateTime.Now.Subtract(inizio).Ticks);
- parentForm.commPlcActive = false;
+#if false
+ //axisTabOsai[] axisTab = new axisTabOsai[currAdpConf.nAxis];
+#endif
+ Dictionary axisDict = new Dictionary();
+ char[] axisTable = new char[currAdpConf.nAxis];
+ short[] axisIdTable = new short[currAdpConf.nAxis];
+ int currId = 0;
+ // verifico quanti path ho... e recupero le info sugli assi (se id > 0 รจ PRESENTE...)
+ for (short i = 1; i <= currAdpConf.nPath; i++)
+ {
+ // chiamo lettura tab assi
+ OSAI_ref.O_GetAxisTab(i, ref axisTable, ref axisIdTable);
+ //...e popolo i dati...
+ for (int j = 0; j < currAdpConf.nAxis; j++)
+ {
+ // recupero Id...
+ currId = axisIdTable[j];
+ // controllo se id > 0...
+ if (currId > 0)
+ {
+ // salvo!!! come path#nome
+ axisDict.Add(string.Format("{0}#{1}", i, axisTable[j]), currId);
+#if false
+ //axisTab[currId - 1].Id = currId;
+ //axisTab[currId - 1].Nome = axisTable[j];
+ //axisTab[currId - 1].Path = i;
+#endif
+ }
+ }
+
+ }
+
+ char axName;
+ int reIdx = 0;
+ // ora processo i dati PER PATH delle posizioni assi...
+ for (short i = 1; i <= currAdpConf.nPath; i++)
+ {
+ OSAI_ref.getAllAxisPos(1, i, ref tmpPosAssiTgt);
+ OSAI_ref.getAllAxisPos(2, i, ref tmpPosAssi);
+ // decodifico e salvo in posizione corretta...
+ for (int j = 0; j < currAdpConf.nAxis; j++)
+ {
+ // per sicurezza try-catch
+ try
+ {
+ if (tmpPosAssiTgt[j].AxisName == 0)
+ {
+ axName = '-';
+ }
+ else
+ {
+ axName = Convert.ToChar(tmpPosAssiTgt[j].AxisName);
+ }
+
+ // salvo nella posizione DECODIFICATA da dictionary x path/nome...
+ if (axName != '\0' && axName != '-')
+ {
+ // calcolo ID REALE
+ reIdx = axisDict[string.Format("{0}#{1}", i, axName)];
+ posAssiTgt[reIdx - 1] = tmpPosAssiTgt[j];
+ posAssi[reIdx - 1] = tmpPosAssi[j];
+ }
+ }
+ catch
+ { }
+ }
+ }
// nuova posizione (per calcoli)
double newPos = 0;
@@ -994,17 +1072,7 @@ namespace MTC_Adapter
int newDir = 0;
string tipoAsse = "";
string direzione = "";
- char axName;
-
- // 2018.01.16 cerco info assi...
- char[] axisTable1 = new char[64];
- short[] axisIdTable1 = new short[64];
- char[] axisTable2 = new char[64];
- short[] axisIdTable2 = new short[64];
- OSAI_ref.O_GetAxisTab(1, ref axisTable1, ref axisIdTable1);
- OSAI_ref.O_GetAxisTab(2, ref axisTable2, ref axisIdTable2);
-
- // ciclo x assi
+ // ORA ho tutto in posizione corretta, PROCESSO!!!
for (int i = 0; i < currAdpConf.nAxis; i++)
{
// per sicurezza try-catch
@@ -1019,6 +1087,7 @@ namespace MTC_Adapter
{
axName = Convert.ToChar(posAssiTgt[i].AxisName);
}
+
newPos = posAssi[i].position;
newPosTgt = posAssiTgt[i].position;
@@ -1074,6 +1143,12 @@ namespace MTC_Adapter
lg.Error(string.Format("Errore in lettura asse {0}", i));
}
}
+ // salvo timing!
+ if (utils.CRB("recTime")) TimingData.addResult("R-AXIS_POS", DateTime.Now.Subtract(inizio).Ticks);
+ parentForm.commPlcActive = false;
+
+
+
parentForm.dataMonitor_3 += sb.ToString();
}